diff options
| author | Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> | 2019-01-04 17:40:44 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-04 17:40:44 -0500 |
| commit | e4a041b8321e49fd9b21fb0f890caf23d4752212 (patch) | |
| tree | 7e4be1c765afd026350f9c450264747b6adf4eca /MediaBrowser.Model/Dlna/ResolutionNormalizer.cs | |
| parent | 72ee4b189d35606ae60b1717ba5b318680025627 (diff) | |
| parent | 340a2c651276d911285a6ff09944c5eba2384a51 (diff) | |
Merge pull request #283 from Bond-009/gpl-cleanup
Post GPL cleanup
Diffstat (limited to 'MediaBrowser.Model/Dlna/ResolutionNormalizer.cs')
| -rw-r--r-- | MediaBrowser.Model/Dlna/ResolutionNormalizer.cs | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs index 4fdf4972f..4cde26a03 100644 --- a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs +++ b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs @@ -1,13 +1,12 @@ using System; -using System.Collections.Generic; using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.Dlna { public class ResolutionNormalizer { - private static readonly ResolutionConfiguration[] Configurations = - new [] + private static readonly ResolutionConfiguration[] Configurations = + new[] { new ResolutionConfiguration(426, 320000), new ResolutionConfiguration(640, 400000), @@ -20,24 +19,24 @@ namespace MediaBrowser.Model.Dlna public static ResolutionOptions Normalize(int? inputBitrate, int? unused1, int? unused2, - int outputBitrate, - string inputCodec, + int outputBitrate, + string inputCodec, string outputCodec, int? maxWidth, int? maxHeight) { - // If the bitrate isn't changing, then don't downlscale the resolution - if (inputBitrate.HasValue && outputBitrate >= inputBitrate.Value) - { - if (maxWidth.HasValue || maxHeight.HasValue) - { - return new ResolutionOptions - { - MaxWidth = maxWidth, - MaxHeight = maxHeight - }; - } - } + // If the bitrate isn't changing, then don't downlscale the resolution + if (inputBitrate.HasValue && outputBitrate >= inputBitrate.Value) + { + if (maxWidth.HasValue || maxHeight.HasValue) + { + return new ResolutionOptions + { + MaxWidth = maxWidth, + MaxHeight = maxHeight + }; + } + } var resolutionConfig = GetResolutionConfiguration(outputBitrate); if (resolutionConfig != null) @@ -90,8 +89,8 @@ namespace MediaBrowser.Model.Dlna { var inputScaleFactor = GetVideoBitrateScaleFactor(inputVideoCodec); var outputScaleFactor = GetVideoBitrateScaleFactor(outputVideoCodec); - var scaleFactor = outputScaleFactor/inputScaleFactor; - var newBitrate = scaleFactor*bitrate; + var scaleFactor = outputScaleFactor / inputScaleFactor; + var newBitrate = scaleFactor * bitrate; return Convert.ToInt32(newBitrate); } |
