Commit 62c8001e authored by bcoudurier's avatar bcoudurier

move decoder initialization in separate function, earlier failure detection

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@15929 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 3ae65438
...@@ -774,16 +774,17 @@ static int svq3_decode_slice_header(H264Context *h) ...@@ -774,16 +774,17 @@ static int svq3_decode_slice_header(H264Context *h)
return 0; return 0;
} }
static int svq3_decode_frame(AVCodecContext *avctx, static int svq3_decode_init(AVCodecContext *avctx)
void *data, int *data_size,
const uint8_t *buf, int buf_size)
{ {
MpegEncContext *const s = avctx->priv_data; MpegEncContext *const s = avctx->priv_data;
H264Context *const h = avctx->priv_data; H264Context *const h = avctx->priv_data;
int m, mb_type; int m;
unsigned char *extradata; unsigned char *extradata;
unsigned int size; unsigned int size;
if (decode_init(avctx) < 0)
return -1;
s->flags = avctx->flags; s->flags = avctx->flags;
s->flags2 = avctx->flags2; s->flags2 = avctx->flags2;
s->unrestricted_mv = 1; s->unrestricted_mv = 1;
...@@ -880,6 +881,17 @@ static int svq3_decode_frame(AVCodecContext *avctx, ...@@ -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 */ /* special case for last picture */
if (buf_size == 0) { if (buf_size == 0) {
if (s->next_picture_ptr && !s->low_delay) { if (s->next_picture_ptr && !s->low_delay) {
...@@ -1030,7 +1042,7 @@ AVCodec svq3_decoder = { ...@@ -1030,7 +1042,7 @@ AVCodec svq3_decoder = {
CODEC_TYPE_VIDEO, CODEC_TYPE_VIDEO,
CODEC_ID_SVQ3, CODEC_ID_SVQ3,
sizeof(H264Context), sizeof(H264Context),
decode_init, svq3_decode_init,
NULL, NULL,
decode_end, decode_end,
svq3_decode_frame, svq3_decode_frame,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment