aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-12-17 16:27:36 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-01-07 21:28:41 +0100
commitd2578f81523728f36092859c36b34beb6a4715e1 (patch)
tree06a63c9933c0ada99b8199a3fe3eddd0ea34547d
parent31c52cd442794a6a5450a076dc49a94c57db3e67 (diff)
downloadffmpeg-d2578f81523728f36092859c36b34beb6a4715e1.tar.gz
avcodec/mjpegenc: drop dependancy on sizeof(AVFrame)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 5b3f4b3ef590b1221d44d24345a846c1aa636b69) Conflicts: libavcodec/mjpegenc.c
-rw-r--r--libavcodec/mjpegenc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 74817cadc2..fcac6f11c1 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -498,19 +498,23 @@ static int amv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
{
MpegEncContext *s = avctx->priv_data;
- AVFrame pic = *pic_arg;
- int i;
+ AVFrame *pic;
+ int i, ret;
//CODEC_FLAG_EMU_EDGE have to be cleared
if(s->avctx->flags & CODEC_FLAG_EMU_EDGE)
return -1;
+ pic = av_frame_alloc();
+ av_frame_ref(pic, pic_arg);
//picture should be flipped upside-down
for(i=0; i < 3; i++) {
- pic.data[i] += (pic.linesize[i] * (s->mjpeg_vsample[i] * (8 * s->mb_height -((s->height/V_MAX)&7)) - 1 ));
- pic.linesize[i] *= -1;
+ pic->data[i] += (pic->linesize[i] * (s->mjpeg_vsample[i] * (8 * s->mb_height -((s->height/V_MAX)&7)) - 1 ));
+ pic->linesize[i] *= -1;
}
- return ff_MPV_encode_picture(avctx, pkt, &pic, got_packet);
+ ret = ff_MPV_encode_picture(avctx, pkt, pic, got_packet);
+ av_frame_free(&pic);
+ return ret;
}
#if CONFIG_MJPEG_ENCODER