fourcc.c 37.6 KB
Newer Older
1
2
3
/*****************************************************************************
 * fourcc.c: fourcc helpers functions
 *****************************************************************************
Laurent Aimar's avatar
Laurent Aimar committed
4
 * Copyright (C) 2009 Laurent Aimar
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 * $Id$
 *
 * Authors: Laurent Aimar <fenrir@videolan.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <vlc_fourcc.h>
#include <assert.h>

typedef struct
{
    char p_class[4];
    char p_fourcc[4];
    const char *psz_description;
} entry_t;

#define NULL4 "\x00\x00\x00\x00"

/* XXX You don't want to see the preprocessor generated code ;) */
#ifdef WORDS_BIGENDIAN
#   define FCC2STR(f) { ((f)>>24)&0xff, ((f)>>16)&0xff, ((f)>>8)&0xff, ((f)>>0)&0xff }
#else
#   define FCC2STR(f) { ((f)>>0)&0xff, ((f)>>8)&0xff, ((f)>>16)&0xff, ((f)>>24)&0xff }
#endif
/* Begin a new class */
#define B(a, c) { .p_class = FCC2STR(a), .p_fourcc = FCC2STR(a), .psz_description = c }
/* Create a sub-class entry with description */
#define E(b, c) { .p_class = NULL4, .p_fourcc = b, .psz_description = c }
/* Create a sub-class entry without description (alias) */
#define A(b) E(b, NULL4)


/* */
static const entry_t p_list_video[] = {
Laurent Aimar's avatar
Laurent Aimar committed
59
60
61

    B(VLC_CODEC_MPGV, "MPEG-1/2 Video"),
        A("mpgv"),
62
63
64
65
66
67
        A("mp1v"),
        A("mpeg"),
        A("mpg1"),
        A("mp2v"),
        A("MPEG"),
        A("mpg2"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
68
        A("MPG2"),
Laurent Aimar's avatar
Laurent Aimar committed
69
70
71

        E("PIM1", "Pinnacle DC1000 (MPEG-1 Video)"),

72
73
74
75
76
77
78
79
80
81
82
83
84
85
        E("hdv1", "HDV 720p30 (MPEG-2 Video)"),
        E("hdv2", "Sony HDV (MPEG-2 Video)"),
        E("hdv3", "FCP HDV (MPEG-2 Video)"),
        E("hdv5", "HDV 720p25 (MPEG-2 Video)"),
        E("hdv6", "HDV 1080p24 (MPEG-2 Video)"),
        E("hdv7", "HDV 1080p25 (MPEG-2 Video)"),
        E("hdv8", "HDV 1080p30 (MPEG-2 Video)"),

        E("mx5n", "MPEG2 IMX NTSC 525/60 50mb/s (FCP)"),
        E("mx5p", "MPEG2 IMX PAL 625/60 50mb/s (FCP)"),
        E("mx4n", "MPEG2 IMX NTSC 525/60 40mb/s (FCP)"),
        E("mx4p", "MPEG2 IMX PAL 625/50 40mb/s (FCP)"),
        E("mx3n", "MPEG2 IMX NTSC 525/60 30mb/s (FCP)"),
        E("mx3p", "MPEG2 IMX NTSC 625/50 30mb/s (FCP)"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

        E("xdv1", "XDCAM HD"),
        E("xdv2", "XDCAM HD 1080i60 35mb/s"),
        E("xdv3", "XDCAM HD 1080i50 35mb/s"),
        E("xdv4", "XDCAM HD"),
        E("xdv5", "XDCAM HD"),
        E("xdv6", "XDCAM HD 1080p24 35mb/s"),
        E("xdv7", "XDCAM HD 1080p25 35mb/s"),
        E("xdv8", "XDCAM HD 1080p30 35mb/s"),
        E("xdv9", "XDCAM HD"),

        E("xdva", "XDCAM"),
        E("xdvb", "XDCAM"),
        E("xdvc", "XDCAM"),
        E("xdvd", "XDCAM"),
        E("xdve", "XDCAM"),
        E("xdvf", "XDCAM"),

        E("xd5a", "XDCAM"),
        E("xd5b", "XDCAM"),
        E("xd5c", "XDCAM"),
        E("xd5d", "XDCAM"),
        E("xd5e", "XDCAM"),
        E("xd5f", "XDCAM"),
        E("xd59", "XDCAM"),

112
        E("AVmp", "AVID IMX PAL"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
113
114
115
116
117
118
        E("MMES", "Matrox MPEG-2"),
        E("mmes", "Matrox MPEG-2"),
        E("PIM2", "Pinnacle MPEG-2"),
        E("LMP2", "Lead MPEG-2"),

        E("VCR2", "ATI VCR-2"),
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138

    B(VLC_CODEC_MP4V, "MPEG-4 Video"),
        A("mp4v"),
        A("DIVX"),
        A("divx"),
        A("MP4S"),
        A("mp4s"),
        A("M4S2"),
        A("m4s2"),
        A("MP4V"),
        A("\x04\x00\x00\x00"),
        A("m4cc"),
        A("M4CC"),
        A("FMP4"),
        A("fmp4"),
        A("DCOD"),
        A("MVXM"),
        A("PM4V"),
        A("M4T3"),
        A("GEOX"),
139
        A("GEOV"),
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
        A("DMK2"),
        A("WV1F"),
        A("DIGI"),
        A("INMC"),
        A("SN40"),
        A("EPHV"),
        /* XVID flavours */
        E("xvid", "Xvid MPEG-4 Video"),
        E("XVID", "Xvid MPEG-4 Video"),
        E("XviD", "Xvid MPEG-4 Video"),
        E("XVIX", "Xvid MPEG-4 Video"),
        E("xvix", "Xvid MPEG-4 Video"),
        /* DX50 */
        E("DX50", "DivX MPEG-4 Video"),
        E("dx50", "DivX MPEG-4 Video"),
        E("BLZ0", "Blizzard MPEG-4 Video"),
        E("DXGM", "Electronic Arts Game MPEG-4 Video"),
        /* 3ivx delta 4 */
        E("3IV2", "3ivx MPEG-4 Video"),
        E("3iv2", "3ivx MPEG-4 Video"),
        /* Various */
        E("UMP4", "UB MPEG-4 Video"),
        E("SEDG", "Samsung MPEG-4 Video"),
        E("RMP4", "REALmagic MPEG-4 Video"),
        E("HDX4", "Jomigo HDX4 (MPEG-4 Video)"),
        E("hdx4", "Jomigo HDX4 (MPEG-4 Video)"),
        E("SMP4", "Samsung SMP4 (MPEG-4 Video)"),
        E("smp4", "Samsung SMP4 (MPEG-4 Video)"),
        E("fvfw", "FFmpeg MPEG-4"),
        E("FVFW", "FFmpeg MPEG-4"),
        E("FFDS", "FFDShow MPEG-4"),
        E("VIDM", "vidm 4.01 codec"),
Laurent Aimar's avatar
Laurent Aimar committed
172
173
174
175
        /* 3ivx delta 3.5 Unsupported
         * putting it here gives extreme distorted images */
        //E("3IV1", "3ivx delta 3.5 MPEG-4 Video"),
        //E("3iv1", "3ivx delta 3.5 MPEG-4 Video"),
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206

    /* MSMPEG4 v1 */
    B(VLC_CODEC_DIV1, "MS MPEG-4 Video v1"),
        A("DIV1"),
        A("div1"),
        A("MPG4"),
        A("mpg4"),
        A("mp41"),

    /* MSMPEG4 v2 */
    B(VLC_CODEC_DIV2, "MS MPEG-4 Video v2"),
        A("DIV2"),
        A("div2"),
        A("MP42"),
        A("mp42"),

    /* MSMPEG4 v3 / M$ mpeg4 v3 */
    B(VLC_CODEC_DIV3, "MS MPEG-4 Video v3"),
        A("DIV3"),
        A("MPG3"),
        A("mpg3"),
        A("div3"),
        A("MP43"),
        A("mp43"),
        /* DivX 3.20 */
        A("DIV4"),
        A("div4"),
        A("DIV5"),
        A("div5"),
        A("DIV6"),
        A("div6"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
207
208
        E("divf", "DivX 4.12"),
        E("DIVF", "DivX 4.12"),
209
210
211
212
213
214
215
216
217
218
219
220
221
        /* Cool Codec */
        A("COL1"),
        A("col1"),
        A("COL0"),
        A("col0"),
        /* AngelPotion stuff */
        A("AP41"),
        /* 3ivx doctered divx files */
        A("3IVD"),
        A("3ivd"),
        /* who knows? */
        A("3VID"),
        A("3vid"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
222
        A("DVX3"),
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283

    /* Sorenson v1 */
    B(VLC_CODEC_SVQ1, "SVQ-1 (Sorenson Video v1)"),
        A("SVQ1"),
        A("svq1"),
        A("svqi"),

    /* Sorenson v3 */
    B(VLC_CODEC_SVQ3, "SVQ-3 (Sorenson Video v3)"),
        A("SVQ3"),

    /* h264 */
    B(VLC_CODEC_H264, "H264 - MPEG-4 AVC (part 10)"),
        A("H264"),
        A("h264"),
        A("x264"),
        A("X264"),
        /* avc1: special case h264 */
        A("avc1"),
        A("AVC1"),
        E("VSSH", "Vanguard VSS H264"),
        E("VSSW", "Vanguard VSS H264"),
        E("vssh", "Vanguard VSS H264"),
        E("DAVC", "Dicas MPEGable H.264/MPEG-4 AVC"),
        E("davc", "Dicas MPEGable H.264/MPEG-4 AVC"),

    /* H263 and H263i */
    /* H263(+) is also known as Real Video 1.0 */

    /* H263 */
    B(VLC_CODEC_H263, "H263"),
        A("H263"),
        A("h263"),
        A("VX1K"),
        A("s263"),
        A("S263"),
        A("U263"),
        A("u263"),
        E("D263", "DEC H263"),
        E("L263", "LEAD H263"),
        E("M263", "Microsoft H263"),
        E("X263", "Xirlink H263"),
        /* Zygo (partial) */
        E("ZyGo", "ITU H263+"),

    /* H263i */
    B(VLC_CODEC_H263I, "I263.I"),
        A("I263"),
        A("i263"),

    /* H263P */
    B(VLC_CODEC_H263P, "ITU H263+"),
        E("ILVR", "ITU H263+"),
        E("viv1", "H263+"),
        E("vivO", "H263+"),
        E("viv2", "H263+"),
        E("U263", "UB H263+"),

    /* Flash (H263) variant */
    B(VLC_CODEC_FLV1, "Flash Video"),
        A("FLV1"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
284
        A("flv "),
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303

    /* H261 */
    B(VLC_CODEC_H261, "H.261"),
        A("H261"),
        A("h261"),

    B(VLC_CODEC_FLIC, "Flic Video"),
        A("FLIC"),

    /* MJPEG */
    B(VLC_CODEC_MJPG, "Motion JPEG Video"),
        A("MJPG"),
        A("mjpg"),
        A("mjpa"),
        A("jpeg"),
        A("JPEG"),
        A("JFIF"),
        A("JPGL"),
        A("AVDJ"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
304
305
        A("MMJP"),
        A("QIVG"),
306
307
        /* AVID MJPEG */
        E("AVRn", "Avid Motion JPEG"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
308
        E("AVDJ", "Avid Motion JPEG"),
309
310
        E("ADJV", "Avid Motion JPEG"),
        E("dmb1", "Motion JPEG OpenDML Video"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
311
        E("ijpg", "Intergraph JPEG Video"),
312
313
        E("IJPG", "Intergraph JPEG Video"),
        E("ACDV", "ACD Systems Digital"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
314
        E("SLMJ", "SL M-JPEG"),
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339

    B(VLC_CODEC_MJPGB, "Motion JPEG B Video"),
        A("mjpb"),

    B(VLC_CODEC_LJPG, "Lead Motion JPEG Video"),
        A("LJPG"),

    // ? from avcodec/fourcc.c but makes not sense.
    //{ VLC_FOURCC( 'L','J','P','G' ), CODEC_ID_MJPEG,       VIDEO_ES, "Lead Motion JPEG Video" },

    /* SP5x */
    B(VLC_CODEC_SP5X, "Sunplus Motion JPEG Video"),
        A("SP5X"),
        A("SP53"),
        A("SP54"),
        A("SP55"),
        A("SP56"),
        A("SP57"),
        A("SP58"),

    /* DV */
    B(VLC_CODEC_DV, "DV Video"),
        A("dv  "),
        A("dvsl"),
        A("DVSD"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
340
341
342
        A("dvsd"),
        A("DVCS"),
        A("dvcs"),
343
344
345
346
347
348
349
350
351
352
353
        A("dvhd"),
        A("dvhp"),
        A("dvhq"),
        A("dvh3"),
        A("dvh5"),
        A("dvh6"),
        A("dv1n"),
        A("dv1p"),
        A("dvc "),
        A("dv25"),
        A("dvh1"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
354
        A("dvs1"),
355
356
357
        E("dvcp", "DV Video PAL"),
        E("dvp ", "DV Video Pro"),
        E("dvpp", "DV Video Pro PAL"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
358
        E("dv50", "DV Video C Pro 50"),
359
360
361
362
363
364
365
        E("dv5p", "DV Video C Pro 50 PAL"),
        E("dv5n", "DV Video C Pro 50 NTSC"),
        E("AVdv", "AVID DV"),
        E("AVd1", "AVID DV"),
        E("CDVC", "Canopus DV Video"),
        E("cdvc", "Canopus DV Video"),
        E("CDVH", "Canopus DV Video"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
366
        E("cdvh", "Canopus DV Video"),
367
368
369
370
371
372
373
374
375
376
377
378
379
380

    /* Windows Media Video */
    B(VLC_CODEC_WMV1, "Windows Media Video 7"),
        A("WMV1"),
        A("wmv1"),

    B(VLC_CODEC_WMV2, "Windows Media Video 8"),
        A("WMV2"),
        A("wmv2"),

    B(VLC_CODEC_WMV3, "Windows Media Video 9"),
        A("WMV3"),
        A("wmv3"),

Laurent Aimar's avatar
Laurent Aimar committed
381
382
383
    /* WMVA is the VC-1 codec before the standardization proces,
     * it is not bitstream compatible and deprecated  */
    B(VLC_CODEC_WMVA, "Windows Media Video Advanced Profile"),
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
        A("WMVA"),
        A("wmva"),
        A("WVP2"),
        A("wvp2"),

    B(VLC_CODEC_VC1, "Windows Media Video VC1"),
        A("WVC1"),
        A("wvc1"),
        A("vc-1"),
        A("VC-1"),

    /* Microsoft Video 1 */
    B(VLC_CODEC_MSVIDEO1, "Microsoft Video 1"),
        A("MSVC"),
        A("msvc"),
        A("CRAM"),
        A("cram"),
        A("WHAM"),
        A("wham"),

    /* Microsoft RLE */
    B(VLC_CODEC_MSRLE, "Microsoft RLE Video"),
        A("mrle"),
        A("WRLE"),
        A("\x01\x00\x00\x00"),
        A("\x02\x00\x00\x00"),

    /* Indeo Video Codecs (Quality of this decoder on ppc is not good) */
    B(VLC_CODEC_INDEO3, "Indeo Video v3"),
        A("IV31"),
        A("iv31"),
        A("IV32"),
        A("iv32"),

    /* Huff YUV */
    B(VLC_CODEC_HUFFYUV, "Huff YUV Video"),
        A("HFYU"),

    B(VLC_CODEC_FFVHUFF, "Huff YUV Video"),
        A("FFVH"),

    /* On2 VP3 Video Codecs */
    B(VLC_CODEC_VP3, "On2's VP3 Video"),
        A("VP3 "),
        A("VP30"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
429
        A("vp30"),
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
        A("VP31"),
        A("vp31"),

    /* On2  VP5, VP6 codecs */
    B(VLC_CODEC_VP5, "On2's VP5 Video"),
        A("VP5 "),
        A("VP50"),

    B(VLC_CODEC_VP6, "On2's VP6.2 Video"),
        A("VP62"),
        A("vp62"),
        E("VP60", "On2's VP6.0 Video"),
        E("VP61", "On2's VP6.1 Video"),

    B(VLC_CODEC_VP6F, "On2's VP6.2 Video (Flash)"),
        A("VP6F"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
446
        A("FLV4"),
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502

    B(VLC_CODEC_VP6A, "On2's VP6 A Video"),
        A("VP6A"),

    /* Xiph.org theora */
    B(VLC_CODEC_THEORA, "Xiph.org's Theora Video"),
        A("theo"),
        A("Thra"),

    /* Xiph.org tarkin */
    B(VLC_CODEC_TARKIN, "Xiph.org's Tarkin Video"),
        A("tark"),

    /* Asus Video (Another thing that doesn't work on PPC) */
    B(VLC_CODEC_ASV1, "Asus V1 Video"),
        A("ASV1"),
    B(VLC_CODEC_ASV2, "Asus V2 Video"),
        A("ASV2"),

    /* FFMPEG Video 1 (lossless codec) */
    B(VLC_CODEC_FFV1, "FFMpeg Video 1"),
        A("FFV1"),

    /* ATI VCR1 */
    B(VLC_CODEC_VCR1, "ATI VCR1 Video"),
        A("VCR1"),

    /* Cirrus Logic AccuPak */
    B(VLC_CODEC_CLJR, "Creative Logic AccuPak"),
        A("CLJR"),

    /* Real Video */
    B(VLC_CODEC_RV10, "Real Video 1.0"),
        A("RV10"),
        A("rv10"),

    B(VLC_CODEC_RV13, "Real Video 1.3"),
        A("RV13"),
        A("rv13"),

    B(VLC_CODEC_RV20, "Real Video 2.0"),
        A("RV20"),
        A("rv20"),

    B(VLC_CODEC_RV30, "Real Video 3.0"),
        A("RV30"),
        A("rv30"),

    B(VLC_CODEC_RV40, "Real Video 4.0"),
        A("RV40"),
        A("rv40"),

    /* Apple Video */
    B(VLC_CODEC_RPZA, "Apple Video"),
        A("rpza"),
        A("azpr"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
503
504
        A("RPZA"),
        A("AZPR"),
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533

    B(VLC_CODEC_SMC, "Apple graphics"),
        A("smc "),

    B(VLC_CODEC_CINEPAK, "Cinepak Video"),
        A("CVID"),
        A("cvid"),

    /* Screen Capture Video Codecs */
    B(VLC_CODEC_TSCC, "TechSmith Camtasia Screen Capture"),
        A("TSCC"),
        A("tscc"),

    B(VLC_CODEC_CSCD, "CamStudio Screen Codec"),
        A("CSCD"),
        A("cscd"),

    B(VLC_CODEC_ZMBV, "DosBox Capture Codec"),
        A("ZMBV"),

    B(VLC_CODEC_VMNC, "VMware Video"),
        A("VMnc"),
    B(VLC_CODEC_FRAPS, "FRAPS: Realtime Video Capture"),
        A("FPS1"),
        A("fps1"),

    /* Duck TrueMotion */
    B(VLC_CODEC_TRUEMOTION1, "Duck TrueMotion v1 Video"),
        A("DUCK"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
534
        A("PVEZ"),
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
    B(VLC_CODEC_TRUEMOTION2, "Duck TrueMotion v2.0 Video"),
        A("TM20"),

    /* FFMPEG's SNOW wavelet codec */
    B(VLC_CODEC_SNOW, "FFMpeg SNOW wavelet Video"),
        A("SNOW"),
        A("snow"),

    B(VLC_CODEC_QTRLE, "Apple QuickTime RLE Video"),
        A("rle "),

    B(VLC_CODEC_QDRAW, "Apple QuickDraw Video"),
        A("qdrw"),

    B(VLC_CODEC_QPEG, "QPEG Video"),
        A("QPEG"),
        A("Q1.0"),
        A("Q1.1"),

    B(VLC_CODEC_ULTI, "IBM Ultimotion Video"),
        A("ULTI"),

    B(VLC_CODEC_VIXL, "Miro/Pinnacle VideoXL Video"),
        A("VIXL"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
559
        A("XIXL"),
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
        E("PIXL", "Pinnacle VideoXL Video"),

    B(VLC_CODEC_LOCO, "LOCO Video"),
        A("LOCO"),

    B(VLC_CODEC_WNV1, "Winnov WNV1 Video"),
        A("WNV1"),

    B(VLC_CODEC_AASC, "Autodesc RLE Video"),
        A("AASC"),

    B(VLC_CODEC_INDEO2, "Indeo Video v2"),
        A("IV20"),
        A("RT21"),

        /* Flash Screen Video */
    B(VLC_CODEC_FLASHSV, "Flash Screen Video"),
        A("FSV1"),
    B(VLC_CODEC_KMVC, "Karl Morton's Video Codec (Worms)"),
        A("KMVC"),

    B(VLC_CODEC_NUV, "Nuppel Video"),
        A("RJPG"),
        A("NUV1"),

    /* CODEC_ID_SMACKVIDEO */
    B(VLC_CODEC_SMACKVIDEO, "Smacker Video"),
        A("SMK2"),
        A("SMK4"),

    /* Chinese AVS - Untested */
    B(VLC_CODEC_CAVS, "Chinese AVS"),
        A("CAVS"),
        A("AVs2"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
594
        A("avs2"),
595

596
597
    B(VLC_CODEC_AMV, "AMV"),

598
599
600
601
602
603
604
605
606
607
608
    /* */
    B(VLC_CODEC_DNXHD, "DNxHD"),
        A("AVdn"),
    B(VLC_CODEC_8BPS, "8BPS"),
        A("8BPS"),
    B(VLC_CODEC_MIMIC, "Mimic"),
        A("ML2O"),

    B(VLC_CODEC_CDG, "CD-G Video"),
        A("CDG "),

609
610
611
    B(VLC_CODEC_FRWU, "Forward Uncompressed" ),
        A("FRWU"),

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
612
613
614
615
616
    B(VLC_CODEC_INDEO5, "Indeo Video v5"),
        A("IV50"),
        A("iv50"),


617
618
619
620
    /* */
    B(VLC_CODEC_YV12, "Planar 4:2:0 YVU"),
        A("YV12"),
        A("yv12"),
621
622
    B(VLC_CODEC_YV9,  "Planar 4:1:0 YVU"),
        A("YVU9"),
gbazin's avatar
gbazin committed
623
    B(VLC_CODEC_I410, "Planar 4:1:0 YUV"),
624
        A("I410"),
gbazin's avatar
gbazin committed
625
    B(VLC_CODEC_I411, "Planar 4:1:1 YUV"),
626
627
628
629
630
631
632
633
634
635
636
        A("I411"),
    B(VLC_CODEC_I420, "Planar 4:2:0 YUV"),
        A("I420"),
        A("IYUV"),
    B(VLC_CODEC_I422, "Planar 4:2:2 YUV"),
        A("I422"),
    B(VLC_CODEC_I444, "Planar 4:4:0 YUV"),
        A("I440"),
    B(VLC_CODEC_I444, "Planar 4:4:4 YUV"),
        A("I444"),

637
    B(VLC_CODEC_J420, "Planar 4:2:0 YUV full scale"),
638
        A("J420"),
639
    B(VLC_CODEC_J422, "Planar 4:2:2 YUV full scale"),
640
        A("J422"),
641
    B(VLC_CODEC_J440, "Planar 4:4:0 YUV full scale"),
642
        A("J440"),
643
    B(VLC_CODEC_J444, "Planar 4:4:4 YUV full scale"),
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
        A("J444"),

    B(VLC_CODEC_YUVP, "Palettized YUV with palette element Y:U:V:A"),
        A("YUVP"),

    B(VLC_CODEC_YUVA, "Planar YUV 4:4:4 Y:U:V:A"),
        A("YUVA"),

    B(VLC_CODEC_RGBP, "Palettized RGB with palette element R:G:B"),
        A("RGBP"),

    B(VLC_CODEC_RGB8, "8 bits RGB"),
        A("RGB2"),
    B(VLC_CODEC_RGB15, "15 bits RGB"),
        A("RV15"),
    B(VLC_CODEC_RGB16, "16 bits RGB"),
        A("RV16"),
    B(VLC_CODEC_RGB24, "24 bits RGB"),
        A("RV24"),
    B(VLC_CODEC_RGB32, "32 bits RGB"),
        A("RV32"),
    B(VLC_CODEC_RGBA, "32 bits RGBA"),
        A("RGBA"),

    B(VLC_CODEC_GREY, "8 bits greyscale"),
        A("GREY"),
        A("Y800"),
        A("Y8  "),

    B(VLC_CODEC_UYVY, "Packed YUV 4:2:2, U:Y:V:Y"),
        A("UYVY"),
        A("UYNV"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
676
        A("UYNY"),
677
        A("Y422"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
678
679
680
        A("HDYC"),
        A("AVUI"),
        A("uyv1"),
681
682
        A("2vuy"),
        A("2Vuy"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
683
        A("2Vu1"),
684
685
686
687
688
689
    B(VLC_CODEC_VYUY, "Packed YUV 4:2:2, V:Y:U:Y"),
        A("VYUY"),
    B(VLC_CODEC_YUYV, "Packed YUV 4:2:2, Y:U:Y:V"),
        A("YUY2"),
        A("YUYV"),
        A("YUNV"),
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
690
        A("V422"),
691
692
693
694
695
696
697
698
699
    B(VLC_CODEC_YVYU, "Packed YUV 4:2:2, Y:V:Y:U"),
        A("YVYU"),

    B(VLC_CODEC_Y211, "Packed YUV 2:1:1, Y:U:Y:V "),
        A("Y211"),
    B(VLC_CODEC_CYUV, "Creative Packed YUV 4:2:2, U:Y:V:Y, reverted"),
        A("cyuv"),
        A("CYUV"),

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
700
701
702
    B(VLC_CODEC_V210, "10-bit 4:2:2 Component YCbCr"),
        A("v210"),

703
704
705
    B(VLC_CODEC_NV12, "Planar  Y, Packet UV (420)"),
        A("NV12"),

706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
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
    /* Videogames Codecs */

    /* Interplay MVE */
    B(VLC_CODEC_INTERPLAY, "Interplay MVE Video"),
        A("imve"),
        A("INPV"),

    /* Id Quake II CIN */
    B(VLC_CODEC_IDCIN, "Id Quake II CIN Video"),
        A("IDCI"),

    /* 4X Technologies */
    B(VLC_CODEC_4XM, "4X Technologies Video"),
        A("4XMV"),
        A("4xmv"),

    /* Id RoQ */
    B(VLC_CODEC_ROQ, "Id RoQ Video"),
        A("RoQv"),

    /* Sony Playstation MDEC */
    B(VLC_CODEC_MDEC, "PSX MDEC Video"),
        A("MDEC"),

    /* Sierra VMD */
    B(VLC_CODEC_VMDVIDEO, "Sierra VMD Video"),
        A("VMDV"),
        A("vmdv"),

    B(VLC_CODEC_DIRAC, "Dirac" ),
        A("drac"),

    /* Image */
    B(VLC_CODEC_PNG, "PNG Image"),
        A("png "),

    B(VLC_CODEC_PPM, "PPM Image"),
        A("ppm "),

    B(VLC_CODEC_PGM, "PGM Image"),
        A("pgm "),

    B(VLC_CODEC_PGMYUV, "PGM YUV Image"),
        A("pgmy"),

    B(VLC_CODEC_PAM, "PAM Image"),
        A("pam "),

    B(VLC_CODEC_JPEGLS, "Lossless JPEG"),
        A("MJLS"),

    B(VLC_CODEC_JPEG, "JPEG"),
        A("jpeg"),
        A("JPEG"),

    B(VLC_CODEC_BMP, "BMP Image"),
        A("bmp "),

    B(VLC_CODEC_TIFF, "TIFF Image"),
        A("tiff"),

    B(VLC_CODEC_GIF, "GIF Image"),
        A("gif "),


    B(VLC_CODEC_TARGA, "Truevision Targa Image"),
        A("tga "),
        A("mtga"),
        A("MTGA"),

    B(VLC_CODEC_SGI, "SGI Image"),
        A("sgi "),

    B(VLC_CODEC_PNM, "Portable Anymap Image"),
        A("pnm "),

    B(VLC_CODEC_PCX, "Personal Computer Exchange Image"),
        A("pcx "),

    B(0, "")
};
static const entry_t p_list_audio[] = {

    /* Windows Media Audio 1 */
    B(VLC_CODEC_WMA1, "Windows Media Audio 1"),
        A("WMA1"),
        A("wma1"),

    /* Windows Media Audio 2 */
    B(VLC_CODEC_WMA2, "Windows Media Audio 2"),
        A("WMA2"),
        A("wma2"),
        A("wma "),

    /* Windows Media Audio Professional */
    B(VLC_CODEC_WMAP, "Windows Media Audio Professional"),
        A("WMAP"),
        A("wmap"),

    /* Windows Media Audio Lossless */
    B(VLC_CODEC_WMAL, "Windows Media Audio Lossless"),
        A("WMAL"),
        A("wmal"),

    /* Windows Media Audio Speech */
811
    B(VLC_CODEC_WMAS, "Windows Media Audio Voice (Speech)"),
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
        A("WMAS"),
        A("wmas"),

    /* DV Audio */
    B(VLC_CODEC_DVAUDIO, "DV Audio"),
        A("dvau"),
        A("vdva"),
        A("dvca"),
        A("RADV"),

    /* MACE-3 Audio */
    B(VLC_CODEC_MACE3, "MACE-3 Audio"),
        A("MAC3"),

    /* MACE-6 Audio */
    B(VLC_CODEC_MACE6, "MACE-6 Audio"),
        A("MAC6"),

    /* MUSEPACK7 Audio */
    B(VLC_CODEC_MUSEPACK7, "MUSEPACK7 Audio"),
        A("MPC "),

    /* MUSEPACK8 Audio */
    B(VLC_CODEC_MUSEPACK8, "MUSEPACK8 Audio"),
        A("MPCK"),
        A("MPC8"),

    /* RealAudio 1.0 */
    B(VLC_CODEC_RA_144, "RealAudio 1.0"),
        A("14_4"),
        A("lpcJ"),

    /* RealAudio 2.0 */
    B(VLC_CODEC_RA_288, "RealAudio 2.0"),
        A("28_8"),

848
849
850
    B(VLC_CODEC_SIPR, "RealAudio Sipr"),
        A("sipr"),

851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
    /* MPEG Audio layer 1/2/3 */
    B(VLC_CODEC_MPGA, "MPEG Audio layer 1/2/3"),
        A("mpga"),
        A("mp3 "),
        A(".mp3"),
        A("MP3 "),
        A("LAME"),
        A("ms\x00\x50"),
        A("ms\x00\x55"),

    /* A52 Audio (aka AC3) */
    B(VLC_CODEC_A52, "A52 Audio (aka AC3)"),
        A("a52 "),
        A("a52b"),
        A("ac-3"),
        A("ms\x20\x00"),

    B(VLC_CODEC_EAC3, "A/52 B Audio (aka E-AC3)"),
        A("eac3"),

    /* DTS Audio */
    B(VLC_CODEC_DTS, "DTS Audio"),
        A("dts "),
        A("dtsb"),
        A("ms\x20\x01"),

    /* AAC audio */
    B(VLC_CODEC_MP4A, "MPEG AAC Audio"),
        A("mp4a"),
        A("aac "),

882
883
884
885
    /* ALS audio */
    B(VLC_CODEC_ALS, "MPEG-4 Audio Lossless (ALS)"),
        A("als "),

886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
    /* 4X Technologies */
    B(VLC_CODEC_ADPCM_4XM, "4X Technologies Audio"),
        A("4xma"),

    /* EA ADPCM */
    B(VLC_CODEC_ADPCM_EA, "EA ADPCM Audio"),
        A("ADEA"),

    /* Interplay DPCM */
    B(VLC_CODEC_INTERPLAY_DPCM, "Interplay DPCM Audio"),
        A("idpc"),

    /* Id RoQ */
    B(VLC_CODEC_ROQ_DPCM, "Id RoQ DPCM Audio"),
        A("RoQa"),

    /* DCIN Audio */
    B(VLC_CODEC_DSICINAUDIO, "Delphine CIN Audio"),
        A("DCIA"),

    /* Sony Playstation XA ADPCM */
    B(VLC_CODEC_ADPCM_XA, "PSX XA ADPCM Audio"),
        A("xa  "),

    /* ADX ADPCM */
    B(VLC_CODEC_ADPCM_ADX, "ADX ADPCM Audio"),
        A("adx "),

    /* Westwood ADPCM */
    B(VLC_CODEC_ADPCM_IMA_WS, "Westwood IMA ADPCM audio"),
        A("AIWS"),

918
919
920
921
    /* MS ADPCM */
    B(VLC_CODEC_ADPCM_MS, "MS ADPCM audio"),
        A("ms\x00\x02"),

922
923
924
925
926
927
928
929
    /* Sierra VMD */
    B(VLC_CODEC_VMDAUDIO, "Sierra VMD Audio"),
        A("vmda"),

    /* G.726 ADPCM */
    B(VLC_CODEC_ADPCM_G726, "G.726 ADPCM Audio"),
        A("g726"),

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
930
    /* Flash ADPCM */
931
932
933
    B(VLC_CODEC_ADPCM_SWF, "Flash ADPCM Audio"),
        A("SWFa"),

934
935
    B(VLC_CODEC_ADPCM_IMA_WAV, "IMA WAV ADPCM Audio"),
        A("ms\x00\x11"),
936

937
    B(VLC_CODEC_ADPCM_IMA_AMV, "IMA AMV ADPCM Audio"),
938
        A("imav"),
939

940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
    /* AMR */
    B(VLC_CODEC_AMR_NB, "AMR narrow band"),
        A("samr"),

    B(VLC_CODEC_AMR_WB, "AMR wide band"),
        A("sawb"),

    /* FLAC */
    B(VLC_CODEC_FLAC, "FLAC (Free Lossless Audio Codec)"),
        A("flac"),

    /* ALAC */
    B(VLC_CODEC_ALAC, "Apple Lossless Audio Codec"),
        A("alac"),

    /* QDM2 */
    B(VLC_CODEC_QDM2, "QDM2 Audio"),
        A("QDM2"),

    /* COOK */
    B(VLC_CODEC_COOK, "Cook Audio"),
        A("cook"),

    /* TTA: The Lossless True Audio */
    B(VLC_CODEC_TTA, "The Lossless True Audio"),
        A("TTA1"),

    /* Shorten */
    B(VLC_CODEC_SHORTEN, "Shorten Lossless Audio"),
        A("shn "),
        A("shrn"),

    B(VLC_CODEC_WAVPACK, "WavPack"),
        A("WVPK"),
        A("wvpk"),

    B(VLC_CODEC_GSM, "GSM Audio"),
        A("gsm "),

    B(VLC_CODEC_GSM_MS, "Microsoft GSM Audio"),
        A("agsm"),

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
982
983
984
    B(VLC_CODEC_ATRAC1, "atrac 1"),
        A("atr1"),

985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
    B(VLC_CODEC_ATRAC3, "atrac 3"),
        A("atrc"),
        A("\x70\x02\x00\x00"),

    B(VLC_CODEC_SONIC, "Sonic"),
        A("SONC"),

    B(VLC_CODEC_IMC, "IMC" ),
        A("\x01\x04\x00\x00"),

    B(VLC_CODEC_TRUESPEECH,"TrueSpeech"),
        A("\x22\x00\x00\x00"),

    B(VLC_CODEC_NELLYMOSER, "NellyMoser ASAO"),
        A("NELL"),

    B(VLC_CODEC_APE, "Monkey's Audio"),
        A("APE "),

    B(VLC_CODEC_MLP, "MLP/TrueHD Audio"),
        A("mlp "),

1007
1008
1009
    B(VLC_CODEC_TRUEHD, "TrueHD Audio"),
        A("trhd"),

1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
    B(VLC_CODEC_QCELP, "QCELP Audio"),
        A("Qclp"),

    B(VLC_CODEC_SPEEX, "Speex Audio"),
        A("spx "),
        A("spxr"),

    B(VLC_CODEC_VORBIS, "Vorbis Audio"),
        A("vorb"),

    B(VLC_CODEC_302M, "302M Audio"),
        A("302m"),

    B(VLC_CODEC_DVD_LPCM, "DVD LPCM Audio"),
        A("lpcm"),

1026
1027
1028
    B(VLC_CODEC_DVDA_LPCM, "DVD-Audio LPCM Audio"),
        A("apcm"),

1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
    B(VLC_CODEC_BD_LPCM, "BD LPCM Audio"),
        A("bpcm"),

    B(VLC_CODEC_SDDS, "SDDS Audio"),
        A("sdds"),
        A("sddb"),

    B(VLC_CODEC_MIDI, "MIDI Audio"),
        A("MIDI"),

    /* PCM */
    B(VLC_CODEC_S8, "PCM S8"),
        A("s8  "),

    B(VLC_CODEC_U8, "PCM U8"),
        A("u8  "),

    B(VLC_CODEC_S16L, "PCM S16 LE"),
        A("s16l"),

    B(VLC_CODEC_S16B, "PCM S16 BE"),
        A("s16b"),

    B(VLC_CODEC_U16L, "PCM U16 LE"),
        A("u16l"),

    B(VLC_CODEC_U16B, "PCM U16 BE"),
        A("u16b"),

    B(VLC_CODEC_S24L, "PCM S24 LE"),
        A("s24l"),
        A("42ni"),  /* Quicktime */

    B(VLC_CODEC_S24B, "PCM S24 BE"),
        A("s24b"),
        A("in24"),  /* Quicktime */

    B(VLC_CODEC_U24L, "PCM U24 LE"),
        A("u24l"),

    B(VLC_CODEC_U24B, "PCM U24 BE"),
        A("u24b"),

    B(VLC_CODEC_S32L, "PCM S32 LE"),
        A("s32l"),
        A("23ni"),  /* Quicktime */

    B(VLC_CODEC_S32B, "PCM S32 BE"),
        A("s32b"),
        A("in32"),  /* Quicktime */

    B(VLC_CODEC_U32L, "PCM U32 LE"),
        A("u32l"),

    B(VLC_CODEC_U32B, "PCM U32 BE"),
        A("u32b"),

    B(VLC_CODEC_ALAW, "PCM ALAW"),
        A("alaw"),

    B(VLC_CODEC_MULAW, "PCM MU-LAW"),
        A("mlaw"),
        A("ulaw"),

    B(VLC_CODEC_S24DAUD, "PCM DAUD"),
        A("daud"),

    B(VLC_CODEC_FI32, "32 bits fixed float"),
        A("fi32"),

Laurent Aimar's avatar
Laurent Aimar committed
1099
1100
    B(VLC_CODEC_F32L, "32 bits float LE"),
        A("f32l"),
1101
1102
        A("fl32"),

Laurent Aimar's avatar
Laurent Aimar committed
1103
    B(VLC_CODEC_F32B, "32 bits float BE"),
Laurent Aimar's avatar
Laurent Aimar committed
1104
1105
1106
1107
1108
1109
1110
        A("f32b"),

    B(VLC_CODEC_F64L, "64 bits float LE"),
        A("f64l"),

    B(VLC_CODEC_F64L, "64 bits float BE"),
        A("f64b"),
1111

1112
1113
1114
    B(VLC_CODEC_TWINVQ, "TwinVQ"),
        A("TWIN"),

1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
    B(0, "")
};
static const entry_t p_list_spu[] = {

    B(VLC_CODEC_SPU, "DVD Subtitles"),
        A("spu "),
        A("spub"),

    B(VLC_CODEC_DVBS, "DVB Subtitles"),
        A("dvbs"),

    B(VLC_CODEC_SUBT, "Text subtitles with various tags"),
        A("subt"),

    B(VLC_CODEC_XSUB, "DivX XSUB subtitles"),
        A("XSUB"),
        A("xsub"),
1132
        A("DXSB"),
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142

    B(VLC_CODEC_SSA, "SubStation Alpha subtitles"),
        A("ssa "),

    B(VLC_CODEC_TEXT, "Plain text subtitles"),
        A("TEXT"),

    B(VLC_CODEC_TELETEXT, "Teletext"),
        A("telx"),

1143
    B(VLC_CODEC_KATE, "Kate subtitles"),
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
        A("kate"),

    B(VLC_CODEC_CMML, "CMML annotations/metadata"),
        A("cmml"),

    B(VLC_CODEC_ITU_T140, "ITU T.140 subtitles"),
        A("t140"),

    B(VLC_CODEC_USF, "USF subtitles"),
        A("usf "),

    B(VLC_CODEC_OGT, "OGT subtitles"),
        A("ogt "),

    B(VLC_CODEC_CVD, "CVD subtitles"),
        A("cvd "),

Laurent Aimar's avatar
Laurent Aimar committed
1161
1162
1163
    B(VLC_CODEC_BD_PG, "BD subtitles"),
        A("bdpg"),

1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
    B(0, "")
};

/* Create a fourcc from a string.
 * XXX it assumes that the string is at least four bytes */
static inline vlc_fourcc_t CreateFourcc( const char *psz_fourcc )
{
    return VLC_FOURCC( psz_fourcc[0], psz_fourcc[1],
                       psz_fourcc[2], psz_fourcc[3] );
}

/* */
static entry_t Lookup( const entry_t p_list[], vlc_fourcc_t i_fourcc )
{
    const char *p_class = NULL;
    const char *psz_description = NULL;

    entry_t e = B(0, "");

    for( int i = 0; ; i++ )
    {
        const entry_t *p = &p_list[i];
        const vlc_fourcc_t i_entry_fourcc = CreateFourcc( p->p_fourcc );
        const vlc_fourcc_t i_entry_class = CreateFourcc( p->p_class );

        if( i_entry_fourcc == 0 )
            break;

        if( i_entry_class != 0 )
        {
            p_class = p->p_class;
            psz_description = p->psz_description;
        }

        if( i_entry_fourcc == i_fourcc )
        {
            assert( p_class != NULL );

            memcpy( e.p_class, p_class, 4 );
            memcpy( e.p_fourcc, p->p_fourcc, 4 );
1204
1205
            e.psz_description = p->psz_description ?
                                p->psz_description : psz_description;
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
            break;
        }
    }
    return e;
}

/* */
static entry_t Find( int i_cat, vlc_fourcc_t i_fourcc )
{
    entry_t e;

    switch( i_cat )
    {
    case VIDEO_ES:
        return Lookup( p_list_video, i_fourcc );
    case AUDIO_ES:
        return Lookup( p_list_audio, i_fourcc );
    case SPU_ES:
        return Lookup( p_list_spu, i_fourcc );

    default:
        e = Find( VIDEO_ES, i_fourcc );
        if( CreateFourcc( e.p_class ) == 0 )
            e = Find( AUDIO_ES, i_fourcc );
        if( CreateFourcc( e.p_class ) == 0 )
            e = Find( SPU_ES, i_fourcc );
        return e;
    }
}

/* */
vlc_fourcc_t vlc_fourcc_GetCodec( int i_cat, vlc_fourcc_t i_fourcc )
{
    entry_t e = Find( i_cat, i_fourcc );

    if( CreateFourcc( e.p_class ) == 0 )
        return i_fourcc;
    return CreateFourcc( e.p_class );
}

1246
1247
1248
1249
1250
1251
1252
1253
1254
vlc_fourcc_t vlc_fourcc_GetCodecFromString( int i_cat, const char *psz_fourcc )
{
    if( !psz_fourcc || strlen(psz_fourcc) != 4 )
        return 0;
    return vlc_fourcc_GetCodec( i_cat,
                                VLC_FOURCC( psz_fourcc[0], psz_fourcc[1],
                                            psz_fourcc[2], psz_fourcc[3] ) );
}

1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
vlc_fourcc_t vlc_fourcc_GetCodecAudio( vlc_fourcc_t i_fourcc, int i_bits )
{
    const int i_bytes = ( i_bits + 7 ) / 8;

    if( i_fourcc == VLC_FOURCC( 'a', 'f', 'l', 't' ) )
    {
        switch( i_bytes )
        {
        case 4:
            return VLC_CODEC_FL32;
        case 8:
            return VLC_CODEC_FL64;
        default:
            return 0;
        }
    }
    else if( i_fourcc == VLC_FOURCC( 'a', 'r', 'a', 'w' ) ||
             i_fourcc == VLC_FOURCC( 'p', 'c', 'm', ' ' ) )
    {
        switch( i_bytes )
        {
        case 1:
            return VLC_CODEC_U8;
        case 2:
            return VLC_CODEC_S16L;
        case 3:
            return VLC_CODEC_S24L;
            break;
        case 4:
            return VLC_CODEC_S32L;
        default:
            return 0;
        }
    }
    else if( i_fourcc == VLC_FOURCC( 't', 'w', 'o', 's' ) )
    {
        switch( i_bytes )
        {
        case 1:
            return VLC_CODEC_S8;
        case 2:
            return VLC_CODEC_S16B;
        case 3:
            return VLC_CODEC_S24B;
        case 4:
            return VLC_CODEC_S32B;
        default:
            return 0;
        }
    }
    else if( i_fourcc == VLC_FOURCC( 's', 'o', 'w', 't' ) )
    {
        switch( i_bytes )
        {
        case 1:
            return VLC_CODEC_S8;
        case 2:
            return VLC_CODEC_S16L;
        case 3:
            return VLC_CODEC_S24L;
        case 4:
            return VLC_CODEC_S32L;
        default:
            return 0;
        }
    }
    else
    {
        return vlc_fourcc_GetCodec( AUDIO_ES, i_fourcc );
    }
}

1327
1328
1329
1330
1331
1332
1333
1334
/* */
const char *vlc_fourcc_GetDescription( int i_cat, vlc_fourcc_t i_fourcc )
{
    entry_t e = Find( i_cat, i_fourcc );

    return e.psz_description;
}

1335
1336

/* */
1337
1338
1339
#define VLC_CODEC_YUV_PLANAR_410 \
    VLC_CODEC_I410, VLC_CODEC_YV9

1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
#define VLC_CODEC_YUV_PLANAR_420 \
    VLC_CODEC_I420, VLC_CODEC_YV12, VLC_CODEC_J420

#define VLC_CODEC_YUV_PLANAR_422 \
    VLC_CODEC_I422, VLC_CODEC_J422

#define VLC_CODEC_YUV_PLANAR_440 \
    VLC_CODEC_I440, VLC_CODEC_J440

#define VLC_CODEC_YUV_PLANAR_444 \
    VLC_CODEC_I444, VLC_CODEC_J444

#define VLC_CODEC_YUV_PACKED \
    VLC_CODEC_YUYV, VLC_CODEC_YVYU, \
    VLC_CODEC_UYVY, VLC_CODEC_VYUY

#define VLC_CODEC_FALLBACK_420 \
    VLC_CODEC_YUV_PLANAR_422, VLC_CODEC_YUV_PACKED, \
    VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PLANAR_440, \
1359
    VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373

static const vlc_fourcc_t p_I420_fallback[] = {
    VLC_CODEC_I420, VLC_CODEC_YV12, VLC_CODEC_J420, VLC_CODEC_FALLBACK_420, 0
};
static const vlc_fourcc_t p_J420_fallback[] = {
    VLC_CODEC_J420, VLC_CODEC_I420, VLC_CODEC_YV12, VLC_CODEC_FALLBACK_420, 0
};
static const vlc_fourcc_t p_YV12_fallback[] = {
    VLC_CODEC_YV12, VLC_CODEC_I420, VLC_CODEC_J420, VLC_CODEC_FALLBACK_420, 0
};

#define VLC_CODEC_FALLBACK_422 \
    VLC_CODEC_YUV_PACKED, VLC_CODEC_YUV_PLANAR_420, \
    VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PLANAR_440, \
1374
    VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385

static const vlc_fourcc_t p_I422_fallback[] = {
    VLC_CODEC_I422, VLC_CODEC_J422, VLC_CODEC_FALLBACK_422, 0
};
static const vlc_fourcc_t p_J422_fallback[] = {
    VLC_CODEC_J422, VLC_CODEC_I422, VLC_CODEC_FALLBACK_422, 0
};

#define VLC_CODEC_FALLBACK_444 \
    VLC_CODEC_YUV_PLANAR_422, VLC_CODEC_YUV_PACKED, \
    VLC_CODEC_YUV_PLANAR_420, VLC_CODEC_YUV_PLANAR_440, \
1386
    VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400

static const vlc_fourcc_t p_I444_fallback[] = {
    VLC_CODEC_I444, VLC_CODEC_J444, VLC_CODEC_FALLBACK_444, 0
};
static const vlc_fourcc_t p_J444_fallback[] = {
    VLC_CODEC_J444, VLC_CODEC_I444, VLC_CODEC_FALLBACK_444, 0
};

static const vlc_fourcc_t p_I440_fallback[] = {
    VLC_CODEC_I440,
    VLC_CODEC_YUV_PLANAR_420,
    VLC_CODEC_YUV_PLANAR_422,
    VLC_CODEC_YUV_PLANAR_444,
    VLC_CODEC_YUV_PACKED,
1401
    VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211, 0
1402
1403
1404
1405
1406
};

#define VLC_CODEC_FALLBACK_PACKED \
    VLC_CODEC_YUV_PLANAR_422, VLC_CODEC_YUV_PLANAR_420, \
    VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PLANAR_440, \
1407
    VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459

static const vlc_fourcc_t p_YUYV_fallback[] = {
    VLC_CODEC_YUYV,
    VLC_CODEC_YVYU,
    VLC_CODEC_UYVY,
    VLC_CODEC_VYUY,
    VLC_CODEC_FALLBACK_PACKED, 0
};
static const vlc_fourcc_t p_YVYU_fallback[] = {
    VLC_CODEC_YVYU,
    VLC_CODEC_YUYV,
    VLC_CODEC_UYVY,
    VLC_CODEC_VYUY,
    VLC_CODEC_FALLBACK_PACKED, 0
};
static const vlc_fourcc_t p_UYVY_fallback[] = {
    VLC_CODEC_UYVY,
    VLC_CODEC_VYUY,
    VLC_CODEC_YUYV,
    VLC_CODEC_YVYU,
    VLC_CODEC_FALLBACK_PACKED, 0
};
static const vlc_fourcc_t p_VYUY_fallback[] = {
    VLC_CODEC_VYUY,
    VLC_CODEC_UYVY,
    VLC_CODEC_YUYV,
    VLC_CODEC_YVYU,
    VLC_CODEC_FALLBACK_PACKED, 0
};

static const vlc_fourcc_t *pp_YUV_fallback[] = {
    p_YV12_fallback,
    p_I420_fallback,
    p_J420_fallback,
    p_I422_fallback,
    p_J422_fallback,
    p_I444_fallback,
    p_J444_fallback,
    p_I440_fallback,
    p_YUYV_fallback,
    p_YVYU_fallback,
    p_UYVY_fallback,
    p_VYUY_fallback,
    NULL,
};

static const vlc_fourcc_t p_list_YUV[] = {
    VLC_CODEC_YUV_PLANAR_420,
    VLC_CODEC_YUV_PLANAR_422,
    VLC_CODEC_YUV_PLANAR_440,
    VLC_CODEC_YUV_PLANAR_444,
    VLC_CODEC_YUV_PACKED,
1460
    VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211,
1461
1462
1463
    0,
};

1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
/* */
static const vlc_fourcc_t p_RGB32_fallback[] = {
    VLC_CODEC_RGB32,
    VLC_CODEC_RGB24,
    VLC_CODEC_RGB16,
    VLC_CODEC_RGB15,
    VLC_CODEC_RGB8,
    0,
};
static const vlc_fourcc_t p_RGB24_fallback[] = {
    VLC_CODEC_RGB24,
    VLC_CODEC_RGB32,
    VLC_CODEC_RGB16,
    VLC_CODEC_RGB15,
    VLC_CODEC_RGB8,
    0,
};
static const vlc_fourcc_t p_RGB16_fallback[] = {
    VLC_CODEC_RGB16,
    VLC_CODEC_RGB24,
    VLC_CODEC_RGB32,
    VLC_CODEC_RGB15,
    VLC_CODEC_RGB8,
    0,
};
static const vlc_fourcc_t p_RGB15_fallback[] = {
    VLC_CODEC_RGB15,
    VLC_CODEC_RGB16,
    VLC_CODEC_RGB24,
    VLC_CODEC_RGB32,
    VLC_CODEC_RGB8,
    0,
};
static const vlc_fourcc_t p_RGB8_fallback[] = {
    VLC_CODEC_RGB8,
    VLC_CODEC_RGB15,
    VLC_CODEC_RGB16,
    VLC_CODEC_RGB24,
    VLC_CODEC_RGB32,
    0,
};
static const vlc_fourcc_t *pp_RGB_fallback[] = {
    p_RGB32_fallback,
    p_RGB24_fallback,
    p_RGB16_fallback,
    p_RGB15_fallback,
    p_RGB8_fallback,
    NULL,
};


/* */
static const vlc_fourcc_t *GetFallback( vlc_fourcc_t i_fourcc,
                                        const vlc_fourcc_t *pp_fallback[],
                                        const vlc_fourcc_t p_list[] )
1519
{
1520
    for( unsigned i = 0; pp_fallback[i]; i++ )
1521
    {
1522
1523
        if( pp_fallback[i][0] == i_fourcc )
            return pp_fallback[i];
1524
    }
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
    return p_list;
}

const vlc_fourcc_t *vlc_fourcc_GetYUVFallback( vlc_fourcc_t i_fourcc )
{
    return GetFallback( i_fourcc, pp_YUV_fallback, p_list_YUV );
}
const vlc_fourcc_t *vlc_fourcc_GetRGBFallback( vlc_fourcc_t i_fourcc )
{
    return GetFallback( i_fourcc, pp_RGB_fallback, p_RGB32_fallback );
1535
1536
1537
1538
}

bool vlc_fourcc_AreUVPlanesSwapped( vlc_fourcc_t a, vlc_fourcc_t b )
{
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
    static const vlc_fourcc_t pp_swapped[][4] = {
        { VLC_CODEC_YV12, VLC_CODEC_I420, VLC_CODEC_J420, 0 },
        { VLC_CODEC_YV9,  VLC_CODEC_I410, 0 },
        { 0 }
    };

    for( int i = 0; pp_swapped[i][0]; i++ )
    {
        if( pp_swapped[i][0] == b )
        {
            vlc_fourcc_t t = a;
            a = b;
            b = t;
        }
        if( pp_swapped[i][0] != a )
            continue;
        for( int j = 1; pp_swapped[i][j]; j++ )
        {
            if( pp_swapped[i][j] == b )
                return true;
        }
    }
    return false;
1562
1563
}

Laurent Aimar's avatar
Laurent Aimar committed
1564
bool vlc_fourcc_IsYUV(vlc_fourcc_t fcc)
1565
1566
1567
1568
1569
1570
1571
1572
{
    for( unsigned i = 0; p_list_YUV[i]; i++ )
    {
        if( p_list_YUV[i] == fcc )
            return true;
    }
    return false;
}
Laurent Aimar's avatar
Laurent Aimar committed
1573