Revision 93dfda88

View differences:

libavformat/movenc.c
238 238
    return 10;
239 239
}
240 240

  
241
static unsigned int descrLength(unsigned int len)
242
{
243
    int i;
244
    for(i=1; len>>(7*i); i++);
245
    return len + 1 + i;
246
}
247

  
248 241
static void putDescr(AVIOContext *pb, int tag, unsigned int size)
249 242
{
250
    int i= descrLength(size) - size - 2;
243
    int i = 3;
251 244
    avio_w8(pb, tag);
252 245
    for(; i>0; i--)
253 246
        avio_w8(pb, (size>>(7*i)) | 0x80);
......
257 250
static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
258 251
{
259 252
    int64_t pos = avio_tell(pb);
260
    int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0;
253
    int decoderSpecificInfoLen = track->vosLen ? 5+track->vosLen : 0;
261 254

  
262 255
    avio_wb32(pb, 0); // size
263 256
    ffio_wfourcc(pb, "esds");
264 257
    avio_wb32(pb, 0); // Version
265 258

  
266 259
    // ES descriptor
267
    putDescr(pb, 0x03, 3 + descrLength(13 + decoderSpecificInfoLen) +
268
             descrLength(1));
260
    putDescr(pb, 0x03, 3 + 5+13 + decoderSpecificInfoLen + 5+1);
269 261
    avio_wb16(pb, track->trackID);
270 262
    avio_w8(pb, 0x00); // flags (= no flags)
271 263

  
tests/ref/lavf/mov
1
c145305a775eb2de43cdf94eb1ab5240 *./tests/data/lavf/lavf.mov
2
357669 ./tests/data/lavf/lavf.mov
1
439684b82ccc1fdd24a23392c238ae53 *./tests/data/lavf/lavf.mov
2
357681 ./tests/data/lavf/lavf.mov
3 3
./tests/data/lavf/lavf.mov CRC=0x2f6a9b26
tests/ref/vsynth1/mpeg4
1
fd83f2ef5887a62b4d755d7cb5f0ac59 *./tests/data/vsynth1/odivx.mp4
2
540144 ./tests/data/vsynth1/odivx.mp4
1
080e75117f8142001b096cd977ba287e *./tests/data/vsynth1/odivx.mp4
2
540156 ./tests/data/vsynth1/odivx.mp4
3 3
8828a375448dc5c2215163ba70656f89 *./tests/data/mpeg4.vsynth1.out.yuv
4 4
stddev:    7.97 PSNR: 30.10 MAXDIFF:  105 bytes:  7603200/  7603200
tests/ref/vsynth2/mpeg4
1
47de227982e77830a2db278214a08773 *./tests/data/vsynth2/odivx.mp4
2
119797 ./tests/data/vsynth2/odivx.mp4
1
8ffbe8ce43fe126b12cf9621717d641b *./tests/data/vsynth2/odivx.mp4
2
119809 ./tests/data/vsynth2/odivx.mp4
3 3
90a3577850239083a9042bef33c50e85 *./tests/data/mpeg4.vsynth2.out.yuv
4 4
stddev:    5.34 PSNR: 33.57 MAXDIFF:   83 bytes:  7603200/  7603200

Also available in: Unified diff