[SCM] libav/experimental: Predicting the size of the hdlr, string data and trkn tags in the MOV muxer

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 17:05:57 UTC 2013


The following commit has been merged in the experimental branch:
commit 6b174197b5bfc6ec09ab5ba89d8c2b232a06e900
Author: Tomas Härdin <tomas.hardin at codemill.se>
Date:   Mon Apr 12 07:24:30 2010 +0000

    Predicting the size of the hdlr, string data and trkn tags in the MOV muxer
    
    Originally committed as revision 22846 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index a8141ff..da1bf66 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1330,8 +1330,7 @@ static int mov_write_mvhd_tag(ByteIOContext *pb, MOVMuxContext *mov)
 static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVMuxContext *mov,
                                      AVFormatContext *s)
 {
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
+    put_be32(pb, 33); /* size */
     put_tag(pb, "hdlr");
     put_be32(pb, 0);
     put_be32(pb, 0);
@@ -1340,20 +1339,20 @@ static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVMuxContext *mov,
     put_be32(pb, 0);
     put_be32(pb, 0);
     put_byte(pb, 0);
-    return updateSize(pb, pos);
+    return 33;
 }
 
 /* helper function to write a data tag with the specified string as data */
 static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int lang, int long_style)
 {
     if(long_style){
-        int64_t pos = url_ftell(pb);
-        put_be32(pb, 0); /* size */
+        int size = 16 + strlen(data);
+        put_be32(pb, size); /* size */
         put_tag(pb, "data");
         put_be32(pb, 1);
         put_be32(pb, 0);
         put_buffer(pb, data, strlen(data));
-        return updateSize(pb, pos);
+        return size;
     }else{
         if (!lang)
             lang = ff_mov_iso639_to_lang("und", 1);
@@ -1407,12 +1406,9 @@ static int mov_write_trkn_tag(ByteIOContext *pb, MOVMuxContext *mov,
     AVMetadataTag *t = av_metadata_get(s->metadata, "track", NULL, 0);
     int size = 0, track = t ? atoi(t->value) : 0;
     if (track) {
-        int64_t pos = url_ftell(pb);
-        put_be32(pb, 0); /* size */
+        put_be32(pb, 32); /* size */
         put_tag(pb, "trkn");
-        {
-            int64_t pos = url_ftell(pb);
-            put_be32(pb, 0); /* size */
+            put_be32(pb, 24); /* size */
             put_tag(pb, "data");
             put_be32(pb, 0);        // 8 bytes empty
             put_be32(pb, 0);
@@ -1420,9 +1416,7 @@ static int mov_write_trkn_tag(ByteIOContext *pb, MOVMuxContext *mov,
             put_be16(pb, track);    // track number
             put_be16(pb, 0);        // total track number
             put_be16(pb, 0);        // empty
-            updateSize(pb, pos);
-        }
-        size = updateSize(pb, pos);
+        size = 32;
     }
     return size;
 }

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list