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