[vlc-commits] commit: Add libvlc_set_exit_handler(), more powerful than libvlc_wait() ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Sun May 30 19:52:34 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 30 20:28:35 2010 +0300| [cb435e2774e43702c7b23ce9fd5bd303e300212e] | committer: Rémi Denis-Courmont 

Add libvlc_set_exit_handler(), more powerful than libvlc_wait()

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

 include/vlc/libvlc.h |   16 ++++++++++++++++
 src/control/core.c   |    7 +++++++
 src/libvlc.sym       |    1 +
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/include/vlc/libvlc.h b/include/vlc/libvlc.h
index cd48aaa..eb6414a 100644
--- a/include/vlc/libvlc.h
+++ b/include/vlc/libvlc.h
@@ -146,6 +146,22 @@ VLC_PUBLIC_API
 int libvlc_add_intf( libvlc_instance_t *p_instance, const char *name );
 
 /**
+ * Registers a callback for the LibVLC exit event. This is mostly useful if
+ * you have started at least one interface with libvlc_add_intf().
+ * Typically, this function will wake up your application main loop (from
+ * another thread).
+ *
+ * \param p_instance LibVLC instance
+ * \param cb callback to invoke when LibVLC wants to exit
+ * \param opaque data pointer for the callback
+ * \warning This function and libvlc_wait() cannot be used at the same time.
+ * Use either or none of them but not both.
+ */
+VLC_PUBLIC_API
+void libvlc_set_exit_handler( libvlc_instance_t *p_instance,
+                              void (*cb) (void *), void *opaque );
+
+/**
  * Waits until an interface causes the instance to exit.
  * You should start at least one interface first, using libvlc_add_intf().
  *
diff --git a/src/control/core.c b/src/control/core.c
index a0a5278..54e2fd0 100644
--- a/src/control/core.c
+++ b/src/control/core.c
@@ -114,6 +114,13 @@ int libvlc_add_intf( libvlc_instance_t *p_i, const char *name )
     return libvlc_InternalAddIntf( p_i->p_libvlc_int, name ) ? -1 : 0;
 }
 
+void libvlc_set_exit_handler( libvlc_instance_t *p_i, void (*cb) (void *),
+                              void *data )
+{
+    libvlc_int_t *p_libvlc = p_i->p_libvlc_int;
+    libvlc_SetExitHandler( p_libvlc, cb, data );
+}
+
 void libvlc_wait( libvlc_instance_t *p_i )
 {
     libvlc_int_t *p_libvlc = p_i->p_libvlc_int;
diff --git a/src/libvlc.sym b/src/libvlc.sym
index e976c72..d46a177 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -217,4 +217,5 @@ libvlc_vlm_set_mux
 libvlc_vlm_set_output
 libvlc_vlm_show_media
 libvlc_vlm_stop_media
+libvlc_set_exit_handler
 libvlc_wait



More information about the vlc-commits mailing list