[FFmpeg-devel] [PATCH]Write an empty annotation field to Sun au

Carl Eugen Hoyos cehoyos at ag.or.at
Sat Nov 24 03:20:52 CET 2012


Hi!

The specification requires an annotation field "length must be a non-zero 
multiple of eight bytes".

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/au.c b/libavformat/au.c
index 788e261..bd7838e 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -35,6 +35,8 @@
 
 /* if we don't know the size in advance */
 #define AU_UNKNOWN_SIZE ((uint32_t)(~0))
+/* the specification requires an annotation field of at least eight bytes */
+#define AU_HEADER_SIZE (24+8)
 
 /* The libavcodec codecs we support, and the IDs they have in the file */
 static const AVCodecTag codec_au_tags[] = {
@@ -56,11 +58,12 @@ static int put_au_header(AVIOContext *pb, AVCodecContext *enc)
     if(!enc->codec_tag)
         return -1;
     ffio_wfourcc(pb, ".snd");    /* magic number */
-    avio_wb32(pb, 24);           /* header size */
+    avio_wb32(pb, AU_HEADER_SIZE);  /* header size */
     avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */
     avio_wb32(pb, (uint32_t)enc->codec_tag);     /* codec ID */
     avio_wb32(pb, enc->sample_rate);
     avio_wb32(pb, (uint32_t)enc->channels);
+    avio_wb64(pb, 0); /* annotation field */
     return 0;
 }
 
@@ -97,7 +100,7 @@ static int au_write_trailer(AVFormatContext *s)
         /* update file size */
         file_size = avio_tell(pb);
         avio_seek(pb, 8, SEEK_SET);
-        avio_wb32(pb, (uint32_t)(file_size - 24));
+        avio_wb32(pb, (uint32_t)(file_size - AU_HEADER_SIZE));
         avio_seek(pb, file_size, SEEK_SET);
 
         avio_flush(pb);


More information about the ffmpeg-devel mailing list