X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Finput_mapping_dialog.cpp;h=831d4873468f488283b6e8d0546982264606efd4;hb=ecaec75dd52d076ba53cafa1fed716ebc0d93da6;hp=23e889531e354fc04589b0fc09ac72c84ff4d648;hpb=392f9d1ccb835c05a3874c4bea163788b2c37024;p=nageru diff --git a/nageru/input_mapping_dialog.cpp b/nageru/input_mapping_dialog.cpp index 23e8895..831d487 100644 --- a/nageru/input_mapping_dialog.cpp +++ b/nageru/input_mapping_dialog.cpp @@ -22,12 +22,26 @@ #include "alsa_pool.h" #include "defs.h" -#include "post_to_main_thread.h" +#include "shared/post_to_main_thread.h" #include "ui_input_mapping.h" using namespace std; using namespace std::placeholders; +namespace { + +bool uses_device(const InputMapping &mapping, DeviceSpec device) +{ + for (const InputMapping::Bus &bus : mapping.buses) { + if (bus.device == device) { + return true; + } + } + return false; +} + +} // namespace + InputMappingDialog::InputMappingDialog() : ui(new Ui::InputMappingDialog), mapping(global_audio_mixer->get_input_mapping()), @@ -113,6 +127,15 @@ void InputMappingDialog::fill_row_from_bus(unsigned row, const InputMapping::Bus } else if (state == ALSAPool::Device::State::DEAD) { label += " (dead)"; } + } else if (!global_audio_mixer->get_active(spec_and_info.first)) { + // Should nominally be skipped, but if we used it before it went away, + // we'll need to allow the user to still see it. + if (uses_device(mapping, spec_and_info.first) || + uses_device(old_mapping, spec_and_info.first)) { + label += " (dead)"; + } else { + continue; + } } ++current_index; if (unsigned(card_combo->count()) > current_index) { @@ -148,8 +171,7 @@ void InputMappingDialog::setup_channel_choices_from_bus(unsigned row, const Inpu QComboBox *channel_combo = new QComboBox; channel_combo->addItem(QString("(none)")); if (bus.device.type == InputSourceType::CAPTURE_CARD || - bus.device.type == InputSourceType::ALSA_INPUT || - bus.device.type == InputSourceType::FFMPEG_VIDEO_INPUT) { + bus.device.type == InputSourceType::ALSA_INPUT) { auto device_it = devices.find(bus.device); assert(device_it != devices.end()); unsigned num_device_channels = device_it->second.num_channels;