summaryrefslogtreecommitdiff
path: root/libavcodec/svq3.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2008-11-24 18:49:50 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2008-11-24 18:49:50 +0000
commitf4cca718cf7ae781052c0853769da9c88ff8cc0d (patch)
treef0496012db83da783f888ebb853c6bb953bf3d48 /libavcodec/svq3.c
parentf2e92ad1054d500b19af960010c615ec3c6bbfc6 (diff)
move decoder initialization in separate function, earlier failure detection
Originally committed as revision 15929 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/svq3.c')
-rw-r--r--libavcodec/svq3.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index a2f533c01f..499d11d6bf 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -774,16 +774,17 @@ static int svq3_decode_slice_header(H264Context *h)
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 @@ static int svq3_decode_frame(AVCodecContext *avctx,
}
}
+ 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 @@ AVCodec svq3_decoder = {
CODEC_TYPE_VIDEO,
CODEC_ID_SVQ3,
sizeof(H264Context),
- decode_init,
+ svq3_decode_init,
NULL,
decode_end,
svq3_decode_frame,