[vlc-commits] Revert 'libvlc: refactor sfilter enabling/disabling'

Felix Paul Kühne git at videolan.org
Mon Sep 8 20:57:07 CEST 2014


vlc/vlc-2.2 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Mon Sep  8 20:54:13 2014 +0200| [1ad06aa4151ae49b04b1cffb5bd00f675eeab3f7] | committer: Felix Paul Kühne

Revert 'libvlc: refactor sfilter enabling/disabling'

This reverts commit 93900cd71aff74d4eec617d8f87be97427f83101 because it breaks the API behavior 3 months after a feature freeze without providing a proper solution or work-around. This code path will be reworked for 3.0.

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

 lib/video.c |   81 +++++++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 56 insertions(+), 25 deletions(-)

diff --git a/lib/video.c b/lib/video.c
index c8b3711..19065fb 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -611,32 +611,33 @@ void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
 /* module helpers */
 /* ************** */
 
-static bool find_sub_source_by_name( libvlc_media_player_t *p_mi, const char *restrict name )
+
+static vlc_object_t *get_object( libvlc_media_player_t * p_mi,
+                                 const char *name )
 {
+    vlc_object_t *object;
     vout_thread_t *vout = GetVout( p_mi, 0 );
-    if (!vout)
-        return false;
 
-    char *psz_sources = var_GetString( vout, "sub-source" );
-    if( !psz_sources )
+    if( vout )
     {
-        libvlc_printerr( "%s not enabled", name );
-        vlc_object_release( vout );
-        return false;
+        object = vlc_object_find_name( vout, name );
+        vlc_object_release(vout);
     }
+    else
+        object = NULL;
 
-    /* Find 'name'  */
-    char *p = strstr( psz_sources, name );
-    free( psz_sources );
-    vlc_object_release( vout );
-    return (p != NULL);
+    if( !object )
+        libvlc_printerr( "%s not enabled", name );
+    return object;
 }
 
+
 typedef const struct {
     const char name[20];
     unsigned type;
 } opt_t;
 
+
 static void
 set_int( libvlc_media_player_t *p_mi, const char *restrict name,
          const opt_t *restrict opt, int value )
@@ -648,9 +649,7 @@ set_int( libvlc_media_player_t *p_mi, const char *restrict name,
         vout_thread_t *vout = GetVout( p_mi, 0 );
         if (vout)
         {
-            /* Fill sub-source */
             vout_EnableFilter( vout, opt->name, value, false );
-            var_TriggerCallback( vout, "sub-source" );
             vlc_object_release( vout );
         }
         return;
@@ -662,9 +661,16 @@ set_int( libvlc_media_player_t *p_mi, const char *restrict name,
         return;
     }
 
-    var_SetInteger( p_mi, opt->name, value );
+    var_SetInteger(p_mi, opt->name, value);
+    vlc_object_t *object = get_object( p_mi, name );
+    if( object )
+    {
+        var_SetInteger(object, opt->name, value);
+        vlc_object_release( object );
+    }
 }
 
+
 static int
 get_int( libvlc_media_player_t *p_mi, const char *restrict name,
          const opt_t *restrict opt )
@@ -675,8 +681,9 @@ get_int( libvlc_media_player_t *p_mi, const char *restrict name,
     {
         case 0: /* the enabler */
         {
-            bool b_enabled = find_sub_source_by_name( p_mi, name );
-            return b_enabled ? 1 : 0;
+            vlc_object_t *object = get_object( p_mi, name );
+            vlc_object_release( object );
+            return object != NULL;
         }
     case VLC_VAR_INTEGER:
         return var_GetInteger(p_mi, opt->name);
@@ -686,6 +693,7 @@ get_int( libvlc_media_player_t *p_mi, const char *restrict name,
     }
 }
 
+
 static void
 set_float( libvlc_media_player_t *p_mi, const char *restrict name,
             const opt_t *restrict opt, float value )
@@ -699,14 +707,23 @@ set_float( libvlc_media_player_t *p_mi, const char *restrict name,
     }
 
     var_SetFloat( p_mi, opt->name, value );
+
+    vlc_object_t *object = get_object( p_mi, name );
+    if( object )
+    {
+        var_SetFloat(object, opt->name, value );
+        vlc_object_release( object );
+    }
 }
 
+
 static float
 get_float( libvlc_media_player_t *p_mi, const char *restrict name,
             const opt_t *restrict opt )
 {
     if( !opt ) return 0.0;
 
+
     if( opt->type != VLC_VAR_FLOAT )
     {
         libvlc_printerr( "Invalid argument to %s in %s", name, "get float" );
@@ -716,6 +733,7 @@ get_float( libvlc_media_player_t *p_mi, const char *restrict name,
     return var_GetFloat( p_mi, opt->name );
 }
 
+
 static void
 set_string( libvlc_media_player_t *p_mi, const char *restrict name,
             const opt_t *restrict opt, const char *restrict psz_value )
@@ -729,8 +747,16 @@ set_string( libvlc_media_player_t *p_mi, const char *restrict name,
     }
 
     var_SetString( p_mi, opt->name, psz_value );
+
+    vlc_object_t *object = get_object( p_mi, name );
+    if( object )
+    {
+        var_SetString(object, opt->name, psz_value );
+        vlc_object_release( object );
+    }
 }
 
+
 static char *
 get_string( libvlc_media_player_t *p_mi, const char *restrict name,
             const opt_t *restrict opt )
@@ -746,6 +772,7 @@ get_string( libvlc_media_player_t *p_mi, const char *restrict name,
     return var_GetString( p_mi, opt->name );
 }
 
+
 static const opt_t *
 marq_option_bynumber(unsigned option)
 {
@@ -770,6 +797,8 @@ marq_option_bynumber(unsigned option)
     return r;
 }
 
+static vlc_object_t *get_object( libvlc_media_player_t *, const char *);
+
 /*****************************************************************************
  * libvlc_video_get_marquee_int : get a marq option value
  *****************************************************************************/
@@ -809,6 +838,7 @@ void libvlc_video_set_marquee_string( libvlc_media_player_t *p_mi,
 
 /* logo module support */
 
+
 static const opt_t *
 logo_option_bynumber( unsigned option )
 {
@@ -832,10 +862,11 @@ logo_option_bynumber( unsigned option )
     return r;
 }
 
+
 void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
                                    unsigned option, const char *psz_value )
 {
-    set_string( p_mi,"logo",logo_option_bynumber(option), psz_value );
+    set_string( p_mi,"logo",logo_option_bynumber(option),psz_value );
 }
 
 
@@ -861,12 +892,12 @@ adjust_option_bynumber( unsigned option )
 {
     static const opt_t optlist[] =
     {
-        { "adjust",     0 },
-        { "contrast",   VLC_VAR_FLOAT },
-        { "brightness", VLC_VAR_FLOAT },
-        { "hue",        VLC_VAR_INTEGER },
-        { "saturation", VLC_VAR_FLOAT },
-        { "gamma",      VLC_VAR_FLOAT },
+        { "adjust",               0 },
+        { "contrast",             VLC_VAR_FLOAT },
+        { "brightness",           VLC_VAR_FLOAT },
+        { "hue",                  VLC_VAR_INTEGER },
+        { "saturation",           VLC_VAR_FLOAT },
+        { "gamma",                VLC_VAR_FLOAT },
     };
     enum { num_opts = sizeof(optlist) / sizeof(*optlist) };
 



More information about the vlc-commits mailing list