aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/smc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-17 02:33:49 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-17 02:35:23 +0100
commit72df87088c8a6593d66b207140edd32b4d2fb6ee (patch)
tree627f4074de47307e4d22564f82ee85f614a44e09 /libavcodec/smc.c
parent4362f272c0ae280cde833589e5c9c6696bd878d5 (diff)
parent508b37557bf36eae83c18e64d42f27b44a321d81 (diff)
downloadffmpeg-72df87088c8a6593d66b207140edd32b4d2fb6ee.tar.gz
Merge commit '508b37557bf36eae83c18e64d42f27b44a321d81'
* commit '508b37557bf36eae83c18e64d42f27b44a321d81': tiertexseqv: use the AVFrame API properly. smc: use the AVFrame API properly. truemotion2: use the AVFrame API properly. truemotion1: use the AVFrame API properly. Conflicts: libavcodec/smc.c libavcodec/tiertexseqv.c libavcodec/truemotion1.c libavcodec/truemotion2.c See: e999f2339ab0200039ee7123b75d79a52aaac5d1 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/smc.c')
-rw-r--r--libavcodec/smc.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/libavcodec/smc.c b/libavcodec/smc.c
index 3b836e7c7a..31e6c885bf 100644
--- a/libavcodec/smc.c
+++ b/libavcodec/smc.c
@@ -46,7 +46,7 @@
typedef struct SmcContext {
AVCodecContext *avctx;
- AVFrame frame;
+ AVFrame *frame;
GetByteContext gb;
@@ -81,7 +81,7 @@ static void smc_decode_stream(SmcContext *s)
{
int width = s->avctx->width;
int height = s->avctx->height;
- int stride = s->frame.linesize[0];
+ int stride = s->frame->linesize[0];
int i;
int chunk_size;
int buf_size = bytestream2_size(&s->gb);
@@ -92,9 +92,9 @@ static void smc_decode_stream(SmcContext *s)
unsigned int color_flags_b;
unsigned int flag_mask;
- unsigned char *pixels = s->frame.data[0];
+ unsigned char *pixels = s->frame->data[0];
- int image_size = height * s->frame.linesize[0];
+ int image_size = height * s->frame->linesize[0];
int row_ptr = 0;
int pixel_ptr = 0;
int pixel_x, pixel_y;
@@ -112,7 +112,7 @@ static void smc_decode_stream(SmcContext *s)
int color_octet_index = 0;
/* make the palette available */
- memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
+ memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);
bytestream2_skip(&s->gb, 1);
chunk_size = bytestream2_get_be24(&s->gb);
@@ -417,7 +417,9 @@ static av_cold int smc_decode_init(AVCodecContext *avctx)
s->avctx = 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;
}
@@ -434,18 +436,18 @@ static int smc_decode_frame(AVCodecContext *avctx,
bytestream2_init(&s->gb, buf, buf_size);
- if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
return ret;
if (pal) {
- s->frame.palette_has_changed = 1;
+ s->frame->palette_has_changed = 1;
memcpy(s->pal, pal, AVPALETTE_SIZE);
}
smc_decode_stream(s);
*got_frame = 1;
- if ((ret = av_frame_ref(data, &s->frame)) < 0)
+ if ((ret = av_frame_ref(data, s->frame)) < 0)
return ret;
/* always report that the buffer was completely consumed */
@@ -456,7 +458,7 @@ static av_cold int smc_decode_end(AVCodecContext *avctx)
{
SmcContext *s = avctx->priv_data;
- av_frame_unref(&s->frame);
+ av_frame_free(&s->frame);
return 0;
}