2 * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * riff-media.h: RIFF-id to/from caps routines
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., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
27 #include "riff-media.h"
29 #include <gst/audio/audio.h>
34 GST_DEBUG_CATEGORY_EXTERN (riff_debug);
35 #define GST_CAT_DEFAULT riff_debug
38 * gst_riff_create_video_caps:
39 * @codec_fcc: fourCC codec for this codec.
40 * @strh: pointer to the strh stream header structure.
41 * @strf: pointer to the strf stream header structure, including any
42 * data that is within the range of strf.size, but excluding any
43 * additional data withint this chunk but outside strf.size.
44 * @strf_data: a #GstBuffer containing the additional data in the strf
45 * chunk outside reach of strf.size. Ususally a palette.
46 * @strd_data: a #GstBuffer containing the data in the strd stream header
47 * chunk. Usually codec initialization data.
48 * @codec_name: if given, will be filled with a human-readable codec name.
52 gst_riff_create_video_caps (guint32 codec_fcc,
53 gst_riff_strh * strh, gst_riff_strf_vids * strf,
54 GstBuffer * strf_data, GstBuffer * strd_data, char **codec_name)
57 GstBuffer *palette = NULL;
59 GST_DEBUG ("video fourcc %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (codec_fcc));
62 case GST_MAKE_FOURCC ('D', 'I', 'B', ' '): /* uncompressed RGB */
63 case GST_MAKE_FOURCC (0x00, 0x00, 0x00, 0x00):
64 case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
65 case GST_MAKE_FOURCC ('R', 'A', 'W', ' '):
67 gint bpp = (strf && strf->bit_cnt != 0) ? strf->bit_cnt : 8;
71 caps = gst_caps_new_simple ("video/x-raw",
72 "format", G_TYPE_STRING, "RGB8P", NULL);
73 } else if (bpp == 24) {
74 caps = gst_caps_new_simple ("video/x-raw",
75 "format", G_TYPE_STRING, "BGR", NULL);
76 } else if (bpp == 32) {
77 caps = gst_caps_new_simple ("video/x-raw",
78 "format", G_TYPE_STRING, "BGRx", NULL);
80 GST_WARNING ("Unhandled DIB RGB depth: %d", bpp);
86 gst_caps_from_string ("video/x-raw, format = (string) "
87 "{ RGB8P, BGR, BGRx }");
94 *codec_name = g_strdup_printf ("Palettized %d-bit RGB", bpp);
96 *codec_name = g_strdup_printf ("%d-bit RGB", bpp);
101 case GST_MAKE_FOURCC ('G', 'R', 'E', 'Y'):
102 case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
103 case GST_MAKE_FOURCC ('Y', '8', ' ', ' '):
104 caps = gst_caps_new_simple ("video/x-raw",
105 "format", G_TYPE_STRING, "GRAY8", NULL);
107 *codec_name = g_strdup ("Uncompressed 8-bit monochrome");
110 case GST_MAKE_FOURCC ('r', '2', '1', '0'):
111 caps = gst_caps_new_simple ("video/x-raw",
112 "format", G_TYPE_STRING, "r210", NULL);
114 *codec_name = g_strdup ("Uncompressed packed RGB 10-bit 4:4:4");
117 case GST_MAKE_FOURCC ('I', '4', '2', '0'):
118 caps = gst_caps_new_simple ("video/x-raw",
119 "format", G_TYPE_STRING, "I420", NULL);
121 *codec_name = g_strdup ("Uncompressed planar YUV 4:2:0");
124 case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
125 case GST_MAKE_FOURCC ('Y', 'U', 'N', 'V'):
126 caps = gst_caps_new_simple ("video/x-raw",
127 "format", G_TYPE_STRING, "YUY2", NULL);
129 *codec_name = g_strdup ("Uncompressed packed YUV 4:2:2");
132 case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
133 caps = gst_caps_new_simple ("video/x-raw",
134 "format", G_TYPE_STRING, "YVU9", NULL);
136 *codec_name = g_strdup ("Uncompressed packed YVU 4:1:0");
139 case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
140 case GST_MAKE_FOURCC ('2', 'v', 'u', 'y'):
141 caps = gst_caps_new_simple ("video/x-raw",
142 "format", G_TYPE_STRING, "UYVY", NULL);
144 *codec_name = g_strdup ("Uncompressed packed YUV 4:2:2");
147 case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
148 caps = gst_caps_new_simple ("video/x-raw",
149 "format", G_TYPE_STRING, "YV12", NULL);
151 *codec_name = g_strdup ("Uncompressed packed YVU 4:2:2");
153 case GST_MAKE_FOURCC ('v', '2', '1', '0'):
154 caps = gst_caps_new_simple ("video/x-raw",
155 "format", G_TYPE_STRING, "v210", NULL);
157 *codec_name = g_strdup ("Uncompressed packed 10-bit YUV 4:2:2");
160 case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): /* YUY2 MJPEG */
161 case GST_MAKE_FOURCC ('A', 'V', 'R', 'n'):
162 case GST_MAKE_FOURCC ('I', 'J', 'P', 'G'):
163 case GST_MAKE_FOURCC ('i', 'j', 'p', 'g'):
164 case GST_MAKE_FOURCC ('d', 'm', 'b', '1'):
165 case GST_MAKE_FOURCC ('A', 'C', 'D', 'V'):
166 case GST_MAKE_FOURCC ('Q', 'I', 'V', 'G'):
167 caps = gst_caps_new_empty_simple ("image/jpeg");
169 *codec_name = g_strdup ("Motion JPEG");
172 case GST_MAKE_FOURCC ('J', 'P', 'E', 'G'): /* generic (mostly RGB) MJPEG */
173 case GST_MAKE_FOURCC ('j', 'p', 'e', 'g'): /* generic (mostly RGB) MJPEG */
174 caps = gst_caps_new_empty_simple ("image/jpeg");
176 *codec_name = g_strdup ("JPEG Still Image");
179 case GST_MAKE_FOURCC ('P', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
180 case GST_MAKE_FOURCC ('V', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
181 caps = gst_caps_new_empty_simple ("image/jpeg");
183 *codec_name = g_strdup ("Miro/Pinnacle Motion JPEG");
186 case GST_MAKE_FOURCC ('C', 'J', 'P', 'G'):
187 caps = gst_caps_new_empty_simple ("image/jpeg");
189 *codec_name = g_strdup ("Creative Webcam JPEG");
192 case GST_MAKE_FOURCC ('S', 'L', 'M', 'J'):
193 caps = gst_caps_new_empty_simple ("image/jpeg");
195 *codec_name = g_strdup ("SL Motion JPEG");
198 case GST_MAKE_FOURCC ('J', 'P', 'G', 'L'):
199 caps = gst_caps_new_empty_simple ("image/jpeg");
201 *codec_name = g_strdup ("Pegasus Lossless JPEG");
204 case GST_MAKE_FOURCC ('L', 'O', 'C', 'O'):
205 caps = gst_caps_new_empty_simple ("video/x-loco");
207 *codec_name = g_strdup ("LOCO Lossless");
210 case GST_MAKE_FOURCC ('S', 'P', '5', '3'):
211 case GST_MAKE_FOURCC ('S', 'P', '5', '4'):
212 case GST_MAKE_FOURCC ('S', 'P', '5', '5'):
213 case GST_MAKE_FOURCC ('S', 'P', '5', '6'):
214 case GST_MAKE_FOURCC ('S', 'P', '5', '7'):
215 case GST_MAKE_FOURCC ('S', 'P', '5', '8'):
216 caps = gst_caps_new_empty_simple ("video/sp5x");
218 *codec_name = g_strdup ("Sp5x-like JPEG");
221 case GST_MAKE_FOURCC ('Z', 'M', 'B', 'V'):
222 caps = gst_caps_new_empty_simple ("video/x-zmbv");
224 *codec_name = g_strdup ("Zip Motion Block video");
227 case GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'):
228 caps = gst_caps_new_empty_simple ("video/x-huffyuv");
230 gst_caps_set_simple (caps, "bpp",
231 G_TYPE_INT, (int) strf->bit_cnt, NULL);
234 *codec_name = g_strdup ("Huffman Lossless Codec");
237 case GST_MAKE_FOURCC ('M', 'P', 'E', 'G'):
238 case GST_MAKE_FOURCC ('M', 'P', 'G', 'I'):
239 case GST_MAKE_FOURCC ('m', 'p', 'g', '1'):
240 case GST_MAKE_FOURCC ('M', 'P', 'G', '1'):
241 case GST_MAKE_FOURCC ('P', 'I', 'M', '1'):
242 case GST_MAKE_FOURCC (0x01, 0x00, 0x00, 0x10):
243 caps = gst_caps_new_simple ("video/mpeg",
244 "systemstream", G_TYPE_BOOLEAN, FALSE,
245 "mpegversion", G_TYPE_INT, 1, NULL);
247 *codec_name = g_strdup ("MPEG-1 video");
250 case GST_MAKE_FOURCC ('M', 'P', 'G', '2'):
251 case GST_MAKE_FOURCC ('m', 'p', 'g', '2'):
252 case GST_MAKE_FOURCC ('P', 'I', 'M', '2'):
253 case GST_MAKE_FOURCC ('D', 'V', 'R', ' '):
254 case GST_MAKE_FOURCC (0x02, 0x00, 0x00, 0x10):
255 caps = gst_caps_new_simple ("video/mpeg",
256 "systemstream", G_TYPE_BOOLEAN, FALSE,
257 "mpegversion", G_TYPE_INT, 2, NULL);
259 *codec_name = g_strdup ("MPEG-2 video");
262 case GST_MAKE_FOURCC ('L', 'M', 'P', '2'):
263 caps = gst_caps_new_simple ("video/mpeg",
264 "systemstream", G_TYPE_BOOLEAN, FALSE,
265 "mpegversion", G_TYPE_INT, 2, NULL);
267 *codec_name = g_strdup ("Lead MPEG-2 video");
270 case GST_MAKE_FOURCC ('H', '2', '6', '3'):
271 case GST_MAKE_FOURCC ('h', '2', '6', '3'):
272 case GST_MAKE_FOURCC ('i', '2', '6', '3'):
273 case GST_MAKE_FOURCC ('U', '2', '6', '3'):
274 case GST_MAKE_FOURCC ('v', 'i', 'v', '1'):
275 case GST_MAKE_FOURCC ('T', '2', '6', '3'):
276 caps = gst_caps_new_simple ("video/x-h263",
277 "variant", G_TYPE_STRING, "itu", NULL);
279 *codec_name = g_strdup ("ITU H.26n");
282 case GST_MAKE_FOURCC ('L', '2', '6', '3'):
283 /* http://www.leadcodecs.com/Codecs/LEAD-H263.htm */
284 caps = gst_caps_new_simple ("video/x-h263",
285 "variant", G_TYPE_STRING, "lead", NULL);
287 *codec_name = g_strdup ("Lead H.263");
290 case GST_MAKE_FOURCC ('M', '2', '6', '3'):
291 case GST_MAKE_FOURCC ('m', '2', '6', '3'):
292 caps = gst_caps_new_simple ("video/x-h263",
293 "variant", G_TYPE_STRING, "microsoft", NULL);
295 *codec_name = g_strdup ("Microsoft H.263");
298 case GST_MAKE_FOURCC ('V', 'D', 'O', 'W'):
299 caps = gst_caps_new_simple ("video/x-h263",
300 "variant", G_TYPE_STRING, "vdolive", NULL);
302 *codec_name = g_strdup ("VDOLive");
305 case GST_MAKE_FOURCC ('V', 'I', 'V', 'O'):
306 caps = gst_caps_new_simple ("video/x-h263",
307 "variant", G_TYPE_STRING, "vivo", NULL);
309 *codec_name = g_strdup ("Vivo H.263");
312 case GST_MAKE_FOURCC ('x', '2', '6', '3'):
313 caps = gst_caps_new_simple ("video/x-h263",
314 "variant", G_TYPE_STRING, "xirlink", NULL);
316 *codec_name = g_strdup ("Xirlink H.263");
319 /* apparently not standard H.263...? */
320 case GST_MAKE_FOURCC ('I', '2', '6', '3'):
321 caps = gst_caps_new_simple ("video/x-intel-h263",
322 "variant", G_TYPE_STRING, "intel", NULL);
324 *codec_name = g_strdup ("Intel H.263");
327 case GST_MAKE_FOURCC ('V', 'X', '1', 'K'):
328 caps = gst_caps_new_simple ("video/x-h263",
329 "variant", G_TYPE_STRING, "lucent", NULL);
331 *codec_name = g_strdup ("Lucent VX1000S H.263");
334 case GST_MAKE_FOURCC ('X', '2', '6', '4'):
335 case GST_MAKE_FOURCC ('x', '2', '6', '4'):
336 case GST_MAKE_FOURCC ('H', '2', '6', '4'):
337 case GST_MAKE_FOURCC ('h', '2', '6', '4'):
338 case GST_MAKE_FOURCC ('a', 'v', 'c', '1'):
339 case GST_MAKE_FOURCC ('A', 'V', 'C', '1'):
340 caps = gst_caps_new_simple ("video/x-h264",
341 "variant", G_TYPE_STRING, "itu", NULL);
343 *codec_name = g_strdup ("ITU H.264");
346 case GST_MAKE_FOURCC ('V', 'S', 'S', 'H'):
347 caps = gst_caps_new_simple ("video/x-h264",
348 "variant", G_TYPE_STRING, "videosoft", NULL);
350 *codec_name = g_strdup ("VideoSoft H.264");
353 case GST_MAKE_FOURCC ('L', '2', '6', '4'):
354 /* http://www.leadcodecs.com/Codecs/LEAD-H264.htm */
355 caps = gst_caps_new_simple ("video/x-h264",
356 "variant", G_TYPE_STRING, "lead", NULL);
358 *codec_name = g_strdup ("Lead H.264");
361 case GST_MAKE_FOURCC ('S', 'E', 'D', 'G'):
362 caps = gst_caps_new_simple ("video/mpeg",
363 "mpegversion", G_TYPE_INT, 4,
364 "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
366 *codec_name = g_strdup ("Samsung MPEG-4");
369 case GST_MAKE_FOURCC ('M', '4', 'C', 'C'):
370 caps = gst_caps_new_simple ("video/mpeg",
371 "mpegversion", G_TYPE_INT, 4,
372 "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
374 *codec_name = g_strdup ("Divio MPEG-4");
377 case GST_MAKE_FOURCC ('D', 'I', 'V', '3'):
378 case GST_MAKE_FOURCC ('d', 'i', 'v', '3'):
379 case GST_MAKE_FOURCC ('D', 'V', 'X', '3'):
380 case GST_MAKE_FOURCC ('d', 'v', 'x', '3'):
381 case GST_MAKE_FOURCC ('D', 'I', 'V', '4'):
382 case GST_MAKE_FOURCC ('d', 'i', 'v', '4'):
383 case GST_MAKE_FOURCC ('D', 'I', 'V', '5'):
384 case GST_MAKE_FOURCC ('d', 'i', 'v', '5'):
385 case GST_MAKE_FOURCC ('D', 'I', 'V', '6'):
386 case GST_MAKE_FOURCC ('d', 'i', 'v', '6'):
387 case GST_MAKE_FOURCC ('M', 'P', 'G', '3'):
388 case GST_MAKE_FOURCC ('m', 'p', 'g', '3'):
389 case GST_MAKE_FOURCC ('c', 'o', 'l', '0'):
390 case GST_MAKE_FOURCC ('C', 'O', 'L', '0'):
391 case GST_MAKE_FOURCC ('c', 'o', 'l', '1'):
392 case GST_MAKE_FOURCC ('C', 'O', 'L', '1'):
393 case GST_MAKE_FOURCC ('A', 'P', '4', '1'):
394 caps = gst_caps_new_simple ("video/x-divx",
395 "divxversion", G_TYPE_INT, 3, NULL);
397 *codec_name = g_strdup ("DivX MS-MPEG-4 Version 3");
400 case GST_MAKE_FOURCC ('d', 'i', 'v', 'x'):
401 case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'):
402 caps = gst_caps_new_simple ("video/x-divx",
403 "divxversion", G_TYPE_INT, 4, NULL);
405 *codec_name = g_strdup ("DivX MPEG-4 Version 4");
408 case GST_MAKE_FOURCC ('B', 'L', 'Z', '0'):
409 caps = gst_caps_new_simple ("video/x-divx",
410 "divxversion", G_TYPE_INT, 4, NULL);
412 *codec_name = g_strdup ("Blizzard DivX");
415 case GST_MAKE_FOURCC ('D', 'X', '5', '0'):
416 caps = gst_caps_new_simple ("video/x-divx",
417 "divxversion", G_TYPE_INT, 5, NULL);
419 *codec_name = g_strdup ("DivX MPEG-4 Version 5");
422 case GST_MAKE_FOURCC ('M', 'P', 'G', '4'):
423 case GST_MAKE_FOURCC ('M', 'P', '4', '1'):
424 case GST_MAKE_FOURCC ('m', 'p', '4', '1'):
425 caps = gst_caps_new_simple ("video/x-msmpeg",
426 "msmpegversion", G_TYPE_INT, 41, NULL);
428 *codec_name = g_strdup ("Microsoft MPEG-4 4.1");
431 case GST_MAKE_FOURCC ('m', 'p', '4', '2'):
432 case GST_MAKE_FOURCC ('M', 'P', '4', '2'):
433 caps = gst_caps_new_simple ("video/x-msmpeg",
434 "msmpegversion", G_TYPE_INT, 42, NULL);
436 *codec_name = g_strdup ("Microsoft MPEG-4 4.2");
439 case GST_MAKE_FOURCC ('m', 'p', '4', '3'):
440 case GST_MAKE_FOURCC ('M', 'P', '4', '3'):
441 caps = gst_caps_new_simple ("video/x-msmpeg",
442 "msmpegversion", G_TYPE_INT, 43, NULL);
444 *codec_name = g_strdup ("Microsoft MPEG-4 4.3");
447 case GST_MAKE_FOURCC ('M', 'P', '4', 'S'):
448 case GST_MAKE_FOURCC ('M', '4', 'S', '2'):
449 caps = gst_caps_new_simple ("video/mpeg",
450 "mpegversion", G_TYPE_INT, 4,
451 "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
453 *codec_name = g_strdup ("Microsoft ISO MPEG-4 1.1");
456 case GST_MAKE_FOURCC ('F', 'M', 'P', '4'):
457 case GST_MAKE_FOURCC ('U', 'M', 'P', '4'):
458 case GST_MAKE_FOURCC ('F', 'F', 'D', 'S'):
459 caps = gst_caps_new_simple ("video/mpeg",
460 "mpegversion", G_TYPE_INT, 4,
461 "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
463 *codec_name = g_strdup ("FFmpeg MPEG-4");
466 case GST_MAKE_FOURCC ('3', 'I', 'V', '1'):
467 case GST_MAKE_FOURCC ('3', 'I', 'V', '2'):
468 case GST_MAKE_FOURCC ('X', 'V', 'I', 'D'):
469 case GST_MAKE_FOURCC ('x', 'v', 'i', 'd'):
470 case GST_MAKE_FOURCC ('E', 'M', '4', 'A'):
471 case GST_MAKE_FOURCC ('E', 'P', 'V', 'H'):
472 case GST_MAKE_FOURCC ('F', 'V', 'F', 'W'):
473 case GST_MAKE_FOURCC ('I', 'N', 'M', 'C'):
474 case GST_MAKE_FOURCC ('D', 'I', 'G', 'I'):
475 case GST_MAKE_FOURCC ('D', 'M', '2', 'K'):
476 case GST_MAKE_FOURCC ('D', 'C', 'O', 'D'):
477 case GST_MAKE_FOURCC ('M', 'V', 'X', 'M'):
478 case GST_MAKE_FOURCC ('P', 'M', '4', 'V'):
479 case GST_MAKE_FOURCC ('S', 'M', 'P', '4'):
480 case GST_MAKE_FOURCC ('D', 'X', 'G', 'M'):
481 case GST_MAKE_FOURCC ('V', 'I', 'D', 'M'):
482 case GST_MAKE_FOURCC ('M', '4', 'T', '3'):
483 case GST_MAKE_FOURCC ('G', 'E', 'O', 'X'):
484 case GST_MAKE_FOURCC ('M', 'P', '4', 'V'):
485 case GST_MAKE_FOURCC ('m', 'p', '4', 'v'):
486 case GST_MAKE_FOURCC ('R', 'M', 'P', '4'):
487 caps = gst_caps_new_simple ("video/mpeg",
488 "mpegversion", G_TYPE_INT, 4,
489 "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
491 *codec_name = g_strdup ("MPEG-4");
494 case GST_MAKE_FOURCC ('3', 'i', 'v', 'd'):
495 case GST_MAKE_FOURCC ('3', 'I', 'V', 'D'):
496 caps = gst_caps_new_simple ("video/x-msmpeg",
497 "msmpegversion", G_TYPE_INT, 43, NULL);
499 *codec_name = g_strdup ("Microsoft MPEG-4 4.3"); /* FIXME? */
502 case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'):
503 case GST_MAKE_FOURCC ('d', 'v', 's', 'd'):
504 case GST_MAKE_FOURCC ('d', 'v', 'c', ' '):
505 case GST_MAKE_FOURCC ('d', 'v', '2', '5'):
506 caps = gst_caps_new_simple ("video/x-dv",
507 "systemstream", G_TYPE_BOOLEAN, FALSE,
508 "dvversion", G_TYPE_INT, 25, NULL);
510 *codec_name = g_strdup ("Generic DV");
513 case GST_MAKE_FOURCC ('C', 'D', 'V', 'C'):
514 case GST_MAKE_FOURCC ('c', 'd', 'v', 'c'):
515 caps = gst_caps_new_simple ("video/x-dv",
516 "systemstream", G_TYPE_BOOLEAN, FALSE,
517 "dvversion", G_TYPE_INT, 25, NULL);
519 *codec_name = g_strdup ("Canopus DV");
522 case GST_MAKE_FOURCC ('D', 'V', '5', '0'):
523 case GST_MAKE_FOURCC ('d', 'v', '5', '0'):
524 caps = gst_caps_new_simple ("video/x-dv",
525 "systemstream", G_TYPE_BOOLEAN, FALSE,
526 "dvversion", G_TYPE_INT, 50, NULL);
528 *codec_name = g_strdup ("DVCPro50 Video");
531 case GST_MAKE_FOURCC ('W', 'M', 'V', '1'):
532 caps = gst_caps_new_simple ("video/x-wmv",
533 "wmvversion", G_TYPE_INT, 1, NULL);
535 *codec_name = g_strdup ("Microsoft Windows Media 7");
538 case GST_MAKE_FOURCC ('W', 'M', 'V', '2'):
539 caps = gst_caps_new_simple ("video/x-wmv",
540 "wmvversion", G_TYPE_INT, 2, NULL);
542 *codec_name = g_strdup ("Microsoft Windows Media 8");
545 case GST_MAKE_FOURCC ('W', 'M', 'V', '3'):
546 caps = gst_caps_new_simple ("video/x-wmv",
547 "wmvversion", G_TYPE_INT, 3, NULL);
549 *codec_name = g_strdup ("Microsoft Windows Media 9");
552 case GST_MAKE_FOURCC ('W', 'M', 'V', 'A'):
553 caps = gst_caps_new_simple ("video/x-wmv",
554 "wmvversion", G_TYPE_INT, 3, "format", G_TYPE_STRING, "WMVA", NULL);
556 *codec_name = g_strdup ("Microsoft Windows Media Advanced Profile");
559 case GST_MAKE_FOURCC ('W', 'V', 'C', '1'):
560 caps = gst_caps_new_simple ("video/x-wmv",
561 "wmvversion", G_TYPE_INT, 3, "format", G_TYPE_STRING, "WVC1", NULL);
563 *codec_name = g_strdup ("Microsoft Windows Media VC-1");
566 case GST_MAKE_FOURCC ('c', 'v', 'i', 'd'):
567 caps = gst_caps_new_empty_simple ("video/x-cinepak");
569 *codec_name = g_strdup ("Cinepak video");
572 case GST_MAKE_FOURCC ('M', 'S', 'V', 'C'):
573 case GST_MAKE_FOURCC ('m', 's', 'v', 'c'):
574 case GST_MAKE_FOURCC ('C', 'R', 'A', 'M'):
575 case GST_MAKE_FOURCC ('c', 'r', 'a', 'm'):
576 case GST_MAKE_FOURCC ('W', 'H', 'A', 'M'):
577 case GST_MAKE_FOURCC ('w', 'h', 'a', 'm'):
578 caps = gst_caps_new_simple ("video/x-msvideocodec",
579 "msvideoversion", G_TYPE_INT, 1, NULL);
581 gst_caps_set_simple (caps, "bpp",
582 G_TYPE_INT, (int) strf->bit_cnt, NULL);
585 *codec_name = g_strdup ("MS video v1");
590 case GST_MAKE_FOURCC ('R', 'L', 'E', ' '):
591 case GST_MAKE_FOURCC ('m', 'r', 'l', 'e'):
592 case GST_MAKE_FOURCC (0x1, 0x0, 0x0, 0x0): /* why, why, why? */
593 case GST_MAKE_FOURCC (0x2, 0x0, 0x0, 0x0): /* why, why, why? */
594 caps = gst_caps_new_simple ("video/x-rle",
595 "layout", G_TYPE_STRING, "microsoft", NULL);
599 gst_caps_set_simple (caps,
600 "depth", G_TYPE_INT, (gint) strf->bit_cnt, NULL);
602 gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 1, 64, NULL);
605 *codec_name = g_strdup ("Microsoft RLE");
608 case GST_MAKE_FOURCC ('A', 'A', 'S', 'C'):
609 caps = gst_caps_new_empty_simple ("video/x-aasc");
611 *codec_name = g_strdup ("Autodesk Animator");
614 case GST_MAKE_FOURCC ('X', 'x', 'a', 'n'):
615 caps = gst_caps_new_simple ("video/x-xan",
616 "wcversion", G_TYPE_INT, 4, NULL);
618 *codec_name = g_strdup ("Xan Wing Commander 4");
621 case GST_MAKE_FOURCC ('R', 'T', '2', '1'):
622 caps = gst_caps_new_simple ("video/x-indeo",
623 "indeoversion", G_TYPE_INT, 2, NULL);
625 *codec_name = g_strdup ("Intel Video 2");
628 case GST_MAKE_FOURCC ('I', 'V', '3', '1'):
629 case GST_MAKE_FOURCC ('I', 'V', '3', '2'):
630 case GST_MAKE_FOURCC ('i', 'v', '3', '1'):
631 case GST_MAKE_FOURCC ('i', 'v', '3', '2'):
632 caps = gst_caps_new_simple ("video/x-indeo",
633 "indeoversion", G_TYPE_INT, 3, NULL);
635 *codec_name = g_strdup ("Intel Video 3");
638 case GST_MAKE_FOURCC ('I', 'V', '4', '1'):
639 case GST_MAKE_FOURCC ('i', 'v', '4', '1'):
640 caps = gst_caps_new_simple ("video/x-indeo",
641 "indeoversion", G_TYPE_INT, 4, NULL);
643 *codec_name = g_strdup ("Intel Video 4");
646 case GST_MAKE_FOURCC ('I', 'V', '5', '0'):
647 caps = gst_caps_new_simple ("video/x-indeo",
648 "indeoversion", G_TYPE_INT, 5, NULL);
650 *codec_name = g_strdup ("Intel Video 5");
653 case GST_MAKE_FOURCC ('M', 'S', 'Z', 'H'):
654 caps = gst_caps_new_empty_simple ("video/x-mszh");
656 *codec_name = g_strdup ("Lossless MSZH Video");
659 case GST_MAKE_FOURCC ('Z', 'L', 'I', 'B'):
660 caps = gst_caps_new_empty_simple ("video/x-zlib");
662 *codec_name = g_strdup ("Lossless zlib video");
665 case GST_MAKE_FOURCC ('C', 'L', 'J', 'R'):
666 case GST_MAKE_FOURCC ('c', 'l', 'j', 'r'):
667 caps = gst_caps_new_empty_simple ("video/x-cirrus-logic-accupak");
669 *codec_name = g_strdup ("Cirrus Logipak AccuPak");
672 case GST_MAKE_FOURCC ('C', 'Y', 'U', 'V'):
673 case GST_MAKE_FOURCC ('c', 'y', 'u', 'v'):
674 caps = gst_caps_new_empty_simple ("video/x-compressed-yuv");
676 *codec_name = g_strdup ("CYUV Lossless");
679 case GST_MAKE_FOURCC ('D', 'U', 'C', 'K'):
680 case GST_MAKE_FOURCC ('P', 'V', 'E', 'Z'):
681 caps = gst_caps_new_simple ("video/x-truemotion",
682 "trueversion", G_TYPE_INT, 1, NULL);
684 *codec_name = g_strdup ("Duck Truemotion1");
687 case GST_MAKE_FOURCC ('T', 'M', '2', '0'):
688 caps = gst_caps_new_simple ("video/x-truemotion",
689 "trueversion", G_TYPE_INT, 2, NULL);
691 *codec_name = g_strdup ("TrueMotion 2.0");
694 case GST_MAKE_FOURCC ('V', 'P', '3', '0'):
695 case GST_MAKE_FOURCC ('v', 'p', '3', '0'):
696 case GST_MAKE_FOURCC ('V', 'P', '3', '1'):
697 case GST_MAKE_FOURCC ('v', 'p', '3', '1'):
698 case GST_MAKE_FOURCC ('V', 'P', '3', ' '):
699 caps = gst_caps_new_empty_simple ("video/x-vp3");
701 *codec_name = g_strdup ("VP3");
704 case GST_MAKE_FOURCC ('U', 'L', 'T', 'I'):
705 caps = gst_caps_new_empty_simple ("video/x-ultimotion");
707 *codec_name = g_strdup ("IBM UltiMotion");
710 case GST_MAKE_FOURCC ('T', 'S', 'C', 'C'):
711 case GST_MAKE_FOURCC ('t', 's', 'c', 'c'):{
713 gint depth = (strf->bit_cnt != 0) ? (gint) strf->bit_cnt : 24;
715 caps = gst_caps_new_simple ("video/x-camtasia", "depth", G_TYPE_INT,
719 caps = gst_caps_new_empty_simple ("video/x-camtasia");
722 *codec_name = g_strdup ("TechSmith Camtasia");
726 case GST_MAKE_FOURCC ('C', 'S', 'C', 'D'):
729 gint depth = (strf->bit_cnt != 0) ? (gint) strf->bit_cnt : 24;
731 caps = gst_caps_new_simple ("video/x-camstudio", "depth", G_TYPE_INT,
735 caps = gst_caps_new_empty_simple ("video/x-camstudio");
738 *codec_name = g_strdup ("Camstudio");
742 case GST_MAKE_FOURCC ('V', 'C', 'R', '1'):
743 caps = gst_caps_new_simple ("video/x-ati-vcr",
744 "vcrversion", G_TYPE_INT, 1, NULL);
746 *codec_name = g_strdup ("ATI VCR 1");
749 case GST_MAKE_FOURCC ('V', 'C', 'R', '2'):
750 caps = gst_caps_new_simple ("video/x-ati-vcr",
751 "vcrversion", G_TYPE_INT, 2, NULL);
753 *codec_name = g_strdup ("ATI VCR 2");
756 case GST_MAKE_FOURCC ('A', 'S', 'V', '1'):
757 caps = gst_caps_new_simple ("video/x-asus",
758 "asusversion", G_TYPE_INT, 1, NULL);
760 *codec_name = g_strdup ("Asus Video 1");
763 case GST_MAKE_FOURCC ('A', 'S', 'V', '2'):
764 caps = gst_caps_new_simple ("video/x-asus",
765 "asusversion", G_TYPE_INT, 2, NULL);
767 *codec_name = g_strdup ("Asus Video 2");
770 case GST_MAKE_FOURCC ('M', 'P', 'N', 'G'):
771 case GST_MAKE_FOURCC ('m', 'p', 'n', 'g'):
772 case GST_MAKE_FOURCC ('P', 'N', 'G', ' '):
773 caps = gst_caps_new_empty_simple ("image/png");
775 *codec_name = g_strdup ("PNG image");
778 case GST_MAKE_FOURCC ('F', 'L', 'V', '1'):
779 caps = gst_caps_new_simple ("video/x-flash-video",
780 "flvversion", G_TYPE_INT, 1, NULL);
782 *codec_name = g_strdup ("Flash Video 1");
785 case GST_MAKE_FOURCC ('V', 'M', 'n', 'c'):
786 caps = gst_caps_new_simple ("video/x-vmnc",
787 "version", G_TYPE_INT, 1, NULL);
789 *codec_name = g_strdup ("VMWare NC Video");
792 case GST_MAKE_FOURCC ('d', 'r', 'a', 'c'):
793 caps = gst_caps_new_empty_simple ("video/x-dirac");
795 *codec_name = g_strdup ("Dirac");
800 case GST_MAKE_FOURCC ('R', 'P', 'Z', 'A'):
801 caps = gst_caps_new_empty_simple ("video/x-apple-video");
803 *codec_name = g_strdup ("Apple Video (RPZA)");
807 case GST_MAKE_FOURCC ('F', 'F', 'V', '1'):
808 caps = gst_caps_new_simple ("video/x-ffv",
809 "ffvversion", G_TYPE_INT, 1, NULL);
811 *codec_name = g_strdup ("FFmpeg lossless video codec");
814 case GST_MAKE_FOURCC ('K', 'M', 'V', 'C'):
815 caps = gst_caps_new_empty_simple ("video/x-kmvc");
817 *codec_name = g_strdup ("Karl Morton's video codec");
820 case GST_MAKE_FOURCC ('v', 'p', '5', '0'):
821 case GST_MAKE_FOURCC ('V', 'P', '5', '0'):
822 caps = gst_caps_new_empty_simple ("video/x-vp5");
824 *codec_name = g_strdup ("On2 VP5");
827 case GST_MAKE_FOURCC ('v', 'p', '6', '0'):
828 case GST_MAKE_FOURCC ('V', 'P', '6', '0'):
829 case GST_MAKE_FOURCC ('v', 'p', '6', '1'):
830 case GST_MAKE_FOURCC ('V', 'P', '6', '1'):
831 case GST_MAKE_FOURCC ('V', 'p', '6', '2'):
832 case GST_MAKE_FOURCC ('V', 'P', '6', '2'):
833 caps = gst_caps_new_empty_simple ("video/x-vp6");
835 *codec_name = g_strdup ("On2 VP6");
838 case GST_MAKE_FOURCC ('V', 'P', '6', 'F'):
839 case GST_MAKE_FOURCC ('v', 'p', '6', 'f'):
840 case GST_MAKE_FOURCC ('F', 'L', 'V', '4'):
841 caps = gst_caps_new_empty_simple ("video/x-vp6-flash");
843 *codec_name = g_strdup ("On2 VP6");
846 case GST_MAKE_FOURCC ('v', 'p', '7', '0'):
847 case GST_MAKE_FOURCC ('V', 'P', '7', '0'):
848 caps = gst_caps_new_empty_simple ("video/x-vp7");
850 *codec_name = g_strdup ("On2 VP7");
853 case GST_MAKE_FOURCC ('V', 'P', '8', '0'):
854 caps = gst_caps_new_empty_simple ("video/x-vp8");
856 *codec_name = g_strdup ("On2 VP8");
859 case GST_MAKE_FOURCC ('L', 'M', '2', '0'):
860 caps = gst_caps_new_empty_simple ("video/x-mimic");
862 *codec_name = g_strdup ("Mimic webcam");
865 case GST_MAKE_FOURCC ('T', 'H', 'E', 'O'):
866 case GST_MAKE_FOURCC ('t', 'h', 'e', 'o'):
867 caps = gst_caps_new_empty_simple ("video/x-theora");
869 *codec_name = g_strdup ("Theora video codec");
873 case GST_MAKE_FOURCC ('F', 'P', 'S', '1'):
874 caps = gst_caps_new_empty_simple ("video/x-fraps");
876 *codec_name = g_strdup ("Fraps video");
881 GST_WARNING ("Unknown video fourcc %" GST_FOURCC_FORMAT,
882 GST_FOURCC_ARGS (codec_fcc));
887 gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION,
888 strh->rate, strh->scale, NULL);
890 gst_caps_set_simple (caps,
891 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
895 gst_caps_set_simple (caps,
896 "width", G_TYPE_INT, strf->width,
897 "height", G_TYPE_INT, strf->height, NULL);
899 gst_caps_set_simple (caps,
900 "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
901 "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
905 if (strf_data || strd_data) {
906 GstBuffer *codec_data;
908 codec_data = strf_data ? strf_data : strd_data;
910 gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, codec_data, NULL);
920 num_colors = strf->num_colors;
924 size = gst_buffer_get_size (palette);
926 if (size >= (num_colors * 4)) {
929 /* palette is always at least 256*4 bytes */
930 pdata = g_malloc0 (MAX (size, 256 * 4));
931 gst_buffer_extract (palette, 0, pdata, size);
933 if (G_BYTE_ORDER == G_BIG_ENDIAN) {
938 for (n = 0; n < num_colors; n++) {
939 GST_WRITE_UINT32_BE (p, GST_READ_UINT32_LE (p));
940 p += sizeof (guint32);
944 copy = gst_buffer_new_wrapped (pdata, size);
945 gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, copy, NULL);
946 gst_buffer_unref (copy);
948 GST_WARNING ("Palette smaller than expected: broken file");
957 const guint32 ms_mask;
958 const GstAudioChannelPosition gst_pos;
959 } layout_mapping[] = {
961 0x00001, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, {
962 0x00002, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, {
963 0x00004, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}, {
964 0x00008, GST_AUDIO_CHANNEL_POSITION_LFE1}, {
965 0x00010, GST_AUDIO_CHANNEL_POSITION_REAR_LEFT}, {
966 0x00020, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, {
967 0x00040, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER}, {
968 0x00080, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, {
969 0x00100, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, {
970 0x00200, GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT}, {
971 0x00400, GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, {
972 0x00800, GST_AUDIO_CHANNEL_POSITION_TOP_CENTER}, {
973 0x01000, GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT}, {
974 0x02000, GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER}, {
975 0x04000, GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT}, {
976 0x08000, GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT}, {
977 0x10000, GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER}, {
978 0x20000, GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT}
981 #define MAX_CHANNEL_POSITIONS G_N_ELEMENTS (layout_mapping)
984 gst_riff_wavext_add_channel_mask (GstCaps * caps, gint num_channels,
985 guint32 layout, gint channel_reorder_map[18])
988 guint64 channel_mask = 0;
989 GstAudioChannelPosition from[18], to[18];
991 if (num_channels < 1 || num_channels > MAX_CHANNEL_POSITIONS) {
992 GST_DEBUG ("invalid number of channels: %d", num_channels);
997 for (i = 0; i < MAX_CHANNEL_POSITIONS; ++i) {
998 if ((layout & layout_mapping[i].ms_mask) != 0) {
999 if (p >= num_channels) {
1000 GST_WARNING ("More bits set in the channel layout map than there "
1001 "are channels! Broken file");
1004 if (layout_mapping[i].gst_pos == GST_AUDIO_CHANNEL_POSITION_INVALID) {
1005 GST_WARNING ("Unsupported channel position (mask 0x%08x) in channel "
1006 "layout map - ignoring those channels", layout_mapping[i].ms_mask);
1007 /* what to do? just ignore it and let downstream deal with a channel
1008 * layout that has INVALID positions in it for now ... */
1010 channel_mask |= G_GUINT64_CONSTANT (1) << layout_mapping[i].gst_pos;
1011 from[p] = layout_mapping[i].gst_pos;
1016 if (p != num_channels) {
1017 GST_WARNING ("Only %d bits set in the channel layout map, but there are "
1018 "supposed to be %d channels! Broken file", p, num_channels);
1022 if (channel_reorder_map) {
1023 memcpy (to, from, sizeof (from[0]) * num_channels);
1024 if (!gst_audio_channel_positions_to_valid_order (to, num_channels))
1026 if (!gst_audio_get_channel_reorder_map (num_channels, from, to,
1027 channel_reorder_map))
1031 gst_caps_set_simple (caps, "channel-mask", GST_TYPE_BITMASK, channel_mask,
1038 gst_riff_wave_add_default_channel_mask (GstCaps * caps,
1039 gint nchannels, gint channel_reorder_map[18])
1041 guint64 channel_mask = 0;
1042 static const gint reorder_maps[8][11] = {
1049 {-1, -1, -1, -1, -1, -1, -1},
1050 {0, 1, 4, 5, 2, 3, 6, 7}
1053 if (nchannels > 8) {
1054 GST_DEBUG ("invalid number of channels: %d", nchannels);
1058 /* This uses the default channel mapping from ALSA which
1059 * is used in quite a few surround test files and seems to be
1060 * the defacto standard. The channel mapping from
1061 * WAVE_FORMAT_EXTENSIBLE doesn't seem to be used in normal
1062 * wav files like chan-id.wav.
1063 * http://bugzilla.gnome.org/show_bug.cgi?id=489010
1065 switch (nchannels) {
1067 /* Mono => nothing */
1068 if (channel_reorder_map)
1069 channel_reorder_map[0] = 0;
1073 G_GUINT64_CONSTANT (1) << GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT;
1075 G_GUINT64_CONSTANT (1) << GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT;
1078 channel_mask |= G_GUINT64_CONSTANT (1) << GST_AUDIO_CHANNEL_POSITION_LFE1;
1082 G_GUINT64_CONSTANT (1) << GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER;
1086 G_GUINT64_CONSTANT (1) << GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT;
1088 G_GUINT64_CONSTANT (1) << GST_AUDIO_CHANNEL_POSITION_REAR_LEFT;
1092 G_GUINT64_CONSTANT (1) << GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
1094 G_GUINT64_CONSTANT (1) << GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
1100 if (channel_reorder_map)
1101 memcpy (channel_reorder_map, reorder_maps[nchannels],
1102 sizeof (gint) * nchannels);
1104 gst_caps_set_simple (caps, "channel-mask", GST_TYPE_BITMASK, channel_mask,
1111 gst_riff_wavext_get_default_channel_mask (guint nchannels)
1113 guint32 channel_mask = 0;
1115 /* Set the default channel mask for the given number of channels.
1116 * http://www.microsoft.com/whdc/device/audio/multichaud.mspx
1118 switch (nchannels) {
1120 channel_mask |= 0x00400;
1121 channel_mask |= 0x00200;
1123 channel_mask |= 0x00100;
1125 channel_mask |= 0x00080;
1126 channel_mask |= 0x00040;
1128 channel_mask |= 0x00020;
1129 channel_mask |= 0x00010;
1131 channel_mask |= 0x00008;
1133 channel_mask |= 0x00004;
1135 channel_mask |= 0x00002;
1136 channel_mask |= 0x00001;
1140 return channel_mask;
1144 gst_riff_create_audio_caps (guint16 codec_id,
1145 gst_riff_strh * strh, gst_riff_strf_auds * strf,
1146 GstBuffer * strf_data, GstBuffer * strd_data, char **codec_name,
1147 gint channel_reorder_map[18])
1149 gboolean block_align = FALSE, rate_chan = TRUE;
1150 GstCaps *caps = NULL;
1151 gint rate_min = 1000, rate_max = 96000;
1152 gint channels_max = 2;
1155 if (channel_reorder_map)
1156 for (i = 0; i < 18; i++)
1157 channel_reorder_map[i] = -1;
1160 case GST_RIFF_WAVE_FORMAT_PCM: /* PCM */
1165 gint ba = strf->blockalign;
1166 gint ch = strf->channels;
1168 GstAudioFormat format;
1170 /* If we have an empty blockalign, we take the width contained in
1171 * strf->bits_per_sample */
1175 wd = strf->bits_per_sample;
1177 if (strf->bits_per_sample > 32) {
1178 GST_WARNING ("invalid depth (%d) of pcm audio, overwriting.",
1179 strf->bits_per_sample);
1180 strf->bits_per_sample = 8 * ((wd + 7) / 8);
1183 /* in riff, the depth is stored in the size field but it just means that
1184 * the _least_ significant bits are cleared. We can therefore just play
1185 * the sample as if it had a depth == width */
1186 /* For reference, the actual depth is in strf->bits_per_sample */
1190 gst_audio_format_build_integer (wd != 8, G_LITTLE_ENDIAN, wd, ws);
1192 caps = gst_caps_new_simple ("audio/x-raw",
1193 "format", G_TYPE_STRING, gst_audio_format_to_string (format),
1194 "layout", G_TYPE_STRING, "interleaved",
1195 "channels", G_TYPE_INT, ch, NULL);
1197 /* Add default channel layout. We know no default layout for more than
1200 GST_WARNING ("don't know default layout for %d channels", ch);
1201 else if (gst_riff_wave_add_default_channel_mask (caps, ch,
1202 channel_reorder_map))
1203 GST_DEBUG ("using default channel layout for %d channels", ch);
1205 GST_WARNING ("failed to add channel layout");
1207 /* FIXME: this is pretty useless - we need fixed caps */
1208 caps = gst_caps_from_string ("audio/x-raw, "
1209 "format = (string) { S8, U8, S16LE, U16LE, S24LE, "
1210 "U24LE, S32LE, U32LE }, " "layout = (string) interleaved");
1212 if (codec_name && strf)
1213 *codec_name = g_strdup_printf ("Uncompressed %d-bit PCM audio",
1214 strf->bits_per_sample);
1217 case GST_RIFF_WAVE_FORMAT_ADPCM:
1218 caps = gst_caps_new_simple ("audio/x-adpcm",
1219 "layout", G_TYPE_STRING, "microsoft", NULL);
1221 *codec_name = g_strdup ("ADPCM audio");
1225 case GST_RIFF_WAVE_FORMAT_IEEE_FLOAT:
1230 gint ba = strf->blockalign;
1231 gint ch = strf->channels;
1232 gint wd = ba * 8 / ch;
1234 caps = gst_caps_new_simple ("audio/x-raw",
1235 "format", G_TYPE_STRING, wd == 64 ? "F64LE" : "F32LE",
1236 "layout", G_TYPE_STRING, "interleaved",
1237 "channels", G_TYPE_INT, ch, NULL);
1239 /* Add default channel layout. We know no default layout for more than
1242 GST_WARNING ("don't know default layout for %d channels", ch);
1243 else if (gst_riff_wave_add_default_channel_mask (caps, ch,
1244 channel_reorder_map))
1245 GST_DEBUG ("using default channel layout for %d channels", ch);
1247 GST_WARNING ("failed to add channel layout");
1249 /* FIXME: this is pretty useless - we need fixed caps */
1250 caps = gst_caps_from_string ("audio/x-raw, "
1251 "format = (string) { F32LE, F64LE }, "
1252 "layout = (string) interleaved");
1254 if (codec_name && strf)
1255 *codec_name = g_strdup_printf ("Uncompressed %d-bit IEEE float audio",
1256 strf->bits_per_sample);
1259 case GST_RIFF_WAVE_FORMAT_IBM_CVSD:
1262 case GST_RIFF_WAVE_FORMAT_ALAW:
1264 if (strf->bits_per_sample != 8) {
1265 GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.",
1266 strf->bits_per_sample);
1267 strf->bits_per_sample = 8;
1268 strf->blockalign = (strf->bits_per_sample * strf->channels) / 8;
1269 strf->av_bps = strf->blockalign * strf->rate;
1271 if (strf->av_bps == 0 || strf->blockalign == 0) {
1272 GST_WARNING ("fixing av_bps (%d) and blockalign (%d) of alaw audio",
1273 strf->av_bps, strf->blockalign);
1274 strf->blockalign = (strf->bits_per_sample * strf->channels) / 8;
1275 strf->av_bps = strf->blockalign * strf->rate;
1279 caps = gst_caps_new_empty_simple ("audio/x-alaw");
1281 *codec_name = g_strdup ("A-law audio");
1284 case GST_RIFF_WAVE_FORMAT_WMS:
1285 caps = gst_caps_new_empty_simple ("audio/x-wms");
1287 gst_caps_set_simple (caps,
1288 "bitrate", G_TYPE_INT, strf->av_bps * 8,
1289 "width", G_TYPE_INT, strf->bits_per_sample,
1290 "depth", G_TYPE_INT, strf->bits_per_sample, NULL);
1292 gst_caps_set_simple (caps,
1293 "bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT, NULL);
1296 *codec_name = g_strdup ("Windows Media Audio Speech");
1300 case GST_RIFF_WAVE_FORMAT_MULAW:
1302 if (strf->bits_per_sample != 8) {
1303 GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.",
1304 strf->bits_per_sample);
1305 strf->bits_per_sample = 8;
1306 strf->blockalign = (strf->bits_per_sample * strf->channels) / 8;
1307 strf->av_bps = strf->blockalign * strf->rate;
1309 if (strf->av_bps == 0 || strf->blockalign == 0) {
1310 GST_WARNING ("fixing av_bps (%d) and blockalign (%d) of mulaw audio",
1311 strf->av_bps, strf->blockalign);
1312 strf->blockalign = (strf->bits_per_sample * strf->channels) / 8;
1313 strf->av_bps = strf->blockalign * strf->rate;
1317 caps = gst_caps_new_empty_simple ("audio/x-mulaw");
1319 *codec_name = g_strdup ("Mu-law audio");
1322 case GST_RIFF_WAVE_FORMAT_OKI_ADPCM:
1325 case GST_RIFF_WAVE_FORMAT_DVI_ADPCM:
1327 caps = gst_caps_new_simple ("audio/x-adpcm",
1328 "layout", G_TYPE_STRING, "dvi", NULL);
1330 *codec_name = g_strdup ("DVI ADPCM audio");
1334 case GST_RIFF_WAVE_FORMAT_DSP_TRUESPEECH:
1337 caps = gst_caps_new_empty_simple ("audio/x-truespeech");
1339 *codec_name = g_strdup ("DSP Group TrueSpeech");
1342 case GST_RIFF_WAVE_FORMAT_GSM610:
1343 case GST_RIFF_WAVE_FORMAT_MSN:
1345 caps = gst_caps_new_empty_simple ("audio/ms-gsm");
1347 *codec_name = g_strdup ("MS GSM audio");
1350 case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
1353 caps = gst_caps_new_simple ("audio/mpeg",
1354 "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL);
1356 *codec_name = g_strdup ("MPEG-1 layer 2");
1359 case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
1362 caps = gst_caps_new_simple ("audio/mpeg",
1363 "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL);
1365 *codec_name = g_strdup ("MPEG-1 layer 3");
1368 case GST_RIFF_WAVE_FORMAT_AMR_NB: /* amr-nb */
1372 caps = gst_caps_new_empty_simple ("audio/AMR");
1374 *codec_name = g_strdup ("AMR Narrow Band (NB)");
1377 case GST_RIFF_WAVE_FORMAT_AMR_WB: /* amr-wb */
1381 caps = gst_caps_new_empty_simple ("audio/AMR-WB");
1383 *codec_name = g_strdup ("AMR Wide Band (WB)");
1386 case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
1387 case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */
1388 case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */
1389 case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
1390 case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
1391 case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
1393 caps = gst_caps_new_empty_simple ("audio/x-vorbis");
1395 *codec_name = g_strdup ("Vorbis");
1398 case GST_RIFF_WAVE_FORMAT_A52:
1400 caps = gst_caps_new_empty_simple ("audio/x-ac3");
1402 *codec_name = g_strdup ("AC-3 audio");
1404 case GST_RIFF_WAVE_FORMAT_DTS:
1406 caps = gst_caps_new_empty_simple ("audio/x-dts");
1408 *codec_name = g_strdup ("DTS audio");
1409 /* wavparse is not always able to specify rate/channels for DTS-in-wav */
1412 case GST_RIFF_WAVE_FORMAT_AAC:
1413 case GST_RIFF_WAVE_FORMAT_AAC_AC:
1414 case GST_RIFF_WAVE_FORMAT_AAC_pm:
1417 caps = gst_caps_new_simple ("audio/mpeg",
1418 "mpegversion", G_TYPE_INT, 4, NULL);
1420 *codec_name = g_strdup ("MPEG-4 AAC audio");
1423 case GST_RIFF_WAVE_FORMAT_WMAV1:
1424 case GST_RIFF_WAVE_FORMAT_WMAV2:
1425 case GST_RIFF_WAVE_FORMAT_WMAV3:
1426 case GST_RIFF_WAVE_FORMAT_WMAV3_L:
1428 gint version = (codec_id - GST_RIFF_WAVE_FORMAT_WMAV1) + 1;
1433 caps = gst_caps_new_simple ("audio/x-wma",
1434 "wmaversion", G_TYPE_INT, version, NULL);
1437 if (codec_id == GST_RIFF_WAVE_FORMAT_WMAV3_L)
1438 *codec_name = g_strdup ("WMA Lossless");
1440 *codec_name = g_strdup_printf ("WMA Version %d", version + 6);
1444 gst_caps_set_simple (caps,
1445 "bitrate", G_TYPE_INT, strf->av_bps * 8,
1446 "depth", G_TYPE_INT, strf->bits_per_sample, NULL);
1448 gst_caps_set_simple (caps,
1449 "bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT, NULL);
1453 case GST_RIFF_WAVE_FORMAT_SONY_ATRAC3:
1454 caps = gst_caps_new_empty_simple ("audio/x-vnd.sony.atrac3");
1456 *codec_name = g_strdup ("Sony ATRAC3");
1459 case GST_RIFF_WAVE_FORMAT_SIREN:
1460 caps = gst_caps_new_empty_simple ("audio/x-siren");
1462 *codec_name = g_strdup ("Siren7");
1466 case GST_RIFF_WAVE_FORMAT_ADPCM_IMA_DK4:
1471 gst_caps_new_simple ("audio/x-adpcm", "layout", G_TYPE_STRING, "dk4",
1474 *codec_name = g_strdup ("IMA/DK4 ADPCM");
1476 case GST_RIFF_WAVE_FORMAT_ADPCM_IMA_DK3:
1481 gst_caps_new_simple ("audio/x-adpcm", "layout", G_TYPE_STRING, "dk3",
1484 *codec_name = g_strdup ("IMA/DK3 ADPCM");
1487 case GST_RIFF_WAVE_FORMAT_ADPCM_IMA_WAV:
1492 gst_caps_new_simple ("audio/x-adpcm", "layout", G_TYPE_STRING, "dvi",
1495 *codec_name = g_strdup ("IMA/WAV ADPCM");
1497 case GST_RIFF_WAVE_FORMAT_EXTENSIBLE:{
1498 guint16 valid_bits_per_sample;
1499 guint32 channel_mask;
1500 guint32 subformat_guid[4];
1506 /* should be at least 22 bytes */
1507 size = gst_buffer_get_size (strf_data);
1509 if (strf_data == NULL || size < 22) {
1510 GST_WARNING ("WAVE_FORMAT_EXTENSIBLE data size is %" G_GSIZE_FORMAT
1511 " (expected: 22)", (strf_data) ? size : -1);
1515 gst_buffer_map (strf_data, &info, GST_MAP_READ);
1516 valid_bits_per_sample = GST_READ_UINT16_LE (info.data);
1517 channel_mask = GST_READ_UINT32_LE (info.data + 2);
1518 subformat_guid[0] = GST_READ_UINT32_LE (info.data + 6);
1519 subformat_guid[1] = GST_READ_UINT32_LE (info.data + 10);
1520 subformat_guid[2] = GST_READ_UINT32_LE (info.data + 14);
1521 subformat_guid[3] = GST_READ_UINT32_LE (info.data + 18);
1522 gst_buffer_unmap (strf_data, &info);
1524 GST_DEBUG ("valid bps = %u", valid_bits_per_sample);
1525 GST_DEBUG ("channel mask = 0x%08x", channel_mask);
1526 GST_DEBUG ("GUID = %08x-%08x-%08x-%08x", subformat_guid[0],
1527 subformat_guid[1], subformat_guid[2], subformat_guid[3]);
1529 if (subformat_guid[1] == 0x00100000 &&
1530 subformat_guid[2] == 0xaa000080 && subformat_guid[3] == 0x719b3800) {
1531 if (subformat_guid[0] == 0x00000001) {
1534 gint ba = strf->blockalign;
1535 gint wd = ba * 8 / strf->channels;
1537 GstAudioFormat format;
1539 /* in riff, the depth is stored in the size field but it just
1540 * means that the _least_ significant bits are cleared. We can
1541 * therefore just play the sample as if it had a depth == width */
1544 /* For reference, use this to get the actual depth:
1545 * ws = strf->bits_per_sample;
1546 * if (valid_bits_per_sample != 0)
1547 * ws = valid_bits_per_sample; */
1550 gst_audio_format_build_integer (wd != 8, G_LITTLE_ENDIAN, wd,
1553 caps = gst_caps_new_simple ("audio/x-raw",
1554 "format", G_TYPE_STRING, gst_audio_format_to_string (format),
1555 "layout", G_TYPE_STRING, "interleaved",
1556 "channels", G_TYPE_INT, strf->channels,
1557 "rate", G_TYPE_INT, strf->rate, NULL);
1560 *codec_name = g_strdup_printf ("Uncompressed %d-bit PCM audio",
1561 strf->bits_per_sample);
1564 } else if (subformat_guid[0] == 0x00000003) {
1565 GST_DEBUG ("FLOAT");
1567 gint ba = strf->blockalign;
1568 gint wd = ba * 8 / strf->channels;
1570 caps = gst_caps_new_simple ("audio/x-raw",
1571 "format", G_TYPE_STRING, wd == 32 ? "F32LE" : "F64LE",
1572 "layout", G_TYPE_STRING, "interleaved",
1573 "channels", G_TYPE_INT, strf->channels,
1574 "rate", G_TYPE_INT, strf->rate, NULL);
1578 g_strdup_printf ("Uncompressed %d-bit IEEE float audio",
1579 strf->bits_per_sample);
1582 } else if (subformat_guid[0] == 0x0000006) {
1585 if (strf->bits_per_sample != 8) {
1586 GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.",
1587 strf->bits_per_sample);
1588 strf->bits_per_sample = 8;
1590 strf->blockalign = strf->av_bps * strf->channels;
1592 if (strf->av_bps == 0 || strf->blockalign == 0) {
1594 ("fixing av_bps (%d) and blockalign (%d) of alaw audio",
1595 strf->av_bps, strf->blockalign);
1596 strf->av_bps = strf->bits_per_sample;
1597 strf->blockalign = strf->av_bps * strf->channels;
1601 caps = gst_caps_new_empty_simple ("audio/x-alaw");
1604 *codec_name = g_strdup ("A-law audio");
1605 } else if (subformat_guid[0] == 0x00000007) {
1606 GST_DEBUG ("MULAW");
1608 if (strf->bits_per_sample != 8) {
1609 GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.",
1610 strf->bits_per_sample);
1611 strf->bits_per_sample = 8;
1613 strf->blockalign = strf->av_bps * strf->channels;
1615 if (strf->av_bps == 0 || strf->blockalign == 0) {
1617 ("fixing av_bps (%d) and blockalign (%d) of mulaw audio",
1618 strf->av_bps, strf->blockalign);
1619 strf->av_bps = strf->bits_per_sample;
1620 strf->blockalign = strf->av_bps * strf->channels;
1624 caps = gst_caps_new_empty_simple ("audio/x-mulaw");
1626 *codec_name = g_strdup ("Mu-law audio");
1627 } else if (subformat_guid[0] == 0x00000092) {
1628 GST_DEBUG ("FIXME: handle DOLBY AC3 SPDIF format");
1629 GST_DEBUG ("WAVE_FORMAT_EXTENSIBLE AC-3 SPDIF audio");
1630 caps = gst_caps_new_empty_simple ("audio/x-ac3");
1632 *codec_name = g_strdup ("wavext AC-3 SPDIF audio");
1633 } else if (subformat_guid[0] == GST_RIFF_WAVE_FORMAT_EXTENSIBLE) {
1634 GST_DEBUG ("WAVE_FORMAT_EXTENSIBLE nested");
1636 /* recurse where no special consideration has yet to be identified
1637 * for the subformat guid */
1638 caps = gst_riff_create_audio_caps (subformat_guid[0], strh, strf,
1639 strf_data, strd_data, codec_name, channel_reorder_map);
1641 GST_DEBUG ("WAVE_FORMAT_EXTENSIBLE audio");
1644 GST_DEBUG ("WAVE_FORMAT_EXTENSIBLE %s", *codec_name);
1645 *codec_name = g_strjoin ("wavext ", *codec_name, NULL);
1650 } else if (subformat_guid[0] == 0x6ba47966 &&
1651 subformat_guid[1] == 0x41783f83 &&
1652 subformat_guid[2] == 0xf0006596 && subformat_guid[3] == 0xe59262bf) {
1653 caps = gst_caps_new_empty_simple ("application/x-ogg-avi");
1655 *codec_name = g_strdup ("Ogg-AVI");
1659 /* If channel_mask == 0 and channels > 1 let's
1660 * assume default layout as some wav files don't have the
1661 * channel mask set. Don't set the layout for 1 channel. */
1662 if (channel_mask == 0 && strf->channels > 1)
1664 gst_riff_wavext_get_default_channel_mask (strf->channels);
1666 if ((channel_mask != 0 || strf->channels > 1) &&
1667 !gst_riff_wavext_add_channel_mask (caps, strf->channels,
1668 channel_mask, channel_reorder_map)) {
1669 GST_WARNING ("failed to add channel layout");
1670 gst_caps_unref (caps);
1677 GST_WARNING ("Unknown WAVE_FORMAT_EXTENSIBLE audio format");
1682 /* can anything decode these? pitfdll? */
1683 case GST_RIFF_WAVE_FORMAT_VOXWARE_AC8:
1684 case GST_RIFF_WAVE_FORMAT_VOXWARE_AC10:
1685 case GST_RIFF_WAVE_FORMAT_VOXWARE_AC16:
1686 case GST_RIFF_WAVE_FORMAT_VOXWARE_AC20:
1687 case GST_RIFF_WAVE_FORMAT_VOXWARE_METAVOICE:
1688 case GST_RIFF_WAVE_FORMAT_VOXWARE_METASOUND:
1689 case GST_RIFF_WAVE_FORMAT_VOXWARE_RT29HW:
1690 case GST_RIFF_WAVE_FORMAT_VOXWARE_VR12:
1691 case GST_RIFF_WAVE_FORMAT_VOXWARE_VR18:
1692 case GST_RIFF_WAVE_FORMAT_VOXWARE_TQ40:
1693 case GST_RIFF_WAVE_FORMAT_VOXWARE_TQ60:{
1694 caps = gst_caps_new_simple ("audio/x-voxware",
1695 "voxwaretype", G_TYPE_INT, (gint) codec_id, NULL);
1697 *codec_name = g_strdup ("Voxware");
1702 GST_WARNING ("Unknown audio tag 0x%04x", codec_id);
1708 if (strf->channels > channels_max)
1709 goto too_many_channels;
1710 if (strf->rate < rate_min || strf->rate > rate_max)
1713 gst_caps_set_simple (caps,
1714 "rate", G_TYPE_INT, strf->rate,
1715 "channels", G_TYPE_INT, strf->channels, NULL);
1718 gst_caps_set_simple (caps,
1719 "block_align", G_TYPE_INT, strf->blockalign, NULL);
1723 if (rate_min == rate_max)
1724 gst_caps_set_simple (caps, "rate", G_TYPE_INT, rate_min, NULL);
1726 gst_caps_set_simple (caps,
1727 "rate", GST_TYPE_INT_RANGE, rate_min, rate_max, NULL);
1728 if (channels_max == 1)
1729 gst_caps_set_simple (caps, "channels", G_TYPE_INT, 1, NULL);
1731 gst_caps_set_simple (caps,
1732 "channels", GST_TYPE_INT_RANGE, 1, channels_max, NULL);
1735 gst_caps_set_simple (caps,
1736 "block_align", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
1741 if (strf_data || strd_data) {
1742 gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER,
1743 strf_data ? strf_data : strd_data, NULL);
1751 ("Stream claims to contain %u channels, but format only supports %d",
1752 strf->channels, channels_max);
1753 gst_caps_unref (caps);
1757 ("Stream with sample_rate %u, but format only supports %d .. %d",
1758 strf->rate, rate_min, rate_max);
1759 gst_caps_unref (caps);
1764 gst_riff_create_iavs_caps (guint32 codec_fcc,
1765 gst_riff_strh * strh, gst_riff_strf_iavs * strf,
1766 GstBuffer * init_data, GstBuffer * extra_data, char **codec_name)
1768 GstCaps *caps = NULL;
1770 switch (codec_fcc) {
1771 /* is this correct? */
1772 case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'):
1773 case GST_MAKE_FOURCC ('d', 'v', 's', 'd'):
1774 caps = gst_caps_new_simple ("video/x-dv",
1775 "systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
1777 *codec_name = g_strdup ("Generic DV");
1781 GST_WARNING ("Unknown IAVS fourcc %" GST_FOURCC_FORMAT,
1782 GST_FOURCC_ARGS (codec_fcc));
1790 * Functions below are for template caps. All is variable.
1794 gst_riff_create_video_template_caps (void)
1796 static const guint32 tags[] = {
1797 GST_MAKE_FOURCC ('3', 'I', 'V', '1'),
1798 GST_MAKE_FOURCC ('A', 'S', 'V', '1'),
1799 GST_MAKE_FOURCC ('A', 'S', 'V', '2'),
1800 GST_MAKE_FOURCC ('C', 'L', 'J', 'R'),
1801 GST_MAKE_FOURCC ('C', 'S', 'C', 'D'),
1802 GST_MAKE_FOURCC ('C', 'Y', 'U', 'V'),
1803 GST_MAKE_FOURCC ('D', 'I', 'B', ' '),
1804 GST_MAKE_FOURCC ('D', 'I', 'V', '3'),
1805 GST_MAKE_FOURCC ('D', 'I', 'V', 'X'),
1806 GST_MAKE_FOURCC ('D', 'U', 'C', 'K'),
1807 GST_MAKE_FOURCC ('D', 'V', 'S', 'D'),
1808 GST_MAKE_FOURCC ('D', 'V', '5', '0'),
1809 GST_MAKE_FOURCC ('D', 'X', '5', '0'),
1810 GST_MAKE_FOURCC ('M', '4', 'C', 'C'),
1811 GST_MAKE_FOURCC ('F', 'L', 'V', '1'),
1812 GST_MAKE_FOURCC ('F', 'L', 'V', '4'),
1813 GST_MAKE_FOURCC ('H', '2', '6', '3'),
1814 GST_MAKE_FOURCC ('V', 'X', '1', 'K'),
1815 GST_MAKE_FOURCC ('H', '2', '6', '4'),
1816 GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'),
1817 GST_MAKE_FOURCC ('I', '2', '6', '3'),
1818 GST_MAKE_FOURCC ('I', '4', '2', '0'),
1819 GST_MAKE_FOURCC ('I', 'V', '3', '2'),
1820 GST_MAKE_FOURCC ('I', 'V', '4', '1'),
1821 GST_MAKE_FOURCC ('I', 'V', '5', '0'),
1822 GST_MAKE_FOURCC ('L', '2', '6', '3'),
1823 GST_MAKE_FOURCC ('L', '2', '6', '4'),
1824 GST_MAKE_FOURCC ('M', '2', '6', '3'),
1825 GST_MAKE_FOURCC ('M', '4', 'S', '2'),
1826 GST_MAKE_FOURCC ('M', 'J', 'P', 'G'),
1827 GST_MAKE_FOURCC ('M', 'P', '4', '2'),
1828 GST_MAKE_FOURCC ('M', 'P', '4', '3'),
1829 GST_MAKE_FOURCC ('M', 'P', 'E', 'G'),
1830 GST_MAKE_FOURCC ('M', 'P', 'G', '2'),
1831 GST_MAKE_FOURCC ('M', 'P', 'G', '4'),
1832 GST_MAKE_FOURCC ('M', 'S', 'Z', 'H'),
1833 GST_MAKE_FOURCC ('P', 'N', 'G', ' '),
1834 GST_MAKE_FOURCC ('R', 'L', 'E', ' '),
1835 GST_MAKE_FOURCC ('R', 'T', '2', '1'),
1836 GST_MAKE_FOURCC ('S', 'P', '5', '3'),
1837 GST_MAKE_FOURCC ('T', 'M', '2', '0'),
1838 GST_MAKE_FOURCC ('T', 'S', 'C', 'C'),
1839 GST_MAKE_FOURCC ('U', 'L', 'T', 'I'),
1840 GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'),
1841 GST_MAKE_FOURCC ('V', 'C', 'R', '1'),
1842 GST_MAKE_FOURCC ('V', 'C', 'R', '2'),
1843 GST_MAKE_FOURCC ('V', 'D', 'O', 'W'),
1844 GST_MAKE_FOURCC ('V', 'I', 'V', 'O'),
1845 GST_MAKE_FOURCC ('V', 'M', 'n', 'c'),
1846 GST_MAKE_FOURCC ('V', 'P', '3', ' '),
1847 GST_MAKE_FOURCC ('V', 'S', 'S', 'H'),
1848 GST_MAKE_FOURCC ('W', 'M', 'V', '1'),
1849 GST_MAKE_FOURCC ('W', 'M', 'V', '2'),
1850 GST_MAKE_FOURCC ('W', 'M', 'V', '3'),
1851 GST_MAKE_FOURCC ('X', 'V', 'I', 'D'),
1852 GST_MAKE_FOURCC ('X', 'x', 'a', 'n'),
1853 GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
1854 GST_MAKE_FOURCC ('Y', 'V', 'U', '9'),
1855 GST_MAKE_FOURCC ('Z', 'L', 'I', 'B'),
1856 GST_MAKE_FOURCC ('c', 'v', 'i', 'd'),
1857 GST_MAKE_FOURCC ('h', '2', '6', '4'),
1858 GST_MAKE_FOURCC ('m', 's', 'v', 'c'),
1859 GST_MAKE_FOURCC ('x', '2', '6', '3'),
1860 GST_MAKE_FOURCC ('d', 'r', 'a', 'c'),
1861 GST_MAKE_FOURCC ('F', 'F', 'V', '1'),
1862 GST_MAKE_FOURCC ('K', 'M', 'V', 'C'),
1863 GST_MAKE_FOURCC ('V', 'P', '5', '0'),
1864 GST_MAKE_FOURCC ('V', 'P', '6', '0'),
1865 GST_MAKE_FOURCC ('V', 'P', '6', 'F'),
1866 GST_MAKE_FOURCC ('V', 'P', '7', '0'),
1867 GST_MAKE_FOURCC ('V', 'P', '8', '0'),
1868 GST_MAKE_FOURCC ('L', 'M', '2', '0'),
1869 GST_MAKE_FOURCC ('R', 'P', 'Z', 'A'),
1870 GST_MAKE_FOURCC ('T', 'H', 'E', 'O'),
1871 GST_MAKE_FOURCC ('F', 'P', 'S', '1'),
1872 GST_MAKE_FOURCC ('A', 'A', 'S', 'C'),
1873 GST_MAKE_FOURCC ('Y', 'V', '1', '2'),
1874 GST_MAKE_FOURCC ('L', 'O', 'C', 'O'),
1875 GST_MAKE_FOURCC ('Z', 'M', 'B', 'V'),
1876 GST_MAKE_FOURCC ('v', '2', '1', '0'),
1877 GST_MAKE_FOURCC ('r', '2', '1', '0'),
1881 GstCaps *caps, *one;
1883 caps = gst_caps_new_empty ();
1884 for (i = 0; i < G_N_ELEMENTS (tags); i++) {
1885 one = gst_riff_create_video_caps (tags[i], NULL, NULL, NULL, NULL, NULL);
1887 gst_caps_append (caps, one);
1894 gst_riff_create_audio_template_caps (void)
1896 static const guint16 tags[] = {
1897 GST_RIFF_WAVE_FORMAT_GSM610,
1898 GST_RIFF_WAVE_FORMAT_MPEGL3,
1899 GST_RIFF_WAVE_FORMAT_MPEGL12,
1900 GST_RIFF_WAVE_FORMAT_PCM,
1901 GST_RIFF_WAVE_FORMAT_VORBIS1,
1902 GST_RIFF_WAVE_FORMAT_A52,
1903 GST_RIFF_WAVE_FORMAT_DTS,
1904 GST_RIFF_WAVE_FORMAT_AAC,
1905 GST_RIFF_WAVE_FORMAT_ALAW,
1906 GST_RIFF_WAVE_FORMAT_MULAW,
1907 GST_RIFF_WAVE_FORMAT_WMS,
1908 GST_RIFF_WAVE_FORMAT_ADPCM,
1909 GST_RIFF_WAVE_FORMAT_DVI_ADPCM,
1910 GST_RIFF_WAVE_FORMAT_DSP_TRUESPEECH,
1911 GST_RIFF_WAVE_FORMAT_WMAV1,
1912 GST_RIFF_WAVE_FORMAT_WMAV2,
1913 GST_RIFF_WAVE_FORMAT_WMAV3,
1914 GST_RIFF_WAVE_FORMAT_SONY_ATRAC3,
1915 GST_RIFF_WAVE_FORMAT_IEEE_FLOAT,
1916 GST_RIFF_WAVE_FORMAT_VOXWARE_METASOUND,
1917 GST_RIFF_WAVE_FORMAT_ADPCM_IMA_DK4,
1918 GST_RIFF_WAVE_FORMAT_ADPCM_IMA_DK3,
1919 GST_RIFF_WAVE_FORMAT_ADPCM_IMA_WAV,
1920 GST_RIFF_WAVE_FORMAT_AMR_NB,
1921 GST_RIFF_WAVE_FORMAT_AMR_WB,
1922 GST_RIFF_WAVE_FORMAT_SIREN,
1926 GstCaps *caps, *one;
1928 caps = gst_caps_new_empty ();
1929 for (i = 0; i < G_N_ELEMENTS (tags); i++) {
1931 gst_riff_create_audio_caps (tags[i], NULL, NULL, NULL, NULL, NULL,
1934 gst_caps_append (caps, one);
1936 one = gst_caps_new_empty_simple ("application/x-ogg-avi");
1937 gst_caps_append (caps, one);
1943 gst_riff_create_iavs_template_caps (void)
1945 static const guint32 tags[] = {
1946 GST_MAKE_FOURCC ('D', 'V', 'S', 'D')
1950 GstCaps *caps, *one;
1952 caps = gst_caps_new_empty ();
1953 for (i = 0; i < G_N_ELEMENTS (tags); i++) {
1954 one = gst_riff_create_iavs_caps (tags[i], NULL, NULL, NULL, NULL, NULL);
1956 gst_caps_append (caps, one);