summaryrefslogtreecommitdiffstats
path: root/libavcodec/mmvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-17 01:48:57 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-17 01:55:38 +0100
commitfe3808eddee81ce4712d1e729fa6fe619f1685c8 (patch)
treecedf1b912ffed79311b5beb8b8d9f4196fa261b6 /libavcodec/mmvideo.c
parent9f890a165666a73376c73b3c2bd920345b5c3b79 (diff)
parenta837c4f2df96a30bf9aa4115b426d608487c7101 (diff)
downloadffmpeg-streaming-fe3808eddee81ce4712d1e729fa6fe619f1685c8.zip
ffmpeg-streaming-fe3808eddee81ce4712d1e729fa6fe619f1685c8.tar.gz
Merge commit 'a837c4f2df96a30bf9aa4115b426d608487c7101'
* commit 'a837c4f2df96a30bf9aa4115b426d608487c7101': zmbvenc: use the AVFrame API properly. flicvideo: use the AVFrame API properly. smacker: use the AVFrame API properly. mmvideo: use the AVFrame API properly. Conflicts: libavcodec/flicvideo.c libavcodec/mmvideo.c libavcodec/smacker.c libavcodec/zmbvenc.c See: 76e27b1d0594199b4b1ff8520312069f42373944 See: 099e57bc38d7e53cf6823dfec349ff9fdaee99ba Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mmvideo.c')
-rw-r--r--libavcodec/mmvideo.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
index ea182a0..ab59b58 100644
--- a/libavcodec/mmvideo.c
+++ b/libavcodec/mmvideo.c
@@ -48,7 +48,7 @@
typedef struct MmContext {
AVCodecContext *avctx;
- AVFrame frame;
+ AVFrame *frame;
int palette[AVPALETTE_COUNT];
GetByteContext gb;
} MmContext;
@@ -61,7 +61,9 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_PAL8;
- avcodec_get_frame_defaults(&s->frame);
+ s->frame = av_frame_alloc();
+ if (!s->frame)
+ return AVERROR(ENOMEM);
return 0;
}
@@ -108,9 +110,9 @@ static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert)
return AVERROR_INVALIDDATA;
if (color) {
- memset(s->frame.data[0] + y*s->frame.linesize[0] + x, color, run_length);
+ memset(s->frame->data[0] + y*s->frame->linesize[0] + x, color, run_length);
if (half_vert)
- memset(s->frame.data[0] + (y+1)*s->frame.linesize[0] + x, color, run_length);
+ memset(s->frame->data[0] + (y+1)*s->frame->linesize[0] + x, color, run_length);
}
x+= run_length;
@@ -159,13 +161,13 @@ static int mm_decode_inter(MmContext * s, int half_horiz, int half_vert)
return AVERROR_INVALIDDATA;
if (replace) {
int color = bytestream2_get_byte(&data_ptr);
- s->frame.data[0][y*s->frame.linesize[0] + x] = color;
+ s->frame->data[0][y*s->frame->linesize[0] + x] = color;
if (half_horiz)
- s->frame.data[0][y*s->frame.linesize[0] + x + 1] = color;
+ s->frame->data[0][y*s->frame->linesize[0] + x + 1] = color;
if (half_vert) {
- s->frame.data[0][(y+1)*s->frame.linesize[0] + x] = color;
+ s->frame->data[0][(y+1)*s->frame->linesize[0] + x] = color;
if (half_horiz)
- s->frame.data[0][(y+1)*s->frame.linesize[0] + x + 1] = color;
+ s->frame->data[0][(y+1)*s->frame->linesize[0] + x + 1] = color;
}
}
x += 1 + half_horiz;
@@ -194,7 +196,7 @@ static int mm_decode_frame(AVCodecContext *avctx,
buf_size -= MM_PREAMBLE_SIZE;
bytestream2_init(&s->gb, buf, buf_size);
- if ((res = ff_reget_buffer(avctx, &s->frame)) < 0)
+ if ((res = ff_reget_buffer(avctx, s->frame)) < 0)
return res;
switch(type) {
@@ -212,9 +214,9 @@ static int mm_decode_frame(AVCodecContext *avctx,
if (res < 0)
return res;
- memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
+ memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE);
- if ((res = av_frame_ref(data, &s->frame)) < 0)
+ if ((res = av_frame_ref(data, s->frame)) < 0)
return res;
*got_frame = 1;
@@ -226,7 +228,7 @@ static av_cold int mm_decode_end(AVCodecContext *avctx)
{
MmContext *s = avctx->priv_data;
- av_frame_unref(&s->frame);
+ av_frame_free(&s->frame);
return 0;
}
OpenPOWER on IntegriCloud