获取track的类型,video&audio&subtitle:
8.4.3 Handler Reference Box
8.4.3.1 Definition
Box Type: ‘hdlr’
Container: Media Box (‘mdia’) or Meta Box (‘meta’)
Mandatory: Yes
Quantity: Exactly one
This box within a Media Box declares media type of the track, and thus the process by which the media‐data in the track is presented. For example, a format for which the decoder delivers video would be stored in a video track, identified by being handled by a video handler. The documentation of the storage of a media format identifies the media type which that format uses.This box when present within a Meta Box, declares the structure or format of the ‘meta’ box contents. There is a general handler for metadata streams of any type; the specific format is identified by the sample entry, as for video or audio, for example.
4.2 Object Structure
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;
}
8.4.3.2 Syntax
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;
}
00000660: 000e 1055 c400 0000 0000 2d68 646c 7200 …U……-hdlr.
00000670: 0000 0000 0000 0076 6964 6500 0000 0000 …….vide…..
00000680: 0000 0000 0000 0056 6964 656f 4861 6e64 …….VideoHand
00000690: 6c65 7200 0000 014b 6d69 6e66 0000 0014 ler….Kminf….
atom box 大小 0000002d=45
整个数据box的数据范围为9+16+16+3 = 45,上面数据加粗部分。
atom box 类型68 646c 72 = hdlr
version 00
flags 00 00 00
pre_defined 00 00 00 00
hander_type 76 69 64 65 vide
reserved 32*3 00000000 00000000 00000000
name 56 6964 656f 4861 6e64 6c65 72 VideoHandler
由上面的 hender_type 可以确定类型为为video。
下面是一个audio track的 hdlr box。
00000880: 0000 0000 00bb 8000 0006 0055 c400 0000 ………..U….
00000890: 0000 2d68 646c 7200 0000 0000 0000 0073 ..-hdlr……..s
000008a0: 6f75 6e00 0000 0000 0000 0000 0000 0053 oun…………S
000008b0: 6f75 6e64 4861 6e64 6c65 7200 0000 00df oundHandler…..
hdlr type 的定义14496-14扩展:
‘vide’ video track
‘soun’ sound track
‘subp’|’clcp’ subtile track
‘odsm’ ObjectDescriptorStream
‘c rsm’ ClockReferenceStream
‘sdsm’ SceneDescriptionStream
‘m7sm’ MPEG7Stream
‘ocsm’ ObjectContentinfoStream
‘ipsm’ IPMP Stream
‘mjsm’ MPEG-J Stream