X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Finput_mapping_dialog.cpp;h=2fe7e34ce87e8b2bb6130c05c61480bf878648ed;hb=f81ae3be1aae619fe4ad022f55d95a4a83ace076;hp=b4565152a4af01b290941025633e7224b8c4d4dd;hpb=eeda8995329601f9f4e35047358400833eeae68e;p=nageru diff --git a/nageru/input_mapping_dialog.cpp b/nageru/input_mapping_dialog.cpp index b456515..2fe7e34 100644 --- a/nageru/input_mapping_dialog.cpp +++ b/nageru/input_mapping_dialog.cpp @@ -15,19 +15,34 @@ #include #include #include -#include #include #include #include #include "alsa_pool.h" +#include "audio_mixer.h" #include "defs.h" +#include "input_mapping.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 +128,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 +172,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;