You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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>
This commit is contained in:
@@ -1192,6 +1192,13 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q,
|
|||||||
if (qsv_frame) {
|
if (qsv_frame) {
|
||||||
surf = &qsv_frame->surface;
|
surf = &qsv_frame->surface;
|
||||||
enc_ctrl = &qsv_frame->enc_ctrl;
|
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);
|
ret = av_new_packet(&new_pkt, q->packet_size);
|
||||||
|
@@ -87,6 +87,7 @@
|
|||||||
{ "adaptive_i", "Adaptive I-frame placement", OFFSET(qsv.adaptive_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
|
{ "adaptive_i", "Adaptive I-frame placement", OFFSET(qsv.adaptive_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
|
||||||
{ "adaptive_b", "Adaptive B-frame placement", OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
|
{ "adaptive_b", "Adaptive B-frame placement", OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
|
||||||
{ "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(qsv.b_strategy), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
|
{ "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(qsv.b_strategy), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
|
||||||
|
{ "forced_idr", "Forcing I frames as IDR frames", OFFSET(qsv.forced_idr), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE }, \
|
||||||
|
|
||||||
typedef int SetEncodeCtrlCB (AVCodecContext *avctx,
|
typedef int SetEncodeCtrlCB (AVCodecContext *avctx,
|
||||||
const AVFrame *frame, mfxEncodeCtrl* enc_ctrl);
|
const AVFrame *frame, mfxEncodeCtrl* enc_ctrl);
|
||||||
@@ -168,6 +169,7 @@ typedef struct QSVEncContext {
|
|||||||
#endif
|
#endif
|
||||||
char *load_plugins;
|
char *load_plugins;
|
||||||
SetEncodeCtrlCB *set_encode_ctrl_cb;
|
SetEncodeCtrlCB *set_encode_ctrl_cb;
|
||||||
|
int forced_idr;
|
||||||
} QSVEncContext;
|
} QSVEncContext;
|
||||||
|
|
||||||
int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q);
|
int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q);
|
||||||
|
Reference in New Issue
Block a user