Commit 0bcd380a authored by Laurent Aimar's avatar Laurent Aimar

Added vlc_fourcc_GetRGBFallback.

parent 09bb05db
...@@ -365,6 +365,14 @@ VLC_EXPORT( const char *, vlc_fourcc_GetDescription, ( int i_cat, vlc_fourcc_t i ...@@ -365,6 +365,14 @@ VLC_EXPORT( const char *, vlc_fourcc_GetDescription, ( int i_cat, vlc_fourcc_t i
*/ */
VLC_EXPORT( const vlc_fourcc_t *, vlc_fourcc_GetYUVFallback, ( vlc_fourcc_t ) ); VLC_EXPORT( const vlc_fourcc_t *, vlc_fourcc_GetYUVFallback, ( vlc_fourcc_t ) );
/**
* It returns a list (terminated with the value 0) of RGB fourccs in
* decreasing priority order for the given chroma.
*
* It will always return a non NULL pointer that must not be freed.
*/
VLC_EXPORT( const vlc_fourcc_t *, vlc_fourcc_GetRGBFallback, ( vlc_fourcc_t ) );
/** /**
* It returns true if the given fourcc is YUV and false otherwise. * It returns true if the given fourcc is YUV and false otherwise.
*/ */
......
...@@ -486,6 +486,7 @@ vlc_fourcc_GetCodecAudio ...@@ -486,6 +486,7 @@ vlc_fourcc_GetCodecAudio
vlc_fourcc_GetCodecFromString vlc_fourcc_GetCodecFromString
vlc_fourcc_GetDescription vlc_fourcc_GetDescription
vlc_fourcc_IsYUV vlc_fourcc_IsYUV
vlc_fourcc_GetRGBFallback
vlc_fourcc_GetYUVFallback vlc_fourcc_GetYUVFallback
vlc_fourcc_AreUVPlanesSwapped vlc_fourcc_AreUVPlanesSwapped
vlc_gai_strerror vlc_gai_strerror
......
...@@ -1425,14 +1425,77 @@ static const vlc_fourcc_t p_list_YUV[] = { ...@@ -1425,14 +1425,77 @@ static const vlc_fourcc_t p_list_YUV[] = {
0, 0,
}; };
const vlc_fourcc_t *vlc_fourcc_GetYUVFallback( vlc_fourcc_t i_fourcc ) /* */
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[] )
{ {
for( unsigned i = 0; pp_YUV_fallback[i]; i++ ) for( unsigned i = 0; pp_fallback[i]; i++ )
{ {
if( pp_YUV_fallback[i][0] == i_fourcc ) if( pp_fallback[i][0] == i_fourcc )
return pp_YUV_fallback[i]; return pp_fallback[i];
} }
return p_list_YUV; 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 );
} }
bool vlc_fourcc_AreUVPlanesSwapped( vlc_fourcc_t a, vlc_fourcc_t b ) bool vlc_fourcc_AreUVPlanesSwapped( vlc_fourcc_t a, vlc_fourcc_t b )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment