diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-04-09 17:38:59 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-04-09 17:38:59 -0400 |
| commit | e56faea17a9c300299a6b088ca399abe4351b472 (patch) | |
| tree | 148e7db3c782d3f345b89d79dbc7036edc430444 /MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs | |
| parent | 8c487250e0984615289f72f781762ba1b9b5cb7e (diff) | |
update vsync
Diffstat (limited to 'MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs')
| -rw-r--r-- | MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs index f5878864b..4e0f223b7 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs @@ -41,7 +41,20 @@ namespace MediaBrowser.Controller.MediaEncoding public string OutputContainer { get; set; } - public string OutputVideoSync = "-1"; + public string OutputVideoSync + { + get + { + // For live tv + recordings + if (string.Equals(InputContainer, "mpegts", StringComparison.OrdinalIgnoreCase) || + string.Equals(InputContainer, "ts", StringComparison.OrdinalIgnoreCase)) + { + return "cfr"; + } + + return "-1"; + } + } public string OutputAudioSync = "1"; public string InputAudioSync { get; set; } public string InputVideoSync { get; set; } @@ -72,10 +85,12 @@ namespace MediaBrowser.Controller.MediaEncoding public int? OutputAudioSampleRate; public bool DeInterlace { get; set; } public bool IsVideoRequest { get; set; } + public TranscodingJobType TranscodingType { get; set; } - public EncodingJobInfo(ILogger logger) + public EncodingJobInfo(ILogger logger, TranscodingJobType jobType) { _logger = logger; + TranscodingType = jobType; RemoteHttpHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); PlayableStreamFileNames = new List<string>(); SupportedAudioCodecs = new List<string>(); @@ -83,6 +98,29 @@ namespace MediaBrowser.Controller.MediaEncoding SupportedSubtitleCodecs = new List<string>(); } + public bool IsSegmentedLiveStream + { + get + { + return TranscodingType != TranscodingJobType.Progressive && !RunTimeTicks.HasValue; + } + } + + public bool EnableBreakOnNonKeyFrames(string videoCodec) + { + if (TranscodingType != TranscodingJobType.Progressive) + { + if (IsSegmentedLiveStream) + { + return false; + } + + return BaseRequest.BreakOnNonKeyFrames && string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase); + } + + return false; + } + /// <summary> /// Predicts the audio sample rate that will be in the output stream /// </summary> @@ -118,4 +156,23 @@ namespace MediaBrowser.Controller.MediaEncoding public abstract void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate); } + + /// <summary> + /// Enum TranscodingJobType + /// </summary> + public enum TranscodingJobType + { + /// <summary> + /// The progressive + /// </summary> + Progressive, + /// <summary> + /// The HLS + /// </summary> + Hls, + /// <summary> + /// The dash + /// </summary> + Dash + } } |
