Procházet zdrojové kódy

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 před 9 roky
rodič
revize
af0ae81046
1 změnil soubory, kde provedl 5 přidání a 1 odebrání
  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())
   {
     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;
   }
+  else
+  {
+    mpv::qt::command_variant(m_mpv, QStringList() << "af" << "del" << "@ac3");
+  }
 
 
   // set the channel layout