• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer Matroska muxer/demuxer
2  * (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  *
4  * matroska-ids.h: matroska file/stream data IDs
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef __GST_MATROSKA_IDS_H__
23 #define __GST_MATROSKA_IDS_H__
24 
25 #include <gst/gst.h>
26 #include <gst/video/video-info.h>
27 
28 #include "ebml-ids.h"
29 
30 /*
31  * EBML DocType.
32  */
33 
34 #define GST_MATROSKA_DOCTYPE_MATROSKA              "matroska"
35 #define GST_MATROSKA_DOCTYPE_WEBM                  "webm"
36 
37 /*
38  * Matroska element IDs. max. 32-bit.
39  */
40 
41 /* toplevel Segment */
42 #define GST_MATROSKA_ID_SEGMENT                    0x18538067
43 
44 /* matroska top-level master IDs, childs of Segment */
45 #define GST_MATROSKA_ID_SEGMENTINFO                0x1549A966
46 #define GST_MATROSKA_ID_TRACKS                     0x1654AE6B
47 #define GST_MATROSKA_ID_CUES                       0x1C53BB6B
48 #define GST_MATROSKA_ID_TAGS                       0x1254C367
49 #define GST_MATROSKA_ID_SEEKHEAD                   0x114D9B74
50 #define GST_MATROSKA_ID_CLUSTER                    0x1F43B675
51 #define GST_MATROSKA_ID_ATTACHMENTS                0x1941A469
52 #define GST_MATROSKA_ID_CHAPTERS                   0x1043A770
53 
54 /* IDs in the SegmentInfo master */
55 #define GST_MATROSKA_ID_TIMECODESCALE              0x2AD7B1
56 #define GST_MATROSKA_ID_DURATION                   0x4489
57 #define GST_MATROSKA_ID_WRITINGAPP                 0x5741
58 #define GST_MATROSKA_ID_MUXINGAPP                  0x4D80
59 #define GST_MATROSKA_ID_DATEUTC                    0x4461
60 #define GST_MATROSKA_ID_SEGMENTUID                 0x73A4
61 #define GST_MATROSKA_ID_SEGMENTFILENAME            0x7384
62 #define GST_MATROSKA_ID_PREVUID                    0x3CB923
63 #define GST_MATROSKA_ID_PREVFILENAME               0x3C83AB
64 #define GST_MATROSKA_ID_NEXTUID                    0x3EB923
65 #define GST_MATROSKA_ID_NEXTFILENAME               0x3E83BB
66 #define GST_MATROSKA_ID_TITLE                      0x7BA9
67 #define GST_MATROSKA_ID_SEGMENTFAMILY              0x4444
68 #define GST_MATROSKA_ID_CHAPTERTRANSLATE           0x6924
69 
70 /* IDs in the ChapterTranslate master */
71 #define GST_MATROSKA_ID_CHAPTERTRANSLATEEDITIONUID 0x69FC
72 #define GST_MATROSKA_ID_CHAPTERTRANSLATECODEC      0x69BF
73 #define GST_MATROSKA_ID_CHAPTERTRANSLATEID         0x69A5
74 
75 /* ID in the Tracks master */
76 #define GST_MATROSKA_ID_TRACKENTRY                 0xAE
77 
78 /* IDs in the TrackEntry master */
79 #define GST_MATROSKA_ID_TRACKNUMBER                0xD7
80 #define GST_MATROSKA_ID_TRACKUID                   0x73C5
81 #define GST_MATROSKA_ID_TRACKTYPE                  0x83
82 #define GST_MATROSKA_ID_TRACKAUDIO                 0xE1
83 #define GST_MATROSKA_ID_TRACKVIDEO                 0xE0
84 #define GST_MATROSKA_ID_CONTENTENCODINGS           0x6D80
85 #define GST_MATROSKA_ID_CODECID                    0x86
86 #define GST_MATROSKA_ID_CODECPRIVATE               0x63A2
87 #define GST_MATROSKA_ID_CODECNAME                  0x258688
88 #define GST_MATROSKA_ID_TRACKNAME                  0x536E
89 #define GST_MATROSKA_ID_TRACKLANGUAGE              0x22B59C
90 #define GST_MATROSKA_ID_TRACKFLAGENABLED           0xB9
91 #define GST_MATROSKA_ID_TRACKFLAGDEFAULT           0x88
92 #define GST_MATROSKA_ID_TRACKFLAGFORCED            0x55AA
93 #define GST_MATROSKA_ID_TRACKFLAGLACING            0x9C
94 #define GST_MATROSKA_ID_TRACKMINCACHE              0x6DE7
95 #define GST_MATROSKA_ID_TRACKMAXCACHE              0x6DF8
96 #define GST_MATROSKA_ID_TRACKDEFAULTDURATION       0x23E383
97 #define GST_MATROSKA_ID_TRACKTIMECODESCALE         0x23314F
98 #define GST_MATROSKA_ID_MAXBLOCKADDITIONID         0x55EE
99 #define GST_MATROSKA_ID_TRACKATTACHMENTLINK        0x7446
100 #define GST_MATROSKA_ID_TRACKOVERLAY               0x6FAB
101 #define GST_MATROSKA_ID_TRACKTRANSLATE             0x6624
102 /* semi-draft */
103 #define GST_MATROSKA_ID_TRACKOFFSET                0x537F
104 /* semi-draft */
105 #define GST_MATROSKA_ID_CODECSETTINGS              0x3A9697
106 /* semi-draft */
107 #define GST_MATROSKA_ID_CODECINFOURL               0x3B4040
108 /* semi-draft */
109 #define GST_MATROSKA_ID_CODECDOWNLOADURL           0x26B240
110 /* semi-draft */
111 #define GST_MATROSKA_ID_CODECDECODEALL             0xAA
112 #define GST_MATROSKA_ID_SEEKPREROLL                0x56BB
113 #define GST_MATROSKA_ID_CODECDELAY                 0x56AA
114 
115 /* IDs in the TrackTranslate master */
116 #define GST_MATROSKA_ID_TRACKTRANSLATEEDITIONUID   0x66FC
117 #define GST_MATROSKA_ID_TRACKTRANSLATECODEC        0x66BF
118 #define GST_MATROSKA_ID_TRACKTRANSLATETRACKID      0x66A5
119 
120 
121 /* IDs in the TrackVideo master */
122 /* NOTE: This one is here only for backward compatibility.
123  * Use _TRACKDEFAULDURATION */
124 #define GST_MATROSKA_ID_VIDEOFRAMERATE             0x2383E3
125 #define GST_MATROSKA_ID_VIDEODISPLAYWIDTH          0x54B0
126 #define GST_MATROSKA_ID_VIDEODISPLAYHEIGHT         0x54BA
127 #define GST_MATROSKA_ID_VIDEODISPLAYUNIT           0x54B2
128 #define GST_MATROSKA_ID_VIDEOPIXELWIDTH            0xB0
129 #define GST_MATROSKA_ID_VIDEOPIXELHEIGHT           0xBA
130 #define GST_MATROSKA_ID_VIDEOPIXELCROPBOTTOM       0x54AA
131 #define GST_MATROSKA_ID_VIDEOPIXELCROPTOP          0x54BB
132 #define GST_MATROSKA_ID_VIDEOPIXELCROPLEFT         0x54CC
133 #define GST_MATROSKA_ID_VIDEOPIXELCROPRIGHT        0x54DD
134 #define GST_MATROSKA_ID_VIDEOFLAGINTERLACED        0x9A
135 #define GST_MATROSKA_ID_VIDEOFIELDORDER            0x9D
136 /* semi-draft */
137 #define GST_MATROSKA_ID_VIDEOSTEREOMODE            0x53B8
138 #define GST_MATROSKA_ID_VIDEOALPHAMODE             0x53C0
139 #define GST_MATROSKA_ID_VIDEOASPECTRATIOTYPE       0x54B3
140 #define GST_MATROSKA_ID_VIDEOCOLOURSPACE           0x2EB524
141 /* semi-draft */
142 #define GST_MATROSKA_ID_VIDEOGAMMAVALUE            0x2FB523
143 
144 #define GST_MATROSKA_ID_VIDEOCOLOUR                0x55B0
145 /* IDs in the Colour master*/
146 #define GST_MATROSKA_ID_VIDEOMATRIXCOEFFICIENTS    0x55B1
147 #define GST_MATROSKA_ID_VIDEORANGE                 0x55B9
148 #define GST_MATROSKA_ID_VIDEOTRANSFERCHARACTERISTICS  0x55BA
149 #define GST_MATROSKA_ID_VIDEOPRIMARIES             0x55BB
150 #define GST_MATROSKA_ID_MAXCLL                     0x55BC
151 #define GST_MATROSKA_ID_MAXFALL                    0x55BD
152 #define GST_MATROSKA_ID_MASTERINGMETADATA          0x55D0
153 /* IDs in the MasteringMetadata */
154 #define GST_MATROSKA_ID_PRIMARYRCHROMATICITYX      0x55D1
155 #define GST_MATROSKA_ID_PRIMARYRCHROMATICITYY      0x55D2
156 #define GST_MATROSKA_ID_PRIMARYGCHROMATICITYX      0x55D3
157 #define GST_MATROSKA_ID_PRIMARYGCHROMATICITYY      0x55D4
158 #define GST_MATROSKA_ID_PRIMARYBCHROMATICITYX      0x55D5
159 #define GST_MATROSKA_ID_PRIMARYBCHROMATICITYY      0x55D6
160 #define GST_MATROSKA_ID_WHITEPOINTCHROMATICITYX    0x55D7
161 #define GST_MATROSKA_ID_WHITEPOINTCHROMATICITYY    0x55D8
162 #define GST_MATROSKA_ID_LUMINANCEMAX               0x55D9
163 #define GST_MATROSKA_ID_LUMINANCEMIN               0x55DA
164 
165 /* IDs in the TrackAudio master */
166 #define GST_MATROSKA_ID_AUDIOSAMPLINGFREQ          0xB5
167 #define GST_MATROSKA_ID_AUDIOBITDEPTH              0x6264
168 #define GST_MATROSKA_ID_AUDIOCHANNELS              0x9F
169 /* semi-draft */
170 #define GST_MATROSKA_ID_AUDIOCHANNELPOSITIONS      0x7D7B
171 #define GST_MATROSKA_ID_AUDIOOUTPUTSAMPLINGFREQ    0x78B5
172 
173 /* IDs in the TrackContentEncoding master */
174 #define GST_MATROSKA_ID_CONTENTENCODING            0x6240
175 
176 /* IDs in the ContentEncoding master */
177 #define GST_MATROSKA_ID_CONTENTENCODINGORDER       0x5031
178 #define GST_MATROSKA_ID_CONTENTENCODINGSCOPE       0x5032
179 #define GST_MATROSKA_ID_CONTENTENCODINGTYPE        0x5033
180 #define GST_MATROSKA_ID_CONTENTCOMPRESSION         0x5034
181 #define GST_MATROSKA_ID_CONTENTENCRYPTION          0x5035
182 
183 /* IDs in the ContentCompression master */
184 #define GST_MATROSKA_ID_CONTENTCOMPALGO            0x4254
185 #define GST_MATROSKA_ID_CONTENTCOMPSETTINGS        0x4255
186 
187 /* IDs in the ContentEncryption master */
188 #define GST_MATROSKA_ID_CONTENTENCALGO             0x47E1
189 #define GST_MATROSKA_ID_CONTENTENCKEYID            0x47E2
190 #define GST_MATROSKA_ID_CONTENTSIGNATURE           0x47E3
191 #define GST_MATROSKA_ID_CONTENTSIGKEYID            0x47E4
192 #define GST_MATROSKA_ID_CONTENTSIGALGO             0x47E5
193 #define GST_MATROSKA_ID_CONTENTSIGHASHALGO         0x47E6
194 /* Added in WebM spec */
195 #define GST_MATROSKA_ID_CONTENTENCAESSETTINGS      0x47E7
196 #define GST_MATROSKA_ID_AESSETTINGSCIPHERMODE      0x47E8
197 
198 /* ID in the CUEs master */
199 #define GST_MATROSKA_ID_POINTENTRY                 0xBB
200 
201 /* IDs in the pointentry master */
202 #define GST_MATROSKA_ID_CUETIME                    0xB3
203 #define GST_MATROSKA_ID_CUETRACKPOSITIONS          0xB7
204 
205 /* IDs in the CueTrackPositions master */
206 #define GST_MATROSKA_ID_CUETRACK                   0xF7
207 #define GST_MATROSKA_ID_CUECLUSTERPOSITION         0xF1
208 #define GST_MATROSKA_ID_CUEBLOCKNUMBER             0x5378
209 /* semi-draft */
210 #define GST_MATROSKA_ID_CUECODECSTATE              0xEA
211 /* semi-draft */
212 #define GST_MATROSKA_ID_CUEREFERENCE               0xDB
213 
214 /* IDs in the CueReference master */
215 /* semi-draft */
216 #define GST_MATROSKA_ID_CUEREFTIME                 0x96
217 /* semi-draft */
218 #define GST_MATROSKA_ID_CUEREFCLUSTER              0x97
219 /* semi-draft */
220 #define GST_MATROSKA_ID_CUEREFNUMBER               0x535F
221 /* semi-draft */
222 #define GST_MATROSKA_ID_CUEREFCODECSTATE           0xEB
223 
224 /* IDs in the Tags master */
225 #define GST_MATROSKA_ID_TAG                        0x7373
226 
227 /* in the Tag master */
228 #define GST_MATROSKA_ID_SIMPLETAG                  0x67C8
229 #define GST_MATROSKA_ID_TARGETS                    0x63C0
230 
231 /* in the SimpleTag master */
232 #define GST_MATROSKA_ID_TAGNAME                    0x45A3
233 #define GST_MATROSKA_ID_TAGSTRING                  0x4487
234 #define GST_MATROSKA_ID_TAGLANGUAGE                0x447A
235 #define GST_MATROSKA_ID_TAGDEFAULT                 0x4484
236 #define GST_MATROSKA_ID_TAGBINARY                  0x4485
237 
238 /* in the Targets master */
239 #define GST_MATROSKA_ID_TARGETTYPEVALUE            0x68CA
240 #define GST_MATROSKA_ID_TARGETTYPE                 0x63CA
241 #define GST_MATROSKA_ID_TARGETTRACKUID             0x63C5
242 #define GST_MATROSKA_ID_TARGETEDITIONUID           0x63C9
243 #define GST_MATROSKA_ID_TARGETCHAPTERUID           0x63C4
244 #define GST_MATROSKA_ID_TARGETATTACHMENTUID        0x63C6
245 
246 /* IDs in the SeekHead master */
247 #define GST_MATROSKA_ID_SEEKENTRY                  0x4DBB
248 
249 /* IDs in the SeekEntry master */
250 #define GST_MATROSKA_ID_SEEKID                     0x53AB
251 #define GST_MATROSKA_ID_SEEKPOSITION               0x53AC
252 
253 /* IDs in the Cluster master */
254 #define GST_MATROSKA_ID_CLUSTERTIMECODE            0xE7
255 #define GST_MATROSKA_ID_BLOCKGROUP                 0xA0
256 #define GST_MATROSKA_ID_SIMPLEBLOCK                0xA3
257 #define GST_MATROSKA_ID_REFERENCEBLOCK             0xFB
258 #define GST_MATROSKA_ID_POSITION                   0xA7
259 #define GST_MATROSKA_ID_PREVSIZE                   0xAB
260 /* semi-draft */
261 #define GST_MATROSKA_ID_ENCRYPTEDBLOCK             0xAF
262 #define GST_MATROSKA_ID_SILENTTRACKS               0x5854
263 
264 /* IDs in the SilentTracks master */
265 #define GST_MATROSKA_ID_SILENTTRACKNUMBER          0x58D7
266 
267 /* IDs in the BlockGroup master */
268 #define GST_MATROSKA_ID_BLOCK                      0xA1
269 #define GST_MATROSKA_ID_BLOCKDURATION              0x9B
270 /* semi-draft */
271 #define GST_MATROSKA_ID_BLOCKVIRTUAL               0xA2
272 #define GST_MATROSKA_ID_REFERENCEBLOCK             0xFB
273 #define GST_MATROSKA_ID_BLOCKADDITIONS             0x75A1
274 #define GST_MATROSKA_ID_REFERENCEPRIORITY          0xFA
275 /* semi-draft */
276 #define GST_MATROSKA_ID_REFERENCEVIRTUAL           0xFD
277 /* semi-draft */
278 #define GST_MATROSKA_ID_CODECSTATE                 0xA4
279 #define GST_MATROSKA_ID_SLICES                     0x8E
280 #define GST_MATROSKA_ID_DISCARDPADDING             0x75A2
281 
282 /* IDs in the BlockAdditions master */
283 #define GST_MATROSKA_ID_BLOCKMORE                  0xA6
284 
285 /* IDs in the BlockMore master */
286 #define GST_MATROSKA_ID_BLOCKADDID                 0xEE
287 #define GST_MATROSKA_ID_BLOCKADDITIONAL            0xA5
288 
289 /* IDs in the Slices master */
290 #define GST_MATROSKA_ID_TIMESLICE                  0xE8
291 
292 /* IDs in the TimeSlice master */
293 #define GST_MATROSKA_ID_LACENUMBER                 0xCC
294 /* semi-draft */
295 #define GST_MATROSKA_ID_FRAMENUMBER                0xCD
296 /* semi-draft */
297 #define GST_MATROSKA_ID_BLOCKADDITIONID            0xCB
298 /* semi-draft */
299 #define GST_MATROSKA_ID_TIMESLICEDELAY             0xCE
300 #define GST_MATROSKA_ID_TIMESLICEDURATION          0xCF
301 
302 /* IDs in the Attachments master */
303 #define GST_MATROSKA_ID_ATTACHEDFILE               0x61A7
304 
305 /* IDs in the AttachedFile master */
306 #define GST_MATROSKA_ID_FILEDESCRIPTION            0x467E
307 #define GST_MATROSKA_ID_FILENAME                   0x466E
308 #define GST_MATROSKA_ID_FILEMIMETYPE               0x4660
309 #define GST_MATROSKA_ID_FILEDATA                   0x465C
310 #define GST_MATROSKA_ID_FILEUID                    0x46AE
311 /* semi-draft */
312 #define GST_MATROSKA_ID_FILEREFERRAL               0x4675
313 
314 /* IDs in the Chapters master */
315 #define GST_MATROSKA_ID_EDITIONENTRY               0x45B9
316 
317 /* IDs in the EditionEntry master */
318 #define GST_MATROSKA_ID_EDITIONUID                 0x45BC
319 #define GST_MATROSKA_ID_EDITIONFLAGHIDDEN          0x45BD
320 #define GST_MATROSKA_ID_EDITIONFLAGDEFAULT         0x45DB
321 #define GST_MATROSKA_ID_EDITIONFLAGORDERED         0x45DD
322 #define GST_MATROSKA_ID_CHAPTERATOM                0xB6
323 
324 /* IDs in the ChapterAtom master */
325 #define GST_MATROSKA_ID_CHAPTERUID                 0x73C4
326 #define GST_MATROSKA_ID_CHAPTERSTRINGUID           0x5654
327 #define GST_MATROSKA_ID_CHAPTERTIMESTART           0x91
328 #define GST_MATROSKA_ID_CHAPTERTIMESTOP            0x92
329 #define GST_MATROSKA_ID_CHAPTERFLAGHIDDEN          0x98
330 #define GST_MATROSKA_ID_CHAPTERFLAGENABLED         0x4598
331 #define GST_MATROSKA_ID_CHAPTERSEGMENTUID          0x6E67
332 #define GST_MATROSKA_ID_CHAPTERSEGMENTEDITIONUID   0x6EBC
333 #define GST_MATROSKA_ID_CHAPTERPHYSICALEQUIV       0x63C3
334 #define GST_MATROSKA_ID_CHAPTERTRACK               0x8F
335 #define GST_MATROSKA_ID_CHAPTERDISPLAY             0x80
336 #define GST_MATROSKA_ID_CHAPPROCESS                0x6944
337 
338 /* IDs in the ChapProcess master */
339 #define GST_MATROSKA_ID_CHAPPROCESSCODECID         0x6955
340 #define GST_MATROSKA_ID_CHAPPROCESSPRIVATE         0x450D
341 #define GST_MATROSKA_ID_CHAPPROCESSCOMMAND         0x6911
342 
343 /* IDs in the ChapProcessCommand master */
344 #define GST_MATROSKA_ID_CHAPPROCESSTIME            0x6922
345 #define GST_MATROSKA_ID_CHAPPROCESSDATA            0x6933
346 
347 /* IDs in the ChapterDisplay master */
348 #define GST_MATROSKA_ID_CHAPSTRING                 0x85
349 #define GST_MATROSKA_ID_CHAPLANGUAGE               0x437C
350 #define GST_MATROSKA_ID_CHAPCOUNTRY                0x437E
351 
352 /* IDs in the ChapterTrack master */
353 #define GST_MATROSKA_ID_CHAPTERTRACKNUMBER         0x89
354 
355 /*
356  * Matroska Codec IDs. Strings.
357  */
358 
359 #define GST_MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC   "V_MS/VFW/FOURCC"
360 #define GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED "V_UNCOMPRESSED"
361 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP     "V_MPEG4/ISO/SP"
362 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP    "V_MPEG4/ISO/ASP"
363 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AP     "V_MPEG4/ISO/AP"
364 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AVC    "V_MPEG4/ISO/AVC"
365 #define GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3    "V_MPEG4/MS/V3"
366 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG1        "V_MPEG1"
367 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG2        "V_MPEG2"
368 /* FIXME: not (yet) in the spec! */
369 #define GST_MATROSKA_CODEC_ID_VIDEO_MJPEG        "V_MJPEG"
370 #define GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO1   "V_REAL/RV10"
371 #define GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO2   "V_REAL/RV20"
372 #define GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO3   "V_REAL/RV30"
373 #define GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO4   "V_REAL/RV40"
374 #define GST_MATROSKA_CODEC_ID_VIDEO_THEORA       "V_THEORA"
375 #define GST_MATROSKA_CODEC_ID_VIDEO_QUICKTIME    "V_QUICKTIME"
376 #define GST_MATROSKA_CODEC_ID_VIDEO_SNOW         "V_SNOW"
377 #define GST_MATROSKA_CODEC_ID_VIDEO_DIRAC        "V_DIRAC"
378 #define GST_MATROSKA_CODEC_ID_VIDEO_VP8          "V_VP8"
379 #define GST_MATROSKA_CODEC_ID_VIDEO_VP9          "V_VP9"
380 #define GST_MATROSKA_CODEC_ID_VIDEO_AV1          "V_AV1"
381 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEGH_HEVC   "V_MPEGH/ISO/HEVC"
382 #define GST_MATROSKA_CODEC_ID_VIDEO_PRORES       "V_PRORES"
383 #define GST_MATROSKA_CODEC_ID_VIDEO_FFV1         "V_FFV1"
384 
385 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1       "A_MPEG/L1"
386 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2       "A_MPEG/L2"
387 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3       "A_MPEG/L3"
388 #define GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE     "A_PCM/INT/BIG"
389 #define GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE     "A_PCM/INT/LIT"
390 #define GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT      "A_PCM/FLOAT/IEEE"
391 #define GST_MATROSKA_CODEC_ID_AUDIO_AC3            "A_AC3"
392 #define GST_MATROSKA_CODEC_ID_AUDIO_AC3_BSID9      "A_AC3/BSID9"
393 #define GST_MATROSKA_CODEC_ID_AUDIO_AC3_BSID10     "A_AC3/BSID10"
394 #define GST_MATROSKA_CODEC_ID_AUDIO_EAC3           "A_EAC3"
395 #define GST_MATROSKA_CODEC_ID_AUDIO_TRUEHD         "A_TRUEHD"
396 #define GST_MATROSKA_CODEC_ID_AUDIO_DTS            "A_DTS"
397 #define GST_MATROSKA_CODEC_ID_AUDIO_VORBIS         "A_VORBIS"
398 #define GST_MATROSKA_CODEC_ID_AUDIO_FLAC           "A_FLAC"
399 /* FIXME: not yet in the spec */
400 #define GST_MATROSKA_CODEC_ID_AUDIO_SPEEX          "A_SPEEX"
401 #define GST_MATROSKA_CODEC_ID_AUDIO_ACM            "A_MS/ACM"
402 #define GST_MATROSKA_CODEC_ID_AUDIO_TTA            "A_TTA1"
403 #define GST_MATROSKA_CODEC_ID_AUDIO_WAVPACK4       "A_WAVPACK4"
404 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_14_4      "A_REAL/14_4"
405 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_28_8      "A_REAL/28_8"
406 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_COOK      "A_REAL/COOK"
407 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_SIPR      "A_REAL/SIPR"
408 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_RALF      "A_REAL/RALF"
409 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_ATRC      "A_REAL/ATRC"
410 #define GST_MATROSKA_CODEC_ID_AUDIO_AAC            "A_AAC"
411 #define GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG2      "A_AAC/MPEG2/"
412 #define GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG4      "A_AAC/MPEG4/"
413 #define GST_MATROSKA_CODEC_ID_AUDIO_QUICKTIME_QDMC "A_QUICKTIME/QDMC"
414 #define GST_MATROSKA_CODEC_ID_AUDIO_QUICKTIME_QDM2 "A_QUICKTIME/QDM2"
415 #define GST_MATROSKA_CODEC_ID_AUDIO_OPUS           "A_OPUS"
416 /* Undefined for now:
417 #define GST_MATROSKA_CODEC_ID_AUDIO_MPC            "A_MPC"
418 */
419 
420 #define GST_MATROSKA_CODEC_ID_SUBTITLE_ASCII     "S_TEXT/ASCII"
421 #define GST_MATROSKA_CODEC_ID_SUBTITLE_UTF8      "S_TEXT/UTF8"
422 #define GST_MATROSKA_CODEC_ID_SUBTITLE_SSA       "S_TEXT/SSA"
423 #define GST_MATROSKA_CODEC_ID_SUBTITLE_ASS       "S_TEXT/ASS"
424 #define GST_MATROSKA_CODEC_ID_SUBTITLE_USF       "S_TEXT/USF"
425 #define GST_MATROSKA_CODEC_ID_SUBTITLE_VOBSUB    "S_VOBSUB"
426 #define GST_MATROSKA_CODEC_ID_SUBTITLE_HDMVPGS   "S_HDMV/PGS"
427 #define GST_MATROSKA_CODEC_ID_SUBTITLE_BMP       "S_IMAGE/BMP"
428 #define GST_MATROSKA_CODEC_ID_SUBTITLE_KATE      "S_KATE"
429 
430 /*
431  * Matroska tags. Strings.
432  */
433 
434 #define GST_MATROSKA_TAG_ID_TITLE    "TITLE"
435 #define GST_MATROSKA_TAG_ID_AUTHOR   "AUTHOR"
436 #define GST_MATROSKA_TAG_ID_ARTIST   "ARTIST"
437 #define GST_MATROSKA_TAG_ID_ALBUM    "ALBUM"
438 #define GST_MATROSKA_TAG_ID_COMMENTS "COMMENTS"
439 #define GST_MATROSKA_TAG_ID_COMMENT  "COMMENT"
440 #define GST_MATROSKA_TAG_ID_BITSPS   "BITSPS"
441 #define GST_MATROSKA_TAG_ID_BPS      "BPS"
442 #define GST_MATROSKA_TAG_ID_ENCODER  "ENCODER"
443 #define GST_MATROSKA_TAG_ID_ISRC     "ISRC"
444 #define GST_MATROSKA_TAG_ID_COPYRIGHT "COPYRIGHT"
445 #define GST_MATROSKA_TAG_ID_BPM       "BPM"
446 #define GST_MATROSKA_TAG_ID_TERMS_OF_USE "TERMS_OF_USE"
447 #define GST_MATROSKA_TAG_ID_DATE      "DATE"
448 #define GST_MATROSKA_TAG_ID_COMPOSER  "COMPOSER"
449 #define GST_MATROSKA_TAG_ID_LEAD_PERFORMER  "LEAD_PERFOMER"
450 #define GST_MATROSKA_TAG_ID_GENRE     "GENRE"
451 #define GST_MATROSKA_TAG_ID_TOTAL_PARTS "TOTAL_PARTS"
452 #define GST_MATROSKA_TAG_ID_PART_NUMBER "PART_NUMBER"
453 #define GST_MATROSKA_TAG_ID_SUBTITLE "SUBTITLE"
454 #define GST_MATROSKA_TAG_ID_ACCOMPANIMENT "ACCOMPANIMENT"
455 #define GST_MATROSKA_TAG_ID_LYRICS "LYRICS"
456 #define GST_MATROSKA_TAG_ID_CONDUCTOR "CONDUCTOR"
457 #define GST_MATROSKA_TAG_ID_ENCODED_BY "ENCODED_BY"
458 #define GST_MATROSKA_TAG_ID_DESCRIPTION "DESCRIPTION"
459 #define GST_MATROSKA_TAG_ID_KEYWORDS "KEYWORDS"
460 #define GST_MATROSKA_TAG_ID_DATE_RELEASED "DATE_RELEASED"
461 #define GST_MATROSKA_TAG_ID_DATE_RECORDED "DATE_RECORDED"
462 #define GST_MATROSKA_TAG_ID_DATE_ENCODED "DATE_ENCODED"
463 #define GST_MATROSKA_TAG_ID_DATE_TAGGED "DATE_TAGGED"
464 #define GST_MATROSKA_TAG_ID_DATE_DIGITIZED "DATE_DIGITIZED"
465 #define GST_MATROSKA_TAG_ID_DATE_WRITTEN "DATE_WRITTEN"
466 #define GST_MATROSKA_TAG_ID_DATE_PURCHASED "DATE_PURCHASED"
467 #define GST_MATROSKA_TAG_ID_RECORDING_LOCATION "RECORDING_LOCATION"
468 #define GST_MATROSKA_TAG_ID_PRODUCTION_COPYRIGHT "PRODUCTION_COPYRIGHT"
469 #define GST_MATROSKA_TAG_ID_LICENSE "LICENSE"
470 
471 /*
472  * TODO: add this tag & mappings
473  * "REPLAYGAIN_GAIN" -> GST_TAG_*_GAIN   see http://replaygain.hydrogenaudio.org/rg_data_format.html
474  * "REPLAYGAIN_PEAK" -> GST_TAG_*_PEAK   see http://replaygain.hydrogenaudio.org/peak_data_format.html
475  * both are depending on the target (track, album?)
476  *
477  * "TOTAL_PARTS" -> GST_TAG_TRACK_COUNT    depending on target
478  * "PART_NUMBER" -> GST_TAG_TRACK_NUMBER   depending on target
479  *
480  * "SORT_WITH" -> nested in other elements, GST_TAG_TITLE_SORTNAME, etc
481  *
482  * TODO: maybe add custom gstreamer tags for other standard matroska tags,
483  * see http://matroska.org/technical/specs/tagging/index.html
484  *
485  * TODO: handle tag targets and nesting correctly
486  */
487 
488 /*
489  * Enumerations for various types (mapping from binary
490  * value to what it actually means).
491  */
492 
493 typedef enum {
494   GST_MATROSKA_TRACK_TYPE_VIDEO    = 0x1,
495   GST_MATROSKA_TRACK_TYPE_AUDIO    = 0x2,
496   GST_MATROSKA_TRACK_TYPE_COMPLEX  = 0x3,
497   GST_MATROSKA_TRACK_TYPE_LOGO     = 0x10,
498   GST_MATROSKA_TRACK_TYPE_SUBTITLE = 0x11,
499   GST_MATROSKA_TRACK_TYPE_BUTTONS  = 0x12,
500   GST_MATROSKA_TRACK_TYPE_CONTROL  = 0x20,
501 } GstMatroskaTrackType;
502 
503 typedef enum {
504   GST_MATROSKA_ASPECT_RATIO_MODE_FREE  = 0x0,
505   GST_MATROSKA_ASPECT_RATIO_MODE_KEEP  = 0x1,
506   GST_MATROSKA_ASPECT_RATIO_MODE_FIXED = 0x2,
507 } GstMatroskaAspectRatioMode;
508 
509 /*
510  * These aren't in any way "matroska-form" things,
511  * it's just something I use in the muxer/demuxer.
512  */
513 
514 typedef enum {
515   GST_MATROSKA_TRACK_ENABLED = (1<<0),
516   GST_MATROSKA_TRACK_DEFAULT = (1<<1),
517   GST_MATROSKA_TRACK_LACING  = (1<<2),
518   GST_MATROSKA_TRACK_FORCED  = (1<<3),
519   GST_MATROSKA_TRACK_SHIFT   = (1<<16)
520 } GstMatroskaTrackFlags;
521 
522 typedef enum {
523   GST_MATROSKA_INTERLACE_MODE_UNKNOWN = 0,
524   GST_MATROSKA_INTERLACE_MODE_INTERLACED = 1,
525   GST_MATROSKA_INTERLACE_MODE_PROGRESSIVE = 2,
526 } GstMatroskaInterlaceMode;
527 
528 typedef enum {
529   GST_MATROSKA_STEREO_MODE_SBS_LR      = 0x1,
530   GST_MATROSKA_STEREO_MODE_TB_RL       = 0x2,
531   GST_MATROSKA_STEREO_MODE_TB_LR       = 0x3,
532   GST_MATROSKA_STEREO_MODE_CHECKER_RL  = 0x4,
533   GST_MATROSKA_STEREO_MODE_CHECKER_LR  = 0x5,
534   GST_MATROSKA_STEREO_MODE_SBS_RL      = 0x9,
535   GST_MATROSKA_STEREO_MODE_FBF_LR      = 0xD,
536   GST_MATROSKA_STEREO_MODE_FBF_RL      = 0xE
537 } GstMatroskaStereoMode;
538 
539 typedef enum {
540   GST_MATROSKA_ENCODING_COMPRESSION = 0x00,
541   GST_MATROSKA_ENCODING_ENCRYPTION  = 0x01
542 } GstMatroskaEncodingType;
543 
544 /* WebM spec */
545 typedef enum {
546   GST_MATROSKA_BLOCK_ENCRYPTED   = 0x01,
547   GST_MATROSKA_BLOCK_PARTITIONED = 0x02
548 } GstMatroskaEncryptedBlockFlags;
549 
550 typedef struct _GstMatroskaTrackContext GstMatroskaTrackContext;
551 
552 /* TODO: check if all fields are used */
553 struct _GstMatroskaTrackContext {
554   GstPad       *pad;
555   GstCaps      *caps;
556   guint         index;
557   /* reverse playback */
558   GstClockTime  from_time;
559   gint64                   from_offset;
560   gint64                   to_offset;
561 
562   GArray       *index_table;
563 
564   gint          index_writer_id;
565 
566   /* some often-used info */
567   gchar        *codec_id, *codec_name, *name, *language;
568   gpointer      codec_priv;
569   gsize         codec_priv_size;
570   gpointer      codec_state;
571   gsize         codec_state_size;
572   GstMatroskaTrackType type;
573   guint64       uid, num;
574   GstMatroskaTrackFlags flags;
575   guint64       default_duration;
576   guint64       pos;
577   gdouble       timecodescale;
578   guint64       seek_preroll;
579   guint64       codec_delay;
580 
581   gboolean      set_discont; /* TRUE = set DISCONT flag on next buffer */
582 
583   /* Queue to save the GST_PROTECTION events which will be sent before the first source buffer */
584   GQueue         protection_event_queue;
585   /* Protection information structure which will be added in protection metadata for each encrypted buffer */
586   GstStructure * protection_info;
587 
588   /* Stream header buffer, to put into caps and send before any other buffers */
589   GstBufferList * stream_headers;
590   gboolean        send_stream_headers;
591 
592   /* Special flag for VobSub, for which we have to send colour table info
593    * (if available) first before sending any data, and just testing
594    * for time == 0 is not enough to detect that. Used by demuxer */
595   gboolean      send_dvd_event;
596 
597   /* Special counter for muxer to skip the first N vorbis/theora headers -
598    * they are put into codec private data, not muxed into the stream */
599   guint         xiph_headers_to_skip;
600 
601   /* Used for postprocessing a frame before it is pushed from the demuxer */
602   GstFlowReturn (*postprocess_frame) (GstElement *element,
603                                       GstMatroskaTrackContext *context,
604 				      GstBuffer **buffer);
605 
606   /* List of tags for this stream */
607   GstTagList   *tags;
608   /* Tags changed and should be pushed again */
609   gboolean      tags_changed;
610 
611   /* A GArray of GstMatroskaTrackEncoding structures which contain the
612    * encoding (compression/encryption) settings for this track, if any */
613   GArray       *encodings;
614 
615   /* Whether the stream is EOS */
616   gboolean      eos;
617 
618   /* any alignment we need our output buffers to have */
619   gint          alignment;
620 
621   /* for compatibility with VFW files, where timestamp represents DTS */
622   gboolean      dts_only;
623 
624   /* indicate that the track is raw (jpeg,raw variants) and so pts=dts */
625   gboolean		intra_only;
626 };
627 
628 typedef struct _GstMatroskaTrackVideoContext {
629   GstMatroskaTrackContext parent;
630 
631   guint         pixel_width, pixel_height;
632   guint         display_width, display_height;
633   gdouble       default_fps;
634   GstMatroskaAspectRatioMode asr_mode;
635   guint32       fourcc;
636 
637   GstMatroskaInterlaceMode interlace_mode;
638   GstVideoFieldOrder field_order;
639 
640   GstVideoMultiviewMode multiview_mode;
641   GstVideoMultiviewFlags multiview_flags;
642 
643   gboolean alpha_mode;
644 
645   /* QoS */
646   GstClockTime  earliest_time;
647 
648   GstBuffer     *dirac_unit;
649   GstVideoColorimetry colorimetry;
650 
651   GstVideoMasteringDisplayInfo mastering_display_info;
652   gboolean mastering_display_info_present;
653 
654   GstVideoContentLightLevel content_light_level;
655 } GstMatroskaTrackVideoContext;
656 
657 typedef struct _GstMatroskaTrackAudioContext {
658   GstMatroskaTrackContext parent;
659 
660   guint         samplerate, channels, bitdepth;
661 
662   guint32       wvpk_block_index;
663 } GstMatroskaTrackAudioContext;
664 
665 typedef struct _GstMatroskaTrackSubtitleContext {
666   GstMatroskaTrackContext parent;
667 
668   gboolean    check_utf8;     /* buffers should be valid UTF-8 */
669   gboolean    check_markup;   /* check if buffers contain markup
670                                * or plaintext and escape characters */
671   gboolean    invalid_utf8;   /* work around broken files      */
672   gboolean    seen_markup_tag;  /* markup found in text */
673 } GstMatroskaTrackSubtitleContext;
674 
675 typedef struct _GstMatroskaIndex {
676   guint64        pos;      /* of the corresponding *cluster*! */
677   GstClockTime   time;     /* in nanoseconds */
678   guint32        block;    /* number of the block in the cluster */
679   guint16        track;    /* reference to 'num' */
680 } GstMatroskaIndex;
681 
682 typedef struct _Wavpack4Header {
683   guchar  ck_id [4];     /* "wvpk"                                         */
684   guint32 ck_size;       /* size of entire frame (minus 8, of course)      */
685   guint16 version;       /* 0x403 for now                                  */
686   guint8  track_no;      /* track number (0 if not used, like now)         */
687   guint8  index_no;      /* remember these? (0 if not used, like now)      */
688   guint32 total_samples; /* for entire file (-1 if unknown)                */
689   guint32 block_index;   /* index of first sample in block (to file begin) */
690   guint32 block_samples; /* # samples in this block                        */
691   guint32 flags;         /* various flags for id and decoding              */
692   guint32 crc;           /* crc for actual decoded data                    */
693 } Wavpack4Header;
694 
695 #define WAVPACK4_HEADER_SIZE (32)
696 
697 typedef enum {
698   GST_MATROSKA_TRACK_ENCODING_SCOPE_FRAME = (1<<0),
699   GST_MATROSKA_TRACK_ENCODING_SCOPE_CODEC_DATA = (1<<1),
700   GST_MATROSKA_TRACK_ENCODING_SCOPE_NEXT_CONTENT_ENCODING = (1<<2)
701 } GstMatroskaTrackEncodingScope;
702 
703 #define MATROSKA_TRACK_ENCODING_SCOPE_TYPE (matroska_track_encoding_scope_get_type())
704 GType matroska_track_encoding_scope_get_type (void);
705 
706 typedef enum {
707   GST_MATROSKA_TRACK_COMPRESSION_ALGORITHM_ZLIB = 0,
708   GST_MATROSKA_TRACK_COMPRESSION_ALGORITHM_BZLIB = 1,
709   GST_MATROSKA_TRACK_COMPRESSION_ALGORITHM_LZO1X = 2,
710   GST_MATROSKA_TRACK_COMPRESSION_ALGORITHM_HEADERSTRIP = 3
711 } GstMatroskaTrackCompressionAlgorithm;
712 
713 /* The encryption algorithm used. The value '0' means that the contents
714  * have not been encrypted but only signed.
715  * Predefined values: 1 - DES; 2 - 3DES; 3 - Twofish; 4 - Blowfish; 5 - AES.
716  * WebM only supports a value of 5 (AES).
717  */
718 typedef enum {
719   GST_MATROSKA_TRACK_ENCRYPTION_ALGORITHM_NONE     = 0,
720   GST_MATROSKA_TRACK_ENCRYPTION_ALGORITHM_DES      = 1,
721   GST_MATROSKA_TRACK_ENCRYPTION_ALGORITHM_3DES     = 2,
722   GST_MATROSKA_TRACK_ENCRYPTION_ALGORITHM_TWOFISH  = 3,
723   GST_MATROSKA_TRACK_ENCRYPTION_ALGORITHM_BLOWFISH = 4,
724   GST_MATROSKA_TRACK_ENCRYPTION_ALGORITHM_AES      = 5
725 } GstMatroskaTrackEncryptionAlgorithm;
726 
727 #define MATROSKA_TRACK_ENCRYPTION_ALGORITHM_TYPE (matroska_track_encryption_algorithm_get_type())
728 GType matroska_track_encryption_algorithm_get_type (void);
729 
730 /* Defined only in WebM spec.
731  * The cipher mode used in the encryption. Predefined values: 1 - CTR
732  */
733 typedef enum {
734   GST_MATROSKA_TRACK_ENCRYPTION_CIPHER_MODE_NONE    = 0,
735   GST_MATROSKA_TRACK_ENCRYPTION_CIPHER_MODE_CTR     = 1
736 } GstMatroskaTrackEncryptionCipherMode;
737 
738 #define MATROSKA_TRACK_ENCRYPTION_CIPHER_MODE_TYPE (matroska_track_encryption_cipher_mode_get_type())
739 GType matroska_track_encryption_cipher_mode_get_type (void);
740 
741 
742 typedef struct _GstMatroskaTrackEncoding {
743   guint   order;
744   guint   scope     : 3;
745   guint   type      : 1;
746   guint   comp_algo : 2;
747   guint8 *comp_settings;
748   guint   comp_settings_length;
749   guint   enc_algo  : 3;
750   guint   enc_cipher_mode : 2;
751 } GstMatroskaTrackEncoding;
752 
753 gboolean gst_matroska_track_init_video_context    (GstMatroskaTrackContext ** p_context);
754 gboolean gst_matroska_track_init_audio_context    (GstMatroskaTrackContext ** p_context);
755 gboolean gst_matroska_track_init_subtitle_context (GstMatroskaTrackContext ** p_context);
756 
757 void gst_matroska_register_tags (void);
758 
759 GstBufferList * gst_matroska_parse_xiph_stream_headers  (gpointer codec_data,
760                                                          gsize codec_data_size);
761 
762 GstBufferList * gst_matroska_parse_speex_stream_headers (gpointer codec_data,
763                                                          gsize codec_data_size);
764 
765 GstBufferList * gst_matroska_parse_opus_stream_headers  (gpointer codec_data,
766                                                          gsize codec_data_size);
767 
768 GstBufferList * gst_matroska_parse_flac_stream_headers  (gpointer codec_data,
769                                                          gsize codec_data_size);
770 void gst_matroska_track_free (GstMatroskaTrackContext * track);
771 GstClockTime gst_matroska_track_get_buffer_timestamp (GstMatroskaTrackContext * track, GstBuffer *buf);
772 
773 #endif /* __GST_MATROSKA_IDS_H__ */
774