]> git.sesse.net Git - nageru/blobdiff - mixer.cpp
Consistently use “video card” instead of “card”.
[nageru] / mixer.cpp
index e8bbc028222b6a0f3724f7bf584d9d3410824ffb..e0371429bc9dc3f678ffb80d0dfb37bf6c3bfdd6 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -285,8 +285,10 @@ void Mixer::configure_card(unsigned card_index, CaptureInterface *capture, bool
        card->fractional_samples = 0;
        card->last_timecode = -1;
        card->capture->configure_card();
-       audio_mixer.reset_card(card_index);
-       audio_mixer.set_name(card_index, card->capture->get_description());
+
+       DeviceSpec device{InputSourceType::CAPTURE_CARD, card_index};
+       audio_mixer.reset_device(device);
+       audio_mixer.set_name(device, card->capture->get_description());
 }
 
 
@@ -332,6 +334,7 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode,
                      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]) {
@@ -381,17 +384,17 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode,
        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) {
@@ -566,9 +569,9 @@ void Mixer::thread_func()
        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);
@@ -678,7 +681,7 @@ void Mixer::thread_func()
        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.