riff-media.c 68.1 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* GStreamer RIFF I/O
 * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
 *
 * riff-media.h: RIFF-id to/from caps routines
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
18
19
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
20
21
22
23
24
25
26
27
28
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "riff-ids.h"
#include "riff-media.h"

Wim Taymans's avatar
Wim Taymans committed
29
#include <gst/audio/audio.h>
30
31

#include <string.h>
32
#include <math.h>
33
34
35
36

GST_DEBUG_CATEGORY_EXTERN (riff_debug);
#define GST_CAT_DEFAULT riff_debug

37
/**
38
 * gst_riff_create_video_caps:
39
40
41
42
43
44
45
46
47
48
49
50
 * @codec_fcc: fourCC codec for this codec.
 * @strh: pointer to the strh stream header structure.
 * @strf: pointer to the strf stream header structure, including any
 *        data that is within the range of strf.size, but excluding any
 *        additional data withint this chunk but outside strf.size.
 * @strf_data: a #GstBuffer containing the additional data in the strf
 *             chunk outside reach of strf.size. Ususally a palette.
 * @strd_data: a #GstBuffer containing the data in the strd stream header
 *             chunk. Usually codec initialization data.
 * @codec_name: if given, will be filled with a human-readable codec name.
 */

51
GstCaps *
52
gst_riff_create_video_caps (guint32 codec_fcc,
53
54
    gst_riff_strh * strh, gst_riff_strf_vids * strf,
    GstBuffer * strf_data, GstBuffer * strd_data, char **codec_name)
55
56
{
  GstCaps *caps = NULL;
57
  GstBuffer *palette = NULL;
58

59
60
  GST_DEBUG ("video fourcc %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (codec_fcc));

61
  switch (codec_fcc) {
Luis de Bethencourt's avatar
Luis de Bethencourt committed
62
63
64
65
    case GST_RIFF_DIB:         /* uncompressed RGB */
    case GST_RIFF_rgb:
    case GST_RIFF_RGB:
    case GST_RIFF_RAW:
66
    {
67
68
69
70
      gint bpp = (strf && strf->bit_cnt != 0) ? strf->bit_cnt : 8;

      if (strf) {
        if (bpp == 8) {
Wim Taymans's avatar
Wim Taymans committed
71
          caps = gst_caps_new_simple ("video/x-raw",
72
              "format", G_TYPE_STRING, "RGB8P", NULL);
73
        } else if (bpp == 24) {
Wim Taymans's avatar
Wim Taymans committed
74
75
          caps = gst_caps_new_simple ("video/x-raw",
              "format", G_TYPE_STRING, "BGR", NULL);
76
        } else if (bpp == 32) {
Wim Taymans's avatar
Wim Taymans committed
77
78
          caps = gst_caps_new_simple ("video/x-raw",
              "format", G_TYPE_STRING, "BGRx", NULL);
79
80
        } else {
          GST_WARNING ("Unhandled DIB RGB depth: %d", bpp);
81
          return NULL;
82
83
84
        }
      } else {
        /* for template */
85
        caps =
Wim Taymans's avatar
Wim Taymans committed
86
            gst_caps_from_string ("video/x-raw, format = (string) "
87
            "{ RGB8P, BGR, BGRx }");
88
89
      }

90
91
      palette = strf_data;
      strf_data = NULL;
92
93
94
95
96
97
      if (codec_name) {
        if (bpp == 8)
          *codec_name = g_strdup_printf ("Palettized %d-bit RGB", bpp);
        else
          *codec_name = g_strdup_printf ("%d-bit RGB", bpp);
      }
98
      break;
99
    }
100

Wim Taymans's avatar
Wim Taymans committed
101
    case GST_MAKE_FOURCC ('G', 'R', 'E', 'Y'):
102
    case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
Wim Taymans's avatar
Wim Taymans committed
103
    case GST_MAKE_FOURCC ('Y', '8', ' ', ' '):
104
105
106
107
108
109
      caps = gst_caps_new_simple ("video/x-raw",
          "format", G_TYPE_STRING, "GRAY8", NULL);
      if (codec_name)
        *codec_name = g_strdup ("Uncompressed 8-bit monochrome");
      break;

David Schleef's avatar
David Schleef committed
110
    case GST_MAKE_FOURCC ('r', '2', '1', '0'):
Wim Taymans's avatar
Wim Taymans committed
111
112
      caps = gst_caps_new_simple ("video/x-raw",
          "format", G_TYPE_STRING, "r210", NULL);
David Schleef's avatar
David Schleef committed
113
114
115
116
      if (codec_name)
        *codec_name = g_strdup ("Uncompressed packed RGB 10-bit 4:4:4");
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
117
    case GST_RIFF_I420:
Luis de Bethencourt's avatar
Luis de Bethencourt committed
118
119
    case GST_RIFF_i420:
    case GST_RIFF_IYUV:
Wim Taymans's avatar
Wim Taymans committed
120
121
      caps = gst_caps_new_simple ("video/x-raw",
          "format", G_TYPE_STRING, "I420", NULL);
122
      if (codec_name)
123
        *codec_name = g_strdup ("Uncompressed planar YUV 4:2:0");
124
      break;
125

Luis de Bethencourt's avatar
Luis de Bethencourt committed
126
    case GST_RIFF_YUY2:
Luis de Bethencourt's avatar
Luis de Bethencourt committed
127
    case GST_RIFF_yuy2:
128
    case GST_MAKE_FOURCC ('Y', 'U', 'N', 'V'):
Luis de Bethencourt's avatar
Luis de Bethencourt committed
129
    case GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V'):
Wim Taymans's avatar
Wim Taymans committed
130
131
      caps = gst_caps_new_simple ("video/x-raw",
          "format", G_TYPE_STRING, "YUY2", NULL);
132
      if (codec_name)
133
        *codec_name = g_strdup ("Uncompressed packed YUV 4:2:2");
134
135
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
136
    case GST_RIFF_YVU9:
Wim Taymans's avatar
Wim Taymans committed
137
138
      caps = gst_caps_new_simple ("video/x-raw",
          "format", G_TYPE_STRING, "YVU9", NULL);
139
140
141
142
      if (codec_name)
        *codec_name = g_strdup ("Uncompressed packed YVU 4:1:0");
      break;

143
    case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
Thijs Vermeir's avatar
Thijs Vermeir committed
144
    case GST_MAKE_FOURCC ('2', 'v', 'u', 'y'):
Luis de Bethencourt's avatar
Luis de Bethencourt committed
145
    case GST_MAKE_FOURCC ('H', 'D', 'Y', 'C'):
Wim Taymans's avatar
Wim Taymans committed
146
147
      caps = gst_caps_new_simple ("video/x-raw",
          "format", G_TYPE_STRING, "UYVY", NULL);
148
149
150
151
      if (codec_name)
        *codec_name = g_strdup ("Uncompressed packed YUV 4:2:2");
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
152
    case GST_RIFF_YV12:
Luis de Bethencourt's avatar
Luis de Bethencourt committed
153
    case GST_RIFF_yv12:
Wim Taymans's avatar
Wim Taymans committed
154
155
      caps = gst_caps_new_simple ("video/x-raw",
          "format", G_TYPE_STRING, "YV12", NULL);
156
157
158
      if (codec_name)
        *codec_name = g_strdup ("Uncompressed packed YVU 4:2:2");
      break;
David Schleef's avatar
David Schleef committed
159
    case GST_MAKE_FOURCC ('v', '2', '1', '0'):
Wim Taymans's avatar
Wim Taymans committed
160
161
      caps = gst_caps_new_simple ("video/x-raw",
          "format", G_TYPE_STRING, "v210", NULL);
David Schleef's avatar
David Schleef committed
162
163
164
      if (codec_name)
        *codec_name = g_strdup ("Uncompressed packed 10-bit YUV 4:2:2");
      break;
165

Luis de Bethencourt's avatar
Luis de Bethencourt committed
166
    case GST_RIFF_MJPG:        /* YUY2 MJPEG */
Luis de Bethencourt's avatar
Luis de Bethencourt committed
167
    case GST_RIFF_mJPG:
168
    case GST_MAKE_FOURCC ('A', 'V', 'R', 'n'):
Luis de Bethencourt's avatar
Luis de Bethencourt committed
169
    case GST_RIFF_IJPG:
170
    case GST_MAKE_FOURCC ('i', 'j', 'p', 'g'):
Luis de Bethencourt's avatar
Luis de Bethencourt committed
171
    case GST_RIFF_DMB1:
Luis de Bethencourt's avatar
Luis de Bethencourt committed
172
    case GST_RIFF_dmb1:
Edward Hervey's avatar
Edward Hervey committed
173
174
    case GST_MAKE_FOURCC ('A', 'C', 'D', 'V'):
    case GST_MAKE_FOURCC ('Q', 'I', 'V', 'G'):
Wim Taymans's avatar
Wim Taymans committed
175
      caps = gst_caps_new_empty_simple ("image/jpeg");
176
      if (codec_name)
177
        *codec_name = g_strdup ("Motion JPEG");
178
      break;
179

Luis de Bethencourt's avatar
Luis de Bethencourt committed
180
    case GST_RIFF_JPEG:        /* generic (mostly RGB) MJPEG */
Luis de Bethencourt's avatar
Luis de Bethencourt committed
181
    case GST_RIFF_jpeg:
182
    case GST_MAKE_FOURCC ('j', 'p', 'e', 'g'): /* generic (mostly RGB) MJPEG */
Wim Taymans's avatar
Wim Taymans committed
183
      caps = gst_caps_new_empty_simple ("image/jpeg");
184
      if (codec_name)
185
        *codec_name = g_strdup ("JPEG Still Image");
186
      break;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
187

188
    case GST_MAKE_FOURCC ('P', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
Luis de Bethencourt's avatar
Luis de Bethencourt committed
189
    case GST_RIFF_VIXL:        /* Miro/Pinnacle fourccs */
Luis de Bethencourt's avatar
Luis de Bethencourt committed
190
    case GST_RIFF_vixl:
Wim Taymans's avatar
Wim Taymans committed
191
      caps = gst_caps_new_empty_simple ("image/jpeg");
192
      if (codec_name)
Edward Hervey's avatar
Edward Hervey committed
193
194
195
196
        *codec_name = g_strdup ("Miro/Pinnacle Motion JPEG");
      break;

    case GST_MAKE_FOURCC ('C', 'J', 'P', 'G'):
Wim Taymans's avatar
Wim Taymans committed
197
      caps = gst_caps_new_empty_simple ("image/jpeg");
Edward Hervey's avatar
Edward Hervey committed
198
199
200
201
202
      if (codec_name)
        *codec_name = g_strdup ("Creative Webcam JPEG");
      break;

    case GST_MAKE_FOURCC ('S', 'L', 'M', 'J'):
Wim Taymans's avatar
Wim Taymans committed
203
      caps = gst_caps_new_empty_simple ("image/jpeg");
Edward Hervey's avatar
Edward Hervey committed
204
205
206
207
208
      if (codec_name)
        *codec_name = g_strdup ("SL Motion JPEG");
      break;

    case GST_MAKE_FOURCC ('J', 'P', 'G', 'L'):
Wim Taymans's avatar
Wim Taymans committed
209
      caps = gst_caps_new_empty_simple ("image/jpeg");
Edward Hervey's avatar
Edward Hervey committed
210
211
      if (codec_name)
        *codec_name = g_strdup ("Pegasus Lossless JPEG");
212
      break;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
213

214
    case GST_MAKE_FOURCC ('L', 'O', 'C', 'O'):
Wim Taymans's avatar
Wim Taymans committed
215
      caps = gst_caps_new_empty_simple ("video/x-loco");
216
217
218
219
      if (codec_name)
        *codec_name = g_strdup ("LOCO Lossless");
      break;

220
221
222
223
224
225
    case GST_MAKE_FOURCC ('S', 'P', '5', '3'):
    case GST_MAKE_FOURCC ('S', 'P', '5', '4'):
    case GST_MAKE_FOURCC ('S', 'P', '5', '5'):
    case GST_MAKE_FOURCC ('S', 'P', '5', '6'):
    case GST_MAKE_FOURCC ('S', 'P', '5', '7'):
    case GST_MAKE_FOURCC ('S', 'P', '5', '8'):
Wim Taymans's avatar
Wim Taymans committed
226
      caps = gst_caps_new_empty_simple ("video/sp5x");
227
228
229
230
      if (codec_name)
        *codec_name = g_strdup ("Sp5x-like JPEG");
      break;

231
    case GST_MAKE_FOURCC ('Z', 'M', 'B', 'V'):
Wim Taymans's avatar
Wim Taymans committed
232
      caps = gst_caps_new_empty_simple ("video/x-zmbv");
233
234
235
236
      if (codec_name)
        *codec_name = g_strdup ("Zip Motion Block video");
      break;

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
237
    case GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'):
Wim Taymans's avatar
Wim Taymans committed
238
      caps = gst_caps_new_empty_simple ("video/x-huffyuv");
239
240
241
242
      if (strf) {
        gst_caps_set_simple (caps, "bpp",
            G_TYPE_INT, (int) strf->bit_cnt, NULL);
      }
243
      if (codec_name)
244
        *codec_name = g_strdup ("Huffman Lossless Codec");
245
      break;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
246
247
248

    case GST_MAKE_FOURCC ('M', 'P', 'E', 'G'):
    case GST_MAKE_FOURCC ('M', 'P', 'G', 'I'):
249
250
    case GST_MAKE_FOURCC ('m', 'p', 'g', '1'):
    case GST_MAKE_FOURCC ('M', 'P', 'G', '1'):
251
    case GST_MAKE_FOURCC ('P', 'I', 'M', '1'):
252
    case GST_MAKE_FOURCC (0x01, 0x00, 0x00, 0x10):
David Schleef's avatar
David Schleef committed
253
      caps = gst_caps_new_simple ("video/mpeg",
254
          "systemstream", G_TYPE_BOOLEAN, FALSE,
255
          "mpegversion", G_TYPE_INT, 1, NULL);
256
      if (codec_name)
257
        *codec_name = g_strdup ("MPEG-1 video");
258
      break;
Edward Hervey's avatar
Edward Hervey committed
259

260
261
    case GST_MAKE_FOURCC ('M', 'P', 'G', '2'):
    case GST_MAKE_FOURCC ('m', 'p', 'g', '2'):
Edward Hervey's avatar
Edward Hervey committed
262
    case GST_MAKE_FOURCC ('P', 'I', 'M', '2'):
263
    case GST_MAKE_FOURCC ('D', 'V', 'R', ' '):
264
    case GST_MAKE_FOURCC (0x02, 0x00, 0x00, 0x10):
265
266
267
268
      caps = gst_caps_new_simple ("video/mpeg",
          "systemstream", G_TYPE_BOOLEAN, FALSE,
          "mpegversion", G_TYPE_INT, 2, NULL);
      if (codec_name)
269
        *codec_name = g_strdup ("MPEG-2 video");
270
      break;
271

Edward Hervey's avatar
Edward Hervey committed
272
273
274
275
276
277
278
279
    case GST_MAKE_FOURCC ('L', 'M', 'P', '2'):
      caps = gst_caps_new_simple ("video/mpeg",
          "systemstream", G_TYPE_BOOLEAN, FALSE,
          "mpegversion", G_TYPE_INT, 2, NULL);
      if (codec_name)
        *codec_name = g_strdup ("Lead MPEG-2 video");
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
280
281
282
    case GST_RIFF_H263:
    case GST_RIFF_h263:
    case GST_RIFF_i263:
283
    case GST_MAKE_FOURCC ('U', '2', '6', '3'):
Edward Hervey's avatar
Edward Hervey committed
284
285
    case GST_MAKE_FOURCC ('v', 'i', 'v', '1'):
    case GST_MAKE_FOURCC ('T', '2', '6', '3'):
286
287
      caps = gst_caps_new_simple ("video/x-h263",
          "variant", G_TYPE_STRING, "itu", NULL);
288
      if (codec_name)
289
        *codec_name = g_strdup ("ITU H.26n");
290
      break;
291

Luis de Bethencourt's avatar
Luis de Bethencourt committed
292
    case GST_RIFF_L263:
293
294
295
      /* http://www.leadcodecs.com/Codecs/LEAD-H263.htm */
      caps = gst_caps_new_simple ("video/x-h263",
          "variant", G_TYPE_STRING, "lead", NULL);
296
      if (codec_name)
297
        *codec_name = g_strdup ("Lead H.263");
298
      break;
299

Luis de Bethencourt's avatar
Luis de Bethencourt committed
300
301
    case GST_RIFF_M263:
    case GST_RIFF_m263:
302
303
      caps = gst_caps_new_simple ("video/x-h263",
          "variant", G_TYPE_STRING, "microsoft", NULL);
304
      if (codec_name)
305
        *codec_name = g_strdup ("Microsoft H.263");
306
      break;
307

Luis de Bethencourt's avatar
Luis de Bethencourt committed
308
    case GST_RIFF_VDOW:
309
310
      caps = gst_caps_new_simple ("video/x-h263",
          "variant", G_TYPE_STRING, "vdolive", NULL);
311
      if (codec_name)
312
        *codec_name = g_strdup ("VDOLive");
313
      break;
314

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
315
    case GST_MAKE_FOURCC ('V', 'I', 'V', 'O'):
316
317
      caps = gst_caps_new_simple ("video/x-h263",
          "variant", G_TYPE_STRING, "vivo", NULL);
318
      if (codec_name)
319
        *codec_name = g_strdup ("Vivo H.263");
320
      break;
321

Luis de Bethencourt's avatar
Luis de Bethencourt committed
322
    case GST_RIFF_x263:
323
324
      caps = gst_caps_new_simple ("video/x-h263",
          "variant", G_TYPE_STRING, "xirlink", NULL);
325
      if (codec_name)
326
        *codec_name = g_strdup ("Xirlink H.263");
327
328
      break;

329
330
      /* apparently not standard H.263...? */
    case GST_MAKE_FOURCC ('I', '2', '6', '3'):
331
332
      caps = gst_caps_new_simple ("video/x-intel-h263",
          "variant", G_TYPE_STRING, "intel", NULL);
333
334
335
336
      if (codec_name)
        *codec_name = g_strdup ("Intel H.263");
      break;

Edward Hervey's avatar
Edward Hervey committed
337
338
339
340
341
342
343
    case GST_MAKE_FOURCC ('V', 'X', '1', 'K'):
      caps = gst_caps_new_simple ("video/x-h263",
          "variant", G_TYPE_STRING, "lucent", NULL);
      if (codec_name)
        *codec_name = g_strdup ("Lucent VX1000S H.263");
      break;

344
345
    case GST_MAKE_FOURCC ('X', '2', '6', '4'):
    case GST_MAKE_FOURCC ('x', '2', '6', '4'):
346
    case GST_MAKE_FOURCC ('H', '2', '6', '4'):
347
    case GST_MAKE_FOURCC ('h', '2', '6', '4'):
348
349
    case GST_MAKE_FOURCC ('a', 'v', 'c', '1'):
    case GST_MAKE_FOURCC ('A', 'V', 'C', '1'):
350
351
      caps = gst_caps_new_simple ("video/x-h264",
          "variant", G_TYPE_STRING, "itu", NULL);
352
353
354
355
      if (codec_name)
        *codec_name = g_strdup ("ITU H.264");
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
356
    case GST_RIFF_VSSH:
357
358
      caps = gst_caps_new_simple ("video/x-h264",
          "variant", G_TYPE_STRING, "videosoft", NULL);
359
360
361
362
      if (codec_name)
        *codec_name = g_strdup ("VideoSoft H.264");
      break;

363
364
365
366
367
368
369
370
    case GST_MAKE_FOURCC ('L', '2', '6', '4'):
      /* http://www.leadcodecs.com/Codecs/LEAD-H264.htm */
      caps = gst_caps_new_simple ("video/x-h264",
          "variant", G_TYPE_STRING, "lead", NULL);
      if (codec_name)
        *codec_name = g_strdup ("Lead H.264");
      break;

371
372
    case GST_MAKE_FOURCC ('S', 'E', 'D', 'G'):
      caps = gst_caps_new_simple ("video/mpeg",
373
374
          "mpegversion", G_TYPE_INT, 4,
          "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
375
376
377
378
      if (codec_name)
        *codec_name = g_strdup ("Samsung MPEG-4");
      break;

Edward Hervey's avatar
Edward Hervey committed
379
380
    case GST_MAKE_FOURCC ('M', '4', 'C', 'C'):
      caps = gst_caps_new_simple ("video/mpeg",
381
382
          "mpegversion", G_TYPE_INT, 4,
          "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
Edward Hervey's avatar
Edward Hervey committed
383
384
385
386
      if (codec_name)
        *codec_name = g_strdup ("Divio MPEG-4");
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
387
    case GST_RIFF_DIV3:
388
    case GST_MAKE_FOURCC ('d', 'i', 'v', '3'):
Edward Hervey's avatar
Edward Hervey committed
389
390
    case GST_MAKE_FOURCC ('D', 'V', 'X', '3'):
    case GST_MAKE_FOURCC ('d', 'v', 'x', '3'):
391
    case GST_MAKE_FOURCC ('D', 'I', 'V', '4'):
392
    case GST_MAKE_FOURCC ('d', 'i', 'v', '4'):
393
    case GST_MAKE_FOURCC ('D', 'I', 'V', '5'):
394
    case GST_MAKE_FOURCC ('d', 'i', 'v', '5'):
395
    case GST_MAKE_FOURCC ('D', 'I', 'V', '6'):
396
    case GST_MAKE_FOURCC ('d', 'i', 'v', '6'):
397
398
399
400
401
402
403
    case GST_MAKE_FOURCC ('M', 'P', 'G', '3'):
    case GST_MAKE_FOURCC ('m', 'p', 'g', '3'):
    case GST_MAKE_FOURCC ('c', 'o', 'l', '0'):
    case GST_MAKE_FOURCC ('C', 'O', 'L', '0'):
    case GST_MAKE_FOURCC ('c', 'o', 'l', '1'):
    case GST_MAKE_FOURCC ('C', 'O', 'L', '1'):
    case GST_MAKE_FOURCC ('A', 'P', '4', '1'):
David Schleef's avatar
David Schleef committed
404
      caps = gst_caps_new_simple ("video/x-divx",
405
          "divxversion", G_TYPE_INT, 3, NULL);
406
      if (codec_name)
407
        *codec_name = g_strdup ("DivX MS-MPEG-4 Version 3");
408
      break;
409

410
411
    case GST_MAKE_FOURCC ('d', 'i', 'v', 'x'):
    case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'):
412
      caps = gst_caps_new_simple ("video/x-divx",
413
          "divxversion", G_TYPE_INT, 4, NULL);
414
      if (codec_name)
415
        *codec_name = g_strdup ("DivX MPEG-4 Version 4");
416
      break;
417

418
419
420
421
422
423
424
    case GST_MAKE_FOURCC ('B', 'L', 'Z', '0'):
      caps = gst_caps_new_simple ("video/x-divx",
          "divxversion", G_TYPE_INT, 4, NULL);
      if (codec_name)
        *codec_name = g_strdup ("Blizzard DivX");
      break;

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
425
    case GST_MAKE_FOURCC ('D', 'X', '5', '0'):
David Schleef's avatar
David Schleef committed
426
      caps = gst_caps_new_simple ("video/x-divx",
427
          "divxversion", G_TYPE_INT, 5, NULL);
428
      if (codec_name)
429
        *codec_name = g_strdup ("DivX MPEG-4 Version 5");
430
431
      break;

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
432
    case GST_MAKE_FOURCC ('M', 'P', 'G', '4'):
Edward Hervey's avatar
Edward Hervey committed
433
434
    case GST_MAKE_FOURCC ('M', 'P', '4', '1'):
    case GST_MAKE_FOURCC ('m', 'p', '4', '1'):
David Schleef's avatar
David Schleef committed
435
      caps = gst_caps_new_simple ("video/x-msmpeg",
436
          "msmpegversion", G_TYPE_INT, 41, NULL);
437
      if (codec_name)
438
        *codec_name = g_strdup ("Microsoft MPEG-4 4.1");
439
440
      break;

441
    case GST_MAKE_FOURCC ('m', 'p', '4', '2'):
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
442
    case GST_MAKE_FOURCC ('M', 'P', '4', '2'):
David Schleef's avatar
David Schleef committed
443
      caps = gst_caps_new_simple ("video/x-msmpeg",
444
          "msmpegversion", G_TYPE_INT, 42, NULL);
445
      if (codec_name)
446
        *codec_name = g_strdup ("Microsoft MPEG-4 4.2");
447
448
      break;

449
    case GST_MAKE_FOURCC ('m', 'p', '4', '3'):
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
450
    case GST_MAKE_FOURCC ('M', 'P', '4', '3'):
David Schleef's avatar
David Schleef committed
451
      caps = gst_caps_new_simple ("video/x-msmpeg",
452
          "msmpegversion", G_TYPE_INT, 43, NULL);
453
      if (codec_name)
454
        *codec_name = g_strdup ("Microsoft MPEG-4 4.3");
455
456
      break;

457
    case GST_MAKE_FOURCC ('M', 'P', '4', 'S'):
458
459
    case GST_MAKE_FOURCC ('M', '4', 'S', '2'):
      caps = gst_caps_new_simple ("video/mpeg",
460
461
          "mpegversion", G_TYPE_INT, 4,
          "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
462
463
464
465
466
      if (codec_name)
        *codec_name = g_strdup ("Microsoft ISO MPEG-4 1.1");
      break;

    case GST_MAKE_FOURCC ('F', 'M', 'P', '4'):
467
    case GST_MAKE_FOURCC ('U', 'M', 'P', '4'):
Edward Hervey's avatar
Edward Hervey committed
468
    case GST_MAKE_FOURCC ('F', 'F', 'D', 'S'):
469
      caps = gst_caps_new_simple ("video/mpeg",
470
471
          "mpegversion", G_TYPE_INT, 4,
          "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
472
473
474
475
      if (codec_name)
        *codec_name = g_strdup ("FFmpeg MPEG-4");
      break;

476
477
    case GST_MAKE_FOURCC ('3', 'I', 'V', '1'):
    case GST_MAKE_FOURCC ('3', 'I', 'V', '2'):
478
479
    case GST_MAKE_FOURCC ('X', 'V', 'I', 'D'):
    case GST_MAKE_FOURCC ('x', 'v', 'i', 'd'):
Edward Hervey's avatar
Edward Hervey committed
480
481
482
483
484
485
486
487
488
489
490
491
492
493
    case GST_MAKE_FOURCC ('E', 'M', '4', 'A'):
    case GST_MAKE_FOURCC ('E', 'P', 'V', 'H'):
    case GST_MAKE_FOURCC ('F', 'V', 'F', 'W'):
    case GST_MAKE_FOURCC ('I', 'N', 'M', 'C'):
    case GST_MAKE_FOURCC ('D', 'I', 'G', 'I'):
    case GST_MAKE_FOURCC ('D', 'M', '2', 'K'):
    case GST_MAKE_FOURCC ('D', 'C', 'O', 'D'):
    case GST_MAKE_FOURCC ('M', 'V', 'X', 'M'):
    case GST_MAKE_FOURCC ('P', 'M', '4', 'V'):
    case GST_MAKE_FOURCC ('S', 'M', 'P', '4'):
    case GST_MAKE_FOURCC ('D', 'X', 'G', 'M'):
    case GST_MAKE_FOURCC ('V', 'I', 'D', 'M'):
    case GST_MAKE_FOURCC ('M', '4', 'T', '3'):
    case GST_MAKE_FOURCC ('G', 'E', 'O', 'X'):
494
495
    case GST_MAKE_FOURCC ('M', 'P', '4', 'V'):
    case GST_MAKE_FOURCC ('m', 'p', '4', 'v'):
496
    case GST_MAKE_FOURCC ('R', 'M', 'P', '4'):
Edward Hervey's avatar
Edward Hervey committed
497
      caps = gst_caps_new_simple ("video/mpeg",
498
499
          "mpegversion", G_TYPE_INT, 4,
          "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
Edward Hervey's avatar
Edward Hervey committed
500
501
502
503
      if (codec_name)
        *codec_name = g_strdup ("MPEG-4");
      break;

504
505
    case GST_MAKE_FOURCC ('3', 'i', 'v', 'd'):
    case GST_MAKE_FOURCC ('3', 'I', 'V', 'D'):
506
507
      caps = gst_caps_new_simple ("video/x-msmpeg",
          "msmpegversion", G_TYPE_INT, 43, NULL);
508
509
      if (codec_name)
        *codec_name = g_strdup ("Microsoft MPEG-4 4.3");        /* FIXME? */
510
      break;
511

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
512
513
    case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'):
    case GST_MAKE_FOURCC ('d', 'v', 's', 'd'):
Edward Hervey's avatar
Edward Hervey committed
514
515
    case GST_MAKE_FOURCC ('d', 'v', 'c', ' '):
    case GST_MAKE_FOURCC ('d', 'v', '2', '5'):
David Schleef's avatar
David Schleef committed
516
      caps = gst_caps_new_simple ("video/x-dv",
517
518
          "systemstream", G_TYPE_BOOLEAN, FALSE,
          "dvversion", G_TYPE_INT, 25, NULL);
519
      if (codec_name)
520
        *codec_name = g_strdup ("Generic DV");
521
522
      break;

Edward Hervey's avatar
Edward Hervey committed
523
524
525
526
527
528
529
530
531
    case GST_MAKE_FOURCC ('C', 'D', 'V', 'C'):
    case GST_MAKE_FOURCC ('c', 'd', 'v', 'c'):
      caps = gst_caps_new_simple ("video/x-dv",
          "systemstream", G_TYPE_BOOLEAN, FALSE,
          "dvversion", G_TYPE_INT, 25, NULL);
      if (codec_name)
        *codec_name = g_strdup ("Canopus DV");
      break;

532
533
534
535
536
537
538
539
540
    case GST_MAKE_FOURCC ('D', 'V', '5', '0'):
    case GST_MAKE_FOURCC ('d', 'v', '5', '0'):
      caps = gst_caps_new_simple ("video/x-dv",
          "systemstream", G_TYPE_BOOLEAN, FALSE,
          "dvversion", G_TYPE_INT, 50, NULL);
      if (codec_name)
        *codec_name = g_strdup ("DVCPro50 Video");
      break;

541
542
543
544
545
546
547
548
549
550
551
552
553
554
    case GST_MAKE_FOURCC ('M', 'S', 'S', '1'):
      caps = gst_caps_new_simple ("video/x-wmv",
          "wmvversion", G_TYPE_INT, 1, "format", G_TYPE_STRING, "MSS1", NULL);
      if (codec_name)
        *codec_name = g_strdup ("Microsoft Windows Media 7 Screen");
      break;

    case GST_MAKE_FOURCC ('M', 'S', 'S', '2'):
      caps = gst_caps_new_simple ("video/x-wmv",
          "wmvversion", G_TYPE_INT, 3, "format", G_TYPE_STRING, "MSS2", NULL);
      if (codec_name)
        *codec_name = g_strdup ("Microsoft Windows Media 9 Screen");
      break;

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
555
    case GST_MAKE_FOURCC ('W', 'M', 'V', '1'):
David Schleef's avatar
David Schleef committed
556
      caps = gst_caps_new_simple ("video/x-wmv",
557
          "wmvversion", G_TYPE_INT, 1, NULL);
558
      if (codec_name)
559
        *codec_name = g_strdup ("Microsoft Windows Media 7");
560
561
      break;

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
562
    case GST_MAKE_FOURCC ('W', 'M', 'V', '2'):
David Schleef's avatar
David Schleef committed
563
      caps = gst_caps_new_simple ("video/x-wmv",
564
          "wmvversion", G_TYPE_INT, 2, NULL);
565
      if (codec_name)
566
        *codec_name = g_strdup ("Microsoft Windows Media 8");
567
      break;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
568
569

    case GST_MAKE_FOURCC ('W', 'M', 'V', '3'):
570
      caps = gst_caps_new_simple ("video/x-wmv",
571
          "wmvversion", G_TYPE_INT, 3, "format", G_TYPE_STRING, "WMV3", NULL);
572
      if (codec_name)
573
        *codec_name = g_strdup ("Microsoft Windows Media 9");
574
575
      break;

576
577
    case GST_MAKE_FOURCC ('W', 'M', 'V', 'A'):
      caps = gst_caps_new_simple ("video/x-wmv",
Wim Taymans's avatar
Wim Taymans committed
578
          "wmvversion", G_TYPE_INT, 3, "format", G_TYPE_STRING, "WMVA", NULL);
579
580
581
582
      if (codec_name)
        *codec_name = g_strdup ("Microsoft Windows Media Advanced Profile");
      break;

583
584
    case GST_MAKE_FOURCC ('W', 'V', 'C', '1'):
      caps = gst_caps_new_simple ("video/x-wmv",
Wim Taymans's avatar
Wim Taymans committed
585
          "wmvversion", G_TYPE_INT, 3, "format", G_TYPE_STRING, "WVC1", NULL);
586
587
588
589
      if (codec_name)
        *codec_name = g_strdup ("Microsoft Windows Media VC-1");
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
590
    case GST_RIFF_cvid:
Luis de Bethencourt's avatar
Luis de Bethencourt committed
591
    case GST_RIFF_CVID:
Wim Taymans's avatar
Wim Taymans committed
592
      caps = gst_caps_new_empty_simple ("video/x-cinepak");
593
594
595
596
      if (codec_name)
        *codec_name = g_strdup ("Cinepak video");
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
597
598
599
600
601
602
    case GST_RIFF_FCCH_MSVC:
    case GST_RIFF_FCCH_msvc:
    case GST_RIFF_CRAM:
    case GST_RIFF_cram:
    case GST_RIFF_WHAM:
    case GST_RIFF_wham:
603
604
      caps = gst_caps_new_simple ("video/x-msvideocodec",
          "msvideoversion", G_TYPE_INT, 1, NULL);
605
606
607
608
      if (strf) {
        gst_caps_set_simple (caps, "bpp",
            G_TYPE_INT, (int) strf->bit_cnt, NULL);
      }
609
610
      if (codec_name)
        *codec_name = g_strdup ("MS video v1");
611
612
      palette = strf_data;
      strf_data = NULL;
613
614
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
615
    case GST_RIFF_FCCH_RLE:
616
617
    case GST_MAKE_FOURCC ('m', 'r', 'l', 'e'):
    case GST_MAKE_FOURCC (0x1, 0x0, 0x0, 0x0): /* why, why, why? */
Edward Hervey's avatar
Edward Hervey committed
618
    case GST_MAKE_FOURCC (0x2, 0x0, 0x0, 0x0): /* why, why, why? */
619
620
      caps = gst_caps_new_simple ("video/x-rle",
          "layout", G_TYPE_STRING, "microsoft", NULL);
621
622
      palette = strf_data;
      strf_data = NULL;
623
624
625
626
627
628
629
      if (strf) {
        gst_caps_set_simple (caps,
            "depth", G_TYPE_INT, (gint) strf->bit_cnt, NULL);
      } else {
        gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 1, 64, NULL);
      }
      if (codec_name)
630
631
632
        *codec_name = g_strdup ("Microsoft RLE");
      break;

633
    case GST_MAKE_FOURCC ('A', 'A', 'S', 'C'):
Wim Taymans's avatar
Wim Taymans committed
634
      caps = gst_caps_new_empty_simple ("video/x-aasc");
635
636
637
638
      if (codec_name)
        *codec_name = g_strdup ("Autodesk Animator");
      break;

639
640
641
642
643
    case GST_MAKE_FOURCC ('X', 'x', 'a', 'n'):
      caps = gst_caps_new_simple ("video/x-xan",
          "wcversion", G_TYPE_INT, 4, NULL);
      if (codec_name)
        *codec_name = g_strdup ("Xan Wing Commander 4");
644
645
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
646
    case GST_RIFF_RT21:
Luis de Bethencourt's avatar
Luis de Bethencourt committed
647
    case GST_RIFF_rt21:
648
649
650
651
652
653
      caps = gst_caps_new_simple ("video/x-indeo",
          "indeoversion", G_TYPE_INT, 2, NULL);
      if (codec_name)
        *codec_name = g_strdup ("Intel Video 2");
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
654
655
656
657
    case GST_RIFF_IV31:
    case GST_RIFF_IV32:
    case GST_RIFF_iv31:
    case GST_RIFF_iv32:
658
659
660
661
662
663
      caps = gst_caps_new_simple ("video/x-indeo",
          "indeoversion", G_TYPE_INT, 3, NULL);
      if (codec_name)
        *codec_name = g_strdup ("Intel Video 3");
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
664
665
    case GST_RIFF_IV41:
    case GST_RIFF_iv41:
666
667
668
669
670
671
      caps = gst_caps_new_simple ("video/x-indeo",
          "indeoversion", G_TYPE_INT, 4, NULL);
      if (codec_name)
        *codec_name = g_strdup ("Intel Video 4");
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
672
    case GST_RIFF_IV50:
673
674
      caps = gst_caps_new_simple ("video/x-indeo",
          "indeoversion", G_TYPE_INT, 5, NULL);
675
676
677
678
      if (codec_name)
        *codec_name = g_strdup ("Intel Video 5");
      break;

679
    case GST_MAKE_FOURCC ('M', 'S', 'Z', 'H'):
Wim Taymans's avatar
Wim Taymans committed
680
      caps = gst_caps_new_empty_simple ("video/x-mszh");
681
682
683
684
685
      if (codec_name)
        *codec_name = g_strdup ("Lossless MSZH Video");
      break;

    case GST_MAKE_FOURCC ('Z', 'L', 'I', 'B'):
Wim Taymans's avatar
Wim Taymans committed
686
      caps = gst_caps_new_empty_simple ("video/x-zlib");
687
688
689
690
691
      if (codec_name)
        *codec_name = g_strdup ("Lossless zlib video");
      break;

    case GST_MAKE_FOURCC ('C', 'L', 'J', 'R'):
Edward Hervey's avatar
Edward Hervey committed
692
    case GST_MAKE_FOURCC ('c', 'l', 'j', 'r'):
Wim Taymans's avatar
Wim Taymans committed
693
      caps = gst_caps_new_empty_simple ("video/x-cirrus-logic-accupak");
694
695
696
697
      if (codec_name)
        *codec_name = g_strdup ("Cirrus Logipak AccuPak");
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
698
699
    case GST_RIFF_CYUV:
    case GST_RIFF_cyuv:
Wim Taymans's avatar
Wim Taymans committed
700
      caps = gst_caps_new_empty_simple ("video/x-compressed-yuv");
701
702
703
704
705
      if (codec_name)
        *codec_name = g_strdup ("CYUV Lossless");
      break;

    case GST_MAKE_FOURCC ('D', 'U', 'C', 'K'):
Edward Hervey's avatar
Edward Hervey committed
706
    case GST_MAKE_FOURCC ('P', 'V', 'E', 'Z'):
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
      caps = gst_caps_new_simple ("video/x-truemotion",
          "trueversion", G_TYPE_INT, 1, NULL);
      if (codec_name)
        *codec_name = g_strdup ("Duck Truemotion1");
      break;

    case GST_MAKE_FOURCC ('T', 'M', '2', '0'):
      caps = gst_caps_new_simple ("video/x-truemotion",
          "trueversion", G_TYPE_INT, 2, NULL);
      if (codec_name)
        *codec_name = g_strdup ("TrueMotion 2.0");
      break;

    case GST_MAKE_FOURCC ('V', 'P', '3', '0'):
    case GST_MAKE_FOURCC ('v', 'p', '3', '0'):
    case GST_MAKE_FOURCC ('V', 'P', '3', '1'):
    case GST_MAKE_FOURCC ('v', 'p', '3', '1'):
    case GST_MAKE_FOURCC ('V', 'P', '3', ' '):
Wim Taymans's avatar
Wim Taymans committed
725
      caps = gst_caps_new_empty_simple ("video/x-vp3");
726
727
728
729
      if (codec_name)
        *codec_name = g_strdup ("VP3");
      break;

Luis de Bethencourt's avatar
Luis de Bethencourt committed
730
    case GST_RIFF_ULTI:
Luis de Bethencourt's avatar
Luis de Bethencourt committed
731
    case GST_RIFF_ulti:
Wim Taymans's avatar
Wim Taymans committed
732
      caps = gst_caps_new_empty_simple ("video/x-ultimotion");
733
734
735
736
      if (codec_name)
        *codec_name = g_strdup ("IBM UltiMotion");
      break;

737
      /* FIXME 2.0: Rename video/x-camtasia to video/x-tscc,version=1 */
738
    case GST_MAKE_FOURCC ('T', 'S', 'C', 'C'):
739
740
    case GST_MAKE_FOURCC ('t', 's', 'c', 'c'):{
      if (strf) {
741
        gint depth = (strf->bit_cnt != 0) ? (gint) strf->bit_cnt : 24;
742

743
744
        caps = gst_caps_new_simple ("video/x-camtasia", "depth", G_TYPE_INT,
            depth, NULL);
745
746
      } else {
        /* template caps */
Wim Taymans's avatar
Wim Taymans committed
747
        caps = gst_caps_new_empty_simple ("video/x-camtasia");
748
      }
749
750
751
      if (codec_name)
        *codec_name = g_strdup ("TechSmith Camtasia");
      break;
752
    }
753

754
755
756
757
758
759
760
761
762
763
    case GST_MAKE_FOURCC ('T', 'S', 'C', '2'):
    case GST_MAKE_FOURCC ('t', 's', 'c', '2'):{
      caps =
          gst_caps_new_simple ("video/x-tscc", "tsccversion", G_TYPE_INT, 2,
          NULL);
      if (codec_name)
        *codec_name = g_strdup ("TechSmith Screen Capture 2");
      break;
    }

764
765
766
767
768
769
770
771
772
    case GST_MAKE_FOURCC ('C', 'S', 'C', 'D'):
    {
      if (strf) {
        gint depth = (strf->bit_cnt != 0) ? (gint) strf->bit_cnt : 24;

        caps = gst_caps_new_simple ("video/x-camstudio", "depth", G_TYPE_INT,
            depth, NULL);
      } else {
        /* template caps */
Wim Taymans's avatar
Wim Taymans committed
773
        caps = gst_caps_new_empty_simple ("video/x-camstudio");
774
775
776
777
778
779
      }
      if (codec_name)
        *codec_name = g_strdup ("Camstudio");
      break;
    }

780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
    case GST_MAKE_FOURCC ('V', 'C', 'R', '1'):
      caps = gst_caps_new_simple ("video/x-ati-vcr",
          "vcrversion", G_TYPE_INT, 1, NULL);
      if (codec_name)
        *codec_name = g_strdup ("ATI VCR 1");
      break;

    case GST_MAKE_FOURCC ('V', 'C', 'R', '2'):
      caps = gst_caps_new_simple ("video/x-ati-vcr",
          "vcrversion", G_TYPE_INT, 2, NULL);
      if (codec_name)
        *codec_name = g_strdup ("ATI VCR 2");
      break;

    case GST_MAKE_FOURCC ('A', 'S', 'V', '1'):
      caps = gst_caps_new_simple ("video/x-asus",
          "asusversion", G_TYPE_INT, 1, NULL);
      if (codec_name)
        *codec_name = g_strdup ("Asus Video 1");
      break;

    case GST_MAKE_FOURCC ('A', 'S', 'V', '2'):
      caps = gst_caps_new_simple ("video/x-asus",
          "asusversion", G_TYPE_INT, 2, NULL);
      if (codec_name)
        *codec_name = g_strdup ("Asus Video 2");
      break;

    case GST_MAKE_FOURCC ('M', 'P', 'N', 'G'):
    case GST_MAKE_FOURCC ('m', 'p', 'n', 'g'):
    case GST_MAKE_FOURCC ('P', 'N', 'G', ' '):
Olivier Crête's avatar
Olivier Crête committed
811
    case GST_MAKE_FOURCC ('p', 'n', 'g', ' '):
Wim Taymans's avatar
Wim Taymans committed
812
      caps = gst_caps_new_empty_simple ("image/png");
813
814
815
816
      if (codec_name)
        *codec_name = g_strdup ("PNG image");
      break;

817
818
819
820
821
822
823
    case GST_MAKE_FOURCC ('F', 'L', 'V', '1'):
      caps = gst_caps_new_simple ("video/x-flash-video",
          "flvversion", G_TYPE_INT, 1, NULL);
      if (codec_name)
        *codec_name = g_strdup ("Flash Video 1");
      break;

824
825
826
    case GST_MAKE_FOURCC ('V', 'M', 'n', 'c'):
      caps = gst_caps_new_simple ("video/x-vmnc",
          "version", G_TYPE_INT, 1, NULL);
827
828
      if (strf && strf->bit_cnt != 0)
        gst_caps_set_simple (caps, "bpp", G_TYPE_INT, strf->bit_cnt, NULL);
829
830
831
832
      if (codec_name)
        *codec_name = g_strdup ("VMWare NC Video");
      break;

833
    case GST_MAKE_FOURCC ('d', 'r', 'a', 'c'):
Wim Taymans's avatar
Wim Taymans committed
834
      caps = gst_caps_new_empty_simple ("video/x-dirac");
835
836
837
838
      if (codec_name)
        *codec_name = g_strdup ("Dirac");
      break;

Edward Hervey's avatar
Edward Hervey committed
839
840
841
    case GST_RIFF_rpza:
    case GST_RIFF_azpr:
    case GST_MAKE_FOURCC ('R', 'P', 'Z', 'A'):
Wim Taymans's avatar
Wim Taymans committed
842
      caps = gst_caps_new_empty_simple ("video/x-apple-video");
Edward Hervey's avatar
Edward Hervey committed
843
844
845
846
847
      if (codec_name)
        *codec_name = g_strdup ("Apple Video (RPZA)");
      break;


848
849
850
851
852
853
854
    case GST_MAKE_FOURCC ('F', 'F', 'V', '1'):
      caps = gst_caps_new_simple ("video/x-ffv",
          "ffvversion", G_TYPE_INT, 1, NULL);
      if (codec_name)
        *codec_name = g_strdup ("FFmpeg lossless video codec");
      break;

855
    case GST_MAKE_FOURCC ('K', 'M', 'V', 'C'):
Wim Taymans's avatar
Wim Taymans committed
856
      caps = gst_caps_new_empty_simple ("video/x-kmvc");
857
858
859
860
      if (codec_name)
        *codec_name = g_strdup ("Karl Morton's video codec");
      break;

Edward Hervey's avatar
Edward Hervey committed
861
862
    case GST_MAKE_FOURCC ('v', 'p', '5', '0'):
    case GST_MAKE_FOURCC ('V', 'P', '5', '0'):
Wim Taymans's avatar
Wim Taymans committed
863
      caps = gst_caps_new_empty_simple ("video/x-vp5");
Edward Hervey's avatar
Edward Hervey committed
864
865
866
867
      if (codec_name)
        *codec_name = g_strdup ("On2 VP5");
      break;

868
869
    case GST_MAKE_FOURCC ('v', 'p', '6', '0'):
    case GST_MAKE_FOURCC ('V', 'P', '6', '0'):
870
871
    case GST_MAKE_FOURCC ('v', 'p', '6', '1'):
    case GST_MAKE_FOURCC ('V', 'P', '6', '1'):
872
873
    case GST_MAKE_FOURCC ('V', 'p', '6', '2'):
    case GST_MAKE_FOURCC ('V', 'P', '6', '2'):
Wim Taymans's avatar
Wim Taymans committed
874
      caps = gst_caps_new_empty_simple ("video/x-vp6");
875
876
877
878
      if (codec_name)
        *codec_name = g_strdup ("On2 VP6");
      break;

879
880
    case GST_MAKE_FOURCC ('V', 'P', '6', 'F'):
    case GST_MAKE_FOURCC ('v', 'p', '6', 'f'):
881
    case GST_MAKE_FOURCC ('F', 'L', 'V', '4'):
Wim Taymans's avatar
Wim Taymans committed
882
      caps = gst_caps_new_empty_simple ("video/x-vp6-flash");
883
884
885
886
      if (codec_name)
        *codec_name = g_strdup ("On2 VP6");
      break;

887
888
    case GST_MAKE_FOURCC ('v', 'p', '7', '0'):
    case GST_MAKE_FOURCC ('V', 'P', '7', '0'):
Wim Taymans's avatar
Wim Taymans committed
889
      caps = gst_caps_new_empty_simple ("video/x-vp7");
890
891
892
893
      if (codec_name)
        *codec_name = g_strdup ("On2 VP7");
      break;

894
    case GST_MAKE_FOURCC ('V', 'P', '8', '0'):
Wim Taymans's avatar
Wim Taymans committed
895
      caps = gst_caps_new_empty_simple ("video/x-vp8");
896
897
898
899
      if (codec_name)
        *codec_name = g_strdup ("On2 VP8");
      break;

Edward Hervey's avatar
Edward Hervey committed
900
    case GST_MAKE_FOURCC ('L', 'M', '2', '0'):
Wim Taymans's avatar
Wim Taymans committed
901
      caps = gst_caps_new_empty_simple ("video/x-mimic");
Edward Hervey's avatar
Edward Hervey committed
902
903
904
905
      if (codec_name)
        *codec_name = g_strdup ("Mimic webcam");
      break;

Wim Taymans's avatar
Wim Taymans committed
906
907
    case GST_MAKE_FOURCC ('T', 'H', 'E', 'O'):
    case GST_MAKE_FOURCC ('t', 'h', 'e', 'o'):
Wim Taymans's avatar
Wim Taymans committed
908
      caps = gst_caps_new_empty_simple ("video/x-theora");
Wim Taymans's avatar
Wim Taymans committed
909
910
911
912
      if (codec_name)
        *codec_name = g_strdup ("Theora video codec");

      break;
Edward Hervey's avatar
Edward Hervey committed
913

914
    case GST_MAKE_FOURCC ('F', 'P', 'S', '1'):
Wim Taymans's avatar
Wim Taymans committed
915
      caps = gst_caps_new_empty_simple ("video/x-fraps");
916
917
918
919
920
      if (codec_name)
        *codec_name = g_strdup ("Fraps video");

      break;

921
    case GST_MAKE_FOURCC ('D', 'X', 'S', 'B'):
922
    case GST_MAKE_FOURCC ('D', 'X', 'S', 'A'):
923
924
925
926
927
928
      caps = gst_caps_new_empty_simple ("subpicture/x-xsub");
      if (codec_name)
        *codec_name = g_strdup ("XSUB subpicture stream");

      break;

929
    default:
930
      GST_WARNING ("Unknown video fourcc %" GST_FOURCC_FORMAT,
931
          GST_FOURCC_ARGS (codec_fcc));
David Schleef's avatar
David Schleef committed
932
      return NULL;
933
934
  }

David Schleef's avatar
David Schleef committed
935
  if (strh != NULL) {
936
937
    gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION,
        strh->rate, strh->scale, NULL);
David Schleef's avatar
David Schleef committed
938
939
  } else {
    gst_caps_set_simple (caps,
940
        "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
David Schleef's avatar
David Schleef committed
941