[FFmpeg-cvslog] r10051 - in trunk/libavformat: nut.h nutenc.c

michael subversion
Fri Aug 10 14:59:18 CEST 2007


Author: michael
Date: Fri Aug 10 14:59:17 2007
New Revision: 10051

Log:
header repeation


Modified:
   trunk/libavformat/nut.h
   trunk/libavformat/nutenc.c

Modified: trunk/libavformat/nut.h
==============================================================================
--- trunk/libavformat/nut.h	(original)
+++ trunk/libavformat/nut.h	Fri Aug 10 14:59:17 2007
@@ -88,6 +88,7 @@ typedef struct {
     unsigned int max_distance;
     unsigned int time_base_count;
     int64_t last_syncpoint_pos;
+    int header_count;
     AVRational *time_base;
     struct AVTreeNode *syncpoints;
 } NUTContext;

Modified: trunk/libavformat/nutenc.c
==============================================================================
--- trunk/libavformat/nutenc.c	(original)
+++ trunk/libavformat/nutenc.c	Fri Aug 10 14:59:17 2007
@@ -365,6 +365,9 @@ static void write_headers(NUTContext *nu
     url_open_dyn_buf(&dyn_bc);
     write_globalinfo(nut, &dyn_bc);
     put_packet(nut, bc, &dyn_bc, 1, INFO_STARTCODE);
+
+    nut->last_syncpoint_pos= INT_MIN;
+    nut->header_count++;
 }
 
 static int write_header(AVFormatContext *s){
@@ -416,7 +419,7 @@ static int write_header(AVFormatContext 
 
     put_flush_packet(bc);
 
-    //FIXME header repeation, index
+    //FIXME index
 
     return 0;
 }
@@ -445,6 +448,9 @@ static int write_packet(AVFormatContext 
     int key_frame = !!(pkt->flags & PKT_FLAG_KEY);
     int store_sp=0;
 
+    if(1LL<<(20+3*nut->header_count) <= url_ftell(bc))
+        write_headers(nut, bc);
+
     if(key_frame && !!(nus->last_flags & FLAG_KEY))
         store_sp= 1;
 
@@ -563,7 +569,8 @@ static int write_trailer(AVFormatContext
     NUTContext *nut= s->priv_data;
     ByteIOContext *bc= &s->pb;
 
-    write_headers(nut, bc);
+    while(nut->header_count<3)
+        write_headers(nut, bc);
     put_flush_packet(bc);
 
     return 0;




More information about the ffmpeg-cvslog mailing list