[vlc-commits] Qt: move the video filter parser in its own function

Ludovic Fauvet git at videolan.org
Wed Jul 10 16:51:50 CEST 2013


vlc | branch: master | Ludovic Fauvet <etix at videolan.org> | Wed Jul 10 16:00:25 2013 +0200| [d3953b96109c0ba62a554b7ebddf989dcfc01be8] | committer: Ludovic Fauvet

Qt: move the video filter parser in its own function

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

 modules/gui/qt4/components/extended_panels.cpp |   80 ++++++++++++++----------
 1 file changed, 46 insertions(+), 34 deletions(-)

diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp
index acc9215..57c35e4 100644
--- a/modules/gui/qt4/components/extended_panels.cpp
+++ b/modules/gui/qt4/components/extended_panels.cpp
@@ -57,6 +57,7 @@
 
 #include <vlc_charset.h> /* us_strtod */
 
+static char *ChangeFiltersString( struct intf_thread_t *p_intf, const char *psz_filter_type, const char *psz_name, bool b_add );
 static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_name, bool b_add );
 
 #if 0
@@ -293,39 +294,9 @@ void ExtVideo::clean()
     ui.cropRightPx->setValue( 0 );
 }
 
-static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_name, bool b_add )
+static char *ChangeFiltersString( struct intf_thread_t *p_intf, const char *psz_filter_type, const char *psz_name, bool b_add )
 {
     char *psz_parser, *psz_string;
-    const char *psz_filter_type;
-
-    module_t *p_obj = module_find( psz_name );
-    if( !p_obj )
-    {
-        msg_Err( p_intf, "Unable to find filter module \"%s\".", psz_name );
-        return;
-    }
-
-    if( module_provides( p_obj, "video splitter" ) )
-    {
-        psz_filter_type = "video-splitter";
-    }
-    else if( module_provides( p_obj, "video filter2" ) )
-    {
-        psz_filter_type = "video-filter";
-    }
-    else if( module_provides( p_obj, "sub source" ) )
-    {
-        psz_filter_type = "sub-source";
-    }
-    else if( module_provides( p_obj, "sub filter" ) )
-    {
-        psz_filter_type = "sub-filter";
-    }
-    else
-    {
-        msg_Err( p_intf, "Unknown video filter type." );
-        return;
-    }
 
     psz_string = config_GetPsz( p_intf, psz_filter_type );
 
@@ -342,14 +313,14 @@ static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_
                             psz_string, psz_name ) == -1 )
             {
                 free( psz_parser );
-                return;
+                return NULL;
             }
             free( psz_parser );
         }
         else
         {
             free( psz_string );
-            return;
+            return NULL;
         }
     }
     else
@@ -376,9 +347,50 @@ static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_
         else
         {
             free( psz_string );
-            return;
+            return NULL;
         }
     }
+    return psz_string;
+}
+
+static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_name, bool b_add )
+{
+    char *psz_string;
+    const char *psz_filter_type;
+
+    module_t *p_obj = module_find( psz_name );
+    if( !p_obj )
+    {
+        msg_Err( p_intf, "Unable to find filter module \"%s\".", psz_name );
+        return;
+    }
+
+    if( module_provides( p_obj, "video splitter" ) )
+    {
+        psz_filter_type = "video-splitter";
+    }
+    else if( module_provides( p_obj, "video filter2" ) )
+    {
+        psz_filter_type = "video-filter";
+    }
+    else if( module_provides( p_obj, "sub source" ) )
+    {
+        psz_filter_type = "sub-source";
+    }
+    else if( module_provides( p_obj, "sub filter" ) )
+    {
+        psz_filter_type = "sub-filter";
+    }
+    else
+    {
+        msg_Err( p_intf, "Unknown video filter type." );
+        return;
+    }
+
+    psz_string = ChangeFiltersString( p_intf, psz_filter_type, psz_name, b_add );
+    if( !psz_string )
+        return;
+
     /* Vout is not kept, so put that in the config */
     config_PutPsz( p_intf, psz_filter_type, psz_string );
 



More information about the vlc-commits mailing list