[vlc-commits] filter_chain: add filter_chain_ForEach() helper

Rémi Denis-Courmont git at videolan.org
Mon Jul 28 23:55:15 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jul 28 22:52:12 2014 +0300| [0a5922714a3115e7fb27bfce67d6fc732b6d6060] | committer: Rémi Denis-Courmont

filter_chain: add filter_chain_ForEach() helper

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

 include/vlc_filter.h    |    3 +++
 src/misc/filter_chain.c |   12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 96ffb61..ff13032 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -428,5 +428,8 @@ VLC_API int filter_chain_MouseFilter( filter_chain_t *, vlc_mouse_t *, const vlc
  */
 VLC_API int filter_chain_MouseEvent( filter_chain_t *, const vlc_mouse_t *, const video_format_t * );
 
+int filter_chain_ForEach( filter_chain_t *chain,
+                          int (*cb)( filter_t *, void * ), void *opaque );
+
 #endif /* _VLC_FILTER_H */
 
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 4143fdc..79a00fa 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -236,6 +236,18 @@ int filter_chain_DeleteFilter( filter_chain_t *p_chain, filter_t *p_filter )
     return UpdateBufferFunctions( p_chain );
 }
 
+int filter_chain_ForEach( filter_chain_t *chain,
+                          int (*cb)( filter_t *, void * ), void *opaque )
+{
+    for( chained_filter_t *f = chain->first; f != NULL; f = f->next )
+    {
+        int ret = cb( &f->filter, opaque );
+        if( ret )
+            return ret;
+    }
+    return VLC_SUCCESS;
+}
+
 int filter_chain_GetLength( filter_chain_t *p_chain )
 {
     return p_chain->length;



More information about the vlc-commits mailing list