[vlc-devel] commit: Added vlc_fourcc_GetRGBFallback. (Laurent Aimar )
git version control
git at videolan.org
Sun Oct 11 21:18:45 CEST 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Oct 11 15:58:09 2009 +0200| [0bcd380a113e72304ef32daeca955ec7e6502176] | committer: Laurent Aimar
Added vlc_fourcc_GetRGBFallback.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0bcd380a113e72304ef32daeca955ec7e6502176
---
include/vlc_fourcc.h | 8 +++++
src/libvlccore.sym | 1 +
src/misc/fourcc.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 77 insertions(+), 5 deletions(-)
diff --git a/include/vlc_fourcc.h b/include/vlc_fourcc.h
index 50fde98..8563d12 100644
--- a/include/vlc_fourcc.h
+++ b/include/vlc_fourcc.h
@@ -366,6 +366,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 ) );
/**
+ * 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.
*/
VLC_EXPORT( bool, vlc_fourcc_IsYUV, ( vlc_fourcc_t ) );
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index ac57220..73d2aa2 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -486,6 +486,7 @@ vlc_fourcc_GetCodecAudio
vlc_fourcc_GetCodecFromString
vlc_fourcc_GetDescription
vlc_fourcc_IsYUV
+vlc_fourcc_GetRGBFallback
vlc_fourcc_GetYUVFallback
vlc_fourcc_AreUVPlanesSwapped
vlc_gai_strerror
diff --git a/src/misc/fourcc.c b/src/misc/fourcc.c
index f3dbb08..38b8ead 100644
--- a/src/misc/fourcc.c
+++ b/src/misc/fourcc.c
@@ -1425,14 +1425,77 @@ static const vlc_fourcc_t p_list_YUV[] = {
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 )
- return pp_YUV_fallback[i];
+ if( pp_fallback[i][0] == i_fourcc )
+ 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 )
More information about the vlc-devel
mailing list