[vlc-commits] fourcc: add a generic GetFallback helper function

Niklas Haas git at videolan.org
Wed Oct 24 10:12:54 CEST 2018


vlc | branch: master | Niklas Haas <git at haasn.xyz> | Wed Oct 10 03:46:33 2018 +0200| [4049ce12316127cf6e8c3adbf6fc61477cc826a5] | committer: Thomas Guillem

fourcc: add a generic GetFallback helper function

There's only GetYUVFallback and GetRGBFallback. This one picks the right
function based on the type of fourcc in use.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4049ce12316127cf6e8c3adbf6fc61477cc826a5
---

 include/vlc_fourcc.h | 9 +++++++++
 src/libvlccore.sym   | 1 +
 src/misc/fourcc.c    | 7 +++++++
 3 files changed, 17 insertions(+)

diff --git a/include/vlc_fourcc.h b/include/vlc_fourcc.h
index 871f01043a..bd192b160c 100644
--- a/include/vlc_fourcc.h
+++ b/include/vlc_fourcc.h
@@ -686,6 +686,15 @@ VLC_API const vlc_fourcc_t * vlc_fourcc_GetYUVFallback( vlc_fourcc_t );
 VLC_API const vlc_fourcc_t * vlc_fourcc_GetRGBFallback( vlc_fourcc_t );
 
 /**
+ * It returns a list (terminated with the value 0) of fourccs in decreasing
+ * priority order for the given chroma. It will return either YUV or RGB
+ * fallbacks depending on whether or not the fourcc given is YUV.
+ *
+ * It will always return a non NULL pointer that must not be freed.
+ */
+VLC_API const vlc_fourcc_t * vlc_fourcc_GetFallback( vlc_fourcc_t );
+
+/**
  * It returns true if the given fourcc is YUV and false otherwise.
  */
 VLC_API bool vlc_fourcc_IsYUV( vlc_fourcc_t );
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index cf0a7e091c..f5bacd3e93 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -577,6 +577,7 @@ vlc_fourcc_GetChromaDescription
 vlc_fourcc_IsYUV
 vlc_fourcc_GetRGBFallback
 vlc_fourcc_GetYUVFallback
+vlc_fourcc_GetFallback
 vlc_fourcc_AreUVPlanesSwapped
 vlc_getaddrinfo
 vlc_getaddrinfo_i11e
diff --git a/src/misc/fourcc.c b/src/misc/fourcc.c
index e99ac32774..98fa40cf79 100644
--- a/src/misc/fourcc.c
+++ b/src/misc/fourcc.c
@@ -620,6 +620,13 @@ const vlc_fourcc_t *vlc_fourcc_GetRGBFallback( vlc_fourcc_t i_fourcc )
     return GetFallback( i_fourcc, pp_RGB_fallback, p_RGB32_fallback );
 }
 
+const vlc_fourcc_t *vlc_fourcc_GetFallback( vlc_fourcc_t i_fourcc )
+{
+    return vlc_fourcc_IsYUV( i_fourcc)
+            ? vlc_fourcc_GetYUVFallback( i_fourcc )
+            : vlc_fourcc_GetRGBFallback( i_fourcc );
+}
+
 bool vlc_fourcc_AreUVPlanesSwapped( vlc_fourcc_t a, vlc_fourcc_t b )
 {
     static const vlc_fourcc_t pp_swapped[][4] = {



More information about the vlc-commits mailing list