summaryrefslogtreecommitdiff
path: root/libavcodec/mss1.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-17 02:43:57 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-17 02:48:17 +0100
commit8d193a24f2da825aaf5382e4aa42ab533806b033 (patch)
tree179ac9e6e4fc57d0e11855418d30309ce408a1ff /libavcodec/mss1.c
parent72df87088c8a6593d66b207140edd32b4d2fb6ee (diff)
parent730bac7bab3c7dcd9fcb7c70f154e5f4cfaef9a7 (diff)
Merge commit '730bac7bab3c7dcd9fcb7c70f154e5f4cfaef9a7'
* commit '730bac7bab3c7dcd9fcb7c70f154e5f4cfaef9a7': mss4: use the AVFrame API properly. mss3: use the AVFrame API properly. mss2: use the AVFrame API properly. mss1: use the AVFrame API properly. Conflicts: libavcodec/mss1.c libavcodec/mss2.c libavcodec/mss3.c libavcodec/mss4.c See: 02fe531afefa7ac3fcc552f8e83461a4bfa7f868 See: ff1c13b133d548b3ce103f91999b6cc1bb7e65cc See: 310bf283542ff81a9ec8fa7492fe7d625e80562f Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mss1.c')
-rw-r--r--libavcodec/mss1.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/libavcodec/mss1.c b/libavcodec/mss1.c
index 3e24d79e4c..fc88eb0fd9 100644
--- a/libavcodec/mss1.c
+++ b/libavcodec/mss1.c
@@ -30,7 +30,7 @@
typedef struct MSS1Context {
MSS12Context ctx;
- AVFrame pic;
+ AVFrame *pic;
SliceContext sc;
} MSS1Context;
@@ -151,32 +151,32 @@ static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
arith_init(&acoder, &gb);
- if ((ret = ff_reget_buffer(avctx, &ctx->pic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, ctx->pic)) < 0)
return ret;
- c->pal_pic = ctx->pic.data[0] + ctx->pic.linesize[0] * (avctx->height - 1);
- c->pal_stride = -ctx->pic.linesize[0];
+ c->pal_pic = ctx->pic->data[0] + ctx->pic->linesize[0] * (avctx->height - 1);
+ c->pal_stride = -ctx->pic->linesize[0];
c->keyframe = !arith_get_bit(&acoder);
if (c->keyframe) {
c->corrupted = 0;
ff_mss12_slicecontext_reset(&ctx->sc);
pal_changed = decode_pal(c, &acoder);
- ctx->pic.key_frame = 1;
- ctx->pic.pict_type = AV_PICTURE_TYPE_I;
+ ctx->pic->key_frame = 1;
+ ctx->pic->pict_type = AV_PICTURE_TYPE_I;
} else {
if (c->corrupted)
return AVERROR_INVALIDDATA;
- ctx->pic.key_frame = 0;
- ctx->pic.pict_type = AV_PICTURE_TYPE_P;
+ ctx->pic->key_frame = 0;
+ ctx->pic->pict_type = AV_PICTURE_TYPE_P;
}
c->corrupted = ff_mss12_decode_rect(&ctx->sc, &acoder, 0, 0,
avctx->width, avctx->height);
if (c->corrupted)
return AVERROR_INVALIDDATA;
- memcpy(ctx->pic.data[1], c->pal, AVPALETTE_SIZE);
- ctx->pic.palette_has_changed = pal_changed;
+ memcpy(ctx->pic->data[1], c->pal, AVPALETTE_SIZE);
+ ctx->pic->palette_has_changed = pal_changed;
- if ((ret = av_frame_ref(data, &ctx->pic)) < 0)
+ if ((ret = av_frame_ref(data, ctx->pic)) < 0)
return ret;
*got_frame = 1;
@@ -192,7 +192,9 @@ static av_cold int mss1_decode_init(AVCodecContext *avctx)
c->ctx.avctx = avctx;
- avcodec_get_frame_defaults(&c->pic);
+ c->pic = av_frame_alloc();
+ if (!c->pic)
+ return AVERROR(ENOMEM);
ret = ff_mss12_decode_init(&c->ctx, 0, &c->sc, NULL);
@@ -205,7 +207,7 @@ static av_cold int mss1_decode_end(AVCodecContext *avctx)
{
MSS1Context * const ctx = avctx->priv_data;
- av_frame_unref(&ctx->pic);
+ av_frame_free(&ctx->pic);
ff_mss12_decode_end(&ctx->ctx);
return 0;