[vlc-devel] commit: Add sub-filter and video-filter to vout_EnableFilter ( Cyril Mathé )

git version control git at videolan.org
Sun Jun 14 21:02:31 CEST 2009


vlc | branch: master | Cyril Mathé <cmathe at actech-innovation.com> | Wed Jun 10 09:41:09 2009 +0200| [5577367b76dd6814c4479e01c5b602bc4d6f08a9] | committer: Laurent Aimar 

Add sub-filter and video-filter to vout_EnableFilter

Signed-off-by: Laurent Aimar <fenrir at videolan.org>
(I have added on missing module_release).

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

 src/video_output/vout_intf.c |   49 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 9824f7c..59472eb 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -805,7 +805,40 @@ void vout_EnableFilter( vout_thread_t *p_vout, char *psz_name,
                         bool b_add, bool b_setconfig )
 {
     char *psz_parser;
-    char *psz_string = config_GetPsz( p_vout, "vout-filter" );
+    char *psz_string;
+    const char *psz_filter_type;
+
+    module_t *p_obj = module_find( psz_name );
+    if( !p_obj )
+    {
+        msg_Err( p_vout, "Unable to find filter module \"%s\".", psz_name );
+        return;
+    }
+
+    if( module_provides( p_obj, "video filter" ) )
+    {
+        psz_filter_type = "vout-filter";
+    }
+    else if( module_provides( p_obj, "video filter2" ) )
+    {
+        psz_filter_type = "video-filter";
+    }
+    else if( module_provides( p_obj, "sub filter" ) )
+    {
+        psz_filter_type = "sub-filter";
+    }
+    else
+    {
+        module_release( p_obj );
+        msg_Err( p_vout, "Unknown video filter type." );
+        return;
+    }
+    module_release( p_obj );
+
+    if( !strcmp( psz_filter_type, "sub-filter") )
+        psz_string = var_GetString( vout_GetSpu( p_vout ), psz_filter_type );
+    else
+        psz_string = var_GetString( p_vout, psz_filter_type );
 
     /* Todo : Use some generic chain manipulation functions */
     if( !psz_string ) psz_string = strdup("");
@@ -847,10 +880,20 @@ void vout_EnableFilter( vout_thread_t *p_vout, char *psz_name,
              return;
          }
     }
+
     if( b_setconfig )
-        config_PutPsz( p_vout, "vout-filter", psz_string );
+    {
+        if( !strcmp( psz_filter_type, "sub-filter") )
+            config_PutPsz( vout_GetSpu( p_vout ), psz_filter_type, psz_string );
+        else
+            config_PutPsz( p_vout, psz_filter_type, psz_string );
+    }
+
+    if( !strcmp( psz_filter_type, "sub-filter") )
+        var_SetString( vout_GetSpu( p_vout ), psz_filter_type, psz_string );
+    else
+        var_SetString( p_vout, psz_filter_type, psz_string );
 
-    var_SetString( p_vout, "vout-filter", psz_string );
     free( psz_string );
 }
 




More information about the vlc-devel mailing list