浏览代码

Properly remove AC3 transcoding filter when it is to be disabled

Somehow the existing code expected the "af" option (audio filter list)
would be reset before running this function. This doesn't ever happen.
So make sure it is removed.

Also, instead of overwriting the "af" option, just add or remove the
transcoding filter by using a command. (Seems like people are starting
to add custom stuff to mpv.conf, and this would overwrite custom audio
filters. As long as avoiding conflict stays relatively easy, it's
probably a good idea to do so.)
Vincent Lang 9 年之前
父节点
当前提交
af0ae81046
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/player/PlayerComponent.cpp

+ 5 - 1
src/player/PlayerComponent.cpp

@@ -697,9 +697,13 @@ void PlayerComponent::setAudioConfiguration()
       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)";
     QLOG_INFO() << "Enabling audio AC3 transcoding (if needed)";
-    mpv::qt::set_option_variant(m_mpv, "af", "lavcac3enc");
+    mpv::qt::command_variant(m_mpv, QStringList() << "af" << "add" << "@ac3:lavcac3enc");
     doAc3Transcoding = true;
     doAc3Transcoding = true;
   }
   }
+  else
+  {
+    mpv::qt::command_variant(m_mpv, QStringList() << "af" << "del" << "@ac3");
+  }
 
 
 
 
   // set the channel layout
   // set the channel layout