[Ffmpeg-cvslog] CVS: ffmpeg/libavformat mpeg.c, 1.93, 1.94 rm.c, 1.56, 1.57 nut.c, 1.61, 1.62 avidec.c, 1.80, 1.81 utils.c, 1.179, 1.180 avformat.h, 1.144, 1.145 asf.c, 1.93, 1.94

Michael Niedermayer CVS michael
Wed Mar 1 12:29:57 CET 2006


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv18402

Modified Files:
	mpeg.c rm.c nut.c avidec.c utils.c avformat.h asf.c 
Log Message:
add size to AVIndex


Index: mpeg.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/mpeg.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- mpeg.c	11 Feb 2006 09:27:00 -0000	1.93
+++ mpeg.c	1 Mar 2006 11:29:55 -0000	1.94
@@ -1541,7 +1541,7 @@
         int i;
         for(i=0; i<s->nb_streams; i++){
             if(startcode == s->streams[i]->id) {
-                av_add_index_entry(s->streams[i], *ppos, dts, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */);
+                av_add_index_entry(s->streams[i], *ppos, dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */);
             }
         }
     }

Index: rm.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/rm.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- rm.c	12 Jan 2006 22:43:25 -0000	1.56
+++ rm.c	1 Mar 2006 11:29:55 -0000	1.57
@@ -982,7 +982,7 @@
         if(flags&2){
             pkt->flags |= PKT_FLAG_KEY;
             if((seq&0x7F) == 1)
-                av_add_index_entry(st, pos, timestamp, 0, AVINDEX_KEYFRAME);
+                av_add_index_entry(st, pos, timestamp, 0, 0, AVINDEX_KEYFRAME);
         }
     }
 
@@ -1054,7 +1054,7 @@
 
         if((flags&2) && (seq&0x7F) == 1){
 //            av_log(s, AV_LOG_DEBUG, "%d %d-%d %Ld %d\n", flags, stream_index2, stream_index, dts, seq);
-            av_add_index_entry(st, pos, dts, 0, AVINDEX_KEYFRAME);
+            av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME);
             if(stream_index2 == stream_index)
                 break;
         }

Index: nut.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/nut.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- nut.c	19 Jan 2006 22:30:37 -0000	1.61
+++ nut.c	1 Mar 2006 11:29:55 -0000	1.62
@@ -1192,6 +1192,7 @@
             s->streams[stream_id],
             frame_start,
             pts,
+            0,
             frame_start - nut->stream[stream_id].last_sync_pos,
             AVINDEX_KEYFRAME);
         nut->stream[stream_id].last_sync_pos= frame_start;

Index: avidec.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/avidec.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- avidec.c	1 Mar 2006 01:32:32 -0000	1.80
+++ avidec.c	1 Mar 2006 11:29:55 -0000	1.81
@@ -55,6 +55,7 @@
 } AVIContext;
 
 static int avi_load_index(AVFormatContext *s);
+static int guess_ni_flag(AVFormatContext *s);
 
 #ifdef DEBUG
 static void print_tag(const char *str, unsigned int tag, int size)
@@ -118,12 +119,14 @@
 
     for(i=0; i<entries_in_use; i++){
         if(index_type){
-            int64_t pos= get_le32(pb) + base;
+            int64_t pos= get_le32(pb) + base - 8;
             int len    = get_le32(pb);
-
-            av_add_index_entry(st, pos, ast->cum_len, 0, (len<0) ? 0 : AVINDEX_KEYFRAME);
+            int key= len >= 0;
             len &= 0x7FFFFFFF;
 
+//av_log(s, AV_LOG_ERROR, "pos:%Ld, len:%X\n", pos, len);
+            av_add_index_entry(st, pos, ast->cum_len, len, 0, key ? AVINDEX_KEYFRAME : 0);
+
             if(ast->sample_size)
                 ast->cum_len += len / ast->sample_size;
             else
@@ -412,6 +415,7 @@
     if(!avi->index_loaded)
         avi_load_index(s);
     avi->index_loaded = 1;
+    avi->non_interleaved |= guess_ni_flag(s);
 
     return 0;
 }
@@ -699,7 +703,7 @@
         if(last_pos == pos)
             avi->non_interleaved= 1;
         else
-            av_add_index_entry(st, pos, ast->cum_len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0);
+            av_add_index_entry(st, pos, ast->cum_len, len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0);
         if(ast->sample_size)
             ast->cum_len += len / ast->sample_size;
         else
@@ -768,7 +772,6 @@
         }
     }
  the_end:
-    avi->non_interleaved |= guess_ni_flag(s);
     url_fseek(pb, pos, SEEK_SET);
     return 0;
 }

Index: utils.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/utils.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -d -r1.179 -r1.180
--- utils.c	11 Feb 2006 17:17:37 -0000	1.179
+++ utils.c	1 Mar 2006 11:29:55 -0000	1.180
@@ -1131,7 +1131,7 @@
  * @param timestamp timestamp in the timebase of the given stream
  */
 int av_add_index_entry(AVStream *st,
-                            int64_t pos, int64_t timestamp, int distance, int flags)
+                            int64_t pos, int64_t timestamp, int size, int distance, int flags)
 {
     AVIndexEntry *entries, *ie;
     int index;
@@ -1168,6 +1168,7 @@
     ie->pos = pos;
     ie->timestamp = timestamp;
     ie->min_distance= distance;
+    ie->size= size;
     ie->flags = flags;
 
     return index;
@@ -1193,7 +1194,7 @@
         if (pkt->stream_index == 0 && st->parser &&
             (pkt->flags & PKT_FLAG_KEY)) {
             av_add_index_entry(st, st->parser->frame_offset, pkt->dts,
-                            0, AVINDEX_KEYFRAME);
+                            0, 0, AVINDEX_KEYFRAME);
         }
         av_free_packet(pkt);
     }

Index: avformat.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/avformat.h,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- avformat.h	17 Feb 2006 03:17:42 -0000	1.144
+++ avformat.h	1 Mar 2006 11:29:55 -0000	1.145
@@ -208,8 +208,8 @@
     int64_t pos;
     int64_t timestamp;
 #define AVINDEX_KEYFRAME 0x0001
-/* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed */
-    int flags;
+    int flags:2;
+    int size:30; //yeah trying to keep the size of this small to reduce memory requirements (its 24 vs 32 byte due to possible 8byte align)
     int min_distance;         /* min distance between this and the previous keyframe, used to avoid unneeded searching */
 } AVIndexEntry;
 
@@ -641,7 +641,7 @@
 int av_find_default_stream_index(AVFormatContext *s);
 int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
 int av_add_index_entry(AVStream *st,
-                       int64_t pos, int64_t timestamp, int distance, int flags);
+                       int64_t pos, int64_t timestamp, int size, int distance, int flags);
 int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags);
 
 /* media file output */

Index: asf.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/asf.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- asf.c	25 Feb 2006 22:41:31 -0000	1.93
+++ asf.c	1 Mar 2006 11:29:55 -0000	1.94
@@ -813,7 +813,7 @@
             assert((asf_st->packet_pos - s->data_offset) % asf->packet_size == 0);
             pos= asf_st->packet_pos;
 
-            av_add_index_entry(s->streams[i], pos, pts, pos - start_pos[i] + 1, AVINDEX_KEYFRAME);
+            av_add_index_entry(s->streams[i], pos, pkt->size, pts, pos - start_pos[i] + 1, AVINDEX_KEYFRAME);
             start_pos[i]= asf_st->packet_pos + 1;
 
             if(pkt->stream_index == stream_index)





More information about the ffmpeg-cvslog mailing list