Add DRM renderer for Rockchip devices

This commit is contained in:
Cameron Gutman
2019-04-21 05:22:37 +00:00
parent 5c8a1e632b
commit dba479774b
4 changed files with 326 additions and 0 deletions

View File

@@ -27,6 +27,10 @@
#include "ffmpeg-renderers/mmal.h"
#endif
#ifdef HAVE_DRM
#include "ffmpeg-renderers/drm.h"
#endif
// This is gross but it allows us to use sizeof()
#include "ffmpeg_videosamples.cpp"
@@ -493,6 +497,24 @@ bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params)
}
}
#endif
#ifdef HAVE_DRM
// RKMPP is a hardware accelerated decoder that outputs DRI PRIME buffers
AVCodec* rkmppDecoder;
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
rkmppDecoder = avcodec_find_decoder_by_name("h264_rkmpp");
}
else {
rkmppDecoder = avcodec_find_decoder_by_name("hevc_rkmpp");
}
if (rkmppDecoder != nullptr &&
tryInitializeRenderer(rkmppDecoder, params, nullptr,
[]() -> IFFmpegRenderer* { return new DrmRenderer(); })) {
return true;
}
#endif
}
// Fallback to software if no matching hardware decoder was found