diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 4a767b0889..67d9cf7a47 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1,5 +1,4 @@ -using System.Globalization; -using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Extensions; using MediaBrowser.Common.IO; using MediaBrowser.Common.MediaInfo; using MediaBrowser.Controller; @@ -11,15 +10,15 @@ using MediaBrowser.Controller.MediaInfo; using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.IO; using System; using System.Collections.Generic; -using System.ComponentModel; using System.Diagnostics; +using System.Globalization; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Model.IO; namespace MediaBrowser.Api.Playback { diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index 080ab9c7ed..dfd18ab154 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -88,7 +88,7 @@ namespace MediaBrowser.Api.Playback.Hls } var volParam = string.Empty; - var AudioSampleRate = string.Empty; + var audioSampleRate = string.Empty; // Boost volume to 200% when downsampling from 6ch to 2ch if (channels.HasValue && channels.Value <= 2 && state.AudioStream.Channels.HasValue && state.AudioStream.Channels.Value > 5) @@ -98,10 +98,10 @@ namespace MediaBrowser.Api.Playback.Hls if (state.Request.AudioSampleRate.HasValue) { - AudioSampleRate= state.Request.AudioSampleRate.Value + ":"; + audioSampleRate= state.Request.AudioSampleRate.Value + ":"; } - args += string.Format(" -af \"adelay=1,aresample={0}async=1000{1}\"",AudioSampleRate, volParam); + args += string.Format(" -af \"adelay=1,aresample={0}async=1000{1}\"",audioSampleRate, volParam); return args; } @@ -127,6 +127,10 @@ namespace MediaBrowser.Api.Playback.Hls const string keyFrameArg = " -force_key_frames expr:if(isnan(prev_forced_t),gte(t,.1),gte(t,prev_forced_t+5))"; + var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsExternal && + (state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 || + state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1); + var args = "-codec:v:0 " + codec + " -preset superfast" + keyFrameArg; var bitrate = GetVideoBitrateParam(state); @@ -137,9 +141,12 @@ namespace MediaBrowser.Api.Playback.Hls } // Add resolution params, if specified - if (state.VideoRequest.Width.HasValue || state.VideoRequest.Height.HasValue || state.VideoRequest.MaxHeight.HasValue || state.VideoRequest.MaxWidth.HasValue) + if (!hasGraphicalSubs) { - args += GetOutputSizeParam(state, codec, performSubtitleConversion); + if (state.VideoRequest.Width.HasValue || state.VideoRequest.Height.HasValue || state.VideoRequest.MaxHeight.HasValue || state.VideoRequest.MaxWidth.HasValue) + { + args += GetOutputSizeParam(state, codec, performSubtitleConversion); + } } if (state.VideoRequest.Framerate.HasValue) @@ -158,14 +165,11 @@ namespace MediaBrowser.Api.Playback.Hls { args += " -level " + state.VideoRequest.Level; } - - if (state.SubtitleStream != null) + + // This is for internal graphical subs + if (hasGraphicalSubs) { - // This is for internal graphical subs - if (!state.SubtitleStream.IsExternal && (state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 || state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1)) - { - args += GetInternalGraphicalSubtitleParam(state, codec); - } + args += GetInternalGraphicalSubtitleParam(state, codec); } return args; diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs index 0ef6d13ccc..97b808b867 100644 --- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs +++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs @@ -143,12 +143,19 @@ namespace MediaBrowser.Api.Playback.Progressive args += keyFrameArg; + var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsExternal && + (state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 || + state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1); + var request = state.VideoRequest; // Add resolution params, if specified - if (request.Width.HasValue || request.Height.HasValue || request.MaxHeight.HasValue || request.MaxWidth.HasValue) + if (!hasGraphicalSubs) { - args += GetOutputSizeParam(state, codec, performSubtitleConversion); + if (request.Width.HasValue || request.Height.HasValue || request.MaxHeight.HasValue || request.MaxWidth.HasValue) + { + args += GetOutputSizeParam(state, codec, performSubtitleConversion); + } } if (request.Framerate.HasValue) @@ -175,13 +182,10 @@ namespace MediaBrowser.Api.Playback.Progressive args += " -level " + state.VideoRequest.Level; } - if (state.SubtitleStream != null) + // This is for internal graphical subs + if (hasGraphicalSubs) { - // This is for internal graphical subs - if (!state.SubtitleStream.IsExternal && (state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 || state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1)) - { - args += GetInternalGraphicalSubtitleParam(state, codec); - } + args += GetInternalGraphicalSubtitleParam(state, codec); } return args; diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index b139cba9a3..29765fe126 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1244,7 +1244,6 @@ namespace MediaBrowser.Controller.Entities /// /// Adds the tagline. /// - /// The item. /// The tagline. /// tagline public void AddTagline(string tagline)