From a1ca5e3ecc076006d7a1b94511132f0544b5e667 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 23 Dec 2016 03:54:30 -0500 Subject: remove dead code --- MediaBrowser.Controller/Channels/IChannelManager.cs | 10 +--------- MediaBrowser.Controller/Entities/Audio/Audio.cs | 2 +- MediaBrowser.Controller/Entities/Video.cs | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs index 9177e2d81..792744628 100644 --- a/MediaBrowser.Controller/Channels/IChannelManager.cs +++ b/MediaBrowser.Controller/Channels/IChannelManager.cs @@ -15,15 +15,8 @@ namespace MediaBrowser.Controller.Channels /// Adds the parts. /// /// The channels. - /// The factories. void AddParts(IEnumerable channels); - /// - /// Gets the channel download path. - /// - /// The channel download path. - string ChannelDownloadPath { get; } - /// /// Gets the channel features. /// @@ -115,10 +108,9 @@ namespace MediaBrowser.Controller.Channels /// Gets the channel item media sources. /// /// The item. - /// if set to true [include cached versions]. /// The cancellation token. /// Task{IEnumerable{MediaSourceInfo}}. - Task> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken); + Task> GetStaticMediaSources(BaseItem item, CancellationToken cancellationToken); /// /// Gets the channel folder. diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index e4f638cb6..3a6a7765b 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -206,7 +206,7 @@ namespace MediaBrowser.Controller.Entities.Audio { if (SourceType == SourceType.Channel) { - var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None) + var sources = ChannelManager.GetStaticMediaSources(this, CancellationToken.None) .Result.ToList(); if (sources.Count > 0) diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 7ba59df4f..47df12e1b 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -549,7 +549,7 @@ namespace MediaBrowser.Controller.Entities { if (SourceType == SourceType.Channel) { - var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None) + var sources = ChannelManager.GetStaticMediaSources(this, CancellationToken.None) .Result.ToList(); if (sources.Count > 0) -- cgit v1.2.3 From a5ffea5752a691fcd7b65093b4cfe4be131d8625 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 26 Dec 2016 14:47:37 -0500 Subject: update video audio encoding --- MediaBrowser.Api/Playback/BaseStreamingService.cs | 42 ++++++++++++++------- .../MediaEncoding/EncodingJobOptions.cs | 2 + .../Encoder/EncodingJobFactory.cs | 44 ++++++++++++++++------ 3 files changed, 62 insertions(+), 26 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 5e450567a..252eadbe8 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -870,33 +870,47 @@ namespace MediaBrowser.Api.Playback inputChannels = null; } - int? resultChannels = null; + int? transcoderChannelLimit = null; var codec = outputAudioCodec ?? string.Empty; if (codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1) { // wmav2 currently only supports two channel output - resultChannels = Math.Min(2, inputChannels ?? 2); + transcoderChannelLimit = 2; } - else if (request.MaxAudioChannels.HasValue) + else if (codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1) + { + // libmp3lame currently only supports two channel output + transcoderChannelLimit = 2; + } + else { - var channelLimit = codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1 - ? 2 - : 6; + // If we don't have any media info then limit it to 6 to prevent encoding errors due to asking for too many channels + transcoderChannelLimit = 6; + } - if (inputChannels.HasValue) - { - channelLimit = Math.Min(channelLimit, inputChannels.Value); - } + var isTranscodingAudio = !string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase); + + int? resultChannels = null; + if (isTranscodingAudio) + { + resultChannels = request.TranscodingMaxAudioChannels; + } + resultChannels = resultChannels ?? request.MaxAudioChannels ?? request.AudioChannels; - // If we don't have any media info then limit it to 5 to prevent encoding errors due to asking for too many channels - resultChannels = Math.Min(request.MaxAudioChannels.Value, channelLimit); + if (inputChannels.HasValue) + { + resultChannels = resultChannels.HasValue + ? Math.Min(resultChannels.Value, inputChannels.Value) + : inputChannels.Value; } - if (request.TranscodingMaxAudioChannels.HasValue && !string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase)) + if (isTranscodingAudio && transcoderChannelLimit.HasValue) { - resultChannels = Math.Min(request.TranscodingMaxAudioChannels.Value, resultChannels ?? inputChannels ?? request.TranscodingMaxAudioChannels.Value); + resultChannels = resultChannels.HasValue + ? Math.Min(resultChannels.Value, transcoderChannelLimit.Value) + : transcoderChannelLimit.Value; } return resultChannels ?? request.AudioChannels; diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs index 844fafcde..d5fe790b9 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs @@ -35,6 +35,7 @@ namespace MediaBrowser.Controller.MediaEncoding public string VideoCodec { get; set; } + public int? TranscodingMaxAudioChannels { get; set; } public int? VideoBitRate { get; set; } public int? AudioStreamIndex { get; set; } public int? VideoStreamIndex { get; set; } @@ -86,6 +87,7 @@ namespace MediaBrowser.Controller.MediaEncoding MaxVideoBitDepth = info.MaxVideoBitDepth; SubtitleMethod = info.SubtitleDeliveryMethod; Context = info.Context; + TranscodingMaxAudioChannels = info.TranscodingMaxAudioChannels; if (info.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External) { diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs index e197bdb6f..d6340d4ab 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs @@ -370,30 +370,50 @@ namespace MediaBrowser.MediaEncoding.Encoder inputChannels = null; } + int? transcoderChannelLimit = 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); + transcoderChannelLimit = 2; } - if (request.MaxAudioChannels.HasValue) + else if (codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1) { - var channelLimit = codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1 - ? 2 - : 6; + // libmp3lame currently only supports two channel output + transcoderChannelLimit = 2; + } + else + { + // If we don't have any media info then limit it to 6 to prevent encoding errors due to asking for too many channels + transcoderChannelLimit = 6; + } - if (inputChannels.HasValue) - { - channelLimit = Math.Min(channelLimit, inputChannels.Value); - } + var isTranscodingAudio = !string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase); - // 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); + int? resultChannels = null; + if (isTranscodingAudio) + { + resultChannels = request.TranscodingMaxAudioChannels; + } + resultChannels = resultChannels ?? request.MaxAudioChannels ?? request.AudioChannels; + + if (inputChannels.HasValue) + { + resultChannels = resultChannels.HasValue + ? Math.Min(resultChannels.Value, inputChannels.Value) + : inputChannels.Value; + } + + if (isTranscodingAudio && transcoderChannelLimit.HasValue) + { + resultChannels = resultChannels.HasValue + ? Math.Min(resultChannels.Value, transcoderChannelLimit.Value) + : transcoderChannelLimit.Value; } - return request.AudioChannels; + return resultChannels ?? request.AudioChannels; } private int? GetVideoBitrateParamValue(EncodingJobOptions request, MediaStream videoStream, string outputVideoCodec) -- cgit v1.2.3