标签:没有 媒体信息 lsa mat pre info 材质 合成模式 containe
文章转自:http://www.cnblogs.com/CoderTian/p/8277965.html

aligned(8) class Box (unsigned int(32) boxtype, optional unsigned int(8)[16] extended_type)
{
unsigned int(32) size;
unsigned int(32) type = boxtype;
if (size==1)
{
unsigned int(64) largesize;
}
else if (size==0)
{
// box extends to end of file
}
if (boxtype==‘uuid’)
{
unsigned int(8)[16] usertype = extended_type;
}
}
aligned(8) class FullBox(unsigned int(32) boxtype, unsigned int(8) v, bit(24) f) extends Box(boxtype)
{
unsigned int(8) version = v;
bit(24) flags = f;
}
aligned(8) class FileTypeBox extends Box(‘ftyp’)
{
unsigned int(32) major_brand;
unsigned int(32) minor_version;
unsigned int(32) compatible_brands[]; // to end of the box
}

box的类型为ftyp box大小为24个字节,其中major_brand和minor_version都是mp42。
aligned(8) class MediaDataBox extends Box(‘mdat’)
{
bit(8) data[];
}
aligned(8) class FreeSpaceBox extends Box(free_type)
{
unsigned int(8) data[];
}
aligned(8) class MovieBox extends Box(‘moov’)
{
}
aligned(8) class MovieHeaderBox extends FullBox(‘mvhd’, version, 0)
{
if (version==1)
{
unsigned int(64) creation_time;
unsigned int(64) modification_time;
unsigned int(32) timescale;
unsigned int(64) duration;
}
else
{ // version==0
unsigned int(32) creation_time;
unsigned int(32) modification_time;
unsigned int(32) timescale;
unsigned int(32) duration;
}
template int(32) rate = 0x00010000; // typically 1.0
template int(16) volume = 0x0100; // typically, full volume
const bit(16) reserved = 0;
const unsigned int(32)[2] reserved = 0;
// Unity matrix
template int(32)[9] matrix = { 0x00010000,0,0,0,0x00010000,0,0,0,0x40000000 };
bit(32)[6] pre_defined = 0;
unsigned int(32) next_track_ID;
}

aligned(8) class TrackBox extends Box(‘trak’)
{
}
aligned(8) class TrackHeaderBox extends FullBox(‘tkhd’, version, flags)
{
if (version==1)
{
unsigned int(64) creation_time;
unsigned int(64) modification_time;
unsigned int(32) track_ID;
const unsigned int(32) reserved = 0;
unsigned int(64) duration;
}
else
{ // version==0
unsigned int(32) creation_time;
unsigned int(32) modification_time;
unsigned int(32) track_ID;
const unsigned int(32) reserved = 0;
unsigned int(32) duration;
}
const unsigned int(32)[2] reserved = 0;
template int(16) layer = 0;
template int(16) alternate_group = 0;
template int(16) volume = {if track_is_audio 0x0100 else 0};
const unsigned int(16) reserved = 0;
// unity matrix
template int(32)[9] matrix= { 0x00010000,0,0,0,0x00010000,0,0,0,0x40000000 };
unsigned int(32) width;
unsigned int(32) height;
}
aligned(8) class MediaBox extends Box(‘mdia’)
{
}
aligned(8) class MediaHeaderBox extends FullBox(‘mdhd’, version, 0)
{
if (version==1)
{
unsigned int(64) creation_time;
unsigned int(64) modification_time;
unsigned int(32) timescale;
unsigned int(64) duration;
}
else
{
// version==0
unsigned int(32) creation_time;
unsigned int(32) modification_time;
unsigned int(32) timescale;
unsigned int(32) duration;
}
bit(1) pad = 0;
unsigned int(5)[3] language; // ISO-639-2/T language code
unsigned int(16) pre_defined = 0;
}
aligned(8) class HandlerBox extends FullBox(‘hdlr’, version = 0, 0)
{
unsigned int(32) pre_defined = 0;
unsigned int(32) handler_type;
const unsigned int(32)[3] reserved = 0;
string name;
}
aligned(8) class MediaInformationBox extends Box(‘minf’)
{
}
aligned(8) class VideoMediaHeaderBox extends FullBox(‘vmhd’, version = 0, 1)
{
template unsigned int(16) graphicsmode = 0; // copy, see below
template unsigned int(16)[3] opcolor = {0, 0, 0};
}
aligned(8) class SoundMediaHeaderBox extends FullBox(‘smhd’, version = 0, 0)
{
template int(16) balance = 0;
const unsigned int(16) reserved = 0;
}
aligned(8) class DataInformationBox extends Box(‘dinf’)
{
}
aligned(8) class DataEntryUrlBox (bit(24) flags) extends FullBox(‘url ’, version = 0, flags)
{
string location;
}
aligned(8) class DataEntryUrnBox (bit(24) flags) extends FullBox(‘urn ’, version = 0, flags)
{
string name;
string location;
}
aligned(8) class DataReferenceBox extends FullBox(‘dref’, version = 0, 0)
{
unsigned int(32) entry_count;
for (i=1; i <= entry_count; i++)
{
DataEntryBox(entry_version, entry_flags) data_entry;
}
}

aligned(8) class SampleTableBox extends Box(‘stbl’)
{
}
aligned(8) abstract class SampleEntry (unsigned int(32) format) extends Box(format)
{
const unsigned int(8)[6] reserved = 0;
unsigned int(16) data_reference_index;
}
aligned(8) class SampleDescriptionBox (unsigned int(32) handler_type) extends FullBox(‘stsd‘, version, 0)
{
int i ;
unsigned int(32) entry_count;
for (i = 1 ; i <= entry_count ; i++)
{
SampleEntry(); // an instance of a class derived from SampleEntry
}
}
视频track的stsd

[stsd] size=12+149
entry-count = 1
[avc1] size=8+137
data_reference_index = 1
width = 720
height = 576
compressor =
[avcC] size=8+51
Configuration Version = 1
Profile = High
Profile Compatibility = 0
Level = 40
NALU Length Size = 4
Sequence Parameter = [67 64 00 28 ac d1 00 b4 12 6c 08 40 00 00 03 00 40 00 00 0c b8 08 00 16 e3 40 00 5b 8d e4 93 00 f8 c1 88 90]
Picture Parameter = [68 eb ef 2c]
音频track的stsd

[stsd] size=12+79
entry-count = 1
[mp4a] size=8+67
data_reference_index = 1
channel_count = 2
sample_size = 16
sample_rate = 48000
[esds] size=12+27
[ESDescriptor] size=2+25
es_id = 0
stream_priority = 31
[DecoderConfig] size=2+17
stream_type = 5
object_type = 64
up_stream = 0
buffer_size = 531
max_bitrate = 129336
avg_bitrate = 125368
DecoderSpecificInfo = 11 90
[Descriptor:06] size=2+1
aligned(8) class CompositionOffsetBox extends FullBox(‘ctts’, version, 0)
{
unsigned int(32) entry_count;
int i;
if (version==0)
{
for (i=0; i < entry_count; i++)
{
unsigned int(32) sample_count;
unsigned int(32) sample_offset;
}
}
else if (version == 1)
{
for (i=0; i < entry_count; i++)
{
unsigned int(32) sample_count;
signed int(32) sample_offset;
}
}
}
aligned(8) class TimeToSampleBox extends FullBox(’stts’, version = 0, 0)
{
unsigned int(32) entry_count;
int i;
for (i=0; i < entry_count; i++)
{
unsigned int(32) sample_count;
unsigned int(32) sample_delta;
}
}
aligned(8) class SampleSizeBox extends FullBox(‘stsz’, version = 0, 0)
{
unsigned int(32) sample_size;
unsigned int(32) sample_count;
if (sample_size==0)
{
for (i=1; i <= sample_count; i++)
{
unsigned int(32) entry_size;
}
}
}
aligned(8) class SampleToChunkBox extends FullBox(‘stsc’, version = 0, 0)
{
unsigned int(32) entry_count;
for (i=1; i <= entry_count; i++)
{
unsigned int(32) first_chunk;
unsigned int(32) samples_per_chunk;
unsigned int(32) sample_description_index;
}
}
aligned(8) class SyncSampleBox extends FullBox(‘stss’, version = 0, 0)
{
unsigned int(32) entry_count;
int i;
for (i=0; i < entry_count; i++)
{
unsigned int(32) sample_number;
}
}
aligned(8) class ChunkOffsetBox extends FullBox(‘stco’, version = 0, 0)
{
unsigned int(32) entry_count;
for (i=1; i <= entry_count; i++)
{
unsigned int(32) chunk_offset;
}
}
aligned(8) class ChunkLargeOffsetBox extends FullBox(‘co64’, version = 0, 0)
{
unsigned int(32) entry_count;
for (i=1; i <= entry_count; i++)
{
unsigned int(64) chunk_offset;
}
}
标签:没有 媒体信息 lsa mat pre info 材质 合成模式 containe
原文地址:https://www.cnblogs.com/lidabo/p/11532618.html