From 4394177c7697b0fa835b23e40d26499f1355cda0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 20 Sep 2016 11:21:09 -0400 Subject: [PATCH] normalize subtitle names --- .../Probing/ProbeResultNormalizer.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index 700af682b..5805127e6 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -393,6 +393,20 @@ namespace MediaBrowser.MediaEncoding.Probing }; } + private string NormalizeSubtitleCodec(string codec) + { + if ((codec ?? string.Empty).IndexOf("PGS", StringComparison.OrdinalIgnoreCase) != -1) + { + codec = "PGSSUB"; + } + else if ((codec ?? string.Empty).IndexOf("DVD", StringComparison.OrdinalIgnoreCase) != -1) + { + codec = "DVDSUB"; + } + + return codec; + } + /// /// Converts ffprobe stream info to our MediaStream class /// @@ -474,6 +488,7 @@ namespace MediaBrowser.MediaEncoding.Probing else if (string.Equals(streamInfo.codec_type, "subtitle", StringComparison.OrdinalIgnoreCase)) { stream.Type = MediaStreamType.Subtitle; + stream.Codec = NormalizeSubtitleCodec(stream.Codec); } else if (string.Equals(streamInfo.codec_type, "video", StringComparison.OrdinalIgnoreCase)) {