Remove support for reparenting
[vlc/asuraparaju-public.git] / src / misc / fourcc.c
blob80b8db3db62433c66587f2c59455a6bae6458e04
1 /*****************************************************************************
2 * fourcc.c: fourcc helpers functions
3 *****************************************************************************
4 * Copyright (C) 2009 Laurent Aimar
5 * $Id$
7 * Authors: Laurent Aimar <fenrir@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
25 * Preamble
26 *****************************************************************************/
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
31 #include <vlc_fourcc.h>
32 #include <assert.h>
34 typedef struct
36 char p_class[4];
37 char p_fourcc[4];
38 const char *psz_description;
39 } entry_t;
41 #define NULL4 "\x00\x00\x00\x00"
43 /* XXX You don't want to see the preprocessor generated code ;) */
44 #ifdef WORDS_BIGENDIAN
45 # define FCC2STR(f) { ((f)>>24)&0xff, ((f)>>16)&0xff, ((f)>>8)&0xff, ((f)>>0)&0xff }
46 #else
47 # define FCC2STR(f) { ((f)>>0)&0xff, ((f)>>8)&0xff, ((f)>>16)&0xff, ((f)>>24)&0xff }
48 #endif
49 /* Begin a new class */
50 #define B(a, c) { .p_class = FCC2STR(a), .p_fourcc = FCC2STR(a), .psz_description = c }
51 /* Create a sub-class entry with description */
52 #define E(b, c) { .p_class = NULL4, .p_fourcc = b, .psz_description = c }
53 /* Create a sub-class entry without description (alias) */
54 #define A(b) E(b, NULL4)
57 /* */
58 static const entry_t p_list_video[] = {
60 B(VLC_CODEC_MPGV, "MPEG-1/2 Video"),
61 A("mpgv"),
62 A("mp1v"),
63 A("mpeg"),
64 A("mpg1"),
65 A("mp2v"),
66 A("MPEG"),
67 A("mpg2"),
68 A("MPG2"),
70 E("PIM1", "Pinnacle DC1000 (MPEG-1 Video)"),
72 E("hdv1", "HDV 720p30 (MPEG-2 Video)"),
73 E("hdv2", "Sony HDV (MPEG-2 Video)"),
74 E("hdv3", "FCP HDV (MPEG-2 Video)"),
75 E("hdv5", "HDV 720p25 (MPEG-2 Video)"),
76 E("hdv6", "HDV 1080p24 (MPEG-2 Video)"),
77 E("hdv7", "HDV 1080p25 (MPEG-2 Video)"),
78 E("hdv8", "HDV 1080p30 (MPEG-2 Video)"),
80 E("mx5n", "MPEG2 IMX NTSC 525/60 50mb/s (FCP)"),
81 E("mx5p", "MPEG2 IMX PAL 625/60 50mb/s (FCP)"),
82 E("mx4n", "MPEG2 IMX NTSC 525/60 40mb/s (FCP)"),
83 E("mx4p", "MPEG2 IMX PAL 625/50 40mb/s (FCP)"),
84 E("mx3n", "MPEG2 IMX NTSC 525/60 30mb/s (FCP)"),
85 E("mx3p", "MPEG2 IMX NTSC 625/50 30mb/s (FCP)"),
87 E("xdv1", "XDCAM HD"),
88 E("xdv2", "XDCAM HD 1080i60 35mb/s"),
89 E("xdv3", "XDCAM HD 1080i50 35mb/s"),
90 E("xdv4", "XDCAM HD"),
91 E("xdv5", "XDCAM HD"),
92 E("xdv6", "XDCAM HD 1080p24 35mb/s"),
93 E("xdv7", "XDCAM HD 1080p25 35mb/s"),
94 E("xdv8", "XDCAM HD 1080p30 35mb/s"),
95 E("xdv9", "XDCAM HD"),
97 E("xdva", "XDCAM"),
98 E("xdvb", "XDCAM"),
99 E("xdvc", "XDCAM"),
100 E("xdvd", "XDCAM"),
101 E("xdve", "XDCAM"),
102 E("xdvf", "XDCAM"),
104 E("xd5a", "XDCAM"),
105 E("xd5b", "XDCAM"),
106 E("xd5c", "XDCAM"),
107 E("xd5d", "XDCAM"),
108 E("xd5e", "XDCAM"),
109 E("xd5f", "XDCAM"),
110 E("xd59", "XDCAM"),
112 E("AVmp", "AVID IMX PAL"),
113 E("MMES", "Matrox MPEG-2"),
114 E("mmes", "Matrox MPEG-2"),
115 E("PIM2", "Pinnacle MPEG-2"),
116 E("LMP2", "Lead MPEG-2"),
118 E("VCR2", "ATI VCR-2"),
120 B(VLC_CODEC_MP4V, "MPEG-4 Video"),
121 A("mp4v"),
122 A("DIVX"),
123 A("divx"),
124 A("MP4S"),
125 A("mp4s"),
126 A("M4S2"),
127 A("m4s2"),
128 A("MP4V"),
129 A("\x04\x00\x00\x00"),
130 A("m4cc"),
131 A("M4CC"),
132 A("FMP4"),
133 A("fmp4"),
134 A("DCOD"),
135 A("MVXM"),
136 A("PM4V"),
137 A("M4T3"),
138 A("GEOX"),
139 A("GEOV"),
140 A("DMK2"),
141 A("WV1F"),
142 A("DIGI"),
143 A("INMC"),
144 A("SN40"),
145 A("EPHV"),
146 /* XVID flavours */
147 E("xvid", "Xvid MPEG-4 Video"),
148 E("XVID", "Xvid MPEG-4 Video"),
149 E("XviD", "Xvid MPEG-4 Video"),
150 E("XVIX", "Xvid MPEG-4 Video"),
151 E("xvix", "Xvid MPEG-4 Video"),
152 /* DX50 */
153 E("DX50", "DivX MPEG-4 Video"),
154 E("dx50", "DivX MPEG-4 Video"),
155 E("BLZ0", "Blizzard MPEG-4 Video"),
156 E("DXGM", "Electronic Arts Game MPEG-4 Video"),
157 /* 3ivx delta 4 */
158 E("3IV2", "3ivx MPEG-4 Video"),
159 E("3iv2", "3ivx MPEG-4 Video"),
160 /* Various */
161 E("UMP4", "UB MPEG-4 Video"),
162 E("SEDG", "Samsung MPEG-4 Video"),
163 E("RMP4", "REALmagic MPEG-4 Video"),
164 E("HDX4", "Jomigo HDX4 (MPEG-4 Video)"),
165 E("hdx4", "Jomigo HDX4 (MPEG-4 Video)"),
166 E("SMP4", "Samsung SMP4 (MPEG-4 Video)"),
167 E("smp4", "Samsung SMP4 (MPEG-4 Video)"),
168 E("fvfw", "FFmpeg MPEG-4"),
169 E("FVFW", "FFmpeg MPEG-4"),
170 E("FFDS", "FFDShow MPEG-4"),
171 E("VIDM", "vidm 4.01 codec"),
172 /* 3ivx delta 3.5 Unsupported
173 * putting it here gives extreme distorted images */
174 //E("3IV1", "3ivx delta 3.5 MPEG-4 Video"),
175 //E("3iv1", "3ivx delta 3.5 MPEG-4 Video"),
177 /* MSMPEG4 v1 */
178 B(VLC_CODEC_DIV1, "MS MPEG-4 Video v1"),
179 A("DIV1"),
180 A("div1"),
181 A("MPG4"),
182 A("mpg4"),
183 A("mp41"),
185 /* MSMPEG4 v2 */
186 B(VLC_CODEC_DIV2, "MS MPEG-4 Video v2"),
187 A("DIV2"),
188 A("div2"),
189 A("MP42"),
190 A("mp42"),
192 /* MSMPEG4 v3 / M$ mpeg4 v3 */
193 B(VLC_CODEC_DIV3, "MS MPEG-4 Video v3"),
194 A("DIV3"),
195 A("MPG3"),
196 A("mpg3"),
197 A("div3"),
198 A("MP43"),
199 A("mp43"),
200 /* DivX 3.20 */
201 A("DIV4"),
202 A("div4"),
203 A("DIV5"),
204 A("div5"),
205 A("DIV6"),
206 A("div6"),
207 E("divf", "DivX 4.12"),
208 E("DIVF", "DivX 4.12"),
209 /* Cool Codec */
210 A("COL1"),
211 A("col1"),
212 A("COL0"),
213 A("col0"),
214 /* AngelPotion stuff */
215 A("AP41"),
216 /* 3ivx doctered divx files */
217 A("3IVD"),
218 A("3ivd"),
219 /* who knows? */
220 A("3VID"),
221 A("3vid"),
222 A("DVX3"),
224 /* Sorenson v1 */
225 B(VLC_CODEC_SVQ1, "SVQ-1 (Sorenson Video v1)"),
226 A("SVQ1"),
227 A("svq1"),
228 A("svqi"),
230 /* Sorenson v3 */
231 B(VLC_CODEC_SVQ3, "SVQ-3 (Sorenson Video v3)"),
232 A("SVQ3"),
234 /* h264 */
235 B(VLC_CODEC_H264, "H264 - MPEG-4 AVC (part 10)"),
236 A("H264"),
237 A("h264"),
238 A("x264"),
239 A("X264"),
240 /* avc1: special case h264 */
241 A("avc1"),
242 A("AVC1"),
243 E("VSSH", "Vanguard VSS H264"),
244 E("VSSW", "Vanguard VSS H264"),
245 E("vssh", "Vanguard VSS H264"),
246 E("DAVC", "Dicas MPEGable H.264/MPEG-4 AVC"),
247 E("davc", "Dicas MPEGable H.264/MPEG-4 AVC"),
249 /* H263 and H263i */
250 /* H263(+) is also known as Real Video 1.0 */
252 /* H263 */
253 B(VLC_CODEC_H263, "H263"),
254 A("H263"),
255 A("h263"),
256 A("VX1K"),
257 A("s263"),
258 A("S263"),
259 A("U263"),
260 A("u263"),
261 E("D263", "DEC H263"),
262 E("L263", "LEAD H263"),
263 E("M263", "Microsoft H263"),
264 E("X263", "Xirlink H263"),
265 /* Zygo (partial) */
266 E("ZyGo", "ITU H263+"),
268 /* H263i */
269 B(VLC_CODEC_H263I, "I263.I"),
270 A("I263"),
271 A("i263"),
273 /* H263P */
274 B(VLC_CODEC_H263P, "ITU H263+"),
275 E("ILVR", "ITU H263+"),
276 E("viv1", "H263+"),
277 E("vivO", "H263+"),
278 E("viv2", "H263+"),
279 E("U263", "UB H263+"),
281 /* Flash (H263) variant */
282 B(VLC_CODEC_FLV1, "Flash Video"),
283 A("FLV1"),
284 A("flv "),
286 /* H261 */
287 B(VLC_CODEC_H261, "H.261"),
288 A("H261"),
289 A("h261"),
291 B(VLC_CODEC_FLIC, "Flic Video"),
292 A("FLIC"),
294 /* MJPEG */
295 B(VLC_CODEC_MJPG, "Motion JPEG Video"),
296 A("MJPG"),
297 A("mjpg"),
298 A("mjpa"),
299 A("jpeg"),
300 A("JPEG"),
301 A("JFIF"),
302 A("JPGL"),
303 A("AVDJ"),
304 A("MMJP"),
305 A("QIVG"),
306 /* AVID MJPEG */
307 E("AVRn", "Avid Motion JPEG"),
308 E("AVDJ", "Avid Motion JPEG"),
309 E("ADJV", "Avid Motion JPEG"),
310 E("dmb1", "Motion JPEG OpenDML Video"),
311 E("ijpg", "Intergraph JPEG Video"),
312 E("IJPG", "Intergraph JPEG Video"),
313 E("ACDV", "ACD Systems Digital"),
314 E("SLMJ", "SL M-JPEG"),
316 B(VLC_CODEC_MJPGB, "Motion JPEG B Video"),
317 A("mjpb"),
319 B(VLC_CODEC_LJPG, "Lead Motion JPEG Video"),
320 A("LJPG"),
322 // ? from avcodec/fourcc.c but makes not sense.
323 //{ VLC_FOURCC( 'L','J','P','G' ), CODEC_ID_MJPEG, VIDEO_ES, "Lead Motion JPEG Video" },
325 /* SP5x */
326 B(VLC_CODEC_SP5X, "Sunplus Motion JPEG Video"),
327 A("SP5X"),
328 A("SP53"),
329 A("SP54"),
330 A("SP55"),
331 A("SP56"),
332 A("SP57"),
333 A("SP58"),
335 /* DV */
336 B(VLC_CODEC_DV, "DV Video"),
337 A("dv "),
338 A("dvsl"),
339 A("DVSD"),
340 A("dvsd"),
341 A("DVCS"),
342 A("dvcs"),
343 A("dvhd"),
344 A("dvhp"),
345 A("dvhq"),
346 A("dvh3"),
347 A("dvh5"),
348 A("dvh6"),
349 A("dv1n"),
350 A("dv1p"),
351 A("dvc "),
352 A("dv25"),
353 A("dvh1"),
354 A("dvs1"),
355 E("dvcp", "DV Video PAL"),
356 E("dvp ", "DV Video Pro"),
357 E("dvpp", "DV Video Pro PAL"),
358 E("dv50", "DV Video C Pro 50"),
359 E("dv5p", "DV Video C Pro 50 PAL"),
360 E("dv5n", "DV Video C Pro 50 NTSC"),
361 E("AVdv", "AVID DV"),
362 E("AVd1", "AVID DV"),
363 E("CDVC", "Canopus DV Video"),
364 E("cdvc", "Canopus DV Video"),
365 E("CDVH", "Canopus DV Video"),
366 E("cdvh", "Canopus DV Video"),
368 /* Windows Media Video */
369 B(VLC_CODEC_WMV1, "Windows Media Video 7"),
370 A("WMV1"),
371 A("wmv1"),
373 B(VLC_CODEC_WMV2, "Windows Media Video 8"),
374 A("WMV2"),
375 A("wmv2"),
377 B(VLC_CODEC_WMV3, "Windows Media Video 9"),
378 A("WMV3"),
379 A("wmv3"),
381 /* WMVA is the VC-1 codec before the standardization proces,
382 * it is not bitstream compatible and deprecated */
383 B(VLC_CODEC_WMVA, "Windows Media Video Advanced Profile"),
384 A("WMVA"),
385 A("wmva"),
386 A("WVP2"),
387 A("wvp2"),
389 B(VLC_CODEC_VC1, "Windows Media Video VC1"),
390 A("WVC1"),
391 A("wvc1"),
392 A("vc-1"),
393 A("VC-1"),
395 /* Microsoft Video 1 */
396 B(VLC_CODEC_MSVIDEO1, "Microsoft Video 1"),
397 A("MSVC"),
398 A("msvc"),
399 A("CRAM"),
400 A("cram"),
401 A("WHAM"),
402 A("wham"),
404 /* Microsoft RLE */
405 B(VLC_CODEC_MSRLE, "Microsoft RLE Video"),
406 A("mrle"),
407 A("WRLE"),
408 A("\x01\x00\x00\x00"),
409 A("\x02\x00\x00\x00"),
411 /* Indeo Video Codecs (Quality of this decoder on ppc is not good) */
412 B(VLC_CODEC_INDEO3, "Indeo Video v3"),
413 A("IV31"),
414 A("iv31"),
415 A("IV32"),
416 A("iv32"),
418 /* Huff YUV */
419 B(VLC_CODEC_HUFFYUV, "Huff YUV Video"),
420 A("HFYU"),
422 B(VLC_CODEC_FFVHUFF, "Huff YUV Video"),
423 A("FFVH"),
425 /* On2 VP3 Video Codecs */
426 B(VLC_CODEC_VP3, "On2's VP3 Video"),
427 A("VP3 "),
428 A("VP30"),
429 A("vp30"),
430 A("VP31"),
431 A("vp31"),
433 /* On2 VP5, VP6 codecs */
434 B(VLC_CODEC_VP5, "On2's VP5 Video"),
435 A("VP5 "),
436 A("VP50"),
438 B(VLC_CODEC_VP6, "On2's VP6.2 Video"),
439 A("VP62"),
440 A("vp62"),
441 E("VP60", "On2's VP6.0 Video"),
442 E("VP61", "On2's VP6.1 Video"),
444 B(VLC_CODEC_VP6F, "On2's VP6.2 Video (Flash)"),
445 A("VP6F"),
446 A("FLV4"),
448 B(VLC_CODEC_VP6A, "On2's VP6 A Video"),
449 A("VP6A"),
451 B(VLC_CODEC_VP8, "Google/On2's VP8 Video"),
452 A("VP80"),
455 /* Xiph.org theora */
456 B(VLC_CODEC_THEORA, "Xiph.org's Theora Video"),
457 A("theo"),
458 A("Thra"),
460 /* Xiph.org tarkin */
461 B(VLC_CODEC_TARKIN, "Xiph.org's Tarkin Video"),
462 A("tark"),
464 /* Asus Video (Another thing that doesn't work on PPC) */
465 B(VLC_CODEC_ASV1, "Asus V1 Video"),
466 A("ASV1"),
467 B(VLC_CODEC_ASV2, "Asus V2 Video"),
468 A("ASV2"),
470 /* FFMPEG Video 1 (lossless codec) */
471 B(VLC_CODEC_FFV1, "FFMpeg Video 1"),
472 A("FFV1"),
474 /* ATI VCR1 */
475 B(VLC_CODEC_VCR1, "ATI VCR1 Video"),
476 A("VCR1"),
478 /* Cirrus Logic AccuPak */
479 B(VLC_CODEC_CLJR, "Creative Logic AccuPak"),
480 A("CLJR"),
482 /* Real Video */
483 B(VLC_CODEC_RV10, "Real Video 1.0"),
484 A("RV10"),
485 A("rv10"),
487 B(VLC_CODEC_RV13, "Real Video 1.3"),
488 A("RV13"),
489 A("rv13"),
491 B(VLC_CODEC_RV20, "Real Video 2.0"),
492 A("RV20"),
493 A("rv20"),
495 B(VLC_CODEC_RV30, "Real Video 3.0"),
496 A("RV30"),
497 A("rv30"),
499 B(VLC_CODEC_RV40, "Real Video 4.0"),
500 A("RV40"),
501 A("rv40"),
503 /* Apple Video */
504 B(VLC_CODEC_RPZA, "Apple Video"),
505 A("rpza"),
506 A("azpr"),
507 A("RPZA"),
508 A("AZPR"),
510 B(VLC_CODEC_SMC, "Apple graphics"),
511 A("smc "),
513 B(VLC_CODEC_CINEPAK, "Cinepak Video"),
514 A("CVID"),
515 A("cvid"),
517 /* Screen Capture Video Codecs */
518 B(VLC_CODEC_TSCC, "TechSmith Camtasia Screen Capture"),
519 A("TSCC"),
520 A("tscc"),
522 B(VLC_CODEC_CSCD, "CamStudio Screen Codec"),
523 A("CSCD"),
524 A("cscd"),
526 B(VLC_CODEC_ZMBV, "DosBox Capture Codec"),
527 A("ZMBV"),
529 B(VLC_CODEC_VMNC, "VMware Video"),
530 A("VMnc"),
531 B(VLC_CODEC_FRAPS, "FRAPS: Realtime Video Capture"),
532 A("FPS1"),
533 A("fps1"),
535 /* Duck TrueMotion */
536 B(VLC_CODEC_TRUEMOTION1, "Duck TrueMotion v1 Video"),
537 A("DUCK"),
538 A("PVEZ"),
539 B(VLC_CODEC_TRUEMOTION2, "Duck TrueMotion v2.0 Video"),
540 A("TM20"),
542 /* FFMPEG's SNOW wavelet codec */
543 B(VLC_CODEC_SNOW, "FFMpeg SNOW wavelet Video"),
544 A("SNOW"),
545 A("snow"),
547 B(VLC_CODEC_QTRLE, "Apple QuickTime RLE Video"),
548 A("rle "),
550 B(VLC_CODEC_QDRAW, "Apple QuickDraw Video"),
551 A("qdrw"),
553 B(VLC_CODEC_QPEG, "QPEG Video"),
554 A("QPEG"),
555 A("Q1.0"),
556 A("Q1.1"),
558 B(VLC_CODEC_ULTI, "IBM Ultimotion Video"),
559 A("ULTI"),
561 B(VLC_CODEC_VIXL, "Miro/Pinnacle VideoXL Video"),
562 A("VIXL"),
563 A("XIXL"),
564 E("PIXL", "Pinnacle VideoXL Video"),
566 B(VLC_CODEC_LOCO, "LOCO Video"),
567 A("LOCO"),
569 B(VLC_CODEC_WNV1, "Winnov WNV1 Video"),
570 A("WNV1"),
572 B(VLC_CODEC_AASC, "Autodesc RLE Video"),
573 A("AASC"),
575 B(VLC_CODEC_INDEO2, "Indeo Video v2"),
576 A("IV20"),
577 A("RT21"),
579 /* Flash Screen Video */
580 B(VLC_CODEC_FLASHSV, "Flash Screen Video"),
581 A("FSV1"),
582 B(VLC_CODEC_KMVC, "Karl Morton's Video Codec (Worms)"),
583 A("KMVC"),
585 B(VLC_CODEC_NUV, "Nuppel Video"),
586 A("RJPG"),
587 A("NUV1"),
589 /* CODEC_ID_SMACKVIDEO */
590 B(VLC_CODEC_SMACKVIDEO, "Smacker Video"),
591 A("SMK2"),
592 A("SMK4"),
594 /* Chinese AVS - Untested */
595 B(VLC_CODEC_CAVS, "Chinese AVS"),
596 A("CAVS"),
597 A("AVs2"),
598 A("avs2"),
600 B(VLC_CODEC_AMV, "AMV"),
602 /* */
603 B(VLC_CODEC_DNXHD, "DNxHD"),
604 A("AVdn"),
605 B(VLC_CODEC_8BPS, "8BPS"),
606 A("8BPS"),
607 B(VLC_CODEC_MIMIC, "Mimic"),
608 A("ML2O"),
610 B(VLC_CODEC_CDG, "CD-G Video"),
611 A("CDG "),
613 B(VLC_CODEC_FRWU, "Forward Uncompressed" ),
614 A("FRWU"),
616 B(VLC_CODEC_INDEO5, "Indeo Video v5"),
617 A("IV50"),
618 A("iv50"),
621 /* */
622 B(VLC_CODEC_YV12, "Planar 4:2:0 YVU"),
623 A("YV12"),
624 A("yv12"),
625 B(VLC_CODEC_YV9, "Planar 4:1:0 YVU"),
626 A("YVU9"),
627 B(VLC_CODEC_I410, "Planar 4:1:0 YUV"),
628 A("I410"),
629 B(VLC_CODEC_I411, "Planar 4:1:1 YUV"),
630 A("I411"),
631 B(VLC_CODEC_I420, "Planar 4:2:0 YUV"),
632 A("I420"),
633 A("IYUV"),
634 B(VLC_CODEC_I422, "Planar 4:2:2 YUV"),
635 A("I422"),
636 B(VLC_CODEC_I444, "Planar 4:4:0 YUV"),
637 A("I440"),
638 B(VLC_CODEC_I444, "Planar 4:4:4 YUV"),
639 A("I444"),
641 B(VLC_CODEC_J420, "Planar 4:2:0 YUV full scale"),
642 A("J420"),
643 B(VLC_CODEC_J422, "Planar 4:2:2 YUV full scale"),
644 A("J422"),
645 B(VLC_CODEC_J440, "Planar 4:4:0 YUV full scale"),
646 A("J440"),
647 B(VLC_CODEC_J444, "Planar 4:4:4 YUV full scale"),
648 A("J444"),
650 B(VLC_CODEC_YUVP, "Palettized YUV with palette element Y:U:V:A"),
651 A("YUVP"),
653 B(VLC_CODEC_YUVA, "Planar YUV 4:4:4 Y:U:V:A"),
654 A("YUVA"),
656 B(VLC_CODEC_RGBP, "Palettized RGB with palette element R:G:B"),
657 A("RGBP"),
659 B(VLC_CODEC_RGB8, "8 bits RGB"),
660 A("RGB2"),
661 B(VLC_CODEC_RGB15, "15 bits RGB"),
662 A("RV15"),
663 B(VLC_CODEC_RGB16, "16 bits RGB"),
664 A("RV16"),
665 B(VLC_CODEC_RGB24, "24 bits RGB"),
666 A("RV24"),
667 B(VLC_CODEC_RGB32, "32 bits RGB"),
668 A("RV32"),
669 B(VLC_CODEC_RGBA, "32 bits RGBA"),
670 A("RGBA"),
672 B(VLC_CODEC_GREY, "8 bits greyscale"),
673 A("GREY"),
674 A("Y800"),
675 A("Y8 "),
677 B(VLC_CODEC_UYVY, "Packed YUV 4:2:2, U:Y:V:Y"),
678 A("UYVY"),
679 A("UYNV"),
680 A("UYNY"),
681 A("Y422"),
682 A("HDYC"),
683 A("AVUI"),
684 A("uyv1"),
685 A("2vuy"),
686 A("2Vuy"),
687 A("2Vu1"),
688 B(VLC_CODEC_VYUY, "Packed YUV 4:2:2, V:Y:U:Y"),
689 A("VYUY"),
690 B(VLC_CODEC_YUYV, "Packed YUV 4:2:2, Y:U:Y:V"),
691 A("YUY2"),
692 A("YUYV"),
693 A("YUNV"),
694 A("V422"),
695 B(VLC_CODEC_YVYU, "Packed YUV 4:2:2, Y:V:Y:U"),
696 A("YVYU"),
698 B(VLC_CODEC_Y211, "Packed YUV 2:1:1, Y:U:Y:V "),
699 A("Y211"),
700 B(VLC_CODEC_CYUV, "Creative Packed YUV 4:2:2, U:Y:V:Y, reverted"),
701 A("cyuv"),
702 A("CYUV"),
704 B(VLC_CODEC_V210, "10-bit 4:2:2 Component YCbCr"),
705 A("v210"),
707 B(VLC_CODEC_NV12, "Planar Y, Packet UV (420)"),
708 A("NV12"),
710 /* Videogames Codecs */
712 /* Interplay MVE */
713 B(VLC_CODEC_INTERPLAY, "Interplay MVE Video"),
714 A("imve"),
715 A("INPV"),
717 /* Id Quake II CIN */
718 B(VLC_CODEC_IDCIN, "Id Quake II CIN Video"),
719 A("IDCI"),
721 /* 4X Technologies */
722 B(VLC_CODEC_4XM, "4X Technologies Video"),
723 A("4XMV"),
724 A("4xmv"),
726 /* Id RoQ */
727 B(VLC_CODEC_ROQ, "Id RoQ Video"),
728 A("RoQv"),
730 /* Sony Playstation MDEC */
731 B(VLC_CODEC_MDEC, "PSX MDEC Video"),
732 A("MDEC"),
734 /* Sierra VMD */
735 B(VLC_CODEC_VMDVIDEO, "Sierra VMD Video"),
736 A("VMDV"),
737 A("vmdv"),
739 B(VLC_CODEC_DIRAC, "Dirac" ),
740 A("drac"),
742 /* Image */
743 B(VLC_CODEC_PNG, "PNG Image"),
744 A("png "),
746 B(VLC_CODEC_PPM, "PPM Image"),
747 A("ppm "),
749 B(VLC_CODEC_PGM, "PGM Image"),
750 A("pgm "),
752 B(VLC_CODEC_PGMYUV, "PGM YUV Image"),
753 A("pgmy"),
755 B(VLC_CODEC_PAM, "PAM Image"),
756 A("pam "),
758 B(VLC_CODEC_JPEGLS, "Lossless JPEG"),
759 A("MJLS"),
761 B(VLC_CODEC_JPEG, "JPEG"),
762 A("jpeg"),
763 A("JPEG"),
765 B(VLC_CODEC_BMP, "BMP Image"),
766 A("bmp "),
768 B(VLC_CODEC_TIFF, "TIFF Image"),
769 A("tiff"),
771 B(VLC_CODEC_GIF, "GIF Image"),
772 A("gif "),
775 B(VLC_CODEC_TARGA, "Truevision Targa Image"),
776 A("tga "),
777 A("mtga"),
778 A("MTGA"),
780 B(VLC_CODEC_SGI, "SGI Image"),
781 A("sgi "),
783 B(VLC_CODEC_PNM, "Portable Anymap Image"),
784 A("pnm "),
786 B(VLC_CODEC_PCX, "Personal Computer Exchange Image"),
787 A("pcx "),
789 B(0, "")
791 static const entry_t p_list_audio[] = {
793 /* Windows Media Audio 1 */
794 B(VLC_CODEC_WMA1, "Windows Media Audio 1"),
795 A("WMA1"),
796 A("wma1"),
798 /* Windows Media Audio 2 */
799 B(VLC_CODEC_WMA2, "Windows Media Audio 2"),
800 A("WMA2"),
801 A("wma2"),
802 A("wma "),
804 /* Windows Media Audio Professional */
805 B(VLC_CODEC_WMAP, "Windows Media Audio Professional"),
806 A("WMAP"),
807 A("wmap"),
809 /* Windows Media Audio Lossless */
810 B(VLC_CODEC_WMAL, "Windows Media Audio Lossless"),
811 A("WMAL"),
812 A("wmal"),
814 /* Windows Media Audio Speech */
815 B(VLC_CODEC_WMAS, "Windows Media Audio Voice (Speech)"),
816 A("WMAS"),
817 A("wmas"),
819 /* DV Audio */
820 B(VLC_CODEC_DVAUDIO, "DV Audio"),
821 A("dvau"),
822 A("vdva"),
823 A("dvca"),
824 A("RADV"),
826 /* MACE-3 Audio */
827 B(VLC_CODEC_MACE3, "MACE-3 Audio"),
828 A("MAC3"),
830 /* MACE-6 Audio */
831 B(VLC_CODEC_MACE6, "MACE-6 Audio"),
832 A("MAC6"),
834 /* MUSEPACK7 Audio */
835 B(VLC_CODEC_MUSEPACK7, "MUSEPACK7 Audio"),
836 A("MPC "),
838 /* MUSEPACK8 Audio */
839 B(VLC_CODEC_MUSEPACK8, "MUSEPACK8 Audio"),
840 A("MPCK"),
841 A("MPC8"),
843 /* RealAudio 1.0 */
844 B(VLC_CODEC_RA_144, "RealAudio 1.0"),
845 A("14_4"),
846 A("lpcJ"),
848 /* RealAudio 2.0 */
849 B(VLC_CODEC_RA_288, "RealAudio 2.0"),
850 A("28_8"),
852 B(VLC_CODEC_SIPR, "RealAudio Sipr"),
853 A("sipr"),
855 /* MPEG Audio layer 1/2/3 */
856 B(VLC_CODEC_MPGA, "MPEG Audio layer 1/2/3"),
857 A("mpga"),
858 A("mp3 "),
859 A(".mp3"),
860 A("MP3 "),
861 A("LAME"),
862 A("ms\x00\x50"),
863 A("ms\x00\x55"),
865 /* A52 Audio (aka AC3) */
866 B(VLC_CODEC_A52, "A52 Audio (aka AC3)"),
867 A("a52 "),
868 A("a52b"),
869 A("ac-3"),
870 A("ms\x20\x00"),
872 B(VLC_CODEC_EAC3, "A/52 B Audio (aka E-AC3)"),
873 A("eac3"),
875 /* DTS Audio */
876 B(VLC_CODEC_DTS, "DTS Audio"),
877 A("dts "),
878 A("dtsb"),
879 A("ms\x20\x01"),
881 /* AAC audio */
882 B(VLC_CODEC_MP4A, "MPEG AAC Audio"),
883 A("mp4a"),
884 A("aac "),
886 /* ALS audio */
887 B(VLC_CODEC_ALS, "MPEG-4 Audio Lossless (ALS)"),
888 A("als "),
890 /* 4X Technologies */
891 B(VLC_CODEC_ADPCM_4XM, "4X Technologies Audio"),
892 A("4xma"),
894 /* EA ADPCM */
895 B(VLC_CODEC_ADPCM_EA, "EA ADPCM Audio"),
896 A("ADEA"),
898 /* Interplay DPCM */
899 B(VLC_CODEC_INTERPLAY_DPCM, "Interplay DPCM Audio"),
900 A("idpc"),
902 /* Id RoQ */
903 B(VLC_CODEC_ROQ_DPCM, "Id RoQ DPCM Audio"),
904 A("RoQa"),
906 /* DCIN Audio */
907 B(VLC_CODEC_DSICINAUDIO, "Delphine CIN Audio"),
908 A("DCIA"),
910 /* Sony Playstation XA ADPCM */
911 B(VLC_CODEC_ADPCM_XA, "PSX XA ADPCM Audio"),
912 A("xa "),
914 /* ADX ADPCM */
915 B(VLC_CODEC_ADPCM_ADX, "ADX ADPCM Audio"),
916 A("adx "),
918 /* Westwood ADPCM */
919 B(VLC_CODEC_ADPCM_IMA_WS, "Westwood IMA ADPCM audio"),
920 A("AIWS"),
922 /* MS ADPCM */
923 B(VLC_CODEC_ADPCM_MS, "MS ADPCM audio"),
924 A("ms\x00\x02"),
926 /* Sierra VMD */
927 B(VLC_CODEC_VMDAUDIO, "Sierra VMD Audio"),
928 A("vmda"),
930 /* G.726 ADPCM */
931 B(VLC_CODEC_ADPCM_G726, "G.726 ADPCM Audio"),
932 A("g726"),
934 /* Flash ADPCM */
935 B(VLC_CODEC_ADPCM_SWF, "Flash ADPCM Audio"),
936 A("SWFa"),
938 B(VLC_CODEC_ADPCM_IMA_WAV, "IMA WAV ADPCM Audio"),
939 A("ms\x00\x11"),
941 B(VLC_CODEC_ADPCM_IMA_AMV, "IMA AMV ADPCM Audio"),
942 A("imav"),
944 /* AMR */
945 B(VLC_CODEC_AMR_NB, "AMR narrow band"),
946 A("samr"),
948 B(VLC_CODEC_AMR_WB, "AMR wide band"),
949 A("sawb"),
951 /* FLAC */
952 B(VLC_CODEC_FLAC, "FLAC (Free Lossless Audio Codec)"),
953 A("flac"),
955 /* ALAC */
956 B(VLC_CODEC_ALAC, "Apple Lossless Audio Codec"),
957 A("alac"),
959 /* QDM2 */
960 B(VLC_CODEC_QDM2, "QDM2 Audio"),
961 A("QDM2"),
963 /* COOK */
964 B(VLC_CODEC_COOK, "Cook Audio"),
965 A("cook"),
967 /* TTA: The Lossless True Audio */
968 B(VLC_CODEC_TTA, "The Lossless True Audio"),
969 A("TTA1"),
971 /* Shorten */
972 B(VLC_CODEC_SHORTEN, "Shorten Lossless Audio"),
973 A("shn "),
974 A("shrn"),
976 B(VLC_CODEC_WAVPACK, "WavPack"),
977 A("WVPK"),
978 A("wvpk"),
980 B(VLC_CODEC_GSM, "GSM Audio"),
981 A("gsm "),
983 B(VLC_CODEC_GSM_MS, "Microsoft GSM Audio"),
984 A("agsm"),
986 B(VLC_CODEC_ATRAC1, "atrac 1"),
987 A("atr1"),
989 B(VLC_CODEC_ATRAC3, "atrac 3"),
990 A("atrc"),
991 A("\x70\x02\x00\x00"),
993 B(VLC_CODEC_SONIC, "Sonic"),
994 A("SONC"),
996 B(VLC_CODEC_IMC, "IMC" ),
997 A("\x01\x04\x00\x00"),
999 B(VLC_CODEC_TRUESPEECH,"TrueSpeech"),
1000 A("\x22\x00\x00\x00"),
1002 B(VLC_CODEC_NELLYMOSER, "NellyMoser ASAO"),
1003 A("NELL"),
1005 B(VLC_CODEC_APE, "Monkey's Audio"),
1006 A("APE "),
1008 B(VLC_CODEC_MLP, "MLP/TrueHD Audio"),
1009 A("mlp "),
1011 B(VLC_CODEC_TRUEHD, "TrueHD Audio"),
1012 A("trhd"),
1014 B(VLC_CODEC_QCELP, "QCELP Audio"),
1015 A("Qclp"),
1017 B(VLC_CODEC_SPEEX, "Speex Audio"),
1018 A("spx "),
1019 A("spxr"),
1021 B(VLC_CODEC_VORBIS, "Vorbis Audio"),
1022 A("vorb"),
1024 B(VLC_CODEC_302M, "302M Audio"),
1025 A("302m"),
1027 B(VLC_CODEC_DVD_LPCM, "DVD LPCM Audio"),
1028 A("lpcm"),
1030 B(VLC_CODEC_DVDA_LPCM, "DVD-Audio LPCM Audio"),
1031 A("apcm"),
1033 B(VLC_CODEC_BD_LPCM, "BD LPCM Audio"),
1034 A("bpcm"),
1036 B(VLC_CODEC_SDDS, "SDDS Audio"),
1037 A("sdds"),
1038 A("sddb"),
1040 B(VLC_CODEC_MIDI, "MIDI Audio"),
1041 A("MIDI"),
1043 /* PCM */
1044 B(VLC_CODEC_S8, "PCM S8"),
1045 A("s8 "),
1047 B(VLC_CODEC_U8, "PCM U8"),
1048 A("u8 "),
1050 B(VLC_CODEC_S16L, "PCM S16 LE"),
1051 A("s16l"),
1053 B(VLC_CODEC_S16B, "PCM S16 BE"),
1054 A("s16b"),
1056 B(VLC_CODEC_U16L, "PCM U16 LE"),
1057 A("u16l"),
1059 B(VLC_CODEC_U16B, "PCM U16 BE"),
1060 A("u16b"),
1062 B(VLC_CODEC_S24L, "PCM S24 LE"),
1063 A("s24l"),
1064 A("42ni"), /* Quicktime */
1066 B(VLC_CODEC_S24B, "PCM S24 BE"),
1067 A("s24b"),
1068 A("in24"), /* Quicktime */
1070 B(VLC_CODEC_U24L, "PCM U24 LE"),
1071 A("u24l"),
1073 B(VLC_CODEC_U24B, "PCM U24 BE"),
1074 A("u24b"),
1076 B(VLC_CODEC_S32L, "PCM S32 LE"),
1077 A("s32l"),
1078 A("23ni"), /* Quicktime */
1080 B(VLC_CODEC_S32B, "PCM S32 BE"),
1081 A("s32b"),
1082 A("in32"), /* Quicktime */
1084 B(VLC_CODEC_U32L, "PCM U32 LE"),
1085 A("u32l"),
1087 B(VLC_CODEC_U32B, "PCM U32 BE"),
1088 A("u32b"),
1090 B(VLC_CODEC_ALAW, "PCM ALAW"),
1091 A("alaw"),
1093 B(VLC_CODEC_MULAW, "PCM MU-LAW"),
1094 A("mlaw"),
1095 A("ulaw"),
1097 B(VLC_CODEC_S24DAUD, "PCM DAUD"),
1098 A("daud"),
1100 B(VLC_CODEC_FI32, "32 bits fixed float"),
1101 A("fi32"),
1103 B(VLC_CODEC_F32L, "32 bits float LE"),
1104 A("f32l"),
1105 A("fl32"),
1107 B(VLC_CODEC_F32B, "32 bits float BE"),
1108 A("f32b"),
1110 B(VLC_CODEC_F64L, "64 bits float LE"),
1111 A("f64l"),
1113 B(VLC_CODEC_F64L, "64 bits float BE"),
1114 A("f64b"),
1116 B(VLC_CODEC_TWINVQ, "TwinVQ"),
1117 A("TWIN"),
1119 B(0, "")
1121 static const entry_t p_list_spu[] = {
1123 B(VLC_CODEC_SPU, "DVD Subtitles"),
1124 A("spu "),
1125 A("spub"),
1127 B(VLC_CODEC_DVBS, "DVB Subtitles"),
1128 A("dvbs"),
1130 B(VLC_CODEC_SUBT, "Text subtitles with various tags"),
1131 A("subt"),
1133 B(VLC_CODEC_XSUB, "DivX XSUB subtitles"),
1134 A("XSUB"),
1135 A("xsub"),
1136 A("DXSB"),
1138 B(VLC_CODEC_SSA, "SubStation Alpha subtitles"),
1139 A("ssa "),
1141 B(VLC_CODEC_TEXT, "Plain text subtitles"),
1142 A("TEXT"),
1144 B(VLC_CODEC_TELETEXT, "Teletext"),
1145 A("telx"),
1147 B(VLC_CODEC_KATE, "Kate subtitles"),
1148 A("kate"),
1150 B(VLC_CODEC_CMML, "CMML annotations/metadata"),
1151 A("cmml"),
1153 B(VLC_CODEC_ITU_T140, "ITU T.140 subtitles"),
1154 A("t140"),
1156 B(VLC_CODEC_USF, "USF subtitles"),
1157 A("usf "),
1159 B(VLC_CODEC_OGT, "OGT subtitles"),
1160 A("ogt "),
1162 B(VLC_CODEC_CVD, "CVD subtitles"),
1163 A("cvd "),
1165 B(VLC_CODEC_BD_PG, "BD subtitles"),
1166 A("bdpg"),
1168 B(0, "")
1171 /* Create a fourcc from a string.
1172 * XXX it assumes that the string is at least four bytes */
1173 static inline vlc_fourcc_t CreateFourcc( const char *psz_fourcc )
1175 return VLC_FOURCC( psz_fourcc[0], psz_fourcc[1],
1176 psz_fourcc[2], psz_fourcc[3] );
1179 /* */
1180 static entry_t Lookup( const entry_t p_list[], vlc_fourcc_t i_fourcc )
1182 const char *p_class = NULL;
1183 const char *psz_description = NULL;
1185 entry_t e = B(0, "");
1187 for( int i = 0; ; i++ )
1189 const entry_t *p = &p_list[i];
1190 const vlc_fourcc_t i_entry_fourcc = CreateFourcc( p->p_fourcc );
1191 const vlc_fourcc_t i_entry_class = CreateFourcc( p->p_class );
1193 if( i_entry_fourcc == 0 )
1194 break;
1196 if( i_entry_class != 0 )
1198 p_class = p->p_class;
1199 psz_description = p->psz_description;
1202 if( i_entry_fourcc == i_fourcc )
1204 assert( p_class != NULL );
1206 memcpy( e.p_class, p_class, 4 );
1207 memcpy( e.p_fourcc, p->p_fourcc, 4 );
1208 e.psz_description = p->psz_description ?
1209 p->psz_description : psz_description;
1210 break;
1213 return e;
1216 /* */
1217 static entry_t Find( int i_cat, vlc_fourcc_t i_fourcc )
1219 entry_t e;
1221 switch( i_cat )
1223 case VIDEO_ES:
1224 return Lookup( p_list_video, i_fourcc );
1225 case AUDIO_ES:
1226 return Lookup( p_list_audio, i_fourcc );
1227 case SPU_ES:
1228 return Lookup( p_list_spu, i_fourcc );
1230 default:
1231 e = Find( VIDEO_ES, i_fourcc );
1232 if( CreateFourcc( e.p_class ) == 0 )
1233 e = Find( AUDIO_ES, i_fourcc );
1234 if( CreateFourcc( e.p_class ) == 0 )
1235 e = Find( SPU_ES, i_fourcc );
1236 return e;
1240 /* */
1241 vlc_fourcc_t vlc_fourcc_GetCodec( int i_cat, vlc_fourcc_t i_fourcc )
1243 entry_t e = Find( i_cat, i_fourcc );
1245 if( CreateFourcc( e.p_class ) == 0 )
1246 return i_fourcc;
1247 return CreateFourcc( e.p_class );
1250 vlc_fourcc_t vlc_fourcc_GetCodecFromString( int i_cat, const char *psz_fourcc )
1252 if( !psz_fourcc || strlen(psz_fourcc) != 4 )
1253 return 0;
1254 return vlc_fourcc_GetCodec( i_cat,
1255 VLC_FOURCC( psz_fourcc[0], psz_fourcc[1],
1256 psz_fourcc[2], psz_fourcc[3] ) );
1259 vlc_fourcc_t vlc_fourcc_GetCodecAudio( vlc_fourcc_t i_fourcc, int i_bits )
1261 const int i_bytes = ( i_bits + 7 ) / 8;
1263 if( i_fourcc == VLC_FOURCC( 'a', 'f', 'l', 't' ) )
1265 switch( i_bytes )
1267 case 4:
1268 return VLC_CODEC_FL32;
1269 case 8:
1270 return VLC_CODEC_FL64;
1271 default:
1272 return 0;
1275 else if( i_fourcc == VLC_FOURCC( 'a', 'r', 'a', 'w' ) ||
1276 i_fourcc == VLC_FOURCC( 'p', 'c', 'm', ' ' ) )
1278 switch( i_bytes )
1280 case 1:
1281 return VLC_CODEC_U8;
1282 case 2:
1283 return VLC_CODEC_S16L;
1284 case 3:
1285 return VLC_CODEC_S24L;
1286 break;
1287 case 4:
1288 return VLC_CODEC_S32L;
1289 default:
1290 return 0;
1293 else if( i_fourcc == VLC_FOURCC( 't', 'w', 'o', 's' ) )
1295 switch( i_bytes )
1297 case 1:
1298 return VLC_CODEC_S8;
1299 case 2:
1300 return VLC_CODEC_S16B;
1301 case 3:
1302 return VLC_CODEC_S24B;
1303 case 4:
1304 return VLC_CODEC_S32B;
1305 default:
1306 return 0;
1309 else if( i_fourcc == VLC_FOURCC( 's', 'o', 'w', 't' ) )
1311 switch( i_bytes )
1313 case 1:
1314 return VLC_CODEC_S8;
1315 case 2:
1316 return VLC_CODEC_S16L;
1317 case 3:
1318 return VLC_CODEC_S24L;
1319 case 4:
1320 return VLC_CODEC_S32L;
1321 default:
1322 return 0;
1325 else
1327 return vlc_fourcc_GetCodec( AUDIO_ES, i_fourcc );
1331 /* */
1332 const char *vlc_fourcc_GetDescription( int i_cat, vlc_fourcc_t i_fourcc )
1334 entry_t e = Find( i_cat, i_fourcc );
1336 return e.psz_description;
1340 /* */
1341 #define VLC_CODEC_YUV_PLANAR_410 \
1342 VLC_CODEC_I410, VLC_CODEC_YV9
1344 #define VLC_CODEC_YUV_PLANAR_420 \
1345 VLC_CODEC_I420, VLC_CODEC_YV12, VLC_CODEC_J420
1347 #define VLC_CODEC_YUV_PLANAR_422 \
1348 VLC_CODEC_I422, VLC_CODEC_J422
1350 #define VLC_CODEC_YUV_PLANAR_440 \
1351 VLC_CODEC_I440, VLC_CODEC_J440
1353 #define VLC_CODEC_YUV_PLANAR_444 \
1354 VLC_CODEC_I444, VLC_CODEC_J444
1356 #define VLC_CODEC_YUV_PACKED \
1357 VLC_CODEC_YUYV, VLC_CODEC_YVYU, \
1358 VLC_CODEC_UYVY, VLC_CODEC_VYUY
1360 #define VLC_CODEC_FALLBACK_420 \
1361 VLC_CODEC_YUV_PLANAR_422, VLC_CODEC_YUV_PACKED, \
1362 VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PLANAR_440, \
1363 VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211
1365 static const vlc_fourcc_t p_I420_fallback[] = {
1366 VLC_CODEC_I420, VLC_CODEC_YV12, VLC_CODEC_J420, VLC_CODEC_FALLBACK_420, 0
1368 static const vlc_fourcc_t p_J420_fallback[] = {
1369 VLC_CODEC_J420, VLC_CODEC_I420, VLC_CODEC_YV12, VLC_CODEC_FALLBACK_420, 0
1371 static const vlc_fourcc_t p_YV12_fallback[] = {
1372 VLC_CODEC_YV12, VLC_CODEC_I420, VLC_CODEC_J420, VLC_CODEC_FALLBACK_420, 0
1375 #define VLC_CODEC_FALLBACK_422 \
1376 VLC_CODEC_YUV_PACKED, VLC_CODEC_YUV_PLANAR_420, \
1377 VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PLANAR_440, \
1378 VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211
1380 static const vlc_fourcc_t p_I422_fallback[] = {
1381 VLC_CODEC_I422, VLC_CODEC_J422, VLC_CODEC_FALLBACK_422, 0
1383 static const vlc_fourcc_t p_J422_fallback[] = {
1384 VLC_CODEC_J422, VLC_CODEC_I422, VLC_CODEC_FALLBACK_422, 0
1387 #define VLC_CODEC_FALLBACK_444 \
1388 VLC_CODEC_YUV_PLANAR_422, VLC_CODEC_YUV_PACKED, \
1389 VLC_CODEC_YUV_PLANAR_420, VLC_CODEC_YUV_PLANAR_440, \
1390 VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211
1392 static const vlc_fourcc_t p_I444_fallback[] = {
1393 VLC_CODEC_I444, VLC_CODEC_J444, VLC_CODEC_FALLBACK_444, 0
1395 static const vlc_fourcc_t p_J444_fallback[] = {
1396 VLC_CODEC_J444, VLC_CODEC_I444, VLC_CODEC_FALLBACK_444, 0
1399 static const vlc_fourcc_t p_I440_fallback[] = {
1400 VLC_CODEC_I440,
1401 VLC_CODEC_YUV_PLANAR_420,
1402 VLC_CODEC_YUV_PLANAR_422,
1403 VLC_CODEC_YUV_PLANAR_444,
1404 VLC_CODEC_YUV_PACKED,
1405 VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211, 0
1408 #define VLC_CODEC_FALLBACK_PACKED \
1409 VLC_CODEC_YUV_PLANAR_422, VLC_CODEC_YUV_PLANAR_420, \
1410 VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PLANAR_440, \
1411 VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211
1413 static const vlc_fourcc_t p_YUYV_fallback[] = {
1414 VLC_CODEC_YUYV,
1415 VLC_CODEC_YVYU,
1416 VLC_CODEC_UYVY,
1417 VLC_CODEC_VYUY,
1418 VLC_CODEC_FALLBACK_PACKED, 0
1420 static const vlc_fourcc_t p_YVYU_fallback[] = {
1421 VLC_CODEC_YVYU,
1422 VLC_CODEC_YUYV,
1423 VLC_CODEC_UYVY,
1424 VLC_CODEC_VYUY,
1425 VLC_CODEC_FALLBACK_PACKED, 0
1427 static const vlc_fourcc_t p_UYVY_fallback[] = {
1428 VLC_CODEC_UYVY,
1429 VLC_CODEC_VYUY,
1430 VLC_CODEC_YUYV,
1431 VLC_CODEC_YVYU,
1432 VLC_CODEC_FALLBACK_PACKED, 0
1434 static const vlc_fourcc_t p_VYUY_fallback[] = {
1435 VLC_CODEC_VYUY,
1436 VLC_CODEC_UYVY,
1437 VLC_CODEC_YUYV,
1438 VLC_CODEC_YVYU,
1439 VLC_CODEC_FALLBACK_PACKED, 0
1442 static const vlc_fourcc_t *pp_YUV_fallback[] = {
1443 p_YV12_fallback,
1444 p_I420_fallback,
1445 p_J420_fallback,
1446 p_I422_fallback,
1447 p_J422_fallback,
1448 p_I444_fallback,
1449 p_J444_fallback,
1450 p_I440_fallback,
1451 p_YUYV_fallback,
1452 p_YVYU_fallback,
1453 p_UYVY_fallback,
1454 p_VYUY_fallback,
1455 NULL,
1458 static const vlc_fourcc_t p_list_YUV[] = {
1459 VLC_CODEC_YUV_PLANAR_420,
1460 VLC_CODEC_YUV_PLANAR_422,
1461 VLC_CODEC_YUV_PLANAR_440,
1462 VLC_CODEC_YUV_PLANAR_444,
1463 VLC_CODEC_YUV_PACKED,
1464 VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211,
1468 /* */
1469 static const vlc_fourcc_t p_RGB32_fallback[] = {
1470 VLC_CODEC_RGB32,
1471 VLC_CODEC_RGB24,
1472 VLC_CODEC_RGB16,
1473 VLC_CODEC_RGB15,
1474 VLC_CODEC_RGB8,
1477 static const vlc_fourcc_t p_RGB24_fallback[] = {
1478 VLC_CODEC_RGB24,
1479 VLC_CODEC_RGB32,
1480 VLC_CODEC_RGB16,
1481 VLC_CODEC_RGB15,
1482 VLC_CODEC_RGB8,
1485 static const vlc_fourcc_t p_RGB16_fallback[] = {
1486 VLC_CODEC_RGB16,
1487 VLC_CODEC_RGB24,
1488 VLC_CODEC_RGB32,
1489 VLC_CODEC_RGB15,
1490 VLC_CODEC_RGB8,
1493 static const vlc_fourcc_t p_RGB15_fallback[] = {
1494 VLC_CODEC_RGB15,
1495 VLC_CODEC_RGB16,
1496 VLC_CODEC_RGB24,
1497 VLC_CODEC_RGB32,
1498 VLC_CODEC_RGB8,
1501 static const vlc_fourcc_t p_RGB8_fallback[] = {
1502 VLC_CODEC_RGB8,
1503 VLC_CODEC_RGB15,
1504 VLC_CODEC_RGB16,
1505 VLC_CODEC_RGB24,
1506 VLC_CODEC_RGB32,
1509 static const vlc_fourcc_t *pp_RGB_fallback[] = {
1510 p_RGB32_fallback,
1511 p_RGB24_fallback,
1512 p_RGB16_fallback,
1513 p_RGB15_fallback,
1514 p_RGB8_fallback,
1515 NULL,
1519 /* */
1520 static const vlc_fourcc_t *GetFallback( vlc_fourcc_t i_fourcc,
1521 const vlc_fourcc_t *pp_fallback[],
1522 const vlc_fourcc_t p_list[] )
1524 for( unsigned i = 0; pp_fallback[i]; i++ )
1526 if( pp_fallback[i][0] == i_fourcc )
1527 return pp_fallback[i];
1529 return p_list;
1532 const vlc_fourcc_t *vlc_fourcc_GetYUVFallback( vlc_fourcc_t i_fourcc )
1534 return GetFallback( i_fourcc, pp_YUV_fallback, p_list_YUV );
1536 const vlc_fourcc_t *vlc_fourcc_GetRGBFallback( vlc_fourcc_t i_fourcc )
1538 return GetFallback( i_fourcc, pp_RGB_fallback, p_RGB32_fallback );
1541 bool vlc_fourcc_AreUVPlanesSwapped( vlc_fourcc_t a, vlc_fourcc_t b )
1543 static const vlc_fourcc_t pp_swapped[][4] = {
1544 { VLC_CODEC_YV12, VLC_CODEC_I420, VLC_CODEC_J420, 0 },
1545 { VLC_CODEC_YV9, VLC_CODEC_I410, 0 },
1546 { 0 }
1549 for( int i = 0; pp_swapped[i][0]; i++ )
1551 if( pp_swapped[i][0] == b )
1553 vlc_fourcc_t t = a;
1554 a = b;
1555 b = t;
1557 if( pp_swapped[i][0] != a )
1558 continue;
1559 for( int j = 1; pp_swapped[i][j]; j++ )
1561 if( pp_swapped[i][j] == b )
1562 return true;
1565 return false;
1568 bool vlc_fourcc_IsYUV(vlc_fourcc_t fcc)
1570 for( unsigned i = 0; p_list_YUV[i]; i++ )
1572 if( p_list_YUV[i] == fcc )
1573 return true;
1575 return false;
1578 #define PLANAR(n, w_den, h_den) \
1579 { .plane_count = n, \
1580 .p = { {.w = {1, 1}, .h = {1, 1}}, \
1581 {.w = {1,w_den}, .h = {1,h_den}}, \
1582 {.w = {1,w_den}, .h = {1,h_den}}, \
1583 {.w = {1, 1}, .h = {1, 1}} }, \
1584 .pixel_size = 1 }
1586 #define PACKED(size) \
1587 { .plane_count = 1, \
1588 .p = { {.w = {1,1}, .h = {1,1}} }, \
1589 .pixel_size = size }
1591 static const struct
1593 vlc_fourcc_t p_fourcc[5];
1594 vlc_chroma_description_t description;
1595 } p_list_chroma_description[] = {
1596 { { VLC_CODEC_I411, 0 }, PLANAR(3, 4, 1) },
1597 { { VLC_CODEC_YUV_PLANAR_410, 0 }, PLANAR(3, 4, 4) },
1598 { { VLC_CODEC_YUV_PLANAR_420, 0 }, PLANAR(3, 2, 2) },
1599 { { VLC_CODEC_YUV_PLANAR_422, 0 }, PLANAR(3, 2, 1) },
1600 { { VLC_CODEC_YUV_PLANAR_440, 0 }, PLANAR(3, 1, 2) },
1601 { { VLC_CODEC_YUV_PLANAR_444, 0 }, PLANAR(3, 1, 1) },
1602 { { VLC_CODEC_YUVA, 0 }, PLANAR(4, 1, 1) },
1604 { { VLC_CODEC_YUV_PACKED, 0 }, PACKED(2) },
1605 { { VLC_CODEC_RGB8, VLC_CODEC_GREY,
1606 VLC_CODEC_YUVP, VLC_CODEC_RGBP, 0 }, PACKED(1) },
1607 { { VLC_CODEC_RGB16, VLC_CODEC_RGB15, 0 }, PACKED(2) },
1608 { { VLC_CODEC_RGB24, 0 }, PACKED(3) },
1609 { { VLC_CODEC_RGB32, VLC_CODEC_RGBA, 0 }, PACKED(4) },
1611 { { VLC_CODEC_Y211, 0 }, { 1, { {{1,4}, {1,1}} }, 4 } },
1613 { {0}, { 0, {}, 0 } }
1616 #undef PACKED
1617 #undef PLANAR
1619 const vlc_chroma_description_t *vlc_fourcc_GetChromaDescription( vlc_fourcc_t i_fourcc )
1621 for( unsigned i = 0; p_list_chroma_description[i].p_fourcc[0]; i++ )
1623 const vlc_fourcc_t *p_fourcc = p_list_chroma_description[i].p_fourcc;
1624 for( unsigned j = 0; p_fourcc[j]; j++ )
1626 if( p_fourcc[j] == i_fourcc )
1627 return &p_list_chroma_description[i].description;
1630 return NULL;