Merge pull request #7404 from nyanmisaka/omx

This commit is contained in:
Joshua M. Boniface 2022-03-05 14:35:41 -05:00 committed by GitHub
commit 947ff9defe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 79 deletions

View File

@ -458,9 +458,12 @@ namespace Jellyfin.Api.Helpers
var audioCodec = state.ActualOutputAudioCodec;
var videoCodec = state.ActualOutputVideoCodec;
var hardwareAccelerationTypeString = _serverConfigurationManager.GetEncodingOptions().HardwareAccelerationType;
HardwareEncodingType? hardwareAccelerationType = string.IsNullOrEmpty(hardwareAccelerationTypeString)
? null
: (HardwareEncodingType)Enum.Parse(typeof(HardwareEncodingType), hardwareAccelerationTypeString, true);
HardwareEncodingType? hardwareAccelerationType = null;
if (!string.IsNullOrEmpty(hardwareAccelerationTypeString)
&& Enum.TryParse<HardwareEncodingType>(hardwareAccelerationTypeString, out var parsedHardwareAccelerationType))
{
hardwareAccelerationType = parsedHardwareAccelerationType;
}
_sessionManager.ReportTranscodingInfo(deviceId, new TranscodingInfo
{

View File

@ -84,7 +84,6 @@ namespace MediaBrowser.Controller.MediaEncoding
{ "vaapi", hwEncoder + "_vaapi" },
{ "videotoolbox", hwEncoder + "_videotoolbox" },
{ "v4l2m2m", hwEncoder + "_v4l2m2m" },
{ "omx", hwEncoder + "_omx" },
};
if (!string.IsNullOrEmpty(hwType)
@ -1593,10 +1592,8 @@ namespace MediaBrowser.Controller.MediaEncoding
if (!string.IsNullOrEmpty(profile))
{
if (!string.Equals(videoEncoder, "h264_omx", StringComparison.OrdinalIgnoreCase)
&& !string.Equals(videoEncoder, "h264_v4l2m2m", StringComparison.OrdinalIgnoreCase))
if (!string.Equals(videoEncoder, "h264_v4l2m2m", StringComparison.OrdinalIgnoreCase))
{
// not supported by h264_omx
param += " -profile:v:0 " + profile;
}
}
@ -1635,8 +1632,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// NVENC cannot adjust the given level, just throw an error.
// level option may cause corrupted frames on AMD VAAPI.
}
else if (!string.Equals(videoEncoder, "h264_omx", StringComparison.OrdinalIgnoreCase)
|| !string.Equals(videoEncoder, "libx265", StringComparison.OrdinalIgnoreCase))
else if (!string.Equals(videoEncoder, "libx265", StringComparison.OrdinalIgnoreCase))
{
param += " -level " + level;
}
@ -4296,11 +4292,6 @@ namespace MediaBrowser.Controller.MediaEncoding
{
return GetVideotoolboxVidDecoder(state, options, videoStream, bitDepth);
}
if (string.Equals(options.HardwareAccelerationType, "omx", StringComparison.OrdinalIgnoreCase))
{
return GetOmxVidDecoder(state, options, videoStream, bitDepth);
}
}
var whichCodec = videoStream.Codec;
@ -4776,43 +4767,6 @@ namespace MediaBrowser.Controller.MediaEncoding
return null;
}
public string GetOmxVidDecoder(EncodingJobInfo state, EncodingOptions options, MediaStream videoStream, int bitDepth)
{
if (!OperatingSystem.IsLinux()
|| !string.Equals(options.HardwareAccelerationType, "omx", StringComparison.OrdinalIgnoreCase))
{
return null;
}
var is8bitSwFormatsOmx = string.Equals("yuv420p", videoStream.PixelFormat, StringComparison.OrdinalIgnoreCase);
if (is8bitSwFormatsOmx)
{
if (string.Equals("avc", videoStream.Codec, StringComparison.OrdinalIgnoreCase)
|| string.Equals("h264", videoStream.Codec, StringComparison.OrdinalIgnoreCase))
{
return GetHwDecoderName(options, "h264", "mmal", "h264", bitDepth);
}
if (string.Equals("mpeg2video", videoStream.Codec, StringComparison.OrdinalIgnoreCase))
{
return GetHwDecoderName(options, "mpeg2", "mmal", "mpeg2video", bitDepth);
}
if (string.Equals("mpeg4", videoStream.Codec, StringComparison.OrdinalIgnoreCase))
{
return GetHwDecoderName(options, "mpeg4", "mmal", "mpeg4", bitDepth);
}
if (string.Equals("vc1", videoStream.Codec, StringComparison.OrdinalIgnoreCase))
{
return GetHwDecoderName(options, "vc1", "mmal", "vc1", bitDepth);
}
}
return null;
}
/// <summary>
/// Gets the number of threads.
/// </summary>

View File

@ -44,18 +44,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
"mpeg4_cuvid",
"vp8_cuvid",
"vp9_cuvid",
"av1_cuvid",
"h264_mmal",
"mpeg2_mmal",
"mpeg4_mmal",
"vc1_mmal",
"h264_opencl",
"hevc_opencl",
"mpeg2_opencl",
"mpeg4_opencl",
"vp8_opencl",
"vp9_opencl",
"vc1_opencl"
"av1_cuvid"
};
private static readonly string[] _requiredEncoders = new[]
@ -82,8 +71,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
"hevc_nvenc",
"h264_vaapi",
"hevc_vaapi",
"h264_omx",
"hevc_omx",
"h264_v4l2m2m",
"h264_videotoolbox",
"hevc_videotoolbox"

View File

@ -21,28 +21,18 @@
NVENC = 2,
/// <summary>
/// OpenMax OMX.
/// Video4Linux2 V4L2.
/// </summary>
OMX = 3,
/// <summary>
/// Exynos V4L2 MFC.
/// </summary>
V4L2M2M = 4,
/// <summary>
/// MediaCodec Android.
/// </summary>
MediaCodec = 5,
V4L2M2M = 3,
/// <summary>
/// Video Acceleration API (VAAPI).
/// </summary>
VAAPI = 6,
VAAPI = 4,
/// <summary>
/// Video ToolBox.
/// </summary>
VideoToolBox = 7
VideoToolBox = 5
}
}