update hw filters
This commit is contained in:
parent
ded141c411
commit
e0161d62db
|
@ -1400,14 +1400,23 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var isExynosV4L2 = string.Equals(outputVideoCodec, "h264_v4l2m2m", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
// If fixed dimensions were supplied
|
// If fixed dimensions were supplied
|
||||||
if (request.Width.HasValue && request.Height.HasValue)
|
if (request.Width.HasValue && request.Height.HasValue)
|
||||||
{
|
{
|
||||||
var widthParam = request.Width.Value.ToString(_usCulture);
|
var widthParam = request.Width.Value.ToString(_usCulture);
|
||||||
var heightParam = request.Height.Value.ToString(_usCulture);
|
var heightParam = request.Height.Value.ToString(_usCulture);
|
||||||
|
|
||||||
|
if (isExynosV4L2)
|
||||||
|
{
|
||||||
|
filters.Add(string.Format("scale=trunc({0}/64)*64:trunc({1}/2)*2", widthParam, heightParam));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
filters.Add(string.Format("scale=trunc({0}/2)*2:trunc({1}/2)*2", widthParam, heightParam));
|
filters.Add(string.Format("scale=trunc({0}/2)*2:trunc({1}/2)*2", widthParam, heightParam));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If Max dimensions were supplied, for width selects lowest even number between input width and width req size and selects lowest even number from in width*display aspect and requested size
|
// If Max dimensions were supplied, for width selects lowest even number between input width and width req size and selects lowest even number from in width*display aspect and requested size
|
||||||
else if (request.MaxWidth.HasValue && request.MaxHeight.HasValue)
|
else if (request.MaxWidth.HasValue && request.MaxHeight.HasValue)
|
||||||
|
@ -1415,8 +1424,15 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
var maxWidthParam = request.MaxWidth.Value.ToString(_usCulture);
|
var maxWidthParam = request.MaxWidth.Value.ToString(_usCulture);
|
||||||
var maxHeightParam = request.MaxHeight.Value.ToString(_usCulture);
|
var maxHeightParam = request.MaxHeight.Value.ToString(_usCulture);
|
||||||
|
|
||||||
|
if (isExynosV4L2)
|
||||||
|
{
|
||||||
|
filters.Add(string.Format("scale=trunc(min(max(iw\\,ih*dar)\\,min({0}\\,{1}*dar))/64)*64:trunc(min(max(iw/dar\\,ih)\\,min({0}/dar\\,{1}))/2)*2", maxWidthParam, maxHeightParam));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
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));
|
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
|
// If a fixed width was requested
|
||||||
else if (request.Width.HasValue)
|
else if (request.Width.HasValue)
|
||||||
|
@ -1431,25 +1447,46 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
{
|
{
|
||||||
var heightParam = request.Height.Value.ToString(_usCulture);
|
var heightParam = request.Height.Value.ToString(_usCulture);
|
||||||
|
|
||||||
|
if (isExynosV4L2)
|
||||||
|
{
|
||||||
|
filters.Add(string.Format("scale=trunc(oh*a/64)*64:{0}", heightParam));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
filters.Add(string.Format("scale=trunc(oh*a/2)*2:{0}", heightParam));
|
filters.Add(string.Format("scale=trunc(oh*a/2)*2:{0}", heightParam));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If a max width was requested
|
// If a max width was requested
|
||||||
else if (request.MaxWidth.HasValue)
|
else if (request.MaxWidth.HasValue)
|
||||||
{
|
{
|
||||||
var maxWidthParam = request.MaxWidth.Value.ToString(_usCulture);
|
var maxWidthParam = request.MaxWidth.Value.ToString(_usCulture);
|
||||||
|
|
||||||
|
if (isExynosV4L2)
|
||||||
|
{
|
||||||
|
filters.Add(string.Format("scale=trunc(min(max(iw\\,ih*dar)\\,{0})/64)*64:trunc(ow/dar/2)*2", maxWidthParam));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
filters.Add(string.Format("scale=trunc(min(max(iw\\,ih*dar)\\,{0})/2)*2:trunc(ow/dar/2)*2", maxWidthParam));
|
filters.Add(string.Format("scale=trunc(min(max(iw\\,ih*dar)\\,{0})/2)*2:trunc(ow/dar/2)*2", maxWidthParam));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If a max height was requested
|
// If a max height was requested
|
||||||
else if (request.MaxHeight.HasValue)
|
else if (request.MaxHeight.HasValue)
|
||||||
{
|
{
|
||||||
var maxHeightParam = request.MaxHeight.Value.ToString(_usCulture);
|
var maxHeightParam = request.MaxHeight.Value.ToString(_usCulture);
|
||||||
|
|
||||||
|
if (isExynosV4L2)
|
||||||
|
{
|
||||||
|
filters.Add(string.Format("scale=trunc(oh*a/64)*64:min(max(iw/dar\\,ih)\\,{0})", maxHeightParam));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
filters.Add(string.Format("scale=trunc(oh*a/2)*2:min(max(iw/dar\\,ih)\\,{0})", maxHeightParam));
|
filters.Add(string.Format("scale=trunc(oh*a/2)*2:min(max(iw/dar\\,ih)\\,{0})", maxHeightParam));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var output = string.Empty;
|
var output = string.Empty;
|
||||||
|
|
||||||
|
@ -1903,9 +1940,9 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
{
|
{
|
||||||
case "avc":
|
case "avc":
|
||||||
case "h264":
|
case "h264":
|
||||||
if (_mediaEncoder.SupportsDecoder("h264_omx") && encodingOptions.HardwareDecodingCodecs.Contains("h264", StringComparer.OrdinalIgnoreCase))
|
if (_mediaEncoder.SupportsDecoder("h264_mmal") && encodingOptions.HardwareDecodingCodecs.Contains("h264", StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "-c:v h264_omx ";
|
return "-c:v h264_mmal";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user