Merge branch 'CR_2089_FFMPEG_omx_Arvin.Zhu' into 'jh7110-mm-devel'

CR 2089 ffmpeg omx: support to set gop of hevc

See merge request sdk/buildroot!66
This commit is contained in:
andy.hu
2022-09-09 06:35:20 +00:00
committed by Andy Hu
@@ -0,0 +1,47 @@
From 5df6206e87edb644a18669c72411aa31e44be1d1 Mon Sep 17 00:00:00 2001
From: "arvin.zhu" <arvin.zhu@starfivetech.com>
Date: Thu, 8 Sep 2022 10:30:00 +0800
Subject: [PATCH] omx: support to change gop of hevc
support to change gop of hevc
Signed-off-by: arvin.zhu <arvin.zhu@starfivetech.com>
---
libavcodec/omx.c | 11 +++++++++++
1 file changed, 11 insertions(+)
mode change 100644 => 100755 libavcodec/omx.c
diff --git a/libavcodec/omx.c b/libavcodec/omx.c
old mode 100644
new mode 100755
index 84b0835..1040094
--- a/libavcodec/omx.c
+++ b/libavcodec/omx.c
@@ -28,6 +28,7 @@
#include <dlfcn.h>
#include <OMX_Core.h>
#include <OMX_Component.h>
+#include <OMX_IndexExt.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
@@ -545,6 +546,16 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role)
}
err = OMX_SetParameter(s->handle, OMX_IndexParamVideoAvc, &avc);
CHECK(err);
+ } else if (avctx->codec->id == AV_CODEC_ID_HEVC) {
+ OMX_VIDEO_PARAM_AVCTYPE hevc = { 0 };
+ INIT_STRUCT(hevc);
+ hevc.nPortIndex = s->out_port;
+ err = OMX_GetParameter(s->handle, OMX_IndexParamVideoHevc, &hevc);
+ CHECK(err);
+ hevc.nBFrames = 0;
+ hevc.nPFrames = avctx->gop_size;
+ err = OMX_SetParameter(s->handle, OMX_IndexParamVideoHevc, &hevc);
+ CHECK(err);
}
err = OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateIdle, NULL);
--
2.17.1