diff --git a/libavformat/movenc.c b/libavformat/movenc.c index bdd92f23b8..52c775a565 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -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) diff --git a/tests/ref/lavf/mov b/tests/ref/lavf/mov index 943c605d93..22aac3600e 100644 --- a/tests/ref/lavf/mov +++ b/tests/ref/lavf/mov @@ -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 diff --git a/tests/ref/vsynth1/mpeg4 b/tests/ref/vsynth1/mpeg4 index 76b3904886..ebe2f5a613 100644 --- a/tests/ref/vsynth1/mpeg4 +++ b/tests/ref/vsynth1/mpeg4 @@ -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 diff --git a/tests/ref/vsynth2/mpeg4 b/tests/ref/vsynth2/mpeg4 index 9a6158c67e..fe436e88f3 100644 --- a/tests/ref/vsynth2/mpeg4 +++ b/tests/ref/vsynth2/mpeg4 @@ -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