]> git.sesse.net Git - ffmpeg/commitdiff
Fix index_entries pos:
authorMichael Chinen <mchinen@gmail.com>
Mon, 27 Sep 2010 22:17:58 +0000 (22:17 +0000)
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>
Mon, 27 Sep 2010 22:17:58 +0000 (22:17 +0000)
It was being set wrong for files with data_offset > 0

Patch by Michael Chinen, mchinen gmail

Originally committed as revision 25239 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/avcodec.h
libavcodec/parser.c
libavformat/utils.c

index 64a558323049eeae7bb80b14a1cf1fc54cafdbb3..9f888992c8e252f6fafd71148cbc89c4d9c7e0b3 100644 (file)
@@ -3738,6 +3738,8 @@ typedef struct AVCodecParserContext {
     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];
index 1aa86515d8ad30a028f8bc95df210219fdb89d29..d877f5d41136119fdf8ed6def1758f310aa6c335 100644 (file)
@@ -150,6 +150,12 @@ int av_parser_parse2(AVCodecParserContext *s,
     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));
index a445e0b861487fb48a9784366eae1dc888e36cbe..24dbd88feb4429bafc9cda02d0a948b4071197aa 100644 (file)
@@ -1159,10 +1159,6 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
                 }else if(st->need_parsing == AVSTREAM_PARSE_FULL_ONCE){
                     st->parser->flags |= PARSER_FLAG_ONCE;
                 }
-                if(st->parser && (s->iformat->flags & AVFMT_GENERIC_INDEX)){
-                    st->parser->next_frame_offset=
-                    st->parser->cur_offset= st->cur_pkt.pos;
-                }
             }
         }
     }