# HG changeset patch # User cehoyos # Date 1285625878 0 # Node ID 9a3f2beae2a9407b82b922286683850c44711a41 # Parent f4caff0e1e10ac9d7a7629d2fe7bb56a61318a11 Fix index_entries pos: It was being set wrong for files with data_offset > 0 Patch by Michael Chinen, mchinen gmail diff -r f4caff0e1e10 -r 9a3f2beae2a9 avcodec.h --- a/avcodec.h Mon Sep 27 21:31:29 2010 +0000 +++ b/avcodec.h Mon Sep 27 22:17:58 2010 +0000 @@ -3738,6 +3738,8 @@ int flags; #define PARSER_FLAG_COMPLETE_FRAMES 0x0001 #define PARSER_FLAG_ONCE 0x0002 +/// Set if the parser has a valid file offset +#define PARSER_FLAG_FETCHED_OFFSET 0x0004 int64_t offset; ///< byte offset from starting packet start int64_t cur_frame_end[AV_PARSER_PTS_NB]; diff -r f4caff0e1e10 -r 9a3f2beae2a9 parser.c --- a/parser.c Mon Sep 27 21:31:29 2010 +0000 +++ b/parser.c Mon Sep 27 22:17:58 2010 +0000 @@ -150,6 +150,12 @@ int index, i; uint8_t dummy_buf[FF_INPUT_BUFFER_PADDING_SIZE]; + if(!(s->flags & PARSER_FLAG_FETCHED_OFFSET)) { + s->next_frame_offset = + s->cur_offset = pos; + s->flags |= PARSER_FLAG_FETCHED_OFFSET; + } + if (buf_size == 0) { /* padding is always necessary even if EOF, so we add it here */ memset(dummy_buf, 0, sizeof(dummy_buf));