Commit 7e19a6e8 authored by Baptiste Coudurier's avatar Baptiste Coudurier Committed by Anton Khirnov
Browse files

movenc: always write esds descriptor length using 4 bytes.



ipod shuffle doesn't support anything else.
Signed-off-by: default avatarAnton Khirnov <anton@khirnov.net>
parent dbe94539
...@@ -238,16 +238,9 @@ static int mov_write_enda_tag(AVIOContext *pb) ...@@ -238,16 +238,9 @@ static int mov_write_enda_tag(AVIOContext *pb)
return 10; 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) static void putDescr(AVIOContext *pb, int tag, unsigned int size)
{ {
int i= descrLength(size) - size - 2; int i = 3;
avio_w8(pb, tag); avio_w8(pb, tag);
for(; i>0; i--) for(; i>0; i--)
avio_w8(pb, (size>>(7*i)) | 0x80); avio_w8(pb, (size>>(7*i)) | 0x80);
...@@ -257,15 +250,14 @@ static void putDescr(AVIOContext *pb, int tag, unsigned int size) ...@@ -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 static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
{ {
int64_t pos = avio_tell(pb); 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 avio_wb32(pb, 0); // size
ffio_wfourcc(pb, "esds"); ffio_wfourcc(pb, "esds");
avio_wb32(pb, 0); // Version avio_wb32(pb, 0); // Version
// ES descriptor // ES descriptor
putDescr(pb, 0x03, 3 + descrLength(13 + decoderSpecificInfoLen) + putDescr(pb, 0x03, 3 + 5+13 + decoderSpecificInfoLen + 5+1);
descrLength(1));
avio_wb16(pb, track->trackID); avio_wb16(pb, track->trackID);
avio_w8(pb, 0x00); // flags (= no flags) avio_w8(pb, 0x00); // flags (= no flags)
......
c145305a775eb2de43cdf94eb1ab5240 *./tests/data/lavf/lavf.mov 439684b82ccc1fdd24a23392c238ae53 *./tests/data/lavf/lavf.mov
357669 ./tests/data/lavf/lavf.mov 357681 ./tests/data/lavf/lavf.mov
./tests/data/lavf/lavf.mov CRC=0x2f6a9b26 ./tests/data/lavf/lavf.mov CRC=0x2f6a9b26
fd83f2ef5887a62b4d755d7cb5f0ac59 *./tests/data/vsynth1/odivx.mp4 080e75117f8142001b096cd977ba287e *./tests/data/vsynth1/odivx.mp4
540144 ./tests/data/vsynth1/odivx.mp4 540156 ./tests/data/vsynth1/odivx.mp4
8828a375448dc5c2215163ba70656f89 *./tests/data/mpeg4.vsynth1.out.yuv 8828a375448dc5c2215163ba70656f89 *./tests/data/mpeg4.vsynth1.out.yuv
stddev: 7.97 PSNR: 30.10 MAXDIFF: 105 bytes: 7603200/ 7603200 stddev: 7.97 PSNR: 30.10 MAXDIFF: 105 bytes: 7603200/ 7603200
47de227982e77830a2db278214a08773 *./tests/data/vsynth2/odivx.mp4 8ffbe8ce43fe126b12cf9621717d641b *./tests/data/vsynth2/odivx.mp4
119797 ./tests/data/vsynth2/odivx.mp4 119809 ./tests/data/vsynth2/odivx.mp4
90a3577850239083a9042bef33c50e85 *./tests/data/mpeg4.vsynth2.out.yuv 90a3577850239083a9042bef33c50e85 *./tests/data/mpeg4.vsynth2.out.yuv
stddev: 5.34 PSNR: 33.57 MAXDIFF: 83 bytes: 7603200/ 7603200 stddev: 5.34 PSNR: 33.57 MAXDIFF: 83 bytes: 7603200/ 7603200
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment