fix outputSize

pull/3442/head
nyanmisaka 5 years ago
parent c23d991c95
commit 54349fc945

@ -1639,35 +1639,45 @@ namespace MediaBrowser.Controller.MediaEncoding
var outputSizeParam = ReadOnlySpan<char>.Empty; var outputSizeParam = ReadOnlySpan<char>.Empty;
var request = state.BaseRequest; var request = state.BaseRequest;
// Add resolution params, if specified outputSizeParam = GetOutputSizeParam(state, options, outputVideoCodec).TrimEnd('"');
if (request.Width.HasValue
|| request.Height.HasValue // All possible beginning of video filters
|| request.MaxHeight.HasValue // Don't break the order
|| request.MaxWidth.HasValue) string[] beginOfOutputSizeParam = new[]
{ {
outputSizeParam = GetOutputSizeParam(state, options, outputVideoCodec).TrimEnd('"'); // for tonemap_opencl
"hwupload,tonemap_opencl",
// All possible beginning of video filters
// Don't break the order // hwupload=extra_hw_frames=64,vpp_qsv (for overlay_qsv on linux)
string[] beginOfParam = new[] "hwupload=extra_hw_frames",
{
"hwupload,tonemap_opencl", // vpp_qsv
"hwupload=extra_hw_frames", "vpp",
"vpp",
"hwdownload", // hwdownload,format=p010le (hardware decode + software encode for vaapi)
"format", "hwdownload",
"yadif",
"scale" // format=nv12|vaapi,hwupload,scale_vaapi
}; "format",
// bwdif,scale=expr
"bwdif",
for (int i = 0, index = -1; i < beginOfParam.Length; i++) // yadif,scale=expr
"yadif",
// scale=expr
"scale"
};
var index = -1;
foreach (var param in beginOfOutputSizeParam)
{
index = outputSizeParam.IndexOf(param, StringComparison.OrdinalIgnoreCase);
if (index != -1)
{ {
index = outputSizeParam.IndexOf(beginOfParam[i], StringComparison.OrdinalIgnoreCase); outputSizeParam = outputSizeParam.Slice(index);
if (index != -1) break;
{
outputSizeParam = outputSizeParam.Slice(index);
break;
}
} }
} }

Loading…
Cancel
Save