From ed3a5448b141c817747410313ee80ff7de783e8d Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 29 Jan 2021 20:19:27 -0600 Subject: [PATCH] Add logic to try LibreELEC's out-of-tree stateless V4L2 decoders --- app/streaming/video/ffmpeg.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/streaming/video/ffmpeg.cpp b/app/streaming/video/ffmpeg.cpp index 6b5716cd..b276841b 100644 --- a/app/streaming/video/ffmpeg.cpp +++ b/app/streaming/video/ffmpeg.cpp @@ -713,6 +713,25 @@ bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params) return true; } } + + { + // v4l2request is an out-of-tree hardware accelerated decoder that outputs DRI PRIME buffers + // https://github.com/LibreELEC/LibreELEC.tv/tree/master/packages/multimedia/ffmpeg/patches/v4l2-request + AVCodec* v4l2requestDecoder; + + if (params->videoFormat & VIDEO_FORMAT_MASK_H264) { + v4l2requestDecoder = avcodec_find_decoder_by_name("h264_v4l2request"); + } + else { + v4l2requestDecoder = avcodec_find_decoder_by_name("hevc_v4l2request"); + } + + if (v4l2requestDecoder != nullptr && + tryInitializeRenderer(v4l2requestDecoder, params, nullptr, + []() -> IFFmpegRenderer* { return new DrmRenderer(); })) { + return true; + } + } #endif #ifdef Q_OS_LINUX