matroskademux: put streamheaders on vorbis/speex/flac/theora caps to make remuxing...
[platform/upstream/gstreamer.git] / gst / matroska / matroska-ids.h
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., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __GST_MATROSKA_IDS_H__
23 #define __GST_MATROSKA_IDS_H__
24
25 #include <gst/gst.h>
26
27 #include "ebml-ids.h"
28
29 /*
30  * EBML DocType.
31  */
32
33 #define GST_MATROSKA_DOCTYPE_MATROSKA              "matroska"
34 #define GST_MATROSKA_DOCTYPE_WEBM                  "webm"
35
36 /*
37  * Matroska element IDs. max. 32-bit.
38  */
39
40 /* toplevel Segment */
41 #define GST_MATROSKA_ID_SEGMENT                    0x18538067
42
43 /* matroska top-level master IDs, childs of Segment */
44 #define GST_MATROSKA_ID_SEGMENTINFO                0x1549A966
45 #define GST_MATROSKA_ID_TRACKS                     0x1654AE6B
46 #define GST_MATROSKA_ID_CUES                       0x1C53BB6B
47 #define GST_MATROSKA_ID_TAGS                       0x1254C367
48 #define GST_MATROSKA_ID_SEEKHEAD                   0x114D9B74
49 #define GST_MATROSKA_ID_CLUSTER                    0x1F43B675
50 #define GST_MATROSKA_ID_ATTACHMENTS                0x1941A469
51 #define GST_MATROSKA_ID_CHAPTERS                   0x1043A770
52
53 /* IDs in the SegmentInfo master */
54 #define GST_MATROSKA_ID_TIMECODESCALE              0x2AD7B1
55 #define GST_MATROSKA_ID_DURATION                   0x4489
56 #define GST_MATROSKA_ID_WRITINGAPP                 0x5741
57 #define GST_MATROSKA_ID_MUXINGAPP                  0x4D80
58 #define GST_MATROSKA_ID_DATEUTC                    0x4461
59 #define GST_MATROSKA_ID_SEGMENTUID                 0x73A4
60 #define GST_MATROSKA_ID_SEGMENTFILENAME            0x7384
61 #define GST_MATROSKA_ID_PREVUID                    0x3CB923
62 #define GST_MATROSKA_ID_PREVFILENAME               0x3C83AB
63 #define GST_MATROSKA_ID_NEXTUID                    0x3EB923
64 #define GST_MATROSKA_ID_NEXTFILENAME               0x3E83BB
65 #define GST_MATROSKA_ID_TITLE                      0x7BA9
66 #define GST_MATROSKA_ID_SEGMENTFAMILY              0x4444
67 #define GST_MATROSKA_ID_CHAPTERTRANSLATE           0x6924
68
69 /* IDs in the ChapterTranslate master */
70 #define GST_MATROSKA_ID_CHAPTERTRANSLATEEDITIONUID 0x69FC
71 #define GST_MATROSKA_ID_CHAPTERTRANSLATECODEC      0x69BF
72 #define GST_MATROSKA_ID_CHAPTERTRANSLATEID         0x69A5
73
74 /* ID in the Tracks master */
75 #define GST_MATROSKA_ID_TRACKENTRY                 0xAE
76
77 /* IDs in the TrackEntry master */
78 #define GST_MATROSKA_ID_TRACKNUMBER                0xD7
79 #define GST_MATROSKA_ID_TRACKUID                   0x73C5
80 #define GST_MATROSKA_ID_TRACKTYPE                  0x83
81 #define GST_MATROSKA_ID_TRACKAUDIO                 0xE1
82 #define GST_MATROSKA_ID_TRACKVIDEO                 0xE0
83 #define GST_MATROSKA_ID_CONTENTENCODINGS           0x6D80
84 #define GST_MATROSKA_ID_CODECID                    0x86
85 #define GST_MATROSKA_ID_CODECPRIVATE               0x63A2
86 #define GST_MATROSKA_ID_CODECNAME                  0x258688
87 #define GST_MATROSKA_ID_TRACKNAME                  0x536E
88 #define GST_MATROSKA_ID_TRACKLANGUAGE              0x22B59C
89 #define GST_MATROSKA_ID_TRACKFLAGENABLED           0xB9
90 #define GST_MATROSKA_ID_TRACKFLAGDEFAULT           0x88
91 #define GST_MATROSKA_ID_TRACKFLAGFORCED            0x55AA
92 #define GST_MATROSKA_ID_TRACKFLAGLACING            0x9C
93 #define GST_MATROSKA_ID_TRACKMINCACHE              0x6DE7
94 #define GST_MATROSKA_ID_TRACKMAXCACHE              0x6DF8
95 #define GST_MATROSKA_ID_TRACKDEFAULTDURATION       0x23E383
96 #define GST_MATROSKA_ID_TRACKTIMECODESCALE         0x23314F
97 #define GST_MATROSKA_ID_MAXBLOCKADDITIONID         0x55EE
98 #define GST_MATROSKA_ID_TRACKATTACHMENTLINK        0x7446
99 #define GST_MATROSKA_ID_TRACKOVERLAY               0x6FAB
100 #define GST_MATROSKA_ID_TRACKTRANSLATE             0x6624
101 /* semi-draft */
102 #define GST_MATROSKA_ID_TRACKOFFSET                0x537F
103 /* semi-draft */
104 #define GST_MATROSKA_ID_CODECSETTINGS              0x3A9697
105 /* semi-draft */
106 #define GST_MATROSKA_ID_CODECINFOURL               0x3B4040
107 /* semi-draft */
108 #define GST_MATROSKA_ID_CODECDOWNLOADURL           0x26B240
109 /* semi-draft */
110 #define GST_MATROSKA_ID_CODECDECODEALL             0xAA
111
112 /* IDs in the TrackTranslate master */
113 #define GST_MATROSKA_ID_TRACKTRANSLATEEDITIONUID   0x66FC
114 #define GST_MATROSKA_ID_TRACKTRANSLATECODEC        0x66BF
115 #define GST_MATROSKA_ID_TRACKTRANSLATETRACKID      0x66A5
116
117
118 /* IDs in the TrackVideo master */
119 /* NOTE: This one is here only for backward compatibility.
120  * Use _TRACKDEFAULDURATION */
121 #define GST_MATROSKA_ID_VIDEOFRAMERATE             0x2383E3
122 #define GST_MATROSKA_ID_VIDEODISPLAYWIDTH          0x54B0
123 #define GST_MATROSKA_ID_VIDEODISPLAYHEIGHT         0x54BA
124 #define GST_MATROSKA_ID_VIDEODISPLAYUNIT           0x54B2
125 #define GST_MATROSKA_ID_VIDEOPIXELWIDTH            0xB0
126 #define GST_MATROSKA_ID_VIDEOPIXELHEIGHT           0xBA
127 #define GST_MATROSKA_ID_VIDEOPIXELCROPBOTTOM       0x54AA
128 #define GST_MATROSKA_ID_VIDEOPIXELCROPTOP          0x54BB
129 #define GST_MATROSKA_ID_VIDEOPIXELCROPLEFT         0x54CC
130 #define GST_MATROSKA_ID_VIDEOPIXELCROPRIGHT        0x54DD
131 #define GST_MATROSKA_ID_VIDEOFLAGINTERLACED        0x9A
132 /* semi-draft */
133 #define GST_MATROSKA_ID_VIDEOSTEREOMODE            0x53B8
134 #define GST_MATROSKA_ID_VIDEOASPECTRATIOTYPE       0x54B3
135 #define GST_MATROSKA_ID_VIDEOCOLOURSPACE           0x2EB524
136 /* semi-draft */
137 #define GST_MATROSKA_ID_VIDEOGAMMAVALUE            0x2FB523
138
139 /* IDs in the TrackAudio master */
140 #define GST_MATROSKA_ID_AUDIOSAMPLINGFREQ          0xB5
141 #define GST_MATROSKA_ID_AUDIOBITDEPTH              0x6264
142 #define GST_MATROSKA_ID_AUDIOCHANNELS              0x9F
143 /* semi-draft */
144 #define GST_MATROSKA_ID_AUDIOCHANNELPOSITIONS      0x7D7B
145 #define GST_MATROSKA_ID_AUDIOOUTPUTSAMPLINGFREQ    0x78B5
146
147 /* IDs in the TrackContentEncoding master */
148 #define GST_MATROSKA_ID_CONTENTENCODING            0x6240
149
150 /* IDs in the ContentEncoding master */
151 #define GST_MATROSKA_ID_CONTENTENCODINGORDER       0x5031
152 #define GST_MATROSKA_ID_CONTENTENCODINGSCOPE       0x5032
153 #define GST_MATROSKA_ID_CONTENTENCODINGTYPE        0x5033
154 #define GST_MATROSKA_ID_CONTENTCOMPRESSION         0x5034
155 #define GST_MATROSKA_ID_CONTENTENCRYPTION          0x5035
156
157 /* IDs in the ContentCompression master */
158 #define GST_MATROSKA_ID_CONTENTCOMPALGO            0x4254
159 #define GST_MATROSKA_ID_CONTENTCOMPSETTINGS        0x4255
160
161 /* IDs in the ContentEncryption master */
162 #define GST_MATROSKA_ID_CONTENTENCALGO             0x47E1
163 #define GST_MATROSKA_ID_CONTENTENCKEYID            0x47E2
164 #define GST_MATROSKA_ID_CONTENTSIGNATURE           0x47E3
165 #define GST_MATROSKA_ID_CONTENTSIGKEYID            0x47E4
166 #define GST_MATROSKA_ID_CONTENTSIGALGO             0x47E5
167 #define GST_MATROSKA_ID_CONTENTSIGHASHALGO         0x47E6
168
169 /* ID in the CUEs master */
170 #define GST_MATROSKA_ID_POINTENTRY                 0xBB
171
172 /* IDs in the pointentry master */
173 #define GST_MATROSKA_ID_CUETIME                    0xB3
174 #define GST_MATROSKA_ID_CUETRACKPOSITIONS          0xB7
175
176 /* IDs in the CueTrackPositions master */
177 #define GST_MATROSKA_ID_CUETRACK                   0xF7
178 #define GST_MATROSKA_ID_CUECLUSTERPOSITION         0xF1
179 #define GST_MATROSKA_ID_CUEBLOCKNUMBER             0x5378
180 /* semi-draft */
181 #define GST_MATROSKA_ID_CUECODECSTATE              0xEA
182 /* semi-draft */
183 #define GST_MATROSKA_ID_CUEREFERENCE               0xDB
184
185 /* IDs in the CueReference master */
186 /* semi-draft */
187 #define GST_MATROSKA_ID_CUEREFTIME                 0x96
188 /* semi-draft */
189 #define GST_MATROSKA_ID_CUEREFCLUSTER              0x97
190 /* semi-draft */
191 #define GST_MATROSKA_ID_CUEREFNUMBER               0x535F
192 /* semi-draft */
193 #define GST_MATROSKA_ID_CUEREFCODECSTATE           0xEB
194
195 /* IDs in the Tags master */
196 #define GST_MATROSKA_ID_TAG                        0x7373
197
198 /* in the Tag master */
199 #define GST_MATROSKA_ID_SIMPLETAG                  0x67C8
200 #define GST_MATROSKA_ID_TARGETS                    0x63C0
201
202 /* in the SimpleTag master */
203 #define GST_MATROSKA_ID_TAGNAME                    0x45A3
204 #define GST_MATROSKA_ID_TAGSTRING                  0x4487
205 #define GST_MATROSKA_ID_TAGLANGUAGE                0x447A
206 #define GST_MATROSKA_ID_TAGDEFAULT                 0x4484
207 #define GST_MATROSKA_ID_TAGBINARY                  0x4485
208
209 /* in the Targets master */
210 #define GST_MATROSKA_ID_TARGETTYPEVALUE            0x68CA
211 #define GST_MATROSKA_ID_TARGETTYPE                 0x63CA
212 #define GST_MATROSKA_ID_TARGETTRACKUID             0x63C5
213 #define GST_MATROSKA_ID_TARGETEDITIONUID           0x63C9
214 #define GST_MATROSKA_ID_TARGETCHAPTERUID           0x63C4
215 #define GST_MATROSKA_ID_TARGETATTACHMENTUID        0x63C6
216
217 /* IDs in the SeekHead master */
218 #define GST_MATROSKA_ID_SEEKENTRY                  0x4DBB
219
220 /* IDs in the SeekEntry master */
221 #define GST_MATROSKA_ID_SEEKID                     0x53AB
222 #define GST_MATROSKA_ID_SEEKPOSITION               0x53AC
223
224 /* IDs in the Cluster master */
225 #define GST_MATROSKA_ID_CLUSTERTIMECODE            0xE7
226 #define GST_MATROSKA_ID_BLOCKGROUP                 0xA0
227 #define GST_MATROSKA_ID_SIMPLEBLOCK                0xA3
228 #define GST_MATROSKA_ID_REFERENCEBLOCK             0xFB
229 #define GST_MATROSKA_ID_POSITION                   0xA7
230 #define GST_MATROSKA_ID_PREVSIZE                   0xAB
231 /* semi-draft */
232 #define GST_MATROSKA_ID_ENCRYPTEDBLOCK             0xAF
233 #define GST_MATROSKA_ID_SILENTTRACKS               0x5854
234
235 /* IDs in the SilentTracks master */
236 #define GST_MATROSKA_ID_SILENTTRACKNUMBER          0x58D7
237
238 /* IDs in the BlockGroup master */
239 #define GST_MATROSKA_ID_BLOCK                      0xA1
240 #define GST_MATROSKA_ID_BLOCKDURATION              0x9B
241 /* semi-draft */
242 #define GST_MATROSKA_ID_BLOCKVIRTUAL               0xA2
243 #define GST_MATROSKA_ID_REFERENCEBLOCK             0xFB
244 #define GST_MATROSKA_ID_BLOCKADDITIONS             0x75A1
245 #define GST_MATROSKA_ID_REFERENCEPRIORITY          0xFA
246 /* semi-draft */
247 #define GST_MATROSKA_ID_REFERENCEVIRTUAL           0xFD
248 /* semi-draft */
249 #define GST_MATROSKA_ID_CODECSTATE                 0xA4
250 #define GST_MATROSKA_ID_SLICES                     0x8E
251
252 /* IDs in the BlockAdditions master */
253 #define GST_MATROSKA_ID_BLOCKMORE                  0xA6
254
255 /* IDs in the BlockMore master */
256 #define GST_MATROSKA_ID_BLOCKADDID                 0xEE
257 #define GST_MATROSKA_ID_BLOCKADDITIONAL            0xA5
258
259 /* IDs in the Slices master */
260 #define GST_MATROSKA_ID_TIMESLICE                  0xE8
261
262 /* IDs in the TimeSlice master */
263 #define GST_MATROSKA_ID_LACENUMBER                 0xCC
264 /* semi-draft */
265 #define GST_MATROSKA_ID_FRAMENUMBER                0xCD
266 /* semi-draft */
267 #define GST_MATROSKA_ID_BLOCKADDITIONID            0xCB
268 /* semi-draft */
269 #define GST_MATROSKA_ID_TIMESLICEDELAY             0xCE
270 #define GST_MATROSKA_ID_TIMESLICEDURATION          0xCF
271
272 /* IDs in the Attachments master */
273 #define GST_MATROSKA_ID_ATTACHEDFILE               0x61A7
274
275 /* IDs in the AttachedFile master */
276 #define GST_MATROSKA_ID_FILEDESCRIPTION            0x467E
277 #define GST_MATROSKA_ID_FILENAME                   0x466E
278 #define GST_MATROSKA_ID_FILEMIMETYPE               0x4660
279 #define GST_MATROSKA_ID_FILEDATA                   0x465C
280 #define GST_MATROSKA_ID_FILEUID                    0x46AE
281 /* semi-draft */
282 #define GST_MATROSKA_ID_FILEREFERRAL               0x4675
283
284 /* IDs in the Chapters master */
285 #define GST_MATROSKA_ID_EDITIONENTRY               0x45B9
286
287 /* IDs in the EditionEntry master */
288 #define GST_MATROSKA_ID_EDITIONUID                 0x45BC
289 #define GST_MATROSKA_ID_EDITIONFLAGHIDDEN          0x45BD
290 #define GST_MATROSKA_ID_EDITIONFLAGDEFAULT         0x45DB
291 #define GST_MATROSKA_ID_EDITIONFLAGORDERED         0x45DD
292 #define GST_MATROSKA_ID_CHAPTERATOM                0xB6
293
294 /* IDs in the ChapterAtom master */
295 #define GST_MATROSKA_ID_CHAPTERUID                 0x73C4
296 #define GST_MATROSKA_ID_CHAPTERTIMESTART           0x91
297 #define GST_MATROSKA_ID_CHAPTERTIMESTOP            0x92
298 #define GST_MATROSKA_ID_CHAPTERFLAGHIDDEN          0x98
299 #define GST_MATROSKA_ID_CHAPTERFLAGENABLED         0x4598
300 #define GST_MATROSKA_ID_CHAPTERSEGMENTUID          0x6E67
301 #define GST_MATROSKA_ID_CHAPTERSEGMENTEDITIONUID   0x6EBC
302 #define GST_MATROSKA_ID_CHAPTERPHYSICALEQUIV       0x63C3
303 #define GST_MATROSKA_ID_CHAPTERTRACK               0x8F
304 #define GST_MATROSKA_ID_CHAPTERDISPLAY             0x80
305 #define GST_MATROSKA_ID_CHAPPROCESS                0x6944
306
307 /* IDs in the ChapProcess master */
308 #define GST_MATROSKA_ID_CHAPPROCESSCODECID         0x6955
309 #define GST_MATROSKA_ID_CHAPPROCESSPRIVATE         0x450D
310 #define GST_MATROSKA_ID_CHAPPROCESSCOMMAND         0x6911
311
312 /* IDs in the ChapProcessCommand master */
313 #define GST_MATROSKA_ID_CHAPPROCESSTIME            0x6922
314 #define GST_MATROSKA_ID_CHAPPROCESSDATA            0x6933
315
316 /* IDs in the ChapterDisplay master */
317 #define GST_MATROSKA_ID_CHAPSTRING                 0x85
318 #define GST_MATROSKA_ID_CHAPLANGUAGE               0x437C
319 #define GST_MATROSKA_ID_CHAPCOUNTRY                0x437E
320
321 /* IDs in the ChapterTrack master */
322 #define GST_MATROSKA_ID_CHAPTERTRACKNUMBER         0x89
323
324 /*
325  * Matroska Codec IDs. Strings.
326  */
327
328 #define GST_MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC   "V_MS/VFW/FOURCC"
329 #define GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED "V_UNCOMPRESSED"
330 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP     "V_MPEG4/ISO/SP"
331 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP    "V_MPEG4/ISO/ASP"
332 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AP     "V_MPEG4/ISO/AP"
333 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AVC    "V_MPEG4/ISO/AVC"
334 #define GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3    "V_MPEG4/MS/V3"
335 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG1        "V_MPEG1"
336 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG2        "V_MPEG2"
337 /* FIXME: not (yet) in the spec! */
338 #define GST_MATROSKA_CODEC_ID_VIDEO_MJPEG        "V_MJPEG"
339 #define GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO1   "V_REAL/RV10"
340 #define GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO2   "V_REAL/RV20"
341 #define GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO3   "V_REAL/RV30"
342 #define GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO4   "V_REAL/RV40"
343 #define GST_MATROSKA_CODEC_ID_VIDEO_THEORA       "V_THEORA"
344 #define GST_MATROSKA_CODEC_ID_VIDEO_QUICKTIME    "V_QUICKTIME"
345 #define GST_MATROSKA_CODEC_ID_VIDEO_SNOW         "V_SNOW"
346 #define GST_MATROSKA_CODEC_ID_VIDEO_DIRAC        "V_DIRAC"
347 #define GST_MATROSKA_CODEC_ID_VIDEO_VP8          "V_VP8"
348
349 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1       "A_MPEG/L1"
350 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2       "A_MPEG/L2"
351 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3       "A_MPEG/L3"
352 #define GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE     "A_PCM/INT/BIG"
353 #define GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE     "A_PCM/INT/LIT"
354 #define GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT      "A_PCM/FLOAT/IEEE"
355 #define GST_MATROSKA_CODEC_ID_AUDIO_AC3            "A_AC3"
356 #define GST_MATROSKA_CODEC_ID_AUDIO_AC3_BSID9      "A_AC3/BSID9"
357 #define GST_MATROSKA_CODEC_ID_AUDIO_AC3_BSID10     "A_AC3/BSID10"
358 #define GST_MATROSKA_CODEC_ID_AUDIO_EAC3           "A_EAC3"
359 #define GST_MATROSKA_CODEC_ID_AUDIO_DTS            "A_DTS"
360 #define GST_MATROSKA_CODEC_ID_AUDIO_VORBIS         "A_VORBIS"
361 #define GST_MATROSKA_CODEC_ID_AUDIO_FLAC           "A_FLAC"
362 /* FIXME: not yet in the spec */
363 #define GST_MATROSKA_CODEC_ID_AUDIO_SPEEX          "A_SPEEX"
364 #define GST_MATROSKA_CODEC_ID_AUDIO_ACM            "A_MS/ACM"
365 #define GST_MATROSKA_CODEC_ID_AUDIO_TTA            "A_TTA1"
366 #define GST_MATROSKA_CODEC_ID_AUDIO_WAVPACK4       "A_WAVPACK4"
367 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_14_4      "A_REAL/14_4"
368 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_28_8      "A_REAL/28_8"
369 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_COOK      "A_REAL/COOK"
370 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_SIPR      "A_REAL/SIPR"
371 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_RALF      "A_REAL/RALF"
372 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_ATRC      "A_REAL/ATRC"
373 #define GST_MATROSKA_CODEC_ID_AUDIO_AAC            "A_AAC"
374 #define GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG2      "A_AAC/MPEG2/"
375 #define GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG4      "A_AAC/MPEG4/"
376 #define GST_MATROSKA_CODEC_ID_AUDIO_QUICKTIME_QDMC "A_QUICKTIME/QDMC"
377 #define GST_MATROSKA_CODEC_ID_AUDIO_QUICKTIME_QDM2 "A_QUICKTIME/QDM2"
378 /* Undefined for now:
379 #define GST_MATROSKA_CODEC_ID_AUDIO_MPC            "A_MPC"
380 */
381
382 #define GST_MATROSKA_CODEC_ID_SUBTITLE_ASCII     "S_TEXT/ASCII"
383 #define GST_MATROSKA_CODEC_ID_SUBTITLE_UTF8      "S_TEXT/UTF8"
384 #define GST_MATROSKA_CODEC_ID_SUBTITLE_SSA       "S_TEXT/SSA"
385 #define GST_MATROSKA_CODEC_ID_SUBTITLE_ASS       "S_TEXT/ASS" 
386 #define GST_MATROSKA_CODEC_ID_SUBTITLE_USF       "S_TEXT/USF"
387 #define GST_MATROSKA_CODEC_ID_SUBTITLE_VOBSUB    "S_VOBSUB"
388 #define GST_MATROSKA_CODEC_ID_SUBTITLE_HDMVPGS   "S_HDMV/PGS"
389 #define GST_MATROSKA_CODEC_ID_SUBTITLE_BMP       "S_IMAGE/BMP"
390 #define GST_MATROSKA_CODEC_ID_SUBTITLE_KATE      "S_KATE"
391
392 /*
393  * Matroska tags. Strings.
394  */
395
396 #define GST_MATROSKA_TAG_ID_TITLE    "TITLE"
397 #define GST_MATROSKA_TAG_ID_AUTHOR   "AUTHOR"
398 #define GST_MATROSKA_TAG_ID_ARTIST   "ARTIST"
399 #define GST_MATROSKA_TAG_ID_ALBUM    "ALBUM"
400 #define GST_MATROSKA_TAG_ID_COMMENTS "COMMENTS"
401 #define GST_MATROSKA_TAG_ID_COMMENT  "COMMENT"
402 #define GST_MATROSKA_TAG_ID_BITSPS   "BITSPS"
403 #define GST_MATROSKA_TAG_ID_BPS      "BPS"
404 #define GST_MATROSKA_TAG_ID_ENCODER  "ENCODER"
405 #define GST_MATROSKA_TAG_ID_ISRC     "ISRC"
406 #define GST_MATROSKA_TAG_ID_COPYRIGHT "COPYRIGHT"
407 #define GST_MATROSKA_TAG_ID_BPM       "BPM"
408 #define GST_MATROSKA_TAG_ID_TERMS_OF_USE "TERMS_OF_USE"
409 #define GST_MATROSKA_TAG_ID_DATE      "DATE"
410 #define GST_MATROSKA_TAG_ID_COMPOSER  "COMPOSER"
411 #define GST_MATROSKA_TAG_ID_LEAD_PERFORMER  "LEAD_PERFOMER"
412 #define GST_MATROSKA_TAG_ID_GENRE     "GENRE"
413 #define GST_MATROSKA_TAG_ID_TOTAL_PARTS "TOTAL_PARTS"
414 #define GST_MATROSKA_TAG_ID_PART_NUMBER "PART_NUMBER"
415 #define GST_MATROSKA_TAG_ID_SUBTITLE "SUBTITLE"
416 #define GST_MATROSKA_TAG_ID_ACCOMPANIMENT "ACCOMPANIMENT"
417 #define GST_MATROSKA_TAG_ID_LYRICS "LYRICS"
418 #define GST_MATROSKA_TAG_ID_CONDUCTOR "CONDUCTOR"
419 #define GST_MATROSKA_TAG_ID_ENCODED_BY "ENCODED_BY"
420 #define GST_MATROSKA_TAG_ID_DESCRIPTION "DESCRIPTION"
421 #define GST_MATROSKA_TAG_ID_KEYWORDS "KEYWORDS"
422 #define GST_MATROSKA_TAG_ID_DATE_RELEASED "DATE_RELEASED"
423 #define GST_MATROSKA_TAG_ID_DATE_RECORDED "DATE_RECORDED"
424 #define GST_MATROSKA_TAG_ID_DATE_ENCODED "DATE_ENCODED"
425 #define GST_MATROSKA_TAG_ID_DATE_TAGGED "DATE_TAGGED"
426 #define GST_MATROSKA_TAG_ID_DATE_DIGITIZED "DATE_DIGITIZED"
427 #define GST_MATROSKA_TAG_ID_DATE_WRITTEN "DATE_WRITTEN"
428 #define GST_MATROSKA_TAG_ID_DATE_PURCHASED "DATE_PURCHASED"
429 #define GST_MATROSKA_TAG_ID_RECORDING_LOCATION "RECORDING_LOCATION"
430 #define GST_MATROSKA_TAG_ID_PRODUCTION_COPYRIGHT "PRODUCTION_COPYRIGHT"
431 #define GST_MATROSKA_TAG_ID_LICENSE "LICENSE"
432
433 /*
434  * TODO: add this tag & mappings
435  * "REPLAYGAIN_GAIN" -> GST_TAG_*_GAIN   see http://replaygain.hydrogenaudio.org/rg_data_format.html
436  * "REPLAYGAIN_PEAK" -> GST_TAG_*_PEAK   see http://replaygain.hydrogenaudio.org/peak_data_format.html
437  * both are depending on the target (track, album?)
438  *
439  * "TOTAL_PARTS" -> GST_TAG_TRACK_COUNT    depending on target
440  * "PART_NUMBER" -> GST_TAG_TRACK_NUMBER   depending on target
441  *
442  * "SORT_WITH" -> nested in other elements, GST_TAG_TITLE_SORTNAME, etc
443  *
444  * TODO: maybe add custom gstreamer tags for other standard matroska tags,
445  * see http://matroska.org/technical/specs/tagging/index.html
446  *
447  * TODO: handle tag targets and nesting correctly
448  */
449
450 /*
451  * Enumerations for various types (mapping from binary
452  * value to what it actually means).
453  */
454
455 typedef enum {
456   GST_MATROSKA_TRACK_TYPE_VIDEO    = 0x1,
457   GST_MATROSKA_TRACK_TYPE_AUDIO    = 0x2,
458   GST_MATROSKA_TRACK_TYPE_COMPLEX  = 0x3,
459   GST_MATROSKA_TRACK_TYPE_LOGO     = 0x10,
460   GST_MATROSKA_TRACK_TYPE_SUBTITLE = 0x11,
461   GST_MATROSKA_TRACK_TYPE_BUTTONS  = 0x12,
462   GST_MATROSKA_TRACK_TYPE_CONTROL  = 0x20,
463 } GstMatroskaTrackType;
464
465 typedef enum {
466   GST_MATROSKA_ASPECT_RATIO_MODE_FREE  = 0x0,
467   GST_MATROSKA_ASPECT_RATIO_MODE_KEEP  = 0x1,
468   GST_MATROSKA_ASPECT_RATIO_MODE_FIXED = 0x2,
469 } GstMatroskaAspectRatioMode;
470
471 /*
472  * These aren't in any way "matroska-form" things,
473  * it's just something I use in the muxer/demuxer.
474  */
475
476 typedef enum {
477   GST_MATROSKA_TRACK_ENABLED = (1<<0),
478   GST_MATROSKA_TRACK_DEFAULT = (1<<1),
479   GST_MATROSKA_TRACK_LACING  = (1<<2),
480   GST_MATROSKA_TRACK_FORCED  = (1<<3),
481   GST_MATROSKA_TRACK_SHIFT   = (1<<16)
482 } GstMatroskaTrackFlags;
483
484 typedef enum {
485   GST_MATROSKA_VIDEOTRACK_INTERLACED = (GST_MATROSKA_TRACK_SHIFT<<0)
486 } GstMatroskaVideoTrackFlags;
487
488
489 typedef struct _GstMatroskaTrackContext GstMatroskaTrackContext;
490
491 /* TODO: check if all fields are used */
492 struct _GstMatroskaTrackContext {
493   GstPad       *pad;
494   GstCaps      *caps;
495   guint         index;
496   GstFlowReturn last_flow;
497   /* reverse playback */
498   GstClockTime  from_time;
499   gint64                   from_offset;
500   gint64                   to_offset;
501
502   GArray       *index_table;
503
504   gint          index_writer_id;
505
506   /* some often-used info */
507   gchar        *codec_id, *codec_name, *name, *language;
508   gpointer      codec_priv;
509   gsize         codec_priv_size;
510   gpointer      codec_state;
511   gsize         codec_state_size;
512   GstMatroskaTrackType type;
513   guint64       uid, num;
514   GstMatroskaTrackFlags flags;
515   guint64       default_duration;
516   guint64       pos;
517   gdouble       timecodescale;
518
519   gboolean      set_discont; /* TRUE = set DISCONT flag on next buffer */
520
521   /* Stream header buffer, to put into caps and send before any other buffers */
522   GstBufferList * stream_headers;
523   gboolean        send_stream_headers;
524
525   /* Special flag for VobSub, for which we have to send colour table info
526    * (if available) first before sending any data, and just testing
527    * for time == 0 is not enough to detect that. Used by demuxer */
528   gboolean      send_dvd_event;
529
530   /* Special counter for muxer to skip the first N vorbis/theora headers -
531    * they are put into codec private data, not muxed into the stream */
532   guint         xiph_headers_to_skip;
533
534   /* Used for postprocessing a frame before it is pushed from the demuxer */
535   GstFlowReturn (*postprocess_frame) (GstElement *element,
536                                       GstMatroskaTrackContext *context,
537                                       GstBuffer **buffer);
538
539   /* Tags to send after newsegment event */
540   GstTagList   *pending_tags;
541
542   /* A GArray of GstMatroskaTrackEncoding structures which contain the
543    * encoding (compression/encryption) settings for this track, if any */
544   GArray       *encodings;
545
546   /* Whether the stream is EOS */
547   gboolean      eos;
548
549   /* any alignment we need our output buffers to have */
550   gint          alignment;
551 };
552
553 typedef struct _GstMatroskaTrackVideoContext {
554   GstMatroskaTrackContext parent;
555
556   guint         pixel_width, pixel_height;
557   guint         display_width, display_height;
558   gdouble       default_fps;
559   GstMatroskaAspectRatioMode asr_mode;
560   guint32       fourcc;
561
562   /* QoS */
563   GstClockTime  earliest_time;
564
565   GstBuffer     *dirac_unit;
566 } GstMatroskaTrackVideoContext;
567
568 typedef struct _GstMatroskaTrackAudioContext {
569   GstMatroskaTrackContext parent;
570
571   guint         samplerate, channels, bitdepth;
572
573   guint32       wvpk_block_index;
574 } GstMatroskaTrackAudioContext;
575
576 typedef struct _GstMatroskaTrackSubtitleContext {
577   GstMatroskaTrackContext parent;
578
579   gboolean    check_utf8;     /* buffers should be valid UTF-8 */
580   gboolean    check_markup;   /* check if buffers contain markup
581                                * or plaintext and escape characters */
582   gboolean    invalid_utf8;   /* work around broken files      */
583   gboolean    seen_markup_tag;  /* markup found in text */
584 } GstMatroskaTrackSubtitleContext;
585
586 typedef struct _GstMatroskaIndex {
587   guint64        pos;      /* of the corresponding *cluster*! */
588   guint16        track;    /* reference to 'num' */
589   GstClockTime   time;     /* in nanoseconds */
590   guint32        block;    /* number of the block in the cluster */
591 } GstMatroskaIndex;
592
593 typedef struct _Wavpack4Header {
594   guchar  ck_id [4];     /* "wvpk"                                         */
595   guint32 ck_size;       /* size of entire frame (minus 8, of course)      */
596   guint16 version;       /* 0x403 for now                                  */
597   guint8  track_no;      /* track number (0 if not used, like now)         */
598   guint8  index_no;      /* remember these? (0 if not used, like now)      */
599   guint32 total_samples; /* for entire file (-1 if unknown)                */
600   guint32 block_index;   /* index of first sample in block (to file begin) */
601   guint32 block_samples; /* # samples in this block                        */
602   guint32 flags;         /* various flags for id and decoding              */
603   guint32 crc;           /* crc for actual decoded data                    */
604 } Wavpack4Header;
605
606 typedef enum {
607   GST_MATROSKA_TRACK_ENCODING_SCOPE_FRAME = (1<<0),
608   GST_MATROSKA_TRACK_ENCODING_SCOPE_CODEC_DATA = (1<<1),
609   GST_MATROSKA_TRACK_ENCODING_SCOPE_NEXT_CONTENT_ENCODING = (1<<2)
610 } GstMatroskaTrackEncodingScope;
611
612 typedef enum {
613   GST_MATROSKA_TRACK_COMPRESSION_ALGORITHM_ZLIB = 0,
614   GST_MATROSKA_TRACK_COMPRESSION_ALGORITHM_BZLIB = 1,
615   GST_MATROSKA_TRACK_COMPRESSION_ALGORITHM_LZO1X = 2,
616   GST_MATROSKA_TRACK_COMPRESSION_ALGORITHM_HEADERSTRIP = 3
617 } GstMatroskaTrackCompressionAlgorithm;
618
619 typedef struct _GstMatroskaTrackEncoding {
620   guint   order;
621   guint   scope     : 3;
622   guint   type      : 1;
623   guint   comp_algo : 2;
624   guint8 *comp_settings;
625   guint   comp_settings_length;
626 } GstMatroskaTrackEncoding;
627
628 gboolean gst_matroska_track_init_video_context    (GstMatroskaTrackContext ** p_context);
629 gboolean gst_matroska_track_init_audio_context    (GstMatroskaTrackContext ** p_context);
630 gboolean gst_matroska_track_init_subtitle_context (GstMatroskaTrackContext ** p_context);
631
632 void gst_matroska_register_tags (void);
633
634 GstBufferList * gst_matroska_parse_xiph_stream_headers  (gpointer codec_data,
635                                                          gsize codec_data_size);
636
637 GstBufferList * gst_matroska_parse_speex_stream_headers (gpointer codec_data,
638                                                          gsize codec_data_size);
639
640 GstBufferList * gst_matroska_parse_flac_stream_headers  (gpointer codec_data,
641                                                          gsize codec_data_size);
642
643 #endif /* __GST_MATROSKA_IDS_H__ */