X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmisc%2Ffourcc.c;h=ec33f76da846cff66605e5cb918f58b6be43652c;hb=b4c9cb160e24388a8c6092717f5257cdf46f146a;hp=5bd1d8b70875fb81f06061bc90ef13f05e809c1b;hpb=02c0032ab42f33533007cbc24866d4ce5f73b635;p=vlc diff --git a/src/misc/fourcc.c b/src/misc/fourcc.c index 5bd1d8b708..ec33f76da8 100644 --- a/src/misc/fourcc.c +++ b/src/misc/fourcc.c @@ -136,6 +136,7 @@ static const entry_t p_list_video[] = { A("PM4V"), A("M4T3"), A("GEOX"), + A("GEOV"), A("DMK2"), A("WV1F"), A("DIGI"), @@ -442,10 +443,15 @@ static const entry_t p_list_video[] = { B(VLC_CODEC_VP6F, "On2's VP6.2 Video (Flash)"), A("VP6F"), + A("FLV4"), B(VLC_CODEC_VP6A, "On2's VP6 A Video"), A("VP6A"), + B(VLC_CODEC_VP8, "Google/On2's VP8 Video"), + A("VP80"), + + /* Xiph.org theora */ B(VLC_CODEC_THEORA, "Xiph.org's Theora Video"), A("theo"), @@ -607,14 +613,20 @@ static const entry_t p_list_video[] = { B(VLC_CODEC_FRWU, "Forward Uncompressed" ), A("FRWU"), + B(VLC_CODEC_INDEO5, "Indeo Video v5"), + A("IV50"), + A("iv50"), + + /* */ B(VLC_CODEC_YV12, "Planar 4:2:0 YVU"), A("YV12"), A("yv12"), - B(VLC_CODEC_I420, "Planar 4:1:0 YUV"), - A("I410"), + B(VLC_CODEC_YV9, "Planar 4:1:0 YVU"), A("YVU9"), - B(VLC_CODEC_I420, "Planar 4:1:1 YUV"), + B(VLC_CODEC_I410, "Planar 4:1:0 YUV"), + A("I410"), + B(VLC_CODEC_I411, "Planar 4:1:1 YUV"), A("I411"), B(VLC_CODEC_I420, "Planar 4:2:0 YUV"), A("I420"), @@ -626,17 +638,13 @@ static const entry_t p_list_video[] = { B(VLC_CODEC_I444, "Planar 4:4:4 YUV"), A("I444"), - B(VLC_CODEC_I420, "Planar 4:1:0 YUV full scale"), - A("J410"), - B(VLC_CODEC_I420, "Planar 4:1:1 YUV full scale"), - A("J411"), - B(VLC_CODEC_I420, "Planar 4:2:0 YUV full scale"), + B(VLC_CODEC_J420, "Planar 4:2:0 YUV full scale"), A("J420"), - B(VLC_CODEC_I422, "Planar 4:2:2 YUV full scale"), + B(VLC_CODEC_J422, "Planar 4:2:2 YUV full scale"), A("J422"), - B(VLC_CODEC_I444, "Planar 4:4:0 YUV full scale"), + B(VLC_CODEC_J440, "Planar 4:4:0 YUV full scale"), A("J440"), - B(VLC_CODEC_I444, "Planar 4:4:4 YUV full scale"), + B(VLC_CODEC_J444, "Planar 4:4:4 YUV full scale"), A("J444"), B(VLC_CODEC_YUVP, "Palettized YUV with palette element Y:U:V:A"), @@ -696,6 +704,9 @@ static const entry_t p_list_video[] = { B(VLC_CODEC_V210, "10-bit 4:2:2 Component YCbCr"), A("v210"), + B(VLC_CODEC_NV12, "Planar Y, Packet UV (420)"), + A("NV12"), + /* Videogames Codecs */ /* Interplay MVE */ @@ -775,6 +786,12 @@ static const entry_t p_list_video[] = { B(VLC_CODEC_PCX, "Personal Computer Exchange Image"), A("pcx "), + B(VLC_CODEC_JPEG2000, "JPEG 2000 Image"), + A("JP2K"), + A("mjp2"), + A("MJP2"), + A("MJ2C"), + B(0, "") }; static const entry_t p_list_audio[] = { @@ -801,7 +818,7 @@ static const entry_t p_list_audio[] = { A("wmal"), /* Windows Media Audio Speech */ - B(VLC_CODEC_WMAS, "Windows Media Audio Speech"), + B(VLC_CODEC_WMAS, "Windows Media Audio Voice (Speech)"), A("WMAS"), A("wmas"), @@ -872,6 +889,10 @@ static const entry_t p_list_audio[] = { A("mp4a"), A("aac "), + /* ALS audio */ + B(VLC_CODEC_ALS, "MPEG-4 Audio Lossless (ALS)"), + A("als "), + /* 4X Technologies */ B(VLC_CODEC_ADPCM_4XM, "4X Technologies Audio"), A("4xma"), @@ -924,6 +945,7 @@ static const entry_t p_list_audio[] = { A("ms\x00\x11"), B(VLC_CODEC_ADPCM_IMA_AMV, "IMA AMV ADPCM Audio"), + A("imav"), /* AMR */ B(VLC_CODEC_AMR_NB, "AMR narrow band"), @@ -1088,7 +1110,7 @@ static const entry_t p_list_audio[] = { A("f32l"), A("fl32"), - B(VLC_CODEC_F32L, "32 bits float BE"), + B(VLC_CODEC_F32B, "32 bits float BE"), A("f32b"), B(VLC_CODEC_F64L, "64 bits float LE"), @@ -1189,7 +1211,8 @@ static entry_t Lookup( const entry_t p_list[], vlc_fourcc_t i_fourcc ) memcpy( e.p_class, p_class, 4 ); memcpy( e.p_fourcc, p->p_fourcc, 4 ); - e.psz_description = p->psz_description ?: psz_description; + e.psz_description = p->psz_description ? + p->psz_description : psz_description; break; } } @@ -1321,6 +1344,9 @@ const char *vlc_fourcc_GetDescription( int i_cat, vlc_fourcc_t i_fourcc ) /* */ +#define VLC_CODEC_YUV_PLANAR_410 \ + VLC_CODEC_I410, VLC_CODEC_YV9 + #define VLC_CODEC_YUV_PLANAR_420 \ VLC_CODEC_I420, VLC_CODEC_YV12, VLC_CODEC_J420 @@ -1340,7 +1366,7 @@ const char *vlc_fourcc_GetDescription( int i_cat, vlc_fourcc_t i_fourcc ) #define VLC_CODEC_FALLBACK_420 \ VLC_CODEC_YUV_PLANAR_422, VLC_CODEC_YUV_PACKED, \ VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PLANAR_440, \ - VLC_CODEC_I411, VLC_CODEC_I410, VLC_CODEC_Y211 + VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211 static const vlc_fourcc_t p_I420_fallback[] = { VLC_CODEC_I420, VLC_CODEC_YV12, VLC_CODEC_J420, VLC_CODEC_FALLBACK_420, 0 @@ -1355,7 +1381,7 @@ static const vlc_fourcc_t p_YV12_fallback[] = { #define VLC_CODEC_FALLBACK_422 \ VLC_CODEC_YUV_PACKED, VLC_CODEC_YUV_PLANAR_420, \ VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PLANAR_440, \ - VLC_CODEC_I411, VLC_CODEC_I410, VLC_CODEC_Y211 + VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211 static const vlc_fourcc_t p_I422_fallback[] = { VLC_CODEC_I422, VLC_CODEC_J422, VLC_CODEC_FALLBACK_422, 0 @@ -1367,7 +1393,7 @@ static const vlc_fourcc_t p_J422_fallback[] = { #define VLC_CODEC_FALLBACK_444 \ VLC_CODEC_YUV_PLANAR_422, VLC_CODEC_YUV_PACKED, \ VLC_CODEC_YUV_PLANAR_420, VLC_CODEC_YUV_PLANAR_440, \ - VLC_CODEC_I411, VLC_CODEC_I410, VLC_CODEC_Y211 + VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211 static const vlc_fourcc_t p_I444_fallback[] = { VLC_CODEC_I444, VLC_CODEC_J444, VLC_CODEC_FALLBACK_444, 0 @@ -1382,13 +1408,13 @@ static const vlc_fourcc_t p_I440_fallback[] = { VLC_CODEC_YUV_PLANAR_422, VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PACKED, - VLC_CODEC_I411, VLC_CODEC_I410, VLC_CODEC_Y211, 0 + VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211, 0 }; #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, \ - VLC_CODEC_I411, VLC_CODEC_I410, VLC_CODEC_Y211 + VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211 static const vlc_fourcc_t p_YUYV_fallback[] = { VLC_CODEC_YUYV, @@ -1441,7 +1467,7 @@ static const vlc_fourcc_t p_list_YUV[] = { VLC_CODEC_YUV_PLANAR_440, VLC_CODEC_YUV_PLANAR_444, VLC_CODEC_YUV_PACKED, - VLC_CODEC_I411, VLC_CODEC_I410, VLC_CODEC_Y211, + VLC_CODEC_I411, VLC_CODEC_YUV_PLANAR_410, VLC_CODEC_Y211, 0, }; @@ -1520,8 +1546,29 @@ const vlc_fourcc_t *vlc_fourcc_GetRGBFallback( vlc_fourcc_t i_fourcc ) bool vlc_fourcc_AreUVPlanesSwapped( vlc_fourcc_t a, vlc_fourcc_t b ) { - return (((a == VLC_CODEC_I420 || a == VLC_CODEC_J420) && b == VLC_CODEC_YV12) || - ((b == VLC_CODEC_I420 || b == VLC_CODEC_J420) && a == VLC_CODEC_YV12)); + 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; } bool vlc_fourcc_IsYUV(vlc_fourcc_t fcc) @@ -1534,3 +1581,58 @@ bool vlc_fourcc_IsYUV(vlc_fourcc_t fcc) return false; } +#define PLANAR(n, w_den, h_den) \ + { .plane_count = n, \ + .p = { {.w = {1, 1}, .h = {1, 1}}, \ + {.w = {1,w_den}, .h = {1,h_den}}, \ + {.w = {1,w_den}, .h = {1,h_den}}, \ + {.w = {1, 1}, .h = {1, 1}} }, \ + .pixel_size = 1 } + +#define PACKED(size) \ + { .plane_count = 1, \ + .p = { {.w = {1,1}, .h = {1,1}} }, \ + .pixel_size = size } + +static const struct +{ + vlc_fourcc_t p_fourcc[5]; + vlc_chroma_description_t description; +} p_list_chroma_description[] = { + { { VLC_CODEC_I411, 0 }, PLANAR(3, 4, 1) }, + { { VLC_CODEC_YUV_PLANAR_410, 0 }, PLANAR(3, 4, 4) }, + { { VLC_CODEC_YUV_PLANAR_420, 0 }, PLANAR(3, 2, 2) }, + { { VLC_CODEC_YUV_PLANAR_422, 0 }, PLANAR(3, 2, 1) }, + { { VLC_CODEC_YUV_PLANAR_440, 0 }, PLANAR(3, 1, 2) }, + { { VLC_CODEC_YUV_PLANAR_444, 0 }, PLANAR(3, 1, 1) }, + { { VLC_CODEC_YUVA, 0 }, PLANAR(4, 1, 1) }, + + { { VLC_CODEC_YUV_PACKED, 0 }, PACKED(2) }, + { { VLC_CODEC_RGB8, VLC_CODEC_GREY, + VLC_CODEC_YUVP, VLC_CODEC_RGBP, 0 }, PACKED(1) }, + { { VLC_CODEC_RGB16, VLC_CODEC_RGB15, 0 }, PACKED(2) }, + { { VLC_CODEC_RGB24, 0 }, PACKED(3) }, + { { VLC_CODEC_RGB32, VLC_CODEC_RGBA, 0 }, PACKED(4) }, + + { { VLC_CODEC_Y211, 0 }, { 1, { {{1,4}, {1,1}} }, 4 } }, + + { {0}, { 0, {}, 0 } } +}; + +#undef PACKED +#undef PLANAR + +const vlc_chroma_description_t *vlc_fourcc_GetChromaDescription( vlc_fourcc_t i_fourcc ) +{ + for( unsigned i = 0; p_list_chroma_description[i].p_fourcc[0]; i++ ) + { + const vlc_fourcc_t *p_fourcc = p_list_chroma_description[i].p_fourcc; + for( unsigned j = 0; p_fourcc[j]; j++ ) + { + if( p_fourcc[j] == i_fourcc ) + return &p_list_chroma_description[i].description; + } + } + return NULL; +} +