void SettingsComponent::updatePossibleValues(const QString §ionID, const QString &key, const QVariantList &possibleValues) { SettingsSection* section = getSection(sectionID); if (!section) { QLOG_ERROR() << "Section" << sectionID << "is unknown"; return; } section->updatePossibleValues(key, possibleValues); QLOG_DEBUG() << "Updated possible values for:" << key << "to" << possibleValues; }
void PlayerComponent::setAudioConfiguration() { QStringList ao_defaults; QString deviceType = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "devicetype").toString(); if (SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "exclusive").toBool()) { ao_defaults << "wasapi:exclusive=yes"; ao_defaults << "coreaudio:exclusive=yes"; } mpv::qt::set_option_variant(m_mpv, "ao-defaults", ao_defaults.join(',')); // set the audio device QVariant device = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "device"); mpv::qt::set_property_variant(m_mpv, "audio-device", device); QString resampleOpts = ""; bool normalize = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "normalize").toBool(); resampleOpts += QString(":normalize=") + (normalize ? "yes" : "no"); // Make downmix more similar to PHT. resampleOpts += ":o=[surround_mix_level=1,lfe_mix_level=1]"; mpv::qt::set_option_variant(m_mpv, "af-defaults", "lavrresample" + resampleOpts); QString passthroughCodecs; // passthrough doesn't make sense with basic type if (deviceType != AUDIO_DEVICE_TYPE_BASIC) { QStringList enabledCodecs; SettingsSection* audioSection = SettingsComponent::Get().getSection(SETTINGS_SECTION_AUDIO); QStringList codecs; if (deviceType == AUDIO_DEVICE_TYPE_SPDIF) codecs = AudioCodecsSPDIF(); else if (deviceType == AUDIO_DEVICE_TYPE_HDMI && audioSection->value("advanced").toBool()) codecs = AudioCodecsAll(); foreach (const QString& key, codecs) { if (audioSection->value("passthrough." + key).toBool()) enabledCodecs << key; } // dts-hd includes dts, but listing dts before dts-hd may disable dts-hd. if (enabledCodecs.indexOf("dts-hd") != -1) enabledCodecs.removeAll("dts"); passthroughCodecs = enabledCodecs.join(","); }
QString Utils::CurrentUserId() { SettingsSection* connections = SettingsComponent::Get().getSection("connections"); if (!connections) return QString(); QVariant ulist = connections->value("users"); if (ulist.isValid()) { QVariantList users = ulist.toList(); if (users.size() > 0) { QVariantMap user = users.at(0).toMap(); return user.value("id").toString(); } } return QString(); }
void AudioSettingsController::valuesUpdated(const QVariantMap& values) { bool advanced = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "advanced").toBool(); SettingsSection* audioSection = SettingsComponent::Get().getSection(SETTINGS_SECTION_AUDIO); if (values.contains("devicetype")) { QString type = values.value("devicetype").toString(); if (type == AUDIO_DEVICE_TYPE_BASIC) { setHiddenPassthrough(PlayerComponent::AudioCodecsAll(), true); } else if (type == AUDIO_DEVICE_TYPE_HDMI) { setHiddenPassthrough(PlayerComponent::AudioCodecsAll(), !advanced); } else if (type == AUDIO_DEVICE_TYPE_SPDIF) { setHiddenPassthrough(PlayerComponent::AudioCodecsAll(), true); setHiddenPassthrough(PlayerComponent::AudioCodecsSPDIF(), false); } emit settingsUpdated(SETTINGS_SECTION_AUDIO, audioSection->descriptions()); } if (values.contains("advanced")) { advanced = values.value("advanced").toBool(); if (audioSection->value("devicetype") == AUDIO_DEVICE_TYPE_HDMI) setHiddenPassthrough(PlayerComponent::AudioCodecsAll(), !advanced); audioSection->setValueHidden("exclusive", !advanced); emit settingsUpdated(SETTINGS_SECTION_AUDIO, audioSection->descriptions()); } }
void AudioSettingsController::setHiddenPassthrough(const QStringList& codecs, bool hidden) { SettingsSection* audioSection = SettingsComponent::Get().getSection(SETTINGS_SECTION_AUDIO); foreach(const QString& codec, codecs) audioSection->setValueHidden("passthrough." + codec, hidden); }