#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/resource.h>
#include <sys/time.h>
#include <time.h>
#include <algorithm>
#include <thread>
#include <utility>
#include <vector>
-#include <arpa/inet.h>
-#include <sys/time.h>
-#include <sys/resource.h>
#include "bmusb/bmusb.h"
#include "bmusb/fake_capture.h"
#include "context.h"
+#include "db.h"
#include "decklink_capture.h"
#include "defs.h"
#include "disk_space_estimator.h"
#include "flags.h"
-#include "video_encoder.h"
#include "pbo_frame_allocator.h"
#include "ref_counted_gl_sync.h"
#include "timebase.h"
+#include "video_encoder.h"
class QOpenGLContext;
if (card->surface == nullptr) {
card->surface = create_surface_with_same_format(mixer_surface);
}
- audio_mixer.reset_card(card_index);
while (!card->new_frames.empty()) card->new_frames.pop();
card->fractional_samples = 0;
card->last_timecode = -1;
card->capture->configure_card();
+
+ DeviceSpec device{InputSourceType::CAPTURE_CARD, card_index};
+ audio_mixer.reset_device(device);
+ audio_mixer.set_name(device, card->capture->get_description());
}
FrameAllocator::Frame video_frame, size_t video_offset, VideoFormat video_format,
FrameAllocator::Frame audio_frame, size_t audio_offset, AudioFormat audio_format)
{
+ DeviceSpec device{InputSourceType::CAPTURE_CARD, card_index};
CaptureCard *card = &cards[card_index];
if (is_mode_scanning[card_index]) {
if (dropped_frames > MAX_FPS * 2) {
fprintf(stderr, "Card %d lost more than two seconds (or time code jumping around; from 0x%04x to 0x%04x), resetting resampler\n",
card_index, card->last_timecode, timecode);
- audio_mixer.reset_card(card_index);
+ audio_mixer.reset_device(device);
dropped_frames = 0;
} else if (dropped_frames > 0) {
// Insert silence as needed.
fprintf(stderr, "Card %d dropped %d frame(s) (before timecode 0x%04x), inserting silence.\n",
card_index, dropped_frames, timecode);
- audio_mixer.add_silence(card_index, silence_samples, dropped_frames, frame_length);
+ audio_mixer.add_silence(device, silence_samples, dropped_frames, frame_length);
}
- audio_mixer.add_audio(card_index, audio_frame.data + audio_offset, num_samples, audio_format, frame_length);
+ audio_mixer.add_audio(device, audio_frame.data + audio_offset, num_samples, audio_format, frame_length);
// Done with the audio, so release it.
if (audio_frame.owner) {
int stats_dropped_frames = 0;
while (!should_quit) {
- CaptureCard::NewFrame new_frames[MAX_CARDS];
- bool has_new_frame[MAX_CARDS] = { false };
- int num_samples[MAX_CARDS] = { 0 };
+ CaptureCard::NewFrame new_frames[MAX_VIDEO_CARDS];
+ bool has_new_frame[MAX_VIDEO_CARDS] = { false };
+ int num_samples[MAX_VIDEO_CARDS] = { 0 };
unsigned master_card_index = theme->map_signal(master_clock_channel);
assert(master_card_index < num_cards);
resource_pool->clean_context();
}
-void Mixer::get_one_frame_from_each_card(unsigned master_card_index, CaptureCard::NewFrame new_frames[MAX_CARDS], bool has_new_frame[MAX_CARDS], int num_samples[MAX_CARDS])
+void Mixer::get_one_frame_from_each_card(unsigned master_card_index, CaptureCard::NewFrame new_frames[MAX_VIDEO_CARDS], bool has_new_frame[MAX_VIDEO_CARDS], int num_samples[MAX_VIDEO_CARDS])
{
start:
// The first card is the master timer, so wait for it to have a new frame.
double loudness_range_low = r128.range_min();
double loudness_range_high = r128.range_max();
- audio_level_callback(loudness_s, 20.0 * log10(peak),
+ audio_level_callback(loudness_s, to_db(peak),
loudness_i, loudness_range_low, loudness_range_high,
audio_mixer.get_gain_staging_db(),
audio_mixer.get_final_makeup_gain_db(),