[vlc-devel] [PATCH 03/18] splitter: wall: automatic fallback to software chroma

Victorien Le Couviour--Tuffet victorien.lecouviour.tuffet at gmail.com
Fri Aug 4 19:40:57 CEST 2017


---
 modules/video_splitter/wall.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/modules/video_splitter/wall.c b/modules/video_splitter/wall.c
index e234ca3622..6e9da7e61b 100644
--- a/modules/video_splitter/wall.c
+++ b/modules/video_splitter/wall.c
@@ -123,10 +123,29 @@ static int Open( vlc_object_t *p_this )
     video_splitter_t *p_splitter = (video_splitter_t*)p_this;
     video_splitter_sys_t *p_sys;
 
-    const vlc_chroma_description_t *p_chroma =
-        vlc_fourcc_GetChromaDescription( p_splitter->fmt.i_chroma );
-    if( p_chroma == NULL || p_chroma->plane_count == 0 )
-        return VLC_EGENERIC;
+    vlc_chroma_description_t const *p_chroma_desc =
+        vlc_fourcc_GetChromaDescription(p_splitter->fmt.i_chroma);
+    if (!p_chroma_desc || !p_chroma_desc->plane_count)
+    {
+        vlc_fourcc_t const *p_fallbacks =
+            vlc_fourcc_GetYUVFallback(p_splitter->fmt.i_chroma);
+        if (!p_fallbacks)
+            return VLC_EGENERIC;
+
+        unsigned int i = 0;
+        while (p_fallbacks[i])
+        {
+            p_chroma_desc = vlc_fourcc_GetChromaDescription(p_fallbacks[i]);
+            if (p_chroma_desc && p_chroma_desc->plane_count)
+            {
+                p_splitter->fmt.i_chroma = p_fallbacks[i];
+                break;
+            }
+            ++i;
+        }
+        if (!p_fallbacks[i])
+            return VLC_EGENERIC;
+    }
 
     p_splitter->p_sys = p_sys = malloc( sizeof(*p_sys) );
     if( !p_sys )
-- 
2.13.1



More information about the vlc-devel mailing list