[vlc-devel] [PATCH 1/2] Introduce vout_GetFilter

Jean-Baptiste Kempf jb at videolan.org
Sun Sep 22 19:01:52 CEST 2013


This is a way to get the filter children of a vout, in order to avoid
using vlc_object_find_name, which is deprecated, in the UI effects.
---
 include/vlc_vout.h           |  1 +
 src/libvlccore.sym           |  1 +
 src/video_output/vout_intf.c | 21 +++++++++++++++++++++
 3 files changed, 23 insertions(+)

diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index 2d6c180..7c93b00 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -158,6 +158,7 @@ VLC_API int vout_RegisterSubpictureChannel( vout_thread_t * );
 VLC_API void vout_FlushSubpictureChannel( vout_thread_t *, int );
 
 VLC_API void vout_EnableFilter( vout_thread_t *, const char *,bool , bool  );
+VLC_API vlc_object_t *vout_GetFilter( vout_thread_t *, const char * );
 
 /**@}*/
 
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 5efc67e..af7af5b 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -600,6 +600,7 @@ vout_PutSubpicture
 vout_RegisterSubpictureChannel
 vout_FlushSubpictureChannel
 vout_EnableFilter
+vout_GetFilter
 vout_GetSnapshot
 vout_OSDIcon
 vout_OSDMessage
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index fb288cf..48a0c6a 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -42,6 +42,8 @@
 #include <vlc_strings.h>
 #include <vlc_charset.h>
 #include "vout_internal.h"
+#include "libvlc.h"
+#include "../misc/variables.h"
 
 /*****************************************************************************
  * Local prototypes
@@ -537,6 +539,25 @@ void vout_EnableFilter( vout_thread_t *p_vout, const char *psz_name,
     free( psz_string );
 }
 
+vlc_object_t *vout_GetFilter( vout_thread_t *p_vout, const char *psz_name )
+{
+    if( !p_vout )
+        return NULL;
+
+    vlc_list_t *p_list = vlc_list_children( p_vout );
+    for( int i = 0; i < p_list->i_count; i++ )
+    {
+        vlc_object_internals_t *priv = vlc_internals( p_list->p_values[i].p_object );
+        if( priv->psz_name != NULL && !strcmp( priv->psz_name, psz_name ) )
+        {
+            vlc_list_release( p_list );
+            return vlc_object_hold( vlc_externals( priv ) );
+        }
+    }
+    vlc_list_release( p_list );
+    return NULL;
+}
+
 /*****************************************************************************
  * Object variables callbacks
  *****************************************************************************/
-- 
1.8.4




More information about the vlc-devel mailing list