aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-12-26 16:22:45 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-12-26 16:22:45 -0500
commitcb8751f985739cef6eefdda83b80f5ede9cc9a80 (patch)
tree83ec2229112fb444b3ac791d51890042be3d9454
parenta5ffea5752a691fcd7b65093b4cfe4be131d8625 (diff)
fixes #2365 - External bitmap subtitles are loaded incorrectly
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs14
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs14
2 files changed, 26 insertions, 2 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 252eadbe8..418ec7fcb 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -1068,7 +1068,19 @@ namespace MediaBrowser.Api.Playback
arg += string.Format(" -canvas_size {0}:{1}", state.VideoStream.Width.Value.ToString(CultureInfo.InvariantCulture), Convert.ToInt32(height).ToString(CultureInfo.InvariantCulture));
}
- arg += " -i \"" + state.SubtitleStream.Path + "\"";
+
+ var subtitlePath = state.SubtitleStream.Path;
+
+ if (string.Equals(Path.GetExtension(subtitlePath), ".sub", StringComparison.OrdinalIgnoreCase))
+ {
+ var idxFile = Path.ChangeExtension(subtitlePath, ".idx");
+ if (FileSystem.FileExists(idxFile))
+ {
+ subtitlePath = idxFile;
+ }
+ }
+
+ arg += " -i \"" + subtitlePath + "\"";
}
}
diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
index d7789a5fd..80bbc87e3 100644
--- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
@@ -474,7 +474,19 @@ namespace MediaBrowser.MediaEncoding.Encoder
arg += string.Format(" -canvas_size {0}:{1}", state.VideoStream.Width.Value.ToString(CultureInfo.InvariantCulture), Convert.ToInt32(height).ToString(CultureInfo.InvariantCulture));
}
- arg += " -i \"" + state.SubtitleStream.Path + "\"";
+
+ var subtitlePath = state.SubtitleStream.Path;
+
+ if (string.Equals(Path.GetExtension(subtitlePath), ".sub", StringComparison.OrdinalIgnoreCase))
+ {
+ var idxFile = Path.ChangeExtension(subtitlePath, ".idx");
+ if (FileSystem.FileExists(idxFile))
+ {
+ subtitlePath = idxFile;
+ }
+ }
+
+ arg += " -i \"" + subtitlePath + "\"";
}
}