summaryrefslogtreecommitdiff
path: root/libavcodec/mss4.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/mss4.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/mss4.c')
-rw-r--r--libavcodec/mss4.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c
index fd1f316bbf..662cf24df5 100644
--- a/libavcodec/mss4.c
+++ b/libavcodec/mss4.c
@@ -626,14 +626,23 @@ static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return buf_size;
}
-static av_cold int mss4_decode_init(AVCodecContext *avctx)
+static av_cold int mss4_decode_end(AVCodecContext *avctx)
{
MSS4Context * const c = avctx->priv_data;
int i;
- c->pic = av_frame_alloc();
- if (!c->pic)
- return AVERROR(ENOMEM);
+ av_frame_free(&c->pic);
+ for (i = 0; i < 3; i++)
+ av_freep(&c->prev_dc[i]);
+ mss4_free_vlcs(c);
+
+ return 0;
+}
+
+static av_cold int mss4_decode_init(AVCodecContext *avctx)
+{
+ MSS4Context * const c = avctx->priv_data;
+ int i;
if (mss4_init_vlcs(c)) {
av_log(avctx, AV_LOG_ERROR, "Cannot initialise VLCs\n");
@@ -650,21 +659,13 @@ static av_cold int mss4_decode_init(AVCodecContext *avctx)
}
}
- avctx->pix_fmt = AV_PIX_FMT_YUV444P;
-
- return 0;
-}
-
-static av_cold int mss4_decode_end(AVCodecContext *avctx)
-{
- MSS4Context * const c = avctx->priv_data;
- int i;
-
- av_frame_free(&c->pic);
+ c->pic = av_frame_alloc();
+ if (!c->pic) {
+ mss4_decode_end(avctx);
+ return AVERROR(ENOMEM);
+ }
- for (i = 0; i < 3; i++)
- av_freep(&c->prev_dc[i]);
- mss4_free_vlcs(c);
+ avctx->pix_fmt = AV_PIX_FMT_YUV444P;
return 0;
}