Commit f518fb33 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/dpx_parser: reset index when finding a startcode, not after

This is simpler
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 25e6310a
...@@ -57,6 +57,7 @@ static int dpx_parse(AVCodecParserContext *s, AVCodecContext *avctx, ...@@ -57,6 +57,7 @@ static int dpx_parse(AVCodecParserContext *s, AVCodecContext *avctx,
state == MKTAG('S','D','P','X')) { state == MKTAG('S','D','P','X')) {
d->pc.frame_start_found = 1; d->pc.frame_start_found = 1;
d->is_be = state == MKBETAG('S','D','P','X'); d->is_be = state == MKBETAG('S','D','P','X');
d->index = 0;
break; break;
} }
} }
...@@ -73,27 +74,26 @@ static int dpx_parse(AVCodecParserContext *s, AVCodecContext *avctx, ...@@ -73,27 +74,26 @@ static int dpx_parse(AVCodecParserContext *s, AVCodecContext *avctx,
for (;d->pc.frame_start_found && i < buf_size; i++) { for (;d->pc.frame_start_found && i < buf_size; i++) {
d->pc.state = (d->pc.state << 8) | buf[i]; d->pc.state = (d->pc.state << 8) | buf[i];
if (d->index == 16) { d->index++;
if (d->index == 17) {
d->fsize = d->is_be ? d->pc.state : av_bswap32(d->pc.state); d->fsize = d->is_be ? d->pc.state : av_bswap32(d->pc.state);
if (d->fsize <= 1664) { if (d->fsize <= 1664) {
d->index = d->pc.frame_start_found = 0; d->pc.frame_start_found = 0;
goto flush; goto flush;
} }
d->index = 0;
if (d->fsize > buf_size - i + 19) if (d->fsize > buf_size - i + 19)
d->remaining_size = d->fsize - buf_size + i - 19; d->remaining_size = d->fsize - buf_size + i - 19;
else else
next = d->fsize + i - 19; next = d->fsize + i - 19;
break; break;
} }
d->index++;
} }
flush: flush:
if (ff_combine_frame(&d->pc, next, &buf, &buf_size) < 0) if (ff_combine_frame(&d->pc, next, &buf, &buf_size) < 0)
return buf_size; return buf_size;
d->index = d->pc.frame_start_found = 0; d->pc.frame_start_found = 0;
*poutbuf = buf; *poutbuf = buf;
*poutbuf_size = buf_size; *poutbuf_size = buf_size;
......
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