[Ffmpeg-cvslog] CVS: ffmpeg/libavformat avienc.c,1.113,1.114

Alex Beregszaszi alex
Sun Nov 13 04:32:14 CET 2005


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

Modified Files:
	avienc.c 
Log Message:
Support for streaming: dont write indexes and dont signal HAS_INDEX in header. Also set filesize to max in this case.

Index: avienc.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/avienc.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- avienc.c	13 Oct 2005 04:31:55 -0000	1.113
+++ avienc.c	13 Nov 2005 03:32:12 -0000	1.114
@@ -357,7 +357,10 @@
     }
     put_le32(pb, bitrate / 8); /* XXX: not quite exact */
     put_le32(pb, 0); /* padding */
-    put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */
+    if (url_is_streamed(pb))
+	put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */
+    else
+	put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */
     avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */
     put_le32(pb, nb_frames); /* nb frames, filled later */
     put_le32(pb, 0); /* initial frame */
@@ -412,7 +415,10 @@
 
         put_le32(pb, 0); /* start */
         avi->frames_hdr_strm[i] = url_ftell(pb); /* remember this offset to fill later */
-        put_le32(pb, 0); /* length, XXX: filled later */
+	if (url_is_streamed(pb))
+	    put_le32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */
+	else
+	    put_le32(pb, 0); /* length, XXX: filled later */
         
         /* suggested buffer size */ //FIXME set at the end to largest chunk
         if(stream->codec_type == CODEC_TYPE_VIDEO)
@@ -502,6 +508,9 @@
     unsigned char ix_tag[] = "ix00";
     int i, j;
     
+    if (url_is_streamed(pb))
+	return -1;
+
     if (avi->riff_id > AVI_MASTER_INDEX_SIZE)
         return -1;
     
@@ -638,7 +647,10 @@
     }
     avi->packet_count[stream_index]++;
 
-    if (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE) { 
+    // Make sure to put an OpenDML chunk when the file size exceeds the limits
+    if (!url_is_streamed(pb) && 
+	(url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
+	 
         avi_write_ix(s);
         end_tag(pb, avi->movi_list);
         
@@ -694,6 +706,8 @@
     int i, j, n, nb_frames;
     offset_t file_size;
 
+    if (!url_is_streamed(pb))
+    {
     if (avi->riff_id == 1) {
         end_tag(pb, avi->movi_list);
         res = avi_write_idx1(s);
@@ -722,6 +736,7 @@
 	put_le32(pb, nb_frames);
 	url_fseek(pb, file_size, SEEK_SET);
     }
+    }
     put_flush_packet(pb);
 
     for (i=0; i<MAX_STREAMS; i++) {





More information about the ffmpeg-cvslog mailing list