1 /* GStreamer Matroska muxer/demuxer
2 * (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * matroska-ids.h: matroska file/stream data IDs
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.
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.
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.
22 #ifndef __GST_MATROSKA_IDS_H__
23 #define __GST_MATROSKA_IDS_H__
28 * Matroska element IDs. max. 32-bit.
31 /* toplevel segment */
32 #define GST_MATROSKA_ID_SEGMENT 0x18538067
34 /* matroska top-level master IDs */
35 #define GST_MATROSKA_ID_INFO 0x1549A966
36 #define GST_MATROSKA_ID_TRACKS 0x1654AE6B
37 #define GST_MATROSKA_ID_CUES 0x1C53BB6B
38 #define GST_MATROSKA_ID_TAGS 0x1254C367
39 #define GST_MATROSKA_ID_SEEKHEAD 0x114D9B74
40 #define GST_MATROSKA_ID_CLUSTER 0x1F43B675
42 /* IDs in the info master */
43 #define GST_MATROSKA_ID_TIMECODESCALE 0x2AD7B1
44 #define GST_MATROSKA_ID_DURATION 0x4489
45 #define GST_MATROSKA_ID_WRITINGAPP 0x5741
46 #define GST_MATROSKA_ID_MUXINGAPP 0x4D80
47 #define GST_MATROSKA_ID_DATEUTC 0x4461
48 #define GST_MATROSKA_ID_SEGMENTUID 0x73A4
50 /* ID in the tracks master */
51 #define GST_MATROSKA_ID_TRACKENTRY 0xAE
53 /* IDs in the trackentry master */
54 #define GST_MATROSKA_ID_TRACKNUMBER 0xD7
55 #define GST_MATROSKA_ID_TRACKUID 0x73C5
56 #define GST_MATROSKA_ID_TRACKTYPE 0x83
57 #define GST_MATROSKA_ID_TRACKAUDIO 0xE1
58 #define GST_MATROSKA_ID_TRACKVIDEO 0xE0
59 #define GST_MATROSKA_ID_CODECID 0x86
60 #define GST_MATROSKA_ID_CODECPRIVATE 0x63A2
61 #define GST_MATROSKA_ID_CODECNAME 0x258688
62 #define GST_MATROSKA_ID_CODECINFOURL 0x3B4040
63 #define GST_MATROSKA_ID_CODECDOWNLOADURL 0x26B240
64 #define GST_MATROSKA_ID_TRACKNAME 0x536E
65 #define GST_MATROSKA_ID_TRACKLANGUAGE 0x22B59C
66 #define GST_MATROSKA_ID_TRACKFLAGENABLED 0xB9
67 #define GST_MATROSKA_ID_TRACKFLAGDEFAULT 0x88
68 #define GST_MATROSKA_ID_TRACKFLAGLACING 0x9C
69 #define GST_MATROSKA_ID_TRACKMINCACHE 0x6DE7
70 #define GST_MATROSKA_ID_TRACKMAXCACHE 0x6DF8
71 #define GST_MATROSKA_ID_TRACKDEFAULTDURATION 0x23E383
73 /* IDs in the trackvideo master */
74 #define GST_MATROSKA_ID_VIDEOFRAMERATE 0x2383E3
75 #define GST_MATROSKA_ID_VIDEODISPLAYWIDTH 0x54B0
76 #define GST_MATROSKA_ID_VIDEODISPLAYHEIGHT 0x54BA
77 #define GST_MATROSKA_ID_VIDEOPIXELWIDTH 0xB0
78 #define GST_MATROSKA_ID_VIDEOPIXELHEIGHT 0xBA
79 #define GST_MATROSKA_ID_VIDEOFLAGINTERLACED 0x9A
80 #define GST_MATROSKA_ID_VIDEOSTEREOMODE 0x53B9
81 #define GST_MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
82 #define GST_MATROSKA_ID_VIDEOCOLOURSPACE 0x2EB524
84 /* IDs in the trackaudio master */
85 #define GST_MATROSKA_ID_AUDIOSAMPLINGFREQ 0xB5
86 #define GST_MATROSKA_ID_AUDIOBITDEPTH 0x6264
87 #define GST_MATROSKA_ID_AUDIOCHANNELS 0x9F
89 /* ID in the cues master */
90 #define GST_MATROSKA_ID_POINTENTRY 0xBB
92 /* IDs in the pointentry master */
93 #define GST_MATROSKA_ID_CUETIME 0xB3
94 #define GST_MATROSKA_ID_CUETRACKPOSITION 0xB7
96 /* IDs in the cuetrackposition master */
97 #define GST_MATROSKA_ID_CUETRACK 0xF7
98 #define GST_MATROSKA_ID_CUECLUSTERPOSITION 0xF1
100 /* IDs in the tags master */
101 #define GST_MATROSKA_ID_TAG 0x7373
103 /* in the tag master */
104 #define GST_MATROSKA_ID_SIMPLETAG 0x67C8
106 /* in the simpletag master */
107 #define GST_MATROSKA_ID_TAGNAME 0x45A3
108 #define GST_MATROSKA_ID_TAGSTRING 0x4487
110 /* IDs in the seekhead master */
111 #define GST_MATROSKA_ID_SEEKENTRY 0x4DBB
113 /* IDs in the seekpoint master */
114 #define GST_MATROSKA_ID_SEEKID 0x53AB
115 #define GST_MATROSKA_ID_SEEKPOSITION 0x53AC
117 /* IDs in the cluster master */
118 #define GST_MATROSKA_ID_CLUSTERTIMECODE 0xE7
119 #define GST_MATROSKA_ID_BLOCKGROUP 0xA0
120 #define GST_MATROSKA_ID_SIMPLEBLOCK 0xA3
121 #define GST_MATROSKA_ID_REFERENCEBLOCK 0xFB
123 /* IDs in the blockgroup master */
124 #define GST_MATROSKA_ID_BLOCK 0xA1
125 #define GST_MATROSKA_ID_BLOCKDURATION 0x9B
128 * Matroska Codec IDs. Strings.
131 #define GST_MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC "V_MS/VFW/FOURCC"
132 #define GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED "V_UNCOMPRESSED"
133 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP "V_MPEG4/ISO/SP"
134 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP "V_MPEG4/ISO/ASP"
135 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AP "V_MPEG4/ISO/AP"
136 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AVC "V_MPEG4/ISO/AVC"
137 #define GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3 "V_MPEG4/MS/V3"
138 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG1 "V_MPEG1"
139 #define GST_MATROSKA_CODEC_ID_VIDEO_MPEG2 "V_MPEG2"
140 #define GST_MATROSKA_CODEC_ID_VIDEO_MJPEG "V_MJPEG"
141 #define GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO1 "V_REAL/RV10"
142 #define GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO2 "V_REAL/RV20"
143 #define GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO3 "V_REAL/RV30"
144 #define GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO4 "V_REAL/RV40"
145 /* TODO: Quicktime */
147 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1 "A_MPEG/L1"
148 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2 "A_MPEG/L2"
149 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3 "A_MPEG/L3"
150 #define GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE "A_PCM/INT/BIG"
151 #define GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE "A_PCM/INT/LIT"
152 #define GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT "A_PCM/FLOAT/IEEE"
153 #define GST_MATROSKA_CODEC_ID_AUDIO_AC3 "A_AC3"
154 #define GST_MATROSKA_CODEC_ID_AUDIO_DTS "A_DTS"
155 #define GST_MATROSKA_CODEC_ID_AUDIO_VORBIS "A_VORBIS"
156 #define GST_MATROSKA_CODEC_ID_AUDIO_ACM "A_MS/ACM"
157 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG2 "A_AAC/MPEG2/"
158 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG4 "A_AAC/MPEG4/"
159 #define GST_MATROSKA_CODEC_ID_AUDIO_TTA "A_TTA1"
160 #define GST_MATROSKA_CODEC_ID_AUDIO_WAVPACK4 "A_WAVPACK4"
161 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_14_4 "A_REAL/28_8"
162 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_28_8 "A_REAL/28_8"
163 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_COOK "A_REAL/COOK"
164 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_SIPR "A_REAL/SIPR"
165 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_RALF "A_REAL/RALF"
166 #define GST_MATROSKA_CODEC_ID_AUDIO_REAL_ATRC "A_REAL/ATRC"
168 /* TODO: AC3-9/10 (?), Musepack, Quicktime */
170 #define GST_MATROSKA_CODEC_ID_SUBTITLE_UTF8 "S_TEXT/UTF8"
171 #define GST_MATROSKA_CODEC_ID_SUBTITLE_SSA "S_TEXT/SSA"
172 #define GST_MATROSKA_CODEC_ID_SUBTITLE_ASS "S_TEXT/ASS"
173 #define GST_MATROSKA_CODEC_ID_SUBTITLE_USF "S_TEXT/USF"
176 * Matrodka tags. Strings.
179 #define GST_MATROSKA_TAG_ID_TITLE "TITLE"
180 #define GST_MATROSKA_TAG_ID_AUTHOR "AUTHOR"
181 #define GST_MATROSKA_TAG_ID_ALBUM "ALBUM"
182 #define GST_MATROSKA_TAG_ID_COMMENTS "COMMENTS"
183 #define GST_MATROSKA_TAG_ID_BITSPS "BITSPS"
184 #define GST_MATROSKA_TAG_ID_ENCODER "ENCODER"
185 #define GST_MATROSKA_TAG_ID_DATE "DATE"
186 #define GST_MATROSKA_TAG_ID_ISRC "ISRC"
187 #define GST_MATROSKA_TAG_ID_COPYRIGHT "COPYRIGHT"
190 * Enumerations for various types (mapping from binary
191 * value to what it actually means).
195 GST_MATROSKA_TRACK_TYPE_VIDEO = 0x1,
196 GST_MATROSKA_TRACK_TYPE_AUDIO = 0x2,
197 GST_MATROSKA_TRACK_TYPE_COMPLEX = 0x3,
198 GST_MATROSKA_TRACK_TYPE_LOGO = 0x10,
199 GST_MATROSKA_TRACK_TYPE_SUBTITLE = 0x11,
200 GST_MATROSKA_TRACK_TYPE_CONTROL = 0x20,
201 } GstMatroskaTrackType;
204 GST_MATROSKA_EYE_MODE_MONO = 0x0,
205 GST_MATROSKA_EYE_MODE_RIGHT = 0x1,
206 GST_MATROSKA_EYE_MODE_LEFT = 0x2,
207 GST_MATROSKA_EYE_MODE_BOTH = 0x3,
208 } GstMatroskaEyeMode;
211 GST_MATROSKA_ASPECT_RATIO_MODE_FREE = 0x0,
212 GST_MATROSKA_ASPECT_RATIO_MODE_KEEP = 0x1,
213 GST_MATROSKA_ASPECT_RATIO_MODE_FIXED = 0x2,
214 } GstMatroskaAspectRatioMode;
217 * These aren't in any way "matroska-form" things,
218 * it's just something I use in the muxer/demuxer.
222 GST_MATROSKA_TRACK_ENABLED = (1<<0),
223 GST_MATROSKA_TRACK_DEFAULT = (1<<1),
224 GST_MATROSKA_TRACK_LACING = (1<<2),
225 GST_MATROSKA_TRACK_SHIFT = (1<<16)
226 } GstMatroskaTrackFlags;
229 GST_MATROSKA_VIDEOTRACK_INTERLACED = (GST_MATROSKA_TRACK_SHIFT<<0)
230 } GstMatroskaVideoTrackFlags;
232 typedef struct _GstMatroskaTrackContext {
237 /* some often-used info */
238 gchar *codec_id, *codec_name, *name, *language;
240 guint codec_priv_size;
241 GstMatroskaTrackType type;
243 GstMatroskaTrackFlags flags;
244 guint64 default_duration;
246 } GstMatroskaTrackContext;
248 typedef struct _GstMatroskaTrackVideoContext {
249 GstMatroskaTrackContext parent;
251 guint pixel_width, pixel_height,
252 display_width, display_height;
253 GstMatroskaEyeMode eye_mode;
254 GstMatroskaAspectRatioMode asr_mode;
256 } GstMatroskaTrackVideoContext;
258 typedef struct _GstMatroskaTrackAudioContext {
259 GstMatroskaTrackContext parent;
261 guint samplerate, channels, bitdepth;
263 /* Special flag for Vorbis, we need to send codec_priv first before
264 * sending any data, and just testing for time == 0 is not enough
266 gboolean first_frame;
267 } GstMatroskaTrackAudioContext;
269 typedef struct _GstMatroskaTrackComplexContext {
270 GstMatroskaTrackContext parent;
272 /* nothing special goes here, apparently */
273 } GstMatroskaTrackComplexContext;
275 typedef struct _GstMatroskaTrackSubtitleContext {
276 GstMatroskaTrackContext parent;
279 } GstMatroskaTrackSubtitleContext;
281 typedef struct _GstMatroskaIndex {
282 guint64 pos; /* of the corresponding *cluster*! */
283 guint16 track; /* reference to 'num' */
284 guint64 time; /* in nanoseconds */
287 typedef struct _Wavpack4Header {
288 guchar ck_id [4]; /* "wvpk" */
289 guint32 ck_size; /* size of entire frame (minus 8, of course) */
290 guint16 version; /* 0x403 for now */
291 guint8 track_no; /* track number (0 if not used, like now) */
292 guint8 index_no; /* remember these? (0 if not used, like now) */
293 guint32 total_samples; /* for entire file (-1 if unknown) */
294 guint32 block_index; /* index of first sample in block (to file begin) */
295 guint32 block_samples; /* # samples in this block */
296 guint32 flags; /* various flags for id and decoding */
297 guint32 crc; /* crc for actual decoded data */
300 #endif /* __GST_MATROSKA_IDS_H__ */