diff options
author | Zhong Li <zhong.li@intel.com> | 2018-04-04 12:51:29 +0300 |
---|---|---|
committer | Maxym Dmytrychenko <maxim.d33@gmail.com> | 2018-04-08 21:47:59 +0300 |
commit | 52ed83fa1a7f5170447eff6fad0b6c57119596e9 (patch) | |
tree | 1ac74520d86c718e9585866207b8c2b34144051e /libavcodec/qsv.c | |
parent | b0958698ea2b976063cb1d683becc213040c709b (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/qsv.c')
-rw-r--r-- | libavcodec/qsv.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index e78633d62a..e578ab15f5 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -195,6 +195,30 @@ int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame) return AVERROR_BUG; } +enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type) +{ + enum AVPictureType type; + switch (mfx_pic_type & 0x7) { + case MFX_FRAMETYPE_I: + if (mfx_pic_type & MFX_FRAMETYPE_S) + type = AV_PICTURE_TYPE_SI; + else + type = AV_PICTURE_TYPE_I; + break; + case MFX_FRAMETYPE_B: + type = AV_PICTURE_TYPE_B; + break; + case MFX_FRAMETYPE_P: + if (mfx_pic_type & MFX_FRAMETYPE_S) + type = AV_PICTURE_TYPE_SP; + else + type = AV_PICTURE_TYPE_P; + break; + } + + return type; +} + static int qsv_load_plugins(mfxSession session, const char *load_plugins, void *logctx) { |