diff options
| author | Tavares André <tavares_and@hotmail.com> | 2015-05-07 19:12:56 +0200 |
|---|---|---|
| committer | Tavares André <tavares_and@hotmail.com> | 2015-05-07 19:12:56 +0200 |
| commit | 48e7ca87254969f98abbedcfc46985fc1ea955c0 (patch) | |
| tree | c1084f29f6529d4bf5524fdab7a723686a379b2d /MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs | |
| parent | f2b800181252b6fd0bb3b51925d1dcb0623f21d2 (diff) | |
| parent | 63dc2512c5d272dbc3cb1515beb175e9b3572440 (diff) | |
Merge branch 'dev' of https://github.com/MediaBrowser/MediaBrowser into dev
Conflicts:
MediaBrowser.Server.Implementations/Localization/Server/server.json
Diffstat (limited to 'MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs index c30ceb62d..e25537362 100644 --- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs @@ -840,7 +840,7 @@ namespace MediaBrowser.MediaEncoding.Encoder var maxWidthParam = request.MaxWidth.Value.ToString(UsCulture); var maxHeightParam = request.MaxHeight.Value.ToString(UsCulture); - filters.Add(string.Format("scale=trunc(min(iw\\,{0})/2)*2:trunc(min((iw/dar)\\,{1})/2)*2", maxWidthParam, maxHeightParam)); + filters.Add(string.Format("scale=trunc(min(max(iw\\,ih*dar)\\,min({0}\\,{1}*dar))/2)*2:trunc(min(max(iw/dar\\,ih)\\,min({0}/dar\\,{1}))/2)*2", maxWidthParam, maxHeightParam)); } // If a fixed width was requested @@ -860,7 +860,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } // If a max width was requested - else if (request.MaxWidth.HasValue && (!request.MaxHeight.HasValue || state.VideoStream == null)) + else if (request.MaxWidth.HasValue) { var maxWidthParam = request.MaxWidth.Value.ToString(UsCulture); @@ -868,35 +868,13 @@ namespace MediaBrowser.MediaEncoding.Encoder } // If a max height was requested - else if (request.MaxHeight.HasValue && (!request.MaxWidth.HasValue || state.VideoStream == null)) + else if (request.MaxHeight.HasValue) { var maxHeightParam = request.MaxHeight.Value.ToString(UsCulture); filters.Add(string.Format("scale=trunc(oh*a*2)/2:min(ih\\,{0})", maxHeightParam)); } - else if (request.MaxWidth.HasValue || - request.MaxHeight.HasValue || - request.Width.HasValue || - request.Height.HasValue) - { - if (state.VideoStream != null) - { - // Need to perform calculations manually - - // Try to account for bad media info - var currentHeight = state.VideoStream.Height ?? request.MaxHeight ?? request.Height ?? 0; - var currentWidth = state.VideoStream.Width ?? request.MaxWidth ?? request.Width ?? 0; - - var outputSize = DrawingUtils.Resize(currentWidth, currentHeight, request.Width, request.Height, request.MaxWidth, request.MaxHeight); - - var manualWidthParam = outputSize.Width.ToString(UsCulture); - var manualHeightParam = outputSize.Height.ToString(UsCulture); - - filters.Add(string.Format("scale=trunc({0}/2)*2:trunc({1}/2)*2", manualWidthParam, manualHeightParam)); - } - } - var output = string.Empty; if (state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream) |
