Commit 975257ff authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/libx264: Export choosen pict_type

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent caba19a5
......@@ -253,6 +253,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
x264_nal_t *nal;
int nnal, i, ret;
x264_picture_t pic_out = {0};
int pict_type;
x264_picture_init( &x4->pic );
x4->pic.img.i_csp = x4->params.i_csp;
......@@ -287,27 +288,31 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
pkt->pts = pic_out.i_pts;
pkt->dts = pic_out.i_dts;
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
switch (pic_out.i_type) {
case X264_TYPE_IDR:
case X264_TYPE_I:
ctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
pict_type = AV_PICTURE_TYPE_I;
break;
case X264_TYPE_P:
ctx->coded_frame->pict_type = AV_PICTURE_TYPE_P;
pict_type = AV_PICTURE_TYPE_P;
break;
case X264_TYPE_B:
case X264_TYPE_BREF:
ctx->coded_frame->pict_type = AV_PICTURE_TYPE_B;
pict_type = AV_PICTURE_TYPE_B;
break;
default:
pict_type = AV_PICTURE_TYPE_NONE;
}
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
ctx->coded_frame->pict_type = pict_type;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
pkt->flags |= AV_PKT_FLAG_KEY*pic_out.b_keyframe;
if (ret) {
ff_side_data_set_encoder_stats(pkt, (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA, NULL, 0, 0);
ff_side_data_set_encoder_stats(pkt, (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA, NULL, 0, pict_type);
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment