simplify
Originally committed as revision 5374 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
039627cf48
commit
08db8f1846
@ -226,54 +226,18 @@ static int mov_write_damr_tag(ByteIOContext *pb)
|
|||||||
|
|
||||||
static unsigned int descrLength(unsigned int len)
|
static unsigned int descrLength(unsigned int len)
|
||||||
{
|
{
|
||||||
if (len < 0x00000080)
|
int i;
|
||||||
return 2 + len;
|
for(i=1; len>>(7*i); i++);
|
||||||
else if (len < 0x00004000)
|
return len + 1 + i;
|
||||||
return 3 + len;
|
|
||||||
else if(len < 0x00200000)
|
|
||||||
return 4 + len;
|
|
||||||
else
|
|
||||||
return 5 + len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void putDescr(ByteIOContext *pb, int tag, int size)
|
static void putDescr(ByteIOContext *pb, int tag, unsigned int size)
|
||||||
{
|
{
|
||||||
uint32_t len;
|
int i= descrLength(size) - size - 2;
|
||||||
uint8_t vals[4];
|
put_byte(pb, tag);
|
||||||
|
for(; i>0; i--)
|
||||||
len = size;
|
put_byte(pb, (size>>(7*i)) | 0x80);
|
||||||
vals[3] = (uint8_t)(len & 0x7f);
|
put_byte(pb, size & 0x7F);
|
||||||
len >>= 7;
|
|
||||||
vals[2] = (uint8_t)((len & 0x7f) | 0x80);
|
|
||||||
len >>= 7;
|
|
||||||
vals[1] = (uint8_t)((len & 0x7f) | 0x80);
|
|
||||||
len >>= 7;
|
|
||||||
vals[0] = (uint8_t)((len & 0x7f) | 0x80);
|
|
||||||
|
|
||||||
put_byte(pb, tag); // DescriptorTag
|
|
||||||
|
|
||||||
if (size < 0x00000080)
|
|
||||||
{
|
|
||||||
put_byte(pb, vals[3]);
|
|
||||||
}
|
|
||||||
else if (size < 0x00004000)
|
|
||||||
{
|
|
||||||
put_byte(pb, vals[2]);
|
|
||||||
put_byte(pb, vals[3]);
|
|
||||||
}
|
|
||||||
else if (size < 0x00200000)
|
|
||||||
{
|
|
||||||
put_byte(pb, vals[1]);
|
|
||||||
put_byte(pb, vals[2]);
|
|
||||||
put_byte(pb, vals[3]);
|
|
||||||
}
|
|
||||||
else if (size < 0x10000000)
|
|
||||||
{
|
|
||||||
put_byte(pb, vals[0]);
|
|
||||||
put_byte(pb, vals[1]);
|
|
||||||
put_byte(pb, vals[2]);
|
|
||||||
put_byte(pb, vals[3]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack* track) // Basic
|
static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack* track) // Basic
|
||||||
|
Loading…
x
Reference in New Issue
Block a user