diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-07-01 12:24:26 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-01 12:24:26 -0400 |
| commit | ff3713153ad2317e1c196f33ac2cba61b449a00e (patch) | |
| tree | 84d2e6ed5bcb556a2395603b6403c8e992535e6b /MediaBrowser.Controller/MediaEncoding | |
| parent | fad71a6c7d12c8b207cdf473c7dd7daafa53c174 (diff) | |
| parent | 2dcad6b5977f5c5be81b18c42506ed8ad3fb73b6 (diff) | |
Merge pull request #2739 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Controller/MediaEncoding')
3 files changed, 74 insertions, 9 deletions
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index c348ffda7..44bdafc5b 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -42,6 +42,11 @@ namespace MediaBrowser.Controller.MediaEncoding { var hwType = encodingOptions.HardwareAccelerationType; + if (!encodingOptions.EnableHardwareEncoding) + { + hwType = null; + } + if (string.Equals(hwType, "qsv", StringComparison.OrdinalIgnoreCase) || string.Equals(hwType, "h264_qsv", StringComparison.OrdinalIgnoreCase)) { @@ -196,6 +201,10 @@ namespace MediaBrowser.Controller.MediaEncoding { return null; } + if (string.Equals(container, "tp", StringComparison.OrdinalIgnoreCase)) + { + return null; + } // Seeing reported failures here, not sure yet if this is related to specfying input format if (string.Equals(container, "m4v", StringComparison.OrdinalIgnoreCase)) @@ -228,7 +237,12 @@ namespace MediaBrowser.Controller.MediaEncoding return null; } - return codec; + if (_mediaEncoder.SupportsDecoder(codec)) + { + return codec; + } + + return null; } /// <summary> @@ -1761,14 +1775,11 @@ namespace MediaBrowser.Controller.MediaEncoding return null; } - if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec)) + if (state.VideoStream != null && + !string.IsNullOrWhiteSpace(state.VideoStream.Codec) && + !string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType) && + encodingOptions.EnableHardwareDecoding) { - if (!string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType)) - { - // causing unpredictable results - //return "-hwaccel auto"; - } - if (string.Equals(encodingOptions.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase)) { switch (state.MediaSource.VideoStream.Codec.ToLower()) @@ -1818,6 +1829,13 @@ namespace MediaBrowser.Controller.MediaEncoding return "-c:v h264_cuvid "; } break; + case "hevc": + case "h265": + if (_mediaEncoder.SupportsDecoder("hevc_cuvid")) + { + return "-c:v hevc_cuvid "; + } + break; } } } diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs index 57c81ddf7..b552579a8 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.Linq; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dto; @@ -9,6 +10,7 @@ using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Drawing; +using MediaBrowser.Model.Session; namespace MediaBrowser.Controller.MediaEncoding { @@ -40,6 +42,24 @@ namespace MediaBrowser.Controller.MediaEncoding public bool ReadInputAtNativeFramerate { get; set; } + private List<TranscodeReason> _transcodeReasons = null; + public List<TranscodeReason> TranscodeReasons + { + get + { + if (_transcodeReasons == null) + { + _transcodeReasons = (BaseRequest.TranscodeReasons ?? string.Empty) + .Split(',') + .Where(i => !string.IsNullOrWhiteSpace(i)) + .Select(v => (TranscodeReason)Enum.Parse(typeof(TranscodeReason), v, true)) + .ToList(); + } + + return _transcodeReasons; + } + } + public bool IgnoreInputDts { get @@ -251,7 +271,7 @@ namespace MediaBrowser.Controller.MediaEncoding { return AudioStream.SampleRate; } - } + } else if (BaseRequest.AudioSampleRate.HasValue) { @@ -264,6 +284,29 @@ namespace MediaBrowser.Controller.MediaEncoding } } + public int? OutputAudioBitDepth + { + get + { + if (BaseRequest.Static || string.Equals(OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase)) + { + if (AudioStream != null) + { + return AudioStream.BitDepth; + } + } + + //else if (BaseRequest.AudioSampleRate.HasValue) + //{ + // // Don't exceed what the encoder supports + // // Seeing issues of attempting to encode to 88200 + // return Math.Min(44100, BaseRequest.AudioSampleRate.Value); + //} + + return null; + } + } + /// <summary> /// Predicts the audio sample rate that will be in the output stream /// </summary> diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs index 632c350ad..5fc93bf38 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs @@ -83,6 +83,8 @@ namespace MediaBrowser.Controller.MediaEncoding [ApiMember(Name = "AudioSampleRate", Description = "Optional. Specify a specific audio sample rate, e.g. 44100", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] public int? AudioSampleRate { get; set; } + public int? MaxAudioBitDepth { get; set; } + /// <summary> /// Gets or sets the audio bit rate. /// </summary> @@ -204,6 +206,8 @@ namespace MediaBrowser.Controller.MediaEncoding public string SubtitleCodec { get; set; } + public string TranscodeReasons { get; set; } + /// <summary> /// Gets or sets the index of the audio stream. /// </summary> |
