diff options
Diffstat (limited to 'MediaBrowser.Model')
| -rw-r--r-- | MediaBrowser.Model/Dlna/ResolutionNormalizer.cs | 35 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dto/MediaSourceInfo.cs | 2 |
2 files changed, 25 insertions, 12 deletions
diff --git a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs index b0760d91f..950d3680d 100644 --- a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs +++ b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs @@ -12,7 +12,9 @@ namespace MediaBrowser.Model.Dlna new ResolutionConfiguration(426, 320000), new ResolutionConfiguration(640, 400000), new ResolutionConfiguration(720, 950000), - new ResolutionConfiguration(1280, 2500000) + new ResolutionConfiguration(1280, 2500000), + new ResolutionConfiguration(1920, 4000000), + new ResolutionConfiguration(3840, 35000000) }; public static ResolutionOptions Normalize(int? inputBitrate, @@ -35,19 +37,15 @@ namespace MediaBrowser.Model.Dlna } } - foreach (var config in Configurations) + var resolutionConfig = GetResolutionConfiguration(outputBitrate); + if (resolutionConfig != null) { - if (outputBitrate <= config.MaxBitrate) - { - var originvalValue = maxWidth; - - maxWidth = Math.Min(config.MaxWidth, maxWidth ?? config.MaxWidth); - if (!originvalValue.HasValue || originvalValue.Value != maxWidth.Value) - { - maxHeight = null; - } + var originvalValue = maxWidth; - break; + maxWidth = Math.Min(resolutionConfig.MaxWidth, maxWidth ?? resolutionConfig.MaxWidth); + if (!originvalValue.HasValue || originvalValue.Value != maxWidth.Value) + { + maxHeight = null; } } @@ -58,6 +56,19 @@ namespace MediaBrowser.Model.Dlna }; } + private static ResolutionConfiguration GetResolutionConfiguration(int outputBitrate) + { + foreach (var config in Configurations) + { + if (outputBitrate <= config.MaxBitrate) + { + return config; + } + } + + return null; + } + private static double GetVideoBitrateScaleFactor(string codec) { if (StringHelper.EqualsIgnoreCase(codec, "h265") || diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs index 131583024..d0655d90b 100644 --- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs +++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs @@ -29,6 +29,8 @@ namespace MediaBrowser.Model.Dto public string ETag { get; set; } public long? RunTimeTicks { get; set; } public bool ReadAtNativeFramerate { get; set; } + public bool IgnoreDts { get; set; } + public bool IgnoreIndex { get; set; } public bool SupportsTranscoding { get; set; } public bool SupportsDirectStream { get; set; } public bool SupportsDirectPlay { get; set; } |
