1 /*****************************************************************************
2 * fourcc.c: fourcc helpers functions
3 *****************************************************************************
4 * Copyright (C) 2009 Laurent Aimar
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 /*****************************************************************************
26 *****************************************************************************/
31 #include <vlc_fourcc.h>
38 const char *psz_description;
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 }
47 # define FCC2STR(f) { ((f)>>0)&0xff, ((f)>>8)&0xff, ((f)>>16)&0xff, ((f)>>24)&0xff }
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)
58 static const entry_t p_list_video[] = {
60 B(VLC_CODEC_MPGV, "MPEG-1/2 Video"),
69 E("PIM1", "Pinnacle DC1000 (MPEG-1 Video)"),
71 E("hdv1", "HDV 720p30 (MPEG-2 Video)"),
72 E("hdv2", "Sony HDV (MPEG-2 Video)"),
73 E("hdv3", "FCP HDV (MPEG-2 Video)"),
74 E("hdv5", "HDV 720p25 (MPEG-2 Video)"),
75 E("hdv6", "HDV 1080p24 (MPEG-2 Video)"),
76 E("hdv7", "HDV 1080p25 (MPEG-2 Video)"),
77 E("hdv8", "HDV 1080p30 (MPEG-2 Video)"),
79 E("mx5n", "MPEG2 IMX NTSC 525/60 50mb/s (FCP)"),
80 E("mx5p", "MPEG2 IMX PAL 625/60 50mb/s (FCP)"),
81 E("mx4n", "MPEG2 IMX NTSC 525/60 40mb/s (FCP)"),
82 E("mx4p", "MPEG2 IMX PAL 625/50 40mb/s (FCP)"),
83 E("mx3n", "MPEG2 IMX NTSC 525/60 30mb/s (FCP)"),
84 E("mx3p", "MPEG2 IMX NTSC 625/50 30mb/s (FCP)"),
86 E("xdv1", "XDCAM HD"),
87 E("xdv2", "XDCAM HD 1080i60 35mb/s"),
88 E("xdv3", "XDCAM HD 1080i50 35mb/s"),
89 E("xdv4", "XDCAM HD"),
90 E("xdv5", "XDCAM HD"),
91 E("xdv6", "XDCAM HD 1080p24 35mb/s"),
92 E("xdv7", "XDCAM HD 1080p25 35mb/s"),
93 E("xdv8", "XDCAM HD 1080p30 35mb/s"),
94 E("xdv9", "XDCAM HD"),
111 E("AVmp", "AVID IMX PAL"),
112 E("MMES", "Matrox MPEG-2"),
113 E("mmes", "Matrox MPEG-2"),
114 E("PIM2", "Pinnacle MPEG-2"),
115 E("LMP2", "Lead MPEG-2"),
117 E("VCR2", "ATI VCR-2"),
119 B(VLC_CODEC_MP4V, "MPEG-4 Video"),
128 A("\x04\x00\x00\x00"),
145 E("xvid", "Xvid MPEG-4 Video"),
146 E("XVID", "Xvid MPEG-4 Video"),
147 E("XviD", "Xvid MPEG-4 Video"),
148 E("XVIX", "Xvid MPEG-4 Video"),
149 E("xvix", "Xvid MPEG-4 Video"),
151 E("DX50", "DivX MPEG-4 Video"),
152 E("dx50", "DivX MPEG-4 Video"),
153 E("BLZ0", "Blizzard MPEG-4 Video"),
154 E("DXGM", "Electronic Arts Game MPEG-4 Video"),
156 E("3IV2", "3ivx MPEG-4 Video"),
157 E("3iv2", "3ivx MPEG-4 Video"),
159 E("UMP4", "UB MPEG-4 Video"),
160 E("SEDG", "Samsung MPEG-4 Video"),
161 E("RMP4", "REALmagic MPEG-4 Video"),
162 E("HDX4", "Jomigo HDX4 (MPEG-4 Video)"),
163 E("hdx4", "Jomigo HDX4 (MPEG-4 Video)"),
164 E("SMP4", "Samsung SMP4 (MPEG-4 Video)"),
165 E("smp4", "Samsung SMP4 (MPEG-4 Video)"),
166 E("fvfw", "FFmpeg MPEG-4"),
167 E("FVFW", "FFmpeg MPEG-4"),
168 E("FFDS", "FFDShow MPEG-4"),
169 E("VIDM", "vidm 4.01 codec"),
170 /* 3ivx delta 3.5 Unsupported
171 * putting it here gives extreme distorted images */
172 //E("3IV1", "3ivx delta 3.5 MPEG-4 Video"),
173 //E("3iv1", "3ivx delta 3.5 MPEG-4 Video"),
176 B(VLC_CODEC_DIV1, "MS MPEG-4 Video v1"),
184 B(VLC_CODEC_DIV2, "MS MPEG-4 Video v2"),
190 /* MSMPEG4 v3 / M$ mpeg4 v3 */
191 B(VLC_CODEC_DIV3, "MS MPEG-4 Video v3"),
205 E("divf", "DivX 4.12"),
206 E("DIVF", "DivX 4.12"),
212 /* AngelPotion stuff */
214 /* 3ivx doctered divx files */
223 B(VLC_CODEC_SVQ1, "SVQ-1 (Sorenson Video v1)"),
229 B(VLC_CODEC_SVQ3, "SVQ-3 (Sorenson Video v3)"),
233 B(VLC_CODEC_H264, "H264 - MPEG-4 AVC (part 10)"),
238 /* avc1: special case h264 */
241 E("VSSH", "Vanguard VSS H264"),
242 E("VSSW", "Vanguard VSS H264"),
243 E("vssh", "Vanguard VSS H264"),
244 E("DAVC", "Dicas MPEGable H.264/MPEG-4 AVC"),
245 E("davc", "Dicas MPEGable H.264/MPEG-4 AVC"),
248 /* H263(+) is also known as Real Video 1.0 */
251 B(VLC_CODEC_H263, "H263"),
259 E("D263", "DEC H263"),
260 E("L263", "LEAD H263"),
261 E("M263", "Microsoft H263"),
262 E("X263", "Xirlink H263"),
264 E("ZyGo", "ITU H263+"),
267 B(VLC_CODEC_H263I, "I263.I"),
272 B(VLC_CODEC_H263P, "ITU H263+"),
273 E("ILVR", "ITU H263+"),
277 E("U263", "UB H263+"),
279 /* Flash (H263) variant */
280 B(VLC_CODEC_FLV1, "Flash Video"),
285 B(VLC_CODEC_H261, "H.261"),
289 B(VLC_CODEC_FLIC, "Flic Video"),
293 B(VLC_CODEC_MJPG, "Motion JPEG Video"),
305 E("AVRn", "Avid Motion JPEG"),
306 E("AVDJ", "Avid Motion JPEG"),
307 E("ADJV", "Avid Motion JPEG"),
308 E("dmb1", "Motion JPEG OpenDML Video"),
309 E("ijpg", "Intergraph JPEG Video"),
310 E("IJPG", "Intergraph JPEG Video"),
311 E("ACDV", "ACD Systems Digital"),
312 E("SLMJ", "SL M-JPEG"),
314 B(VLC_CODEC_MJPGB, "Motion JPEG B Video"),
317 B(VLC_CODEC_LJPG, "Lead Motion JPEG Video"),
320 // ? from avcodec/fourcc.c but makes not sense.
321 //{ VLC_FOURCC( 'L','J','P','G' ), CODEC_ID_MJPEG, VIDEO_ES, "Lead Motion JPEG Video" },
324 B(VLC_CODEC_SP5X, "Sunplus Motion JPEG Video"),
334 B(VLC_CODEC_DV, "DV Video"),
353 E("dvcp", "DV Video PAL"),
354 E("dvp ", "DV Video Pro"),
355 E("dvpp", "DV Video Pro PAL"),
356 E("dv50", "DV Video C Pro 50"),
357 E("dv5p", "DV Video C Pro 50 PAL"),
358 E("dv5n", "DV Video C Pro 50 NTSC"),
359 E("AVdv", "AVID DV"),
360 E("AVd1", "AVID DV"),
361 E("CDVC", "Canopus DV Video"),
362 E("cdvc", "Canopus DV Video"),
363 E("CDVH", "Canopus DV Video"),
364 E("cdvh", "Canopus DV Video"),
366 /* Windows Media Video */
367 B(VLC_CODEC_WMV1, "Windows Media Video 7"),
371 B(VLC_CODEC_WMV2, "Windows Media Video 8"),
375 B(VLC_CODEC_WMV3, "Windows Media Video 9"),
379 B(VLC_CODEC_WMVA, "Windows Media Video Advanced"),
385 B(VLC_CODEC_VC1, "Windows Media Video VC1"),
390 /* WMVA is the VC-1 codec before the standardization proces,
391 * it is not bitstream compatible and deprecated */
392 E("WMVA", "Windows Media Video Advanced Profile"),
394 /* Microsoft Video 1 */
395 B(VLC_CODEC_MSVIDEO1, "Microsoft Video 1"),
404 B(VLC_CODEC_MSRLE, "Microsoft RLE Video"),
407 A("\x01\x00\x00\x00"),
408 A("\x02\x00\x00\x00"),
410 /* Indeo Video Codecs (Quality of this decoder on ppc is not good) */
411 B(VLC_CODEC_INDEO3, "Indeo Video v3"),
418 B(VLC_CODEC_HUFFYUV, "Huff YUV Video"),
421 B(VLC_CODEC_FFVHUFF, "Huff YUV Video"),
424 /* On2 VP3 Video Codecs */
425 B(VLC_CODEC_VP3, "On2's VP3 Video"),
432 /* On2 VP5, VP6 codecs */
433 B(VLC_CODEC_VP5, "On2's VP5 Video"),
437 B(VLC_CODEC_VP6, "On2's VP6.2 Video"),
440 E("VP60", "On2's VP6.0 Video"),
441 E("VP61", "On2's VP6.1 Video"),
443 B(VLC_CODEC_VP6F, "On2's VP6.2 Video (Flash)"),
446 B(VLC_CODEC_VP6A, "On2's VP6 A Video"),
449 /* Xiph.org theora */
450 B(VLC_CODEC_THEORA, "Xiph.org's Theora Video"),
454 /* Xiph.org tarkin */
455 B(VLC_CODEC_TARKIN, "Xiph.org's Tarkin Video"),
458 /* Asus Video (Another thing that doesn't work on PPC) */
459 B(VLC_CODEC_ASV1, "Asus V1 Video"),
461 B(VLC_CODEC_ASV2, "Asus V2 Video"),
464 /* FFMPEG Video 1 (lossless codec) */
465 B(VLC_CODEC_FFV1, "FFMpeg Video 1"),
469 B(VLC_CODEC_VCR1, "ATI VCR1 Video"),
472 /* Cirrus Logic AccuPak */
473 B(VLC_CODEC_CLJR, "Creative Logic AccuPak"),
477 B(VLC_CODEC_RV10, "Real Video 1.0"),
481 B(VLC_CODEC_RV13, "Real Video 1.3"),
485 B(VLC_CODEC_RV20, "Real Video 2.0"),
489 B(VLC_CODEC_RV30, "Real Video 3.0"),
493 B(VLC_CODEC_RV40, "Real Video 4.0"),
498 B(VLC_CODEC_RPZA, "Apple Video"),
504 B(VLC_CODEC_SMC, "Apple graphics"),
507 B(VLC_CODEC_CINEPAK, "Cinepak Video"),
511 /* Screen Capture Video Codecs */
512 B(VLC_CODEC_TSCC, "TechSmith Camtasia Screen Capture"),
516 B(VLC_CODEC_CSCD, "CamStudio Screen Codec"),
520 B(VLC_CODEC_ZMBV, "DosBox Capture Codec"),
523 B(VLC_CODEC_VMNC, "VMware Video"),
525 B(VLC_CODEC_FRAPS, "FRAPS: Realtime Video Capture"),
529 /* Duck TrueMotion */
530 B(VLC_CODEC_TRUEMOTION1, "Duck TrueMotion v1 Video"),
533 B(VLC_CODEC_TRUEMOTION2, "Duck TrueMotion v2.0 Video"),
536 /* FFMPEG's SNOW wavelet codec */
537 B(VLC_CODEC_SNOW, "FFMpeg SNOW wavelet Video"),
541 B(VLC_CODEC_QTRLE, "Apple QuickTime RLE Video"),
544 B(VLC_CODEC_QDRAW, "Apple QuickDraw Video"),
547 B(VLC_CODEC_QPEG, "QPEG Video"),
552 B(VLC_CODEC_ULTI, "IBM Ultimotion Video"),
555 B(VLC_CODEC_VIXL, "Miro/Pinnacle VideoXL Video"),
558 E("PIXL", "Pinnacle VideoXL Video"),
560 B(VLC_CODEC_LOCO, "LOCO Video"),
563 B(VLC_CODEC_WNV1, "Winnov WNV1 Video"),
566 B(VLC_CODEC_AASC, "Autodesc RLE Video"),
569 B(VLC_CODEC_INDEO2, "Indeo Video v2"),
573 /* Flash Screen Video */
574 B(VLC_CODEC_FLASHSV, "Flash Screen Video"),
576 B(VLC_CODEC_KMVC, "Karl Morton's Video Codec (Worms)"),
579 B(VLC_CODEC_NUV, "Nuppel Video"),
583 /* CODEC_ID_SMACKVIDEO */
584 B(VLC_CODEC_SMACKVIDEO, "Smacker Video"),
588 /* Chinese AVS - Untested */
589 B(VLC_CODEC_CAVS, "Chinese AVS"),
595 B(VLC_CODEC_DNXHD, "DNxHD"),
597 B(VLC_CODEC_8BPS, "8BPS"),
599 B(VLC_CODEC_MIMIC, "Mimic"),
602 B(VLC_CODEC_CDG, "CD-G Video"),
606 B(VLC_CODEC_YV12, "Planar 4:2:0 YVU"),
609 B(VLC_CODEC_I420, "Planar 4:1:0 YUV"),
612 B(VLC_CODEC_I420, "Planar 4:1:1 YUV"),
614 B(VLC_CODEC_I420, "Planar 4:2:0 YUV"),
617 B(VLC_CODEC_I422, "Planar 4:2:2 YUV"),
619 B(VLC_CODEC_I444, "Planar 4:4:0 YUV"),
621 B(VLC_CODEC_I444, "Planar 4:4:4 YUV"),
624 B(VLC_CODEC_I420, "Planar 4:1:0 YUV full scale"),
626 B(VLC_CODEC_I420, "Planar 4:1:1 YUV full scale"),
628 B(VLC_CODEC_I420, "Planar 4:2:0 YUV full scale"),
630 B(VLC_CODEC_I422, "Planar 4:2:2 YUV full scale"),
632 B(VLC_CODEC_I444, "Planar 4:4:0 YUV full scale"),
634 B(VLC_CODEC_I444, "Planar 4:4:4 YUV full scale"),
637 B(VLC_CODEC_YUVP, "Palettized YUV with palette element Y:U:V:A"),
640 B(VLC_CODEC_YUVA, "Planar YUV 4:4:4 Y:U:V:A"),
643 B(VLC_CODEC_RGBP, "Palettized RGB with palette element R:G:B"),
646 B(VLC_CODEC_RGB8, "8 bits RGB"),
648 B(VLC_CODEC_RGB15, "15 bits RGB"),
650 B(VLC_CODEC_RGB16, "16 bits RGB"),
652 B(VLC_CODEC_RGB24, "24 bits RGB"),
654 B(VLC_CODEC_RGB32, "32 bits RGB"),
656 B(VLC_CODEC_RGBA, "32 bits RGBA"),
659 B(VLC_CODEC_GREY, "8 bits greyscale"),
664 B(VLC_CODEC_UYVY, "Packed YUV 4:2:2, U:Y:V:Y"),
671 B(VLC_CODEC_VYUY, "Packed YUV 4:2:2, V:Y:U:Y"),
673 B(VLC_CODEC_YUYV, "Packed YUV 4:2:2, Y:U:Y:V"),
677 B(VLC_CODEC_YVYU, "Packed YUV 4:2:2, Y:V:Y:U"),
680 B(VLC_CODEC_Y211, "Packed YUV 2:1:1, Y:U:Y:V "),
682 B(VLC_CODEC_YMGA, "Planar Y, packed UV, from Matrox"),
684 B(VLC_CODEC_CYUV, "Creative Packed YUV 4:2:2, U:Y:V:Y, reverted"),
688 B(VLC_CODEC_V210, "10-bit 4:2:2 Component YCbCr"),
691 /* Videogames Codecs */
694 B(VLC_CODEC_INTERPLAY, "Interplay MVE Video"),
698 /* Id Quake II CIN */
699 B(VLC_CODEC_IDCIN, "Id Quake II CIN Video"),
702 /* 4X Technologies */
703 B(VLC_CODEC_4XM, "4X Technologies Video"),
708 B(VLC_CODEC_ROQ, "Id RoQ Video"),
711 /* Sony Playstation MDEC */
712 B(VLC_CODEC_MDEC, "PSX MDEC Video"),
716 B(VLC_CODEC_VMDVIDEO, "Sierra VMD Video"),
720 B(VLC_CODEC_DIRAC, "Dirac" ),
724 B(VLC_CODEC_PNG, "PNG Image"),
727 B(VLC_CODEC_PPM, "PPM Image"),
730 B(VLC_CODEC_PGM, "PGM Image"),
733 B(VLC_CODEC_PGMYUV, "PGM YUV Image"),
736 B(VLC_CODEC_PAM, "PAM Image"),
739 B(VLC_CODEC_JPEGLS, "Lossless JPEG"),
742 B(VLC_CODEC_JPEG, "JPEG"),
746 B(VLC_CODEC_BMP, "BMP Image"),
749 B(VLC_CODEC_TIFF, "TIFF Image"),
752 B(VLC_CODEC_GIF, "GIF Image"),
756 B(VLC_CODEC_TARGA, "Truevision Targa Image"),
761 B(VLC_CODEC_SGI, "SGI Image"),
764 B(VLC_CODEC_PNM, "Portable Anymap Image"),
767 B(VLC_CODEC_PCX, "Personal Computer Exchange Image"),
772 static const entry_t p_list_audio[] = {
774 /* Windows Media Audio 1 */
775 B(VLC_CODEC_WMA1, "Windows Media Audio 1"),
779 /* Windows Media Audio 2 */
780 B(VLC_CODEC_WMA2, "Windows Media Audio 2"),
785 /* Windows Media Audio Professional */
786 B(VLC_CODEC_WMAP, "Windows Media Audio Professional"),
790 /* Windows Media Audio Lossless */
791 B(VLC_CODEC_WMAL, "Windows Media Audio Lossless"),
795 /* Windows Media Audio Speech */
796 B(VLC_CODEC_WMAS, "Windows Media Audio Speech"),
801 B(VLC_CODEC_DVAUDIO, "DV Audio"),
808 B(VLC_CODEC_MACE3, "MACE-3 Audio"),
812 B(VLC_CODEC_MACE6, "MACE-6 Audio"),
815 /* MUSEPACK7 Audio */
816 B(VLC_CODEC_MUSEPACK7, "MUSEPACK7 Audio"),
819 /* MUSEPACK8 Audio */
820 B(VLC_CODEC_MUSEPACK8, "MUSEPACK8 Audio"),
825 B(VLC_CODEC_RA_144, "RealAudio 1.0"),
830 B(VLC_CODEC_RA_288, "RealAudio 2.0"),
833 /* MPEG Audio layer 1/2/3 */
834 B(VLC_CODEC_MPGA, "MPEG Audio layer 1/2/3"),
843 /* A52 Audio (aka AC3) */
844 B(VLC_CODEC_A52, "A52 Audio (aka AC3)"),
850 B(VLC_CODEC_EAC3, "A/52 B Audio (aka E-AC3)"),
854 B(VLC_CODEC_DTS, "DTS Audio"),
860 B(VLC_CODEC_MP4A, "MPEG AAC Audio"),
864 /* 4X Technologies */
865 B(VLC_CODEC_ADPCM_4XM, "4X Technologies Audio"),
869 B(VLC_CODEC_ADPCM_EA, "EA ADPCM Audio"),
873 B(VLC_CODEC_INTERPLAY_DPCM, "Interplay DPCM Audio"),
877 B(VLC_CODEC_ROQ_DPCM, "Id RoQ DPCM Audio"),
881 B(VLC_CODEC_DSICINAUDIO, "Delphine CIN Audio"),
884 /* Sony Playstation XA ADPCM */
885 B(VLC_CODEC_ADPCM_XA, "PSX XA ADPCM Audio"),
889 B(VLC_CODEC_ADPCM_ADX, "ADX ADPCM Audio"),
893 B(VLC_CODEC_ADPCM_IMA_WS, "Westwood IMA ADPCM audio"),
897 B(VLC_CODEC_VMDAUDIO, "Sierra VMD Audio"),
901 B(VLC_CODEC_ADPCM_G726, "G.726 ADPCM Audio"),
905 B(VLC_CODEC_ADPCM_SWF, "Flash ADPCM Audio"),
910 B(VLC_CODEC_AMR_NB, "AMR narrow band"),
913 B(VLC_CODEC_AMR_WB, "AMR wide band"),
917 B(VLC_CODEC_FLAC, "FLAC (Free Lossless Audio Codec)"),
921 B(VLC_CODEC_ALAC, "Apple Lossless Audio Codec"),
925 B(VLC_CODEC_QDM2, "QDM2 Audio"),
929 B(VLC_CODEC_COOK, "Cook Audio"),
932 /* TTA: The Lossless True Audio */
933 B(VLC_CODEC_TTA, "The Lossless True Audio"),
937 B(VLC_CODEC_SHORTEN, "Shorten Lossless Audio"),
941 B(VLC_CODEC_WAVPACK, "WavPack"),
945 B(VLC_CODEC_GSM, "GSM Audio"),
948 B(VLC_CODEC_GSM_MS, "Microsoft GSM Audio"),
951 B(VLC_CODEC_ATRAC3, "atrac 3"),
953 A("\x70\x02\x00\x00"),
955 B(VLC_CODEC_SONIC, "Sonic"),
958 B(VLC_CODEC_IMC, "IMC" ),
959 A("\x01\x04\x00\x00"),
961 B(VLC_CODEC_TRUESPEECH,"TrueSpeech"),
962 A("\x22\x00\x00\x00"),
964 B(VLC_CODEC_NELLYMOSER, "NellyMoser ASAO"),
967 B(VLC_CODEC_APE, "Monkey's Audio"),
970 B(VLC_CODEC_MLP, "MLP/TrueHD Audio"),
973 B(VLC_CODEC_TRUEHD, "TrueHD Audio"),
976 B(VLC_CODEC_QCELP, "QCELP Audio"),
979 B(VLC_CODEC_SPEEX, "Speex Audio"),
983 B(VLC_CODEC_VORBIS, "Vorbis Audio"),
986 B(VLC_CODEC_302M, "302M Audio"),
989 B(VLC_CODEC_DVD_LPCM, "DVD LPCM Audio"),
992 B(VLC_CODEC_BD_LPCM, "BD LPCM Audio"),
995 B(VLC_CODEC_SDDS, "SDDS Audio"),
999 B(VLC_CODEC_MIDI, "MIDI Audio"),
1003 B(VLC_CODEC_S8, "PCM S8"),
1006 B(VLC_CODEC_U8, "PCM U8"),
1009 B(VLC_CODEC_S16L, "PCM S16 LE"),
1012 B(VLC_CODEC_S16B, "PCM S16 BE"),
1015 B(VLC_CODEC_U16L, "PCM U16 LE"),
1018 B(VLC_CODEC_U16B, "PCM U16 BE"),
1021 B(VLC_CODEC_S24L, "PCM S24 LE"),
1023 A("42ni"), /* Quicktime */
1025 B(VLC_CODEC_S24B, "PCM S24 BE"),
1027 A("in24"), /* Quicktime */
1029 B(VLC_CODEC_U24L, "PCM U24 LE"),
1032 B(VLC_CODEC_U24B, "PCM U24 BE"),
1035 B(VLC_CODEC_S32L, "PCM S32 LE"),
1037 A("23ni"), /* Quicktime */
1039 B(VLC_CODEC_S32B, "PCM S32 BE"),
1041 A("in32"), /* Quicktime */
1043 B(VLC_CODEC_U32L, "PCM U32 LE"),
1046 B(VLC_CODEC_U32B, "PCM U32 BE"),
1049 B(VLC_CODEC_ALAW, "PCM ALAW"),
1052 B(VLC_CODEC_MULAW, "PCM MU-LAW"),
1056 B(VLC_CODEC_S24DAUD, "PCM DAUD"),
1059 B(VLC_CODEC_FI32, "32 bits fixed float"),
1062 B(VLC_CODEC_FL32, "32 bits float"),
1065 B(VLC_CODEC_FL32, "64 bits float"),
1070 static const entry_t p_list_spu[] = {
1072 B(VLC_CODEC_SPU, "DVD Subtitles"),
1076 B(VLC_CODEC_DVBS, "DVB Subtitles"),
1079 B(VLC_CODEC_SUBT, "Text subtitles with various tags"),
1082 B(VLC_CODEC_XSUB, "DivX XSUB subtitles"),
1086 B(VLC_CODEC_SSA, "SubStation Alpha subtitles"),
1089 B(VLC_CODEC_TEXT, "Plain text subtitles"),
1092 B(VLC_CODEC_TELETEXT, "Teletext"),
1095 B(VLC_CODEC_KATE, "Kate subtitles"),
1098 B(VLC_CODEC_CMML, "CMML annotations/metadata"),
1101 B(VLC_CODEC_ITU_T140, "ITU T.140 subtitles"),
1104 B(VLC_CODEC_ITU_T140, "ITU T.140 subtitles"),
1107 B(VLC_CODEC_USF, "USF subtitles"),
1110 B(VLC_CODEC_OGT, "OGT subtitles"),
1113 B(VLC_CODEC_CVD, "CVD subtitles"),
1119 /* Create a fourcc from a string.
1120 * XXX it assumes that the string is at least four bytes */
1121 static inline vlc_fourcc_t CreateFourcc( const char *psz_fourcc )
1123 return VLC_FOURCC( psz_fourcc[0], psz_fourcc[1],
1124 psz_fourcc[2], psz_fourcc[3] );
1128 static entry_t Lookup( const entry_t p_list[], vlc_fourcc_t i_fourcc )
1130 const char *p_class = NULL;
1131 const char *psz_description = NULL;
1133 entry_t e = B(0, "");
1135 for( int i = 0; ; i++ )
1137 const entry_t *p = &p_list[i];
1138 const vlc_fourcc_t i_entry_fourcc = CreateFourcc( p->p_fourcc );
1139 const vlc_fourcc_t i_entry_class = CreateFourcc( p->p_class );
1141 if( i_entry_fourcc == 0 )
1144 if( i_entry_class != 0 )
1146 p_class = p->p_class;
1147 psz_description = p->psz_description;
1150 if( i_entry_fourcc == i_fourcc )
1152 assert( p_class != NULL );
1154 memcpy( e.p_class, p_class, 4 );
1155 memcpy( e.p_fourcc, p->p_fourcc, 4 );
1156 e.psz_description = p->psz_description ?: psz_description;
1164 static entry_t Find( int i_cat, vlc_fourcc_t i_fourcc )
1171 return Lookup( p_list_video, i_fourcc );
1173 return Lookup( p_list_audio, i_fourcc );
1175 return Lookup( p_list_spu, i_fourcc );
1178 e = Find( VIDEO_ES, i_fourcc );
1179 if( CreateFourcc( e.p_class ) == 0 )
1180 e = Find( AUDIO_ES, i_fourcc );
1181 if( CreateFourcc( e.p_class ) == 0 )
1182 e = Find( SPU_ES, i_fourcc );
1188 vlc_fourcc_t vlc_fourcc_GetCodec( int i_cat, vlc_fourcc_t i_fourcc )
1190 entry_t e = Find( i_cat, i_fourcc );
1192 if( CreateFourcc( e.p_class ) == 0 )
1194 return CreateFourcc( e.p_class );
1197 vlc_fourcc_t vlc_fourcc_GetCodecFromString( int i_cat, const char *psz_fourcc )
1199 if( !psz_fourcc || strlen(psz_fourcc) != 4 )
1201 return vlc_fourcc_GetCodec( i_cat,
1202 VLC_FOURCC( psz_fourcc[0], psz_fourcc[1],
1203 psz_fourcc[2], psz_fourcc[3] ) );
1206 vlc_fourcc_t vlc_fourcc_GetCodecAudio( vlc_fourcc_t i_fourcc, int i_bits )
1208 const int i_bytes = ( i_bits + 7 ) / 8;
1210 if( i_fourcc == VLC_FOURCC( 'a', 'f', 'l', 't' ) )
1215 return VLC_CODEC_FL32;
1217 return VLC_CODEC_FL64;
1222 else if( i_fourcc == VLC_FOURCC( 'a', 'r', 'a', 'w' ) ||
1223 i_fourcc == VLC_FOURCC( 'p', 'c', 'm', ' ' ) )
1228 return VLC_CODEC_U8;
1230 return VLC_CODEC_S16L;
1232 return VLC_CODEC_S24L;
1235 return VLC_CODEC_S32L;
1240 else if( i_fourcc == VLC_FOURCC( 't', 'w', 'o', 's' ) )
1245 return VLC_CODEC_S8;
1247 return VLC_CODEC_S16B;
1249 return VLC_CODEC_S24B;
1251 return VLC_CODEC_S32B;
1256 else if( i_fourcc == VLC_FOURCC( 's', 'o', 'w', 't' ) )
1261 return VLC_CODEC_S8;
1263 return VLC_CODEC_S16L;
1265 return VLC_CODEC_S24L;
1267 return VLC_CODEC_S32L;
1274 return vlc_fourcc_GetCodec( AUDIO_ES, i_fourcc );
1279 const char *vlc_fourcc_GetDescription( int i_cat, vlc_fourcc_t i_fourcc )
1281 entry_t e = Find( i_cat, i_fourcc );
1283 return e.psz_description;
1288 #define VLC_CODEC_YUV_PLANAR_420 \
1289 VLC_CODEC_I420, VLC_CODEC_YV12, VLC_CODEC_J420
1291 #define VLC_CODEC_YUV_PLANAR_422 \
1292 VLC_CODEC_I422, VLC_CODEC_J422
1294 #define VLC_CODEC_YUV_PLANAR_440 \
1295 VLC_CODEC_I440, VLC_CODEC_J440
1297 #define VLC_CODEC_YUV_PLANAR_444 \
1298 VLC_CODEC_I444, VLC_CODEC_J444
1300 #define VLC_CODEC_YUV_PACKED \
1301 VLC_CODEC_YUYV, VLC_CODEC_YVYU, \
1302 VLC_CODEC_UYVY, VLC_CODEC_VYUY
1304 #define VLC_CODEC_FALLBACK_420 \
1305 VLC_CODEC_YUV_PLANAR_422, VLC_CODEC_YUV_PACKED, \
1306 VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PLANAR_440, \
1307 VLC_CODEC_I411, VLC_CODEC_I410, VLC_CODEC_Y211
1309 static const vlc_fourcc_t p_I420_fallback[] = {
1310 VLC_CODEC_I420, VLC_CODEC_YV12, VLC_CODEC_J420, VLC_CODEC_FALLBACK_420, 0
1312 static const vlc_fourcc_t p_J420_fallback[] = {
1313 VLC_CODEC_J420, VLC_CODEC_I420, VLC_CODEC_YV12, VLC_CODEC_FALLBACK_420, 0
1315 static const vlc_fourcc_t p_YV12_fallback[] = {
1316 VLC_CODEC_YV12, VLC_CODEC_I420, VLC_CODEC_J420, VLC_CODEC_FALLBACK_420, 0
1319 #define VLC_CODEC_FALLBACK_422 \
1320 VLC_CODEC_YUV_PACKED, VLC_CODEC_YUV_PLANAR_420, \
1321 VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PLANAR_440, \
1322 VLC_CODEC_I411, VLC_CODEC_I410, VLC_CODEC_Y211
1324 static const vlc_fourcc_t p_I422_fallback[] = {
1325 VLC_CODEC_I422, VLC_CODEC_J422, VLC_CODEC_FALLBACK_422, 0
1327 static const vlc_fourcc_t p_J422_fallback[] = {
1328 VLC_CODEC_J422, VLC_CODEC_I422, VLC_CODEC_FALLBACK_422, 0
1331 #define VLC_CODEC_FALLBACK_444 \
1332 VLC_CODEC_YUV_PLANAR_422, VLC_CODEC_YUV_PACKED, \
1333 VLC_CODEC_YUV_PLANAR_420, VLC_CODEC_YUV_PLANAR_440, \
1334 VLC_CODEC_I411, VLC_CODEC_I410, VLC_CODEC_Y211
1336 static const vlc_fourcc_t p_I444_fallback[] = {
1337 VLC_CODEC_I444, VLC_CODEC_J444, VLC_CODEC_FALLBACK_444, 0
1339 static const vlc_fourcc_t p_J444_fallback[] = {
1340 VLC_CODEC_J444, VLC_CODEC_I444, VLC_CODEC_FALLBACK_444, 0
1343 static const vlc_fourcc_t p_I440_fallback[] = {
1345 VLC_CODEC_YUV_PLANAR_420,
1346 VLC_CODEC_YUV_PLANAR_422,
1347 VLC_CODEC_YUV_PLANAR_444,
1348 VLC_CODEC_YUV_PACKED,
1349 VLC_CODEC_I411, VLC_CODEC_I410, VLC_CODEC_Y211,
1352 #define VLC_CODEC_FALLBACK_PACKED \
1353 VLC_CODEC_YUV_PLANAR_422, VLC_CODEC_YUV_PLANAR_420, \
1354 VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PLANAR_440, \
1355 VLC_CODEC_I411, VLC_CODEC_I410, VLC_CODEC_Y211
1357 static const vlc_fourcc_t p_YUYV_fallback[] = {
1362 VLC_CODEC_FALLBACK_PACKED, 0
1364 static const vlc_fourcc_t p_YVYU_fallback[] = {
1369 VLC_CODEC_FALLBACK_PACKED, 0
1371 static const vlc_fourcc_t p_UYVY_fallback[] = {
1376 VLC_CODEC_FALLBACK_PACKED, 0
1378 static const vlc_fourcc_t p_VYUY_fallback[] = {
1383 VLC_CODEC_FALLBACK_PACKED, 0
1386 static const vlc_fourcc_t *pp_YUV_fallback[] = {
1402 static const vlc_fourcc_t p_list_YUV[] = {
1403 VLC_CODEC_YUV_PLANAR_420,
1404 VLC_CODEC_YUV_PLANAR_422,
1405 VLC_CODEC_YUV_PLANAR_440,
1406 VLC_CODEC_YUV_PLANAR_444,
1407 VLC_CODEC_YUV_PACKED,
1408 VLC_CODEC_I411, VLC_CODEC_I410, VLC_CODEC_Y211,
1412 const vlc_fourcc_t *vlc_fourcc_GetYUVFallback( vlc_fourcc_t i_fourcc )
1414 for( unsigned i = 0; pp_YUV_fallback[i]; i++ )
1416 if( pp_YUV_fallback[i][0] == i_fourcc )
1417 return pp_YUV_fallback[i];
1422 bool vlc_fourcc_AreUVPlanesSwapped( vlc_fourcc_t a, vlc_fourcc_t b )
1424 return (((a == VLC_CODEC_I420 || a == VLC_CODEC_J420) && b == VLC_CODEC_YV12) ||
1425 ((b == VLC_CODEC_I420 || b == VLC_CODEC_J420) && a == VLC_CODEC_YV12));
1429 static inline bool vlc_fourcc_IsYUV(vlc_fourcc_t fcc)
1431 for( unsigned i = 0; p_list_YUV[i]; i++ )
1433 if( p_list_YUV[i] == fcc )