From fb39ad896e003ce9c5119c252cbb2fec3786f4da Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 2 Apr 2023 17:17:25 -0500 Subject: [PATCH] Add h264_omx and hevc_omx decoders used by the Vision Five 2 --- app/streaming/video/ffmpeg-renderers/drm.cpp | 8 ++++++++ app/streaming/video/ffmpeg.cpp | 2 ++ 2 files changed, 10 insertions(+) diff --git a/app/streaming/video/ffmpeg-renderers/drm.cpp b/app/streaming/video/ffmpeg-renderers/drm.cpp index 57e751a3..a12fa892 100644 --- a/app/streaming/video/ffmpeg-renderers/drm.cpp +++ b/app/streaming/video/ffmpeg-renderers/drm.cpp @@ -135,6 +135,14 @@ bool DrmRenderer::prepareDecoderContext(AVCodecContext* context, AVDictionary** // buffers that we get back. We only support NV12 buffers now. av_dict_set_int(options, "pixel_format", AV_PIX_FMT_NV12, 0); + // This option controls the pixel format for the h264_omx and hevc_omx decoders + // used by the JH7110 multimedia stack. This decoder gives us software frames, + // so we need a format supported by our DRM dumb buffer code (NV12/NV21/P010). + // + // https://doc-en.rvspace.org/VisionFive2/DG_Multimedia/JH7110_SDK/h264_omx.html + // https://doc-en.rvspace.org/VisionFive2/DG_Multimedia/JH7110_SDK/hevc_omx.html + av_dict_set(options, "omx_pix_fmt", "nv12", 0); + if (m_HwAccelBackend) { context->hw_device_ctx = av_buffer_ref(m_HwContext); } diff --git a/app/streaming/video/ffmpeg.cpp b/app/streaming/video/ffmpeg.cpp index 443095f7..88371bc0 100644 --- a/app/streaming/video/ffmpeg.cpp +++ b/app/streaming/video/ffmpeg.cpp @@ -56,11 +56,13 @@ static const struct { {"h264_nvv4l2", 0}, {"h264_nvmpi", 0}, {"h264_v4l2m2m", 0}, + {"h264_omx", 0}, {"hevc_rkmpp", 0}, {"hevc_nvv4l2", CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC}, {"hevc_nvmpi", 0}, {"hevc_v4l2m2m", 0}, + {"hevc_omx", 0}, }; bool FFmpegVideoDecoder::isHardwareAccelerated()