[vlc-devel] commit: libvlc_wait: wait until libvlc is killed by an interface ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu May 29 21:49:39 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Thu May 29 22:48:52 2008 +0300| [da316c39348c837e7dc4e506e17ede6922901112]

libvlc_wait: wait until libvlc is killed by an interface

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

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

diff --git a/include/vlc/libvlc.h b/include/vlc/libvlc.h
index 9d5a3db..cd81fea 100644
--- a/include/vlc/libvlc.h
+++ b/include/vlc/libvlc.h
@@ -158,6 +158,15 @@ void libvlc_run_interface( libvlc_instance_t *p_instance, const char *name,
                            libvlc_exception_t *p_exception );
 
 /**
+ * Waits until an interface causes the instance to exit.
+ * You should start at least one interface first, using libvlc_add_intf().
+ *
+ * \param p_instance the instance
+ */
+VLC_PUBLIC_API
+void libvlc_wait( libvlc_instance_t *p_instance );
+
+/**
  * Retrieve libvlc version.
  *
  * Example: "0.9.0-git Grishenko"
diff --git a/src/control/core.c b/src/control/core.c
index 068ca67..5d4bf63 100644
--- a/src/control/core.c
+++ b/src/control/core.c
@@ -173,6 +173,14 @@ void libvlc_run_interface( libvlc_instance_t *p_i, const char *name,
         RAISEVOID( "Interface initialization failed" );
 }
 
+void libvlc_wait( libvlc_instance_t *p_i )
+{
+    libvlc_int_t *p_libvlc = p_i->p_libvlc_int;
+    vlc_object_lock( p_libvlc );
+    while( !vlc_object_wait( p_libvlc ) );
+    vlc_object_unlock( p_libvlc );
+}
+
 int libvlc_get_vlc_id( libvlc_instance_t *p_instance )
 {
     return p_instance->p_libvlc_int->i_object_id;
diff --git a/src/libvlc.sym b/src/libvlc.sym
index 25e0cce..a7547d3 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -203,6 +203,7 @@ libvlc_vlm_set_loop
 libvlc_vlm_set_output
 libvlc_vlm_show_media
 libvlc_vlm_stop_media
+libvlc_wait
 mediacontrol_RGBPicture__free
 mediacontrol_StreamInformation__free
 mediacontrol_display_text




More information about the vlc-devel mailing list