summaryrefslogtreecommitdiff
path: root/libavcodec/libx264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-17 12:17:05 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-17 12:19:55 +0100
commit5b0c70c2499e20529d517b712910d6f4f72e9485 (patch)
tree620207093db182a6b54129a2a166b2f721685378 /libavcodec/libx264.c
parent3ea168edeb7a20eae1fccf7da66ac7b8c8c791ba (diff)
parent57e7b3a89f5a0879ad039e8f04273b48649799a8 (diff)
downloadffmpeg-5b0c70c2499e20529d517b712910d6f4f72e9485.tar.gz
Merge commit '57e7b3a89f5a0879ad039e8f04273b48649799a8'
* commit '57e7b3a89f5a0879ad039e8f04273b48649799a8': dnxhdenc: use the AVFrame API properly. libx264: use the AVFrame API properly. svq1enc: use the AVFrame API properly. gif: use the AVFrame API properly. Conflicts: libavcodec/gif.c libavcodec/svq1enc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r--libavcodec/libx264.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4093510c66..89df55fac6 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -44,7 +44,6 @@ typedef struct X264Context {
x264_picture_t pic;
uint8_t *sei;
int sei_size;
- AVFrame out_pic;
char *preset;
char *tune;
char *profile;
@@ -208,20 +207,20 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
switch (pic_out.i_type) {
case X264_TYPE_IDR:
case X264_TYPE_I:
- x4->out_pic.pict_type = AV_PICTURE_TYPE_I;
+ ctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
break;
case X264_TYPE_P:
- x4->out_pic.pict_type = AV_PICTURE_TYPE_P;
+ ctx->coded_frame->pict_type = AV_PICTURE_TYPE_P;
break;
case X264_TYPE_B:
case X264_TYPE_BREF:
- x4->out_pic.pict_type = AV_PICTURE_TYPE_B;
+ ctx->coded_frame->pict_type = AV_PICTURE_TYPE_B;
break;
}
pkt->flags |= AV_PKT_FLAG_KEY*pic_out.b_keyframe;
if (ret)
- x4->out_pic.quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA;
+ ctx->coded_frame->quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA;
*got_packet = ret;
return 0;
@@ -237,6 +236,8 @@ static av_cold int X264_close(AVCodecContext *avctx)
if (x4->enc)
x264_encoder_close(x4->enc);
+ av_frame_free(&avctx->coded_frame);
+
return 0;
}
@@ -570,7 +571,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
if (!x4->enc)
return -1;
- avctx->coded_frame = &x4->out_pic;
+ avctx->coded_frame = av_frame_alloc();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
x264_nal_t *nal;