In ipod/mov/mp4 muxer, always write esds descriptor length using 4 bytes,

ipod shuffle doesn't support anything else.
oldabi
Baptiste Coudurier 14 years ago
parent da3534b01e
commit 93dfda8896
  1. 14
      libavformat/movenc.c
  2. 4
      tests/ref/lavf/mov
  3. 4
      tests/ref/vsynth1/mpeg4
  4. 4
      tests/ref/vsynth2/mpeg4

@ -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)

@ -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

@ -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

@ -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

Loading…
Cancel
Save