From b8f57f586b218558bcb45259d65dfe990e593559 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 30 Dec 2016 00:55:46 -0500 Subject: [PATCH] update stream specifiers --- .../Playback/BaseStreamingService.cs | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index a768d0cc41..dc137521c8 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1975,7 +1975,7 @@ namespace MediaBrowser.Api.Playback if (state.OutputVideoBitrate.HasValue && !string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase)) { var resolution = ResolutionNormalizer.Normalize( - state.VideoStream == null ? (int?) null : state.VideoStream.BitRate, + state.VideoStream == null ? (int?)null : state.VideoStream.BitRate, state.OutputVideoBitrate.Value, state.VideoStream == null ? null : state.VideoStream.Codec, state.OutputVideoCodec, @@ -2692,17 +2692,27 @@ namespace MediaBrowser.Api.Playback //inputModifier += " -noaccurate_seek"; } - var videoStream = state.VideoStream; - if (videoStream != null && !string.IsNullOrWhiteSpace(videoStream.Codec)) + foreach (var stream in state.MediaSource.MediaStreams) { - inputModifier += " -codec:0 " + videoStream.Codec; - - var audioStream = state.AudioStream; - if (audioStream != null && !string.IsNullOrWhiteSpace(audioStream.Codec)) + if (!stream.IsExternal && stream.Type != MediaStreamType.Subtitle) { - inputModifier += " -codec:1 " + audioStream.Codec; + if (!string.IsNullOrWhiteSpace(stream.Codec) && stream.Index != -1) + { + inputModifier += " -codec:" + stream.Index.ToString(UsCulture) + " " + stream.Codec; + } } } + //var videoStream = state.VideoStream; + //if (videoStream != null && !string.IsNullOrWhiteSpace(videoStream.Codec)) + //{ + // inputModifier += " -codec:0 " + videoStream.Codec; + + // var audioStream = state.AudioStream; + // if (audioStream != null && !string.IsNullOrWhiteSpace(audioStream.Codec)) + // { + // inputModifier += " -codec:1 " + audioStream.Codec; + // } + //} } return inputModifier;