[Ffmpeg-cvslog] CVS: ffmpeg/libavformat nut.c,1.53,1.54

Michael Niedermayer CVS michael
Sun Sep 11 10:28:05 CEST 2005


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

Modified Files:
	nut.c 
Log Message:
forward_ptr doesnt contain its own length anymore


Index: nut.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/nut.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- nut.c	17 Jul 2005 22:24:36 -0000	1.53
+++ nut.c	11 Sep 2005 08:28:03 -0000	1.54
@@ -462,8 +462,7 @@
 static int put_packetheader(NUTContext *nut, ByteIOContext *bc, int max_size, int calculate_checksum)
 {
     put_flush_packet(bc);
-    nut->packet_start[2]+= nut->written_packet_size;
-    assert(url_ftell(bc) - 8 == nut->packet_start[2]);
+    nut->packet_start[2]= url_ftell(bc) - 8;
     nut->written_packet_size = max_size;
     
     if(calculate_checksum)
@@ -475,10 +474,14 @@
     return 0;
 }
 
+/**
+ *
+ * must not be called more then once per packet
+ */
 static int update_packetheader(NUTContext *nut, ByteIOContext *bc, int additional_size, int calculate_checksum){
     int64_t start= nut->packet_start[2];
     int64_t cur= url_ftell(bc);
-    int size= cur - start + additional_size;
+    int size= cur - start - get_length(nut->written_packet_size)/7 - 8;
     
     if(calculate_checksum)
         size += 4;
@@ -1276,7 +1279,7 @@
         case INDEX_STARTCODE:
             get_packetheader(nut, bc, 0);
             assert(nut->packet_start[2] == pos);
-            url_fseek(bc, nut->written_packet_size + nut->packet_start[2], SEEK_SET);
+            url_fseek(bc, nut->written_packet_size, SEEK_CUR);
             break;
         case INFO_STARTCODE:
             if(decode_info_header(nut)<0)
@@ -1357,7 +1360,7 @@
         case INFO_STARTCODE:
             get_packetheader(nut, bc, 0);
             assert(nut->packet_start[2]==pos);
-            url_fseek(bc, nut->written_packet_size + pos, SEEK_SET);
+            url_fseek(bc, nut->written_packet_size, SEEK_CUR);
             break;
         case KEYFRAME_STARTCODE:
             frame_type=2;





More information about the ffmpeg-cvslog mailing list