diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-05-14 11:31:11 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2016-05-14 11:31:11 -0400 |
| commit | d0257a36e6fa2cc3a8ab6bf3dce238eee48e3709 (patch) | |
| tree | dfbf43ae9ae2063ed17b6c7df754de91bc72ee0a /MediaBrowser.Api | |
| parent | 7b52f7caceac4afcab0f1eb59e7c122feecc7959 (diff) | |
| parent | 187b1099bc0ce50b8b2bef8ff37fa4be6e1b3739 (diff) | |
Merge pull request #1732 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Api')
| -rw-r--r-- | MediaBrowser.Api/Playback/BaseStreamingService.cs | 21 | ||||
| -rw-r--r-- | MediaBrowser.Api/Playback/StreamRequest.cs | 4 |
2 files changed, 20 insertions, 5 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 800f246c4d..792e468429 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -712,15 +712,16 @@ namespace MediaBrowser.Api.Playback inputChannels = null; } + int? resultChannels = null; var codec = outputAudioCodec ?? string.Empty; if (codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1) { // wmav2 currently only supports two channel output - return Math.Min(2, inputChannels ?? 2); + resultChannels = Math.Min(2, inputChannels ?? 2); } - if (request.MaxAudioChannels.HasValue) + else if (request.MaxAudioChannels.HasValue) { var channelLimit = codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1 ? 2 @@ -732,10 +733,18 @@ namespace MediaBrowser.Api.Playback } // If we don't have any media info then limit it to 5 to prevent encoding errors due to asking for too many channels - return Math.Min(request.MaxAudioChannels.Value, channelLimit); + resultChannels = Math.Min(request.MaxAudioChannels.Value, channelLimit); } - return request.AudioChannels; + if (resultChannels.HasValue && !string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase)) + { + if (request.TranscodingMaxAudioChannels.HasValue) + { + resultChannels = Math.Min(request.TranscodingMaxAudioChannels.Value, resultChannels.Value); + } + } + + return resultChannels ?? request.AudioChannels; } /// <summary> @@ -1504,6 +1513,10 @@ namespace MediaBrowser.Api.Playback } } } + else if (i == 26) + { + request.TranscodingMaxAudioChannels = int.Parse(val, UsCulture); + } } } diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs index 371dbbda2a..370915ec38 100644 --- a/MediaBrowser.Api/Playback/StreamRequest.cs +++ b/MediaBrowser.Api/Playback/StreamRequest.cs @@ -51,7 +51,9 @@ namespace MediaBrowser.Api.Playback [ApiMember(Name = "MaxAudioChannels", Description = "Optional. Specify a maximum number of audio channels to encode to, e.g. 2", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] public int? MaxAudioChannels { get; set; } - + + public int? TranscodingMaxAudioChannels { get; set; } + /// <summary> /// Gets or sets the audio sample rate. /// </summary> |
