add IgnoreDts option

This commit is contained in:
Luke Pulverenti
2017-04-30 16:03:28 -04:00
parent 7ef16a449a
commit 7ee588060d
7 changed files with 56 additions and 22 deletions

View File

@@ -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(resolutionConfig.MaxWidth, maxWidth ?? resolutionConfig.MaxWidth);
if (!originvalValue.HasValue || originvalValue.Value != maxWidth.Value)
{
var originvalValue = maxWidth;
maxWidth = Math.Min(config.MaxWidth, maxWidth ?? config.MaxWidth);
if (!originvalValue.HasValue || originvalValue.Value != maxWidth.Value)
{
maxHeight = null;
}
break;
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") ||