Jelajahi Sumber

Skip early if subtitle is in MKS to avoid unnecessary function calls.

Carsten Braun 10 bulan lalu
induk
melakukan
84cebeae64
1 mengubah file dengan 4 tambahan dan 4 penghapusan
  1. 4 4
      MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs

+ 4 - 4
MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs

@@ -608,16 +608,16 @@ namespace MediaBrowser.MediaEncoding.Subtitles
 
             foreach (var subtitleStream in subtitleStreams)
             {
-                var outputPath = GetSubtitleCachePath(mediaSource, subtitleStream.Index, "." + GetExtractableSubtitleFileExtension(subtitleStream));
-                var outputCodec = IsCodecCopyable(subtitleStream.Codec) ? "copy" : "srt";
-                var streamIndex = EncodingHelper.FindIndex(mediaSource.MediaStreams, subtitleStream);
-
                 if (subtitleStream.Path.EndsWith(".mks", StringComparison.OrdinalIgnoreCase))
                 {
                     _logger.LogDebug("Subtitle {Index} for file {InputPath} is part in an MKS file. Skipping", inputPath, subtitleStream.Index);
                     continue;
                 }
 
+                var outputPath = GetSubtitleCachePath(mediaSource, subtitleStream.Index, "." + GetExtractableSubtitleFileExtension(subtitleStream));
+                var outputCodec = IsCodecCopyable(subtitleStream.Codec) ? "copy" : "srt";
+                var streamIndex = EncodingHelper.FindIndex(mediaSource.MediaStreams, subtitleStream);
+
                 if (streamIndex == -1)
                 {
                     _logger.LogError("Cannot find subtitle stream index for {InputPath} ({Index}), skipping this stream", inputPath, subtitleStream.Index);