# HG changeset patch # User bcoudurier # Date 1227552590 0 # Node ID 65e05fda52803ae5c6f8e93511965fd0f780e333 # Parent 1fbeeeec901d23922423c9846081c77883dc91b0 move decoder initialization in separate function, earlier failure detection diff -r 1fbeeeec901d -r 65e05fda5280 svq3.c --- a/svq3.c Mon Nov 24 16:33:11 2008 +0000 +++ b/svq3.c Mon Nov 24 18:49:50 2008 +0000 @@ -774,16 +774,17 @@ return 0; } -static int svq3_decode_frame(AVCodecContext *avctx, - void *data, int *data_size, - const uint8_t *buf, int buf_size) +static int svq3_decode_init(AVCodecContext *avctx) { MpegEncContext *const s = avctx->priv_data; H264Context *const h = avctx->priv_data; - int m, mb_type; + int m; unsigned char *extradata; unsigned int size; + if (decode_init(avctx) < 0) + return -1; + s->flags = avctx->flags; s->flags2 = avctx->flags2; s->unrestricted_mv = 1; @@ -880,6 +881,17 @@ } } + return 0; +} + +static int svq3_decode_frame(AVCodecContext *avctx, + void *data, int *data_size, + const uint8_t *buf, int buf_size) +{ + MpegEncContext *const s = avctx->priv_data; + H264Context *const h = avctx->priv_data; + int m, mb_type; + /* special case for last picture */ if (buf_size == 0) { if (s->next_picture_ptr && !s->low_delay) { @@ -1030,7 +1042,7 @@ CODEC_TYPE_VIDEO, CODEC_ID_SVQ3, sizeof(H264Context), - decode_init, + svq3_decode_init, NULL, decode_end, svq3_decode_frame,