[FFmpeg-cvslog] r25239 - in trunk: libavcodec/avcodec.h libavcodec/parser.c libavformat/utils.c

cehoyos subversion
Tue Sep 28 00:17:58 CEST 2010


Author: cehoyos
Date: Tue Sep 28 00:17:58 2010
New Revision: 25239

Log:
Fix index_entries pos:
It was being set wrong for files with data_offset > 0

Patch by Michael Chinen, mchinen gmail

Modified:
   trunk/libavcodec/avcodec.h
   trunk/libavcodec/parser.c
   trunk/libavformat/utils.c

Modified: trunk/libavcodec/avcodec.h
==============================================================================
--- trunk/libavcodec/avcodec.h	Tue Sep 28 00:13:18 2010	(r25238)
+++ trunk/libavcodec/avcodec.h	Tue Sep 28 00:17:58 2010	(r25239)
@@ -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];

Modified: trunk/libavcodec/parser.c
==============================================================================
--- trunk/libavcodec/parser.c	Tue Sep 28 00:13:18 2010	(r25238)
+++ trunk/libavcodec/parser.c	Tue Sep 28 00:17:58 2010	(r25239)
@@ -150,6 +150,12 @@ int av_parser_parse2(AVCodecParserContex
     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));

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	Tue Sep 28 00:13:18 2010	(r25238)
+++ trunk/libavformat/utils.c	Tue Sep 28 00:17:58 2010	(r25239)
@@ -1159,10 +1159,6 @@ static int av_read_frame_internal(AVForm
                 }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;
-                }
             }
         }
     }



More information about the ffmpeg-cvslog mailing list