فهرست منبع

PlayerComponent: avoid subtitle selection issues due to stale state

Setting options in the load command will reset the options when playback
terminates. setSubtitleStream() on the other hand usually sets permanent
options, _unless_ the corresponding options have already been marker as
playback-local. Since the load command and setSubtitleStream() set
different options depending on the situation, the result is a mess.

Resolve this by resetting all relevant options in the load command. This
potentially fixes issues with the ff-sid option not being reset and
influencing what the load command does.

The same actually applies to audio streams, but to a lesser extent, as
we don't have external audio streams yet.

(Maybe it would be better not to use the "ff-" options, and do the
stream mapping manually by retrieving the list of streams on start.)
Vincent Lang 9 سال پیش
والد
کامیت
5a69526599
1فایلهای تغییر یافته به همراه10 افزوده شده و 6 حذف شده
  1. 10 6
      src/player/PlayerComponent.cpp

+ 10 - 6
src/player/PlayerComponent.cpp

@@ -227,19 +227,23 @@ void PlayerComponent::queueMedia(const QString& url, const QVariantMap& options,
   if (startMilliseconds != 0)
     extraArgs.insert("start", "+" + QString::number(startMilliseconds / 1000.0));
 
+  // force default audio selection
+  extraArgs.insert("ff-aid", "auto");
+
+  // by default ignore all subtitles, unless overridden
+  extraArgs.insert("sid", "no");
+  extraArgs.insert("ff-sid", "auto");
+
   // detect subtitles
   if (!subtitleStream.isEmpty())
   {
     // If the stream title starts with a #, then it's an index
     if (subtitleStream.startsWith("#"))
       extraArgs.insert("ff-sid", subtitleStream.mid(1));
-    else
+    else {
       extraArgs.insert("sub-file", subtitleStream);
-  }
-  else
-  {
-    // no subtitles, tell mpv to ignore them.
-    extraArgs.insert("sid", "no");
+      extraArgs.insert("sid", "auto"); // select the external one by default
+    }
   }
 
   if (metadata["type"] == "music")