浏览代码

Always enable AC3 transcoding if AC3 and stereo channels are selected

This removes the specialcasing of the "Optical" device type, which
implicitly enabled AC3 transcoding. The new behavior should be simpler
and what users want.
Vincent Lang 9 年之前
父节点
当前提交
799251d584
共有 1 个文件被更改,包括 7 次插入11 次删除
  1. 7 11
      src/player/PlayerComponent.cpp

+ 7 - 11
src/player/PlayerComponent.cpp

@@ -693,17 +693,20 @@ void PlayerComponent::setAudioConfiguration()
 
 
   mpv::qt::set_option_variant(m_mpv, "audio-spdif", passthroughCodecs);
   mpv::qt::set_option_variant(m_mpv, "audio-spdif", passthroughCodecs);
 
 
-  // if the user has indicated that we have a optical spdif connection
-  // we need to set this extra option that allows us to transcode
+  // set the channel layout
+  QVariant layout = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "channels");
+  mpv::qt::set_option_variant(m_mpv, "audio-channels", layout);
+
+  // if the user has indicated that PCM only works for stereo, and that
+  // the receiver supports AC3, set this extra option that allows us to transcode
   // 5.1 audio into a usable format, note that we only support AC3
   // 5.1 audio into a usable format, note that we only support AC3
   // here for now. We might need to add support for DTS transcoding
   // here for now. We might need to add support for DTS transcoding
   // if we see user requests for it.
   // if we see user requests for it.
   //
   //
   bool doAc3Transcoding = false;
   bool doAc3Transcoding = false;
-  if (deviceType == AUDIO_DEVICE_TYPE_SPDIF &&
+  if (layout == "2.0" &&
       SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "passthrough.ac3").toBool())
       SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "passthrough.ac3").toBool())
   {
   {
-    QLOG_INFO() << "Enabling audio AC3 transcoding (if needed)";
     mpv::qt::command_variant(m_mpv, QStringList() << "af" << "add" << "@ac3:lavcac3enc");
     mpv::qt::command_variant(m_mpv, QStringList() << "af" << "add" << "@ac3:lavcac3enc");
     doAc3Transcoding = true;
     doAc3Transcoding = true;
   }
   }
@@ -712,13 +715,6 @@ void PlayerComponent::setAudioConfiguration()
     mpv::qt::command_variant(m_mpv, QStringList() << "af" << "del" << "@ac3");
     mpv::qt::command_variant(m_mpv, QStringList() << "af" << "del" << "@ac3");
   }
   }
 
 
-
-  // 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.
   // Make a informational log message.
   QString audioConfig = QString(QString("Audio Config - device: %1, ") +
   QString audioConfig = QString(QString("Audio Config - device: %1, ") +
                                         "channel layout: %2, " +
                                         "channel layout: %2, " +