[vlc-devel] [PATCH 02/18] splitter: panoramix: automatic fallback to software chroma

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


---
 modules/video_splitter/panoramix.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/modules/video_splitter/panoramix.c b/modules/video_splitter/panoramix.c
index 9079c02824..97bd0bb2d7 100644
--- a/modules/video_splitter/panoramix.c
+++ b/modules/video_splitter/panoramix.c
@@ -419,6 +419,30 @@ static int Open( vlc_object_t *p_this )
     video_splitter_t *p_splitter = (video_splitter_t*)p_this;
     video_splitter_sys_t *p_sys;
 
+    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;
+    }
+
     const panoramix_chroma_t *p_chroma;
     for( int i = 0; ; i++ )
     {
-- 
2.13.1



More information about the vlc-devel mailing list