From 8321b1cf93126b79302a6610bcb6e1b426f76c3d Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 11 Aug 2016 19:48:12 +0200 Subject: [PATCH] =?utf8?q?Consistently=20use=20=E2=80=9Cvideo=20card?= =?utf8?q?=E2=80=9D=20instead=20of=20=E2=80=9Ccard=E2=80=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- audio_mixer.cpp | 11 +++++------ audio_mixer.h | 2 +- defs.h | 2 +- input_state.h | 2 +- mixer.cpp | 8 ++++---- mixer.h | 12 ++++++------ theme.cpp | 8 ++++---- 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/audio_mixer.cpp b/audio_mixer.cpp index b61a3c3..c4f6f0b 100644 --- a/audio_mixer.cpp +++ b/audio_mixer.cpp @@ -195,8 +195,7 @@ AudioMixer::AudioDevice *AudioMixer::find_audio_device(DeviceSpec device) { switch (device.type) { case InputSourceType::CAPTURE_CARD: - return &cards[device.index]; - break; + return &video_cards[device.index]; case InputSourceType::SILENCE: default: assert(false); @@ -246,7 +245,7 @@ void AudioMixer::fill_audio_bus(const vector *samples_card, const InputMa vector AudioMixer::get_output(double pts, unsigned num_samples, ResamplingQueue::RateAdjustmentPolicy rate_adjustment_policy) { - vector samples_card[MAX_CARDS]; // TODO: Needs room for other kinds of capture cards. + vector samples_card[MAX_VIDEO_CARDS]; // TODO: Needs room for other kinds of capture cards. vector samples_bus; lock_guard lock(audio_mutex); @@ -256,7 +255,7 @@ vector AudioMixer::get_output(double pts, unsigned num_samples, Resamplin // might have changed; if so, we need to do some sort of remapping // to silence. for (unsigned card_index = 0; card_index < num_cards; ++card_index) { - AudioDevice *device = &cards[card_index]; + AudioDevice *device = &video_cards[card_index]; if (!device->interesting_channels.empty()) { samples_card[card_index].resize(num_samples * device->interesting_channels.size()); device->resampling_queue->get_output_samples( @@ -405,7 +404,7 @@ map AudioMixer::get_devices() const map devices; for (unsigned card_index = 0; card_index < num_cards; ++card_index) { const DeviceSpec spec{ InputSourceType::CAPTURE_CARD, card_index }; - const AudioDevice *device = &cards[card_index]; + const AudioDevice *device = &video_cards[card_index]; DeviceInfo info; info.name = device->name; info.num_channels = 8; // FIXME: This is wrong for fake cards. @@ -440,7 +439,7 @@ void AudioMixer::set_input_mapping(const InputMapping &new_input_mapping) // Reset resamplers for all cards that don't have the exact same state as before. for (unsigned card_index = 0; card_index < num_cards; ++card_index) { DeviceSpec device_spec{InputSourceType::CAPTURE_CARD, card_index}; - AudioDevice *device = &cards[card_index]; + AudioDevice *device = &video_cards[card_index]; if (device->interesting_channels != interesting_channels[device_spec]) { device->interesting_channels = interesting_channels[device_spec]; reset_device_mutex_held(DeviceSpec{InputSourceType::CAPTURE_CARD, card_index}); diff --git a/audio_mixer.h b/audio_mixer.h index f2c77b9..0fe3418 100644 --- a/audio_mixer.h +++ b/audio_mixer.h @@ -215,7 +215,7 @@ private: mutable std::mutex audio_mutex; - AudioDevice cards[MAX_CARDS]; // Under audio_mutex. + AudioDevice video_cards[MAX_VIDEO_CARDS]; // Under audio_mutex. StereoFilter locut; // Default cutoff 120 Hz, 24 dB/oct. std::atomic locut_cutoff_hz; diff --git a/defs.h b/defs.h index b64aeef..15e6f3c 100644 --- a/defs.h +++ b/defs.h @@ -6,7 +6,7 @@ #define WIDTH 1280 #define HEIGHT 720 #define FAKE_FPS 25 // Must be an integer. -#define MAX_CARDS 16 +#define MAX_VIDEO_CARDS 16 #define MAX_BUSES 256 // Audio buses. // For deinterlacing. See also comments on InputState. diff --git a/input_state.h b/input_state.h index 70b4436..ca14739 100644 --- a/input_state.h +++ b/input_state.h @@ -18,7 +18,7 @@ struct InputState { // interlaced output (for deinterlacing), so if we detect progressive input, // we immediately clear out all history and all entries will point to the same // frame. - BufferedFrame buffered_frames[MAX_CARDS][FRAME_HISTORY_LENGTH]; + BufferedFrame buffered_frames[MAX_VIDEO_CARDS][FRAME_HISTORY_LENGTH]; }; #endif // !defined(_INPUT_STATE_H) diff --git a/mixer.cpp b/mixer.cpp index 7624c80..e037142 100644 --- a/mixer.cpp +++ b/mixer.cpp @@ -569,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); @@ -681,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. diff --git a/mixer.h b/mixer.h index 31ae7ae..354735d 100644 --- a/mixer.h +++ b/mixer.h @@ -382,9 +382,9 @@ private: int last_timecode = -1; // Unwrapped. }; - CaptureCard cards[MAX_CARDS]; // protected by + CaptureCard cards[MAX_VIDEO_CARDS]; // protected by AudioMixer audio_mixer; - void 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 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]); InputState input_state; @@ -445,10 +445,10 @@ private: std::queue audio_task_queue; // Under audio_mutex. // For mode scanning. - bool is_mode_scanning[MAX_CARDS]{ false }; - std::vector mode_scanlist[MAX_CARDS]; - unsigned mode_scanlist_index[MAX_CARDS]{ 0 }; - std::chrono::steady_clock::time_point last_mode_scan_change[MAX_CARDS]; + bool is_mode_scanning[MAX_VIDEO_CARDS]{ false }; + std::vector mode_scanlist[MAX_VIDEO_CARDS]; + unsigned mode_scanlist_index[MAX_VIDEO_CARDS]{ 0 }; + std::chrono::steady_clock::time_point last_mode_scan_change[MAX_VIDEO_CARDS]; }; extern Mixer *global_mixer; diff --git a/theme.cpp b/theme.cpp index 1434d98..d6c9a23 100644 --- a/theme.cpp +++ b/theme.cpp @@ -45,14 +45,14 @@ namespace { struct InputStateInfo { InputStateInfo(const InputState& input_state); - unsigned last_width[MAX_CARDS], last_height[MAX_CARDS]; - bool last_interlaced[MAX_CARDS], last_has_signal[MAX_CARDS], last_is_connected[MAX_CARDS]; - unsigned last_frame_rate_nom[MAX_CARDS], last_frame_rate_den[MAX_CARDS]; + unsigned last_width[MAX_VIDEO_CARDS], last_height[MAX_VIDEO_CARDS]; + bool last_interlaced[MAX_VIDEO_CARDS], last_has_signal[MAX_VIDEO_CARDS], last_is_connected[MAX_VIDEO_CARDS]; + unsigned last_frame_rate_nom[MAX_VIDEO_CARDS], last_frame_rate_den[MAX_VIDEO_CARDS]; }; InputStateInfo::InputStateInfo(const InputState &input_state) { - for (unsigned signal_num = 0; signal_num < MAX_CARDS; ++signal_num) { + for (unsigned signal_num = 0; signal_num < MAX_VIDEO_CARDS; ++signal_num) { BufferedFrame frame = input_state.buffered_frames[signal_num][0]; if (frame.frame == nullptr) { last_width[signal_num] = last_height[signal_num] = 0; -- 2.39.2