Commit 63021436 authored by reimar's avatar reimar

reset restart_count when restart_interval is set and fill the

MJpegDecodeContext with 0 on init.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@4464 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 3ffd3d5f
...@@ -882,6 +882,7 @@ static int mjpeg_decode_init(AVCodecContext *avctx) ...@@ -882,6 +882,7 @@ static int mjpeg_decode_init(AVCodecContext *avctx)
{ {
MJpegDecodeContext *s = avctx->priv_data; MJpegDecodeContext *s = avctx->priv_data;
MpegEncContext s2; MpegEncContext s2;
memset(s, 0, sizeof(MJpegDecodeContext));
s->avctx = avctx; s->avctx = avctx;
...@@ -1573,6 +1574,7 @@ static int mjpeg_decode_dri(MJpegDecodeContext *s) ...@@ -1573,6 +1574,7 @@ static int mjpeg_decode_dri(MJpegDecodeContext *s)
if (get_bits(&s->gb, 16) != 4) if (get_bits(&s->gb, 16) != 4)
return -1; return -1;
s->restart_interval = get_bits(&s->gb, 16); s->restart_interval = get_bits(&s->gb, 16);
s->restart_count = 0;
dprintf("restart interval: %d\n", s->restart_interval); dprintf("restart interval: %d\n", s->restart_interval);
return 0; return 0;
...@@ -1892,6 +1894,7 @@ static int mjpeg_decode_frame(AVCodecContext *avctx, ...@@ -1892,6 +1894,7 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
switch(start_code) { switch(start_code) {
case SOI: case SOI:
s->restart_interval = 0; s->restart_interval = 0;
s->restart_count = 0;
/* nothing to do on SOI */ /* nothing to do on SOI */
break; break;
case DQT: case DQT:
...@@ -2000,6 +2003,7 @@ static int mjpegb_decode_frame(AVCodecContext *avctx, ...@@ -2000,6 +2003,7 @@ static int mjpegb_decode_frame(AVCodecContext *avctx,
read_header: read_header:
/* reset on every SOI */ /* reset on every SOI */
s->restart_interval = 0; s->restart_interval = 0;
s->restart_count = 0;
s->mjpb_skiptosod = 0; s->mjpb_skiptosod = 0;
init_get_bits(&hgb, buf_ptr, /*buf_size*/(buf_end - buf_ptr)*8); init_get_bits(&hgb, buf_ptr, /*buf_size*/(buf_end - buf_ptr)*8);
......
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