[vlc-devel] [PATCH] Added libvlc_get_internal_object functions to the PUBLIC API

basos g noxelia at gmail.com
Thu Dec 11 15:27:03 CET 2008


It is intented to expose the libvlc_int_t (the main vlc object)
to enable extented vlc hacking.. E.g. when you need to make something
with configuration or modules that it is not provided by the API.
So you expose the libvlc_object and act upon it with the internal
API...
---
 include/vlc/libvlc.h            |   26 ++++++++++++++++++++++++++
 include/vlc/libvlc_structures.h |   14 ++++++++++++++
 src/control/core.c              |   18 ++++++++++++++++++
 src/libvlc.sym                  |    3 +++
 4 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/include/vlc/libvlc.h b/include/vlc/libvlc.h
index 7f2f384..932192f 100644
--- a/include/vlc/libvlc.h
+++ b/include/vlc/libvlc.h
@@ -148,6 +148,32 @@ libvlc_new( int , const char *const *,
libvlc_exception_t *);
 VLC_PUBLIC_API int libvlc_get_vlc_id( libvlc_instance_t *p_instance );

 /**
+ * Return the libvlc internal object, the main object that all other depend on.
+ *  This function should be handfull *only* when hacking. E.g. you need to
+ *  expose some functionality that is not provided by this API by
using functions
+ *  that act upon struct libvlc_int_t or struct libvlc_object_t.
+ *   Remember to release the object
+ *
+ * \param p_instance the libvlc instance
+ */
+VLC_PUBLIC_API libvlc_internal_t* libvlc_get_internal_object(
libvlc_instance_t *p_instance );
+
+/**
+ * Release the libvlc_internal object you got from libvlc_get_internal_object
+ *
+ * \param p_object the libvlc internal object
+ */
+VLC_PUBLIC_API void libvlc_release_internal_object(
libvlc_internal_t* p_object );
+
+/**
+ * Retain (incref) the libvlc_internal object you got from
libvlc_get_internal_object
+ *
+ * \param p_object the libvlc internal object
+ */
+VLC_PUBLIC_API void libvlc_retain_internal_object( libvlc_internal_t*
p_object ) ;
+
+
+/**
  * Decrement the reference count of a libvlc instance, and destroy it
  * if it reaches zero.
  *
diff --git a/include/vlc/libvlc_structures.h b/include/vlc/libvlc_structures.h
index 76427ad..764108a 100644
--- a/include/vlc/libvlc_structures.h
+++ b/include/vlc/libvlc_structures.h
@@ -281,6 +281,20 @@ typedef struct libvlc_log_message_t

 /**@} */

+/****************************************************************************************
+ * Misc
+ ****************************************************************************************/
+
+/** \defgroup libvlc_internal libvlc_internal
+  *  \ingroup libvlc_core
+  *  LibVLC Internal object for hacking :)
+  *  @{
+  */
+typedef struct libvlc_int_t libvlc_internal_t ;
+
+/**@} */
+
+
 # ifdef __cplusplus
 }
 # endif
diff --git a/src/control/core.c b/src/control/core.c
index a4a62f8..7914c0f 100644
--- a/src/control/core.c
+++ b/src/control/core.c
@@ -175,6 +175,24 @@ void libvlc_release( libvlc_instance_t *p_instance )
     }
 }

+
+libvlc_internal_t* libvlc_get_internal_object( libvlc_instance_t* p_instance )
+{
+	vlc_object_yield( p_instance->p_libvlc_int ) ;
+	return p_instance->p_libvlc_int ;
+}
+
+void libvlc_release_internal_object( libvlc_internal_t* p_object )
+{
+	vlc_object_release( p_object ) ;
+}
+
+void libvlc_retain_internal_object( libvlc_internal_t* p_object )
+{
+	vlc_object_yield( p_object );
+}
+
+
 void libvlc_add_intf( libvlc_instance_t *p_i, const char *name,
                       libvlc_exception_t *p_e )
 {
diff --git a/src/libvlc.sym b/src/libvlc.sym
index ce03edd..52dfb03 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -28,6 +28,9 @@ libvlc_get_input_thread
 libvlc_get_log_verbosity
 libvlc_get_version
 libvlc_get_vlc_id
+libvlc_get_internal_object
+libvlc_retain_internal_object
+libvlc_release_internal_object
 libvlc_log_clear
 libvlc_log_close
 libvlc_log_count
-- 
1.5.6.5



More information about the vlc-devel mailing list