mkv: Add support for Spherical Video elements
[libav.git] / libavformat / matroska.h
1 /*
2 * Matroska constants
3 * Copyright (c) 2003-2004 The FFmpeg project
4 *
5 * This file is part of Libav.
6 *
7 * Libav is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * Libav is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with Libav; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #ifndef AVFORMAT_MATROSKA_H
23 #define AVFORMAT_MATROSKA_H
24
25 #include "libavcodec/avcodec.h"
26 #include "metadata.h"
27 #include "internal.h"
28
29 /* EBML version supported */
30 #define EBML_VERSION 1
31
32 /* top-level master-IDs */
33 #define EBML_ID_HEADER 0x1A45DFA3
34
35 /* IDs in the HEADER master */
36 #define EBML_ID_EBMLVERSION 0x4286
37 #define EBML_ID_EBMLREADVERSION 0x42F7
38 #define EBML_ID_EBMLMAXIDLENGTH 0x42F2
39 #define EBML_ID_EBMLMAXSIZELENGTH 0x42F3
40 #define EBML_ID_DOCTYPE 0x4282
41 #define EBML_ID_DOCTYPEVERSION 0x4287
42 #define EBML_ID_DOCTYPEREADVERSION 0x4285
43
44 /* general EBML types */
45 #define EBML_ID_VOID 0xEC
46 #define EBML_ID_CRC32 0xBF
47
48 /*
49 * Matroska element IDs, max. 32 bits
50 */
51
52 /* toplevel segment */
53 #define MATROSKA_ID_SEGMENT 0x18538067
54
55 /* Matroska top-level master IDs */
56 #define MATROSKA_ID_INFO 0x1549A966
57 #define MATROSKA_ID_TRACKS 0x1654AE6B
58 #define MATROSKA_ID_CUES 0x1C53BB6B
59 #define MATROSKA_ID_TAGS 0x1254C367
60 #define MATROSKA_ID_SEEKHEAD 0x114D9B74
61 #define MATROSKA_ID_ATTACHMENTS 0x1941A469
62 #define MATROSKA_ID_CLUSTER 0x1F43B675
63 #define MATROSKA_ID_CHAPTERS 0x1043A770
64
65 /* IDs in the info master */
66 #define MATROSKA_ID_TIMECODESCALE 0x2AD7B1
67 #define MATROSKA_ID_DURATION 0x4489
68 #define MATROSKA_ID_TITLE 0x7BA9
69 #define MATROSKA_ID_WRITINGAPP 0x5741
70 #define MATROSKA_ID_MUXINGAPP 0x4D80
71 #define MATROSKA_ID_DATEUTC 0x4461
72 #define MATROSKA_ID_SEGMENTUID 0x73A4
73
74 /* ID in the tracks master */
75 #define MATROSKA_ID_TRACKENTRY 0xAE
76
77 /* IDs in the trackentry master */
78 #define MATROSKA_ID_TRACKNUMBER 0xD7
79 #define MATROSKA_ID_TRACKUID 0x73C5
80 #define MATROSKA_ID_TRACKTYPE 0x83
81 #define MATROSKA_ID_TRACKAUDIO 0xE1
82 #define MATROSKA_ID_TRACKVIDEO 0xE0
83 #define MATROSKA_ID_CODECID 0x86
84 #define MATROSKA_ID_CODECPRIVATE 0x63A2
85 #define MATROSKA_ID_CODECNAME 0x258688
86 #define MATROSKA_ID_CODECINFOURL 0x3B4040
87 #define MATROSKA_ID_CODECDOWNLOADURL 0x26B240
88 #define MATROSKA_ID_CODECDECODEALL 0xAA
89 #define MATROSKA_ID_CODECDELAY 0x56AA
90 #define MATROSKA_ID_TRACKNAME 0x536E
91 #define MATROSKA_ID_TRACKLANGUAGE 0x22B59C
92 #define MATROSKA_ID_TRACKFLAGENABLED 0xB9
93 #define MATROSKA_ID_TRACKFLAGDEFAULT 0x88
94 #define MATROSKA_ID_TRACKFLAGFORCED 0x55AA
95 #define MATROSKA_ID_TRACKFLAGLACING 0x9C
96 #define MATROSKA_ID_TRACKMINCACHE 0x6DE7
97 #define MATROSKA_ID_TRACKMAXCACHE 0x6DF8
98 #define MATROSKA_ID_TRACKDEFAULTDURATION 0x23E383
99 #define MATROSKA_ID_TRACKCONTENTENCODINGS 0x6D80
100 #define MATROSKA_ID_TRACKCONTENTENCODING 0x6240
101 #define MATROSKA_ID_TRACKTIMECODESCALE 0x23314F
102 #define MATROSKA_ID_TRACKMAXBLKADDID 0x55EE
103
104 /* IDs in the trackvideo master */
105 #define MATROSKA_ID_VIDEOFRAMERATE 0x2383E3
106 #define MATROSKA_ID_VIDEODISPLAYWIDTH 0x54B0
107 #define MATROSKA_ID_VIDEODISPLAYHEIGHT 0x54BA
108 #define MATROSKA_ID_VIDEOPIXELWIDTH 0xB0
109 #define MATROSKA_ID_VIDEOPIXELHEIGHT 0xBA
110 #define MATROSKA_ID_VIDEOPIXELCROPB 0x54AA
111 #define MATROSKA_ID_VIDEOPIXELCROPT 0x54BB
112 #define MATROSKA_ID_VIDEOPIXELCROPL 0x54CC
113 #define MATROSKA_ID_VIDEOPIXELCROPR 0x54DD
114 #define MATROSKA_ID_VIDEODISPLAYUNIT 0x54B2
115 #define MATROSKA_ID_VIDEOFLAGINTERLACED 0x9A
116 #define MATROSKA_ID_VIDEOFIELDORDER 0x9D
117 #define MATROSKA_ID_VIDEOSTEREOMODE 0x53B8
118 #define MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
119 #define MATROSKA_ID_VIDEOCOLORSPACE 0x2EB524
120
121 #define MATROSKA_ID_VIDEOPROJECTION 0x7670
122 #define MATROSKA_ID_VIDEOPROJECTIONTYPE 0x7671
123 #define MATROSKA_ID_VIDEOPROJECTIONPRIVATE 0x7672
124 #define MATROSKA_ID_VIDEOPROJECTIONPOSEYAW 0x7673
125 #define MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH 0x7674
126 #define MATROSKA_ID_VIDEOPROJECTIONPOSEROLL 0x7675
127
128 /* IDs in the trackaudio master */
129 #define MATROSKA_ID_AUDIOSAMPLINGFREQ 0xB5
130 #define MATROSKA_ID_AUDIOOUTSAMPLINGFREQ 0x78B5
131
132 #define MATROSKA_ID_AUDIOBITDEPTH 0x6264
133 #define MATROSKA_ID_AUDIOCHANNELS 0x9F
134
135 /* IDs in the content encoding master */
136 #define MATROSKA_ID_ENCODINGORDER 0x5031
137 #define MATROSKA_ID_ENCODINGSCOPE 0x5032
138 #define MATROSKA_ID_ENCODINGTYPE 0x5033
139 #define MATROSKA_ID_ENCODINGCOMPRESSION 0x5034
140 #define MATROSKA_ID_ENCODINGCOMPALGO 0x4254
141 #define MATROSKA_ID_ENCODINGCOMPSETTINGS 0x4255
142
143 /* ID in the cues master */
144 #define MATROSKA_ID_POINTENTRY 0xBB
145
146 /* IDs in the pointentry master */
147 #define MATROSKA_ID_CUETIME 0xB3
148 #define MATROSKA_ID_CUETRACKPOSITION 0xB7
149
150 /* IDs in the cuetrackposition master */
151 #define MATROSKA_ID_CUETRACK 0xF7
152 #define MATROSKA_ID_CUECLUSTERPOSITION 0xF1
153 #define MATROSKA_ID_CUEBLOCKNUMBER 0x5378
154
155 /* IDs in the tags master */
156 #define MATROSKA_ID_TAG 0x7373
157 #define MATROSKA_ID_SIMPLETAG 0x67C8
158 #define MATROSKA_ID_TAGNAME 0x45A3
159 #define MATROSKA_ID_TAGSTRING 0x4487
160 #define MATROSKA_ID_TAGLANG 0x447A
161 #define MATROSKA_ID_TAGDEFAULT 0x4484
162 #define MATROSKA_ID_TAGDEFAULT_BUG 0x44B4
163 #define MATROSKA_ID_TAGTARGETS 0x63C0
164 #define MATROSKA_ID_TAGTARGETS_TYPE 0x63CA
165 #define MATROSKA_ID_TAGTARGETS_TYPEVALUE 0x68CA
166 #define MATROSKA_ID_TAGTARGETS_TRACKUID 0x63C5
167 #define MATROSKA_ID_TAGTARGETS_CHAPTERUID 0x63C4
168 #define MATROSKA_ID_TAGTARGETS_ATTACHUID 0x63C6
169
170 /* IDs in the seekhead master */
171 #define MATROSKA_ID_SEEKENTRY 0x4DBB
172
173 /* IDs in the seekpoint master */
174 #define MATROSKA_ID_SEEKID 0x53AB
175 #define MATROSKA_ID_SEEKPOSITION 0x53AC
176
177 /* IDs in the cluster master */
178 #define MATROSKA_ID_CLUSTERTIMECODE 0xE7
179 #define MATROSKA_ID_CLUSTERPOSITION 0xA7
180 #define MATROSKA_ID_CLUSTERPREVSIZE 0xAB
181 #define MATROSKA_ID_BLOCKGROUP 0xA0
182 #define MATROSKA_ID_SIMPLEBLOCK 0xA3
183
184 /* IDs in the blockgroup master */
185 #define MATROSKA_ID_BLOCK 0xA1
186 #define MATROSKA_ID_BLOCKDURATION 0x9B
187 #define MATROSKA_ID_BLOCKREFERENCE 0xFB
188 #define MATROSKA_ID_CODECSTATE 0xA4
189
190 /* IDs in the attachments master */
191 #define MATROSKA_ID_ATTACHEDFILE 0x61A7
192 #define MATROSKA_ID_FILEDESC 0x467E
193 #define MATROSKA_ID_FILENAME 0x466E
194 #define MATROSKA_ID_FILEMIMETYPE 0x4660
195 #define MATROSKA_ID_FILEDATA 0x465C
196 #define MATROSKA_ID_FILEUID 0x46AE
197
198 /* IDs in the chapters master */
199 #define MATROSKA_ID_EDITIONENTRY 0x45B9
200 #define MATROSKA_ID_CHAPTERATOM 0xB6
201 #define MATROSKA_ID_CHAPTERTIMESTART 0x91
202 #define MATROSKA_ID_CHAPTERTIMEEND 0x92
203 #define MATROSKA_ID_CHAPTERDISPLAY 0x80
204 #define MATROSKA_ID_CHAPSTRING 0x85
205 #define MATROSKA_ID_CHAPLANG 0x437C
206 #define MATROSKA_ID_EDITIONUID 0x45BC
207 #define MATROSKA_ID_EDITIONFLAGHIDDEN 0x45BD
208 #define MATROSKA_ID_EDITIONFLAGDEFAULT 0x45DB
209 #define MATROSKA_ID_EDITIONFLAGORDERED 0x45DD
210 #define MATROSKA_ID_CHAPTERUID 0x73C4
211 #define MATROSKA_ID_CHAPTERFLAGHIDDEN 0x98
212 #define MATROSKA_ID_CHAPTERFLAGENABLED 0x4598
213 #define MATROSKA_ID_CHAPTERPHYSEQUIV 0x63C3
214
215 typedef enum {
216 MATROSKA_TRACK_TYPE_NONE = 0x0,
217 MATROSKA_TRACK_TYPE_VIDEO = 0x1,
218 MATROSKA_TRACK_TYPE_AUDIO = 0x2,
219 MATROSKA_TRACK_TYPE_COMPLEX = 0x3,
220 MATROSKA_TRACK_TYPE_LOGO = 0x10,
221 MATROSKA_TRACK_TYPE_SUBTITLE = 0x11,
222 MATROSKA_TRACK_TYPE_CONTROL = 0x20,
223 } MatroskaTrackType;
224
225 typedef enum {
226 MATROSKA_TRACK_ENCODING_COMP_ZLIB = 0,
227 MATROSKA_TRACK_ENCODING_COMP_BZLIB = 1,
228 MATROSKA_TRACK_ENCODING_COMP_LZO = 2,
229 MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP = 3,
230 } MatroskaTrackEncodingCompAlgo;
231
232 typedef enum {
233 MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED = 0,
234 MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED = 1,
235 MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE = 2
236 } MatroskaVideoInterlaceFlag;
237
238 typedef enum {
239 MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE = 0,
240 MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
241 MATROSKA_VIDEO_FIELDORDER_TT = 1,
242 MATROSKA_VIDEO_FIELDORDER_BB = 6,
243 MATROSKA_VIDEO_FIELDORDER_TB = 9,
244 MATROSKA_VIDEO_FIELDORDER_BT = 14,
245 } MatroskaVideoFieldOrder;
246
247 typedef enum {
248 MATROSKA_VIDEO_STEREOMODE_TYPE_MONO = 0,
249 MATROSKA_VIDEO_STEREOMODE_TYPE_LEFT_RIGHT = 1,
250 MATROSKA_VIDEO_STEREOMODE_TYPE_BOTTOM_TOP = 2,
251 MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM = 3,
252 MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_RL = 4,
253 MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_LR = 5,
254 MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_RL = 6,
255 MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_LR = 7,
256 MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_RL = 8,
257 MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_LR = 9,
258 MATROSKA_VIDEO_STEREOMODE_TYPE_ANAGLYPH_CYAN_RED = 10,
259 MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT = 11,
260 MATROSKA_VIDEO_STEREOMODE_TYPE_ANAGLYPH_GREEN_MAG = 12,
261 MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR = 13,
262 MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_RL = 14,
263 MATROSKA_VIDEO_STEREOMODE_TYPE_NB,
264 } MatroskaVideoStereoModeType;
265
266 typedef enum {
267 MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR = 0,
268 MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR = 1,
269 MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP = 2,
270 MATROSKA_VIDEO_PROJECTION_TYPE_MESH = 3,
271 } MatroskaVideoProjectionType;
272
273 /*
274 * Matroska Codec IDs, strings
275 */
276
277 typedef struct CodecTags{
278 char str[20];
279 enum AVCodecID id;
280 }CodecTags;
281
282 /* max. depth in the EBML tree structure */
283 #define EBML_MAX_DEPTH 16
284
285 extern const CodecTags ff_mkv_codec_tags[];
286 extern const CodecMime ff_mkv_mime_tags[];
287 extern const CodecMime ff_mkv_image_mime_tags[];
288 extern const AVMetadataConv ff_mkv_metadata_conv[];
289
290 int ff_mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mode);
291
292 #endif /* AVFORMAT_MATROSKA_H */