movenc: always write esds descriptor length using 4 bytes.

ipod shuffle doesn't support anything else.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Baptiste Coudurier
2011-03-30 14:08:16 -07:00
committed by Anton Khirnov
parent dbe9453946
commit 7e19a6e868
4 changed files with 9 additions and 17 deletions

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