5 #include "stream/stream.h"
8 /* EBML version supported */
12 * EBML element IDs. max. 32-bit.
15 /* top-level master-IDs */
16 #define EBML_ID_HEADER 0x1A45DFA3
18 /* IDs in the HEADER master */
19 #define EBML_ID_EBMLVERSION 0x4286
20 #define EBML_ID_EBMLREADVERSION 0x42F7
21 #define EBML_ID_EBMLMAXIDLENGTH 0x42F2
22 #define EBML_ID_EBMLMAXSIZELENGTH 0x42F3
23 #define EBML_ID_DOCTYPE 0x4282
24 #define EBML_ID_DOCTYPEVERSION 0x4287
25 #define EBML_ID_DOCTYPEREADVERSION 0x4285
27 /* general EBML types */
28 #define EBML_ID_VOID 0xEC
30 /* ID returned in error cases */
31 #define EBML_ID_INVALID 0xFFFFFFFF
35 * Matroska element IDs. max. 32-bit.
38 /* toplevel segment */
39 #define MATROSKA_ID_SEGMENT 0x18538067
41 /* matroska top-level master IDs */
42 #define MATROSKA_ID_INFO 0x1549A966
43 #define MATROSKA_ID_TRACKS 0x1654AE6B
44 #define MATROSKA_ID_CUES 0x1C53BB6B
45 #define MATROSKA_ID_TAGS 0x1254C367
46 #define MATROSKA_ID_SEEKHEAD 0x114D9B74
47 #define MATROSKA_ID_ATTACHMENTS 0x1941A469
48 #define MATROSKA_ID_CHAPTERS 0x1043A770
49 #define MATROSKA_ID_CLUSTER 0x1F43B675
51 /* IDs in the info master */
52 #define MATROSKA_ID_TIMECODESCALE 0x2AD7B1
53 #define MATROSKA_ID_DURATION 0x4489
54 #define MATROSKA_ID_WRITINGAPP 0x5741
55 #define MATROSKA_ID_MUXINGAPP 0x4D80
56 #define MATROSKA_ID_DATEUTC 0x4461
58 /* ID in the tracks master */
59 #define MATROSKA_ID_TRACKENTRY 0xAE
61 /* IDs in the trackentry master */
62 #define MATROSKA_ID_TRACKNUMBER 0xD7
63 #define MATROSKA_ID_TRACKUID 0x73C5
64 #define MATROSKA_ID_TRACKTYPE 0x83
65 #define MATROSKA_ID_TRACKAUDIO 0xE1
66 #define MATROSKA_ID_TRACKVIDEO 0xE0
67 #define MATROSKA_ID_CODECID 0x86
68 #define MATROSKA_ID_CODECPRIVATE 0x63A2
69 #define MATROSKA_ID_CODECNAME 0x258688
70 #define MATROSKA_ID_CODECINFOURL 0x3B4040
71 #define MATROSKA_ID_CODECDOWNLOADURL 0x26B240
72 #define MATROSKA_ID_TRACKNAME 0x536E
73 #define MATROSKA_ID_TRACKLANGUAGE 0x22B59C
74 #define MATROSKA_ID_TRACKFLAGENABLED 0xB9
75 #define MATROSKA_ID_TRACKFLAGDEFAULT 0x88
76 #define MATROSKA_ID_TRACKFLAGLACING 0x9C
77 #define MATROSKA_ID_TRACKMINCACHE 0x6DE7
78 #define MATROSKA_ID_TRACKMAXCACHE 0x6DF8
79 #define MATROSKA_ID_TRACKDEFAULTDURATION 0x23E383
80 #define MATROSKA_ID_TRACKENCODINGS 0x6D80
82 /* IDs in the trackaudio master */
83 #define MATROSKA_ID_AUDIOSAMPLINGFREQ 0xB5
84 #define MATROSKA_ID_AUDIOBITDEPTH 0x6264
85 #define MATROSKA_ID_AUDIOCHANNELS 0x9F
87 /* IDs in the trackvideo master */
88 #define MATROSKA_ID_VIDEOFRAMERATE 0x2383E3
89 #define MATROSKA_ID_VIDEODISPLAYWIDTH 0x54B0
90 #define MATROSKA_ID_VIDEODISPLAYHEIGHT 0x54BA
91 #define MATROSKA_ID_VIDEOPIXELWIDTH 0xB0
92 #define MATROSKA_ID_VIDEOPIXELHEIGHT 0xBA
93 #define MATROSKA_ID_VIDEOFLAGINTERLACED 0x9A
94 #define MATROSKA_ID_VIDEOSTEREOMODE 0x53B9
95 #define MATROSKA_ID_VIDEODISPLAYUNIT 0x54B2
96 #define MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
97 #define MATROSKA_ID_VIDEOCOLOURSPACE 0x2EB524
98 #define MATROSKA_ID_VIDEOGAMMA 0x2FB523
100 /* IDs in the trackencodings master */
101 #define MATROSKA_ID_CONTENTENCODING 0x6240
102 #define MATROSKA_ID_CONTENTENCODINGORDER 0x5031
103 #define MATROSKA_ID_CONTENTENCODINGSCOPE 0x5032
104 #define MATROSKA_ID_CONTENTENCODINGTYPE 0x5033
105 #define MATROSKA_ID_CONTENTCOMPRESSION 0x5034
106 #define MATROSKA_ID_CONTENTCOMPALGO 0x4254
107 #define MATROSKA_ID_CONTENTCOMPSETTINGS 0x4255
109 /* ID in the cues master */
110 #define MATROSKA_ID_POINTENTRY 0xBB
112 /* IDs in the pointentry master */
113 #define MATROSKA_ID_CUETIME 0xB3
114 #define MATROSKA_ID_CUETRACKPOSITION 0xB7
116 /* IDs in the cuetrackposition master */
117 #define MATROSKA_ID_CUETRACK 0xF7
118 #define MATROSKA_ID_CUECLUSTERPOSITION 0xF1
120 /* IDs in the seekhead master */
121 #define MATROSKA_ID_SEEKENTRY 0x4DBB
123 /* IDs in the seekpoint master */
124 #define MATROSKA_ID_SEEKID 0x53AB
125 #define MATROSKA_ID_SEEKPOSITION 0x53AC
127 /* IDs in the chapters master */
128 #define MATROSKA_ID_EDITIONENTRY 0x45B9
129 #define MATROSKA_ID_CHAPTERATOM 0xB6
130 #define MATROSKA_ID_CHAPTERTIMESTART 0x91
131 #define MATROSKA_ID_CHAPTERTIMEEND 0x92
132 #define MATROSKA_ID_CHAPTERDISPLAY 0x80
133 #define MATROSKA_ID_CHAPSTRING 0x85
135 /* IDs in the cluster master */
136 #define MATROSKA_ID_CLUSTERTIMECODE 0xE7
137 #define MATROSKA_ID_BLOCKGROUP 0xA0
139 /* IDs in the blockgroup master */
140 #define MATROSKA_ID_BLOCKDURATION 0x9B
141 #define MATROSKA_ID_BLOCK 0xA1
142 #define MATROSKA_ID_SIMPLEBLOCK 0xA3
143 #define MATROSKA_ID_REFERENCEBLOCK 0xFB
145 /* IDs in the attachments master */
146 #define MATROSKA_ID_ATTACHEDFILE 0x61A7
147 #define MATROSKA_ID_FILENAME 0x466E
148 #define MATROSKA_ID_FILEMIMETYPE 0x4660
149 #define MATROSKA_ID_FILEDATA 0x465C
150 #define MATROSKA_ID_FILEUID 0x46AE
152 /* matroska track types */
153 #define MATROSKA_TRACK_VIDEO 0x01 /* rectangle-shaped pictures aka video */
154 #define MATROSKA_TRACK_AUDIO 0x02 /* anything you can hear */
155 #define MATROSKA_TRACK_COMPLEX 0x03 /* audio+video in same track used by DV */
156 #define MATROSKA_TRACK_LOGO 0x10 /* overlay-pictures displayed over video*/
157 #define MATROSKA_TRACK_SUBTITLE 0x11 /* text-subtitles */
158 #define MATROSKA_TRACK_CONTROL 0x20 /* control-codes for menu or other stuff*/
160 /* matroska subtitle types */
161 #define MATROSKA_SUBTYPE_UNKNOWN 0
162 #define MATROSKA_SUBTYPE_TEXT 1
163 #define MATROSKA_SUBTYPE_SSA 2
164 #define MATROSKA_SUBTYPE_VOBSUB 3
167 #define UINT64_MAX 18446744073709551615ULL
171 #define INT64_MAX 9223372036854775807LL
174 #define EBML_UINT_INVALID UINT64_MAX
175 #define EBML_INT_INVALID INT64_MAX
176 #define EBML_FLOAT_INVALID -1000000000.0
179 uint32_t ebml_read_id (stream_t
*s
, int *length
);
180 uint64_t ebml_read_vlen_uint (uint8_t *buffer
, int *length
);
181 int64_t ebml_read_vlen_int (uint8_t *buffer
, int *length
);
182 uint64_t ebml_read_length (stream_t
*s
, int *length
);
183 uint64_t ebml_read_uint (stream_t
*s
, uint64_t *length
);
184 int64_t ebml_read_int (stream_t
*s
, uint64_t *length
);
185 long double ebml_read_float (stream_t
*s
, uint64_t *length
);
186 char *ebml_read_ascii (stream_t
*s
, uint64_t *length
);
187 char *ebml_read_utf8 (stream_t
*s
, uint64_t *length
);
188 int ebml_read_skip (stream_t
*s
, uint64_t *length
);
189 uint32_t ebml_read_master (stream_t
*s
, uint64_t *length
);
190 char *ebml_read_header (stream_t
*s
, int *version
);
192 #endif /* MPLAYER_EBML_H */