In ipod/mov/mp4 muxer, always write esds descriptor length using 4 bytes,
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>
Wed, 30 Mar 2011 21:08:16 +0000 (14:08 -0700)
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>
Wed, 30 Mar 2011 21:09:09 +0000 (14:09 -0700)
ipod shuffle doesn't support anything else.

libavformat/movenc.c
tests/ref/lavf/mov
tests/ref/vsynth1/mpeg4
tests/ref/vsynth2/mpeg4

index b7bffd9..fe52917 100644 (file)
@@ -238,16 +238,9 @@ static int mov_write_enda_tag(AVIOContext *pb)
     return 10;
 }
 
-static unsigned int descrLength(unsigned int len)
-{
-    int i;
-    for(i=1; len>>(7*i); i++);
-    return len + 1 + i;
-}
-
 static void putDescr(AVIOContext *pb, int tag, unsigned int size)
 {
-    int i= descrLength(size) - size - 2;
+    int i = 3;
     avio_w8(pb, tag);
     for(; i>0; i--)
         avio_w8(pb, (size>>(7*i)) | 0x80);
@@ -257,15 +250,14 @@ static void putDescr(AVIOContext *pb, int tag, unsigned int size)
 static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
 {
     int64_t pos = avio_tell(pb);
-    int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0;
+    int decoderSpecificInfoLen = track->vosLen ? 5+track->vosLen : 0;
 
     avio_wb32(pb, 0); // size
     ffio_wfourcc(pb, "esds");
     avio_wb32(pb, 0); // Version
 
     // ES descriptor
-    putDescr(pb, 0x03, 3 + descrLength(13 + decoderSpecificInfoLen) +
-             descrLength(1));
+    putDescr(pb, 0x03, 3 + 5+13 + decoderSpecificInfoLen + 5+1);
     avio_wb16(pb, track->trackID);
     avio_w8(pb, 0x00); // flags (= no flags)
 
index 943c605..22aac36 100644 (file)
@@ -1,3 +1,3 @@
-c145305a775eb2de43cdf94eb1ab5240 *./tests/data/lavf/lavf.mov
-357669 ./tests/data/lavf/lavf.mov
+439684b82ccc1fdd24a23392c238ae53 *./tests/data/lavf/lavf.mov
+357681 ./tests/data/lavf/lavf.mov
 ./tests/data/lavf/lavf.mov CRC=0x2f6a9b26
index 76b3904..ebe2f5a 100644 (file)
@@ -1,4 +1,4 @@
-fd83f2ef5887a62b4d755d7cb5f0ac59 *./tests/data/vsynth1/odivx.mp4
-540144 ./tests/data/vsynth1/odivx.mp4
+080e75117f8142001b096cd977ba287e *./tests/data/vsynth1/odivx.mp4
+540156 ./tests/data/vsynth1/odivx.mp4
 8828a375448dc5c2215163ba70656f89 *./tests/data/mpeg4.vsynth1.out.yuv
 stddev:    7.97 PSNR: 30.10 MAXDIFF:  105 bytes:  7603200/  7603200
index 9a6158c..fe436e8 100644 (file)
@@ -1,4 +1,4 @@
-47de227982e77830a2db278214a08773 *./tests/data/vsynth2/odivx.mp4
-119797 ./tests/data/vsynth2/odivx.mp4
+8ffbe8ce43fe126b12cf9621717d641b *./tests/data/vsynth2/odivx.mp4
+119809 ./tests/data/vsynth2/odivx.mp4
 90a3577850239083a9042bef33c50e85 *./tests/data/mpeg4.vsynth2.out.yuv
 stddev:    5.34 PSNR: 33.57 MAXDIFF:   83 bytes:  7603200/  7603200