aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/qsvenc.c
diff options
context:
space:
mode:
authorZhong Li <zhong.li@intel.com>2018-11-29 16:29:00 +0800
committerZhong Li <zhong.li@intel.com>2018-11-30 17:53:00 +0800
commitac0bcd6b619479d56612b3938e8f00f5b88c0f10 (patch)
tree9b467d798c33434314846134d20bfacacb4d3478 /libavcodec/qsvenc.c
parent518b963d2c99ad03570b3224f76a1224c62e66e9 (diff)
downloadffmpeg-ac0bcd6b619479d56612b3938e8f00f5b88c0f10.tar.gz
lavc/qsvenc: add forced_idr option
This option can be used to repect original input I/IDR frame type. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Zhong Li <zhong.li@intel.com>
Diffstat (limited to 'libavcodec/qsvenc.c')
-rw-r--r--libavcodec/qsvenc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 948751daf4..3946c1d837 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1192,6 +1192,13 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q,
if (qsv_frame) {
surf = &qsv_frame->surface;
enc_ctrl = &qsv_frame->enc_ctrl;
+ memset(enc_ctrl, 0, sizeof(mfxEncodeCtrl));
+
+ if (frame->pict_type == AV_PICTURE_TYPE_I) {
+ enc_ctrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF;
+ if (q->forced_idr)
+ enc_ctrl->FrameType |= MFX_FRAMETYPE_IDR;
+ }
}
ret = av_new_packet(&new_pkt, q->packet_size);