diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-17 16:27:46 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-17 16:55:50 +0400 |
commit | be1e6e7503b2f10b0176201418eb97912cee093f (patch) | |
tree | 620da8277e8837ccbb93a2a21e14a9b188c95b16 /libavcodec/huffyuvenc.c | |
parent | f4f7888bab7061f08c54356c285adaba24383dc0 (diff) | |
parent | 1c01b0253ebfe05f907c3a723101fe77f6dd2336 (diff) |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
mpegvideo_enc: use the AVFrame API properly.
ffv1: use the AVFrame API properly.
jpegls: use the AVFrame API properly.
huffyuv: use the AVFrame API properly.
Conflicts:
libavcodec/ffv1.c
libavcodec/ffv1.h
libavcodec/ffv1dec.c
libavcodec/ffv1enc.c
Changes to ffv1 are more redone than merged due to them being based on
an ancient codebase and a good part of that having being done already
as well.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/huffyuvenc.c')
-rw-r--r-- | libavcodec/huffyuvenc.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index c56e281014..3a55d543a9 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -156,7 +156,12 @@ static av_cold int encode_init(AVCodecContext *avctx) } s->version = 2; - avctx->coded_frame = &s->picture; + avctx->coded_frame = av_frame_alloc(); + if (!avctx->coded_frame) + return AVERROR(ENOMEM); + + avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; + avctx->coded_frame->key_frame = 1; switch (avctx->pix_fmt) { case AV_PIX_FMT_YUV420P: @@ -446,16 +451,12 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const int fake_ystride = s->interlaced ? pict->linesize[0]*2 : pict->linesize[0]; const int fake_ustride = s->interlaced ? pict->linesize[1]*2 : pict->linesize[1]; const int fake_vstride = s->interlaced ? pict->linesize[2]*2 : pict->linesize[2]; - AVFrame * const p = &s->picture; + const AVFrame * const p = pict; int i, j, size = 0, ret; if ((ret = ff_alloc_packet2(avctx, pkt, width * height * 3 * 4 + FF_MIN_BUFFER_SIZE)) < 0) return ret; - *p = *pict; - p->pict_type = AV_PICTURE_TYPE_I; - p->key_frame = 1; - if (s->context) { for (i = 0; i < 3; i++) { ff_huff_gen_len_table(s->len[i], s->stats[i]); @@ -681,6 +682,8 @@ static av_cold int encode_end(AVCodecContext *avctx) av_freep(&avctx->extradata); av_freep(&avctx->stats_out); + av_frame_free(&avctx->coded_frame); + return 0; } |