فهرست منبع

Fix issues with optical device type

Do not force a non-stereo channel layout in libmpv. mpv normally does
not force the channel count if passthrough is used, but the AC3
transcoding filter confuses it. (mpv does not bother to check this case;
it only looks at the decoder output - this it works only for real
passthrough.)

Hide the channel selector in the settings UI if this device type is
enabled. It only confuses everyone.
Vincent Lang 9 سال پیش
والد
کامیت
c1d9e76055
2فایلهای تغییر یافته به همراه10 افزوده شده و 4 حذف شده
  1. 7 4
      src/player/PlayerComponent.cpp
  2. 3 0
      src/settings/AudioSettingsController.cpp

+ 7 - 4
src/player/PlayerComponent.cpp

@@ -649,10 +649,6 @@ void PlayerComponent::setAudioConfiguration()
   QVariant device = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "device");
   mpv::qt::set_property_variant(m_mpv, "audio-device", device);
 
-  // set the channel layout
-  QVariant layout = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "channels");
-  mpv::qt::set_option_variant(m_mpv, "audio-channels", layout);
-
   QString resampleOpts = "";
   bool normalize = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "normalize").toBool();
   resampleOpts += QString(":normalize=") + (normalize ? "yes" : "no");
@@ -705,6 +701,13 @@ void PlayerComponent::setAudioConfiguration()
     doAc3Transcoding = true;
   }
 
+
+  // set the channel layout
+  QVariant layout = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "channels");
+  if (doAc3Transcoding)
+    layout = "stereo"; // AC3 spdif always uses 2 physical channels
+  mpv::qt::set_option_variant(m_mpv, "audio-channels", layout);
+
   // Make a informational log message.
   QString audioConfig = QString(QString("Audio Config - device: %1, ") +
                                         "channel layout: %2, " +

+ 3 - 0
src/settings/AudioSettingsController.cpp

@@ -31,6 +31,8 @@ void AudioSettingsController::valuesUpdated(const QVariantMap& values)
   bool advanced = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "advanced").toBool();
   QString type = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "devicetype").toString();
 
+  audioSection->setValueHidden("channels", false);
+
   if (type == AUDIO_DEVICE_TYPE_BASIC)
   {
     setHiddenPassthrough(PlayerComponent::AudioCodecsAll(), true);
@@ -43,6 +45,7 @@ void AudioSettingsController::valuesUpdated(const QVariantMap& values)
   {
     setHiddenPassthrough(PlayerComponent::AudioCodecsAll(), true);
     setHiddenPassthrough(PlayerComponent::AudioCodecsSPDIF(), false);
+    audioSection->setValueHidden("channels", true);
   }
 
   audioSection->setValueHidden("exclusive", !advanced);