changeset 36:1188ad85857a libavformat

audio only avi patch by (Andriy Rysin <arysin at bcsii dot net>)
author michaelni
date Mon, 27 Jan 2003 02:18:41 +0000
parents a16ccdf4a87c
children 8f76666c71c2
files avienc.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/avienc.c	Sat Jan 25 13:05:39 2003 +0000
+++ b/avienc.c	Mon Jan 27 02:18:41 2003 +0000
@@ -199,13 +199,20 @@
             video_enc = stream;
     }
     
+/*	allowing audio-only AVI file 
+    
     if (!video_enc) {
         av_free(avi);
         return -1;
     }
+*/    
     nb_frames = 0;
 
+    if(video_enc){
     put_le32(pb, (UINT32)(INT64_C(1000000) * FRAME_RATE_BASE / video_enc->frame_rate));
+    } else {
+	put_le32(pb, 0);
+    }
     put_le32(pb, bitrate / 8); /* XXX: not quite exact */
     put_le32(pb, 0); /* padding */
     put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */
@@ -214,8 +221,13 @@
     put_le32(pb, 0); /* initial frame */
     put_le32(pb, s->nb_streams); /* nb streams */
     put_le32(pb, 1024 * 1024); /* suggested buffer size */
+    if(video_enc){    
     put_le32(pb, video_enc->width);
     put_le32(pb, video_enc->height);
+    } else {
+	put_le32(pb, 0);
+	put_le32(pb, 0);
+    }	
     put_le32(pb, 0); /* reserved */
     put_le32(pb, 0); /* reserved */
     put_le32(pb, 0); /* reserved */