[FFmpeg-cvslog] lavf/avienc: use metadata_header_padding

James Darnley git at videolan.org
Fri Jan 24 23:19:11 CET 2014


ffmpeg | branch: master | James Darnley <james.darnley at gmail.com> | Fri Jan 24 02:22:50 2014 +0100| [fa20babb4661ab4263caec55119bf3e99e855f76] | committer: Michael Niedermayer

lavf/avienc: use metadata_header_padding

The muxer will write at least the number of bytes requested and possibly
up to 3 bytes more.  This is because the muxer writes 32-bit integers
and the format requires 4-byte alignment anyway.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fa20babb4661ab4263caec55119bf3e99e855f76
---

 libavformat/avienc.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 95e4e7e..9f80576 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -154,6 +154,7 @@ static int avi_write_header(AVFormatContext *s)
     AVCodecContext *stream, *video_enc;
     int64_t list1, list2, strh, strf;
     AVDictionaryEntry *t = NULL;
+    int padding;
 
     if (s->nb_streams > AVI_MAX_STREAM_COUNT) {
         av_log(s, AV_LOG_ERROR, "AVI does not support >%d streams\n",
@@ -397,11 +398,18 @@ static int avi_write_header(AVFormatContext *s)
 
     ff_riff_write_info(s);
 
+
+    padding = s->metadata_header_padding;
+    if (padding < 0)
+        padding = 1016;
+
     /* some padding for easier tag editing */
+    if (padding) {
     list2 = ff_start_tag(pb, "JUNK");
-    for (i = 0; i < 1016; i += 4)
+    for (i = padding; i > 0; i -= 4)
         avio_wl32(pb, 0);
     ff_end_tag(pb, list2);
+    }
 
     avi->movi_list = ff_start_tag(pb, "LIST");
     ffio_wfourcc(pb, "movi");



More information about the ffmpeg-cvslog mailing list