aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-29 17:08:53 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-29 17:18:47 +0200
commitf518fb33184b35b0cc5eb9354bbeb39a548ea41e (patch)
tree3b87123a0d96e88ef03ff2b2c4dea41f649a3faa
parent25e6310a3ec96ce991c73f50c411736f4c80de11 (diff)
downloadffmpeg-f518fb33184b35b0cc5eb9354bbeb39a548ea41e.tar.gz
avcodec/dpx_parser: reset index when finding a startcode, not after
This is simpler Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/dpx_parser.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/dpx_parser.c b/libavcodec/dpx_parser.c
index 70baaf42cd..6c6d502d7e 100644
--- a/libavcodec/dpx_parser.c
+++ b/libavcodec/dpx_parser.c
@@ -57,6 +57,7 @@ static int dpx_parse(AVCodecParserContext *s, AVCodecContext *avctx,
state == MKTAG('S','D','P','X')) {
d->pc.frame_start_found = 1;
d->is_be = state == MKBETAG('S','D','P','X');
+ d->index = 0;
break;
}
}
@@ -73,27 +74,26 @@ static int dpx_parse(AVCodecParserContext *s, AVCodecContext *avctx,
for (;d->pc.frame_start_found && i < buf_size; 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);
if (d->fsize <= 1664) {
- d->index = d->pc.frame_start_found = 0;
+ d->pc.frame_start_found = 0;
goto flush;
}
- d->index = 0;
if (d->fsize > buf_size - i + 19)
d->remaining_size = d->fsize - buf_size + i - 19;
else
next = d->fsize + i - 19;
break;
}
- d->index++;
}
flush:
if (ff_combine_frame(&d->pc, next, &buf, &buf_size) < 0)
return buf_size;
- d->index = d->pc.frame_start_found = 0;
+ d->pc.frame_start_found = 0;
*poutbuf = buf;
*poutbuf_size = buf_size;