summaryrefslogtreecommitdiff
path: root/libavcodec/qsvdec.c
diff options
context:
space:
mode:
authorZhong Li <zhong.li@intel.com>2018-04-04 17:51:29 +0800
committerMaxym Dmytrychenko <maxim.d33@gmail.com>2018-04-08 20:47:59 +0200
commit52ed83fa1a7f5170447eff6fad0b6c57119596e9 (patch)
tree1ac74520d86c718e9585866207b8c2b34144051e /libavcodec/qsvdec.c
parentb0958698ea2b976063cb1d683becc213040c709b (diff)
lavc/qsvdec: expose frame pic_type and key_frame
Currently pict_type and key_frame are unset. Add an extra param to fetch the picture type from qsv decoder The judgement “key frame is equal to IDR frame” only suitable for H264. For HEVC, all IRAP frames are key frames, and other codecs have no IDR frame. Signed-off-by: ChaoX A Liu <chaox.a.liu@intel.com> Signed-off-by: Zhong Li <zhong.li@intel.com> Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
Diffstat (limited to 'libavcodec/qsvdec.c')
-rw-r--r--libavcodec/qsvdec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index f31172de29..c1b6238cfb 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -232,6 +232,11 @@ static int alloc_frame(AVCodecContext *avctx, QSVContext *q, QSVFrame *frame)
frame->surface.Data.MemId = &q->frames_ctx.mids[ret];
}
+ frame->surface.Data.ExtParam = &frame->ext_param;
+ frame->surface.Data.NumExtParam = 1;
+ frame->ext_param = (mfxExtBuffer*)&frame->dec_info;
+ frame->dec_info.Header.BufferId = MFX_EXTBUFF_DECODED_FRAME_INFO;
+ frame->dec_info.Header.BufferSz = sizeof(frame->dec_info);
frame->used = 1;
@@ -416,6 +421,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
outsurf->Info.PicStruct & MFX_PICSTRUCT_FIELD_TFF;
frame->interlaced_frame =
!(outsurf->Info.PicStruct & MFX_PICSTRUCT_PROGRESSIVE);
+ frame->pict_type = ff_qsv_map_pictype(out_frame->dec_info.FrameType);
+ //Key frame is IDR frame is only suitable for H264. For HEVC, IRAPs are key frames.
+ if (avctx->codec_id == AV_CODEC_ID_H264)
+ frame->key_frame = !!(out_frame->dec_info.FrameType & MFX_FRAMETYPE_IDR);
/* update the surface properties */
if (avctx->pix_fmt == AV_PIX_FMT_QSV)