]> git.sesse.net Git - vlc/blobdiff - src/misc/media_library.c
Rename the sdi module to decklink.
[vlc] / src / misc / media_library.c
index cf4e2b75259c597cd7a9784ae668435dfee4e5e6..922b4935f2c5480684beaaad982a375cee7207b2 100644 (file)
 
 #include <assert.h>
 #include <vlc_media_library.h>
+#include <vlc_modules.h>
 #include "../libvlc.h"
 
 /**
  * @brief Destroy the medialibrary object
  * @param Parent object that holds the media library object
  */
-void __ml_Destroy( vlc_object_t * p_this )
+void ml_Destroy( vlc_object_t * p_this )
 {
     media_library_t* p_ml = ( media_library_t* )p_this;
     module_unneed( p_ml, p_ml->p_module );
@@ -76,9 +77,9 @@ static void *ml_gc_init (ml_gc_object_t *p_gc, void (*pf_destruct) (ml_gc_object
  * @return p_ml created and attached, module loaded. NULL if
  * not able to load
  */
-media_library_t *__ml_Create( vlc_object_t *p_this, char *psz_name )
+media_library_t *ml_Create( vlc_object_t *p_this, char *psz_name )
 {
-    media_library_t *p_ml = NULL;
+    media_library_t *p_ml;
 
     p_ml = ( media_library_t * ) vlc_custom_create(
                                 p_this, sizeof( media_library_t ),
@@ -101,34 +102,38 @@ media_library_t *__ml_Create( vlc_object_t *p_this, char *psz_name )
     return p_ml;
 }
 
+#undef ml_Hold
 /**
  * @brief Acquire a reference to the media library singleton
  * @param p_this Object that holds the reference
  * @return media_library_t The ml object. NULL if not compiled with
  * media library or if unable to load
  */
-media_library_t* __ml_Hold( vlc_object_t* p_this )
+media_library_t* ml_Hold( vlc_object_t* p_this )
 {
-    media_library_t* p_ml = NULL;
+    media_library_t* p_ml;
+    vlc_mutex_lock( &( libvlc_priv( p_this->p_libvlc )->ml_lock ) );
     p_ml = libvlc_priv (p_this->p_libvlc)->p_ml;
     assert( VLC_OBJECT( p_ml ) != p_this );
     if( p_ml == NULL &&
             var_GetBool( p_this->p_libvlc, "load-media-library-on-startup" ) == false )
     {
         libvlc_priv (p_this->p_libvlc)->p_ml
-            = __ml_Create( VLC_OBJECT( p_this->p_libvlc ), NULL );
+            = ml_Create( VLC_OBJECT( p_this->p_libvlc ), NULL );
         p_ml = libvlc_priv (p_this->p_libvlc)->p_ml;
     }
     if( p_ml )
         vlc_object_hold( p_ml );
+    vlc_mutex_unlock( &( libvlc_priv( p_this->p_libvlc )->ml_lock ) );
     return p_ml;
 }
 
+#undef ml_Release
 /**
  * @brief Release a reference to the media library singleton
  * @param p_this Object that holds the reference
  */
-void __ml_Release( vlc_object_t* p_this )
+void ml_Release( vlc_object_t* p_this )
 {
     media_library_t* p_ml;
     p_ml = libvlc_priv (p_this->p_libvlc)->p_ml;
@@ -175,6 +180,7 @@ ml_media_t* media_New( media_library_t* p_ml, int id,
         return p_ml->functions.pf_GetMedia( p_ml, id, select, reload );
 }
 
+#undef ml_UpdateSimple
 /**
  * @brief Update a given table
  * @param p_media_library The media library object
@@ -183,12 +189,12 @@ ml_media_t* media_New( media_library_t* p_ml, int id,
  * @param id The id of the row to update
  * @param ... The update data. [SelectType [RoleType] Value] ... ML_END
  */
-int __ml_UpdateSimple( media_library_t *p_media_library,
+int ml_UpdateSimple( media_library_t *p_media_library,
                                      ml_select_e selected_type,
                                      const char* psz_lvalue,
                                      int id, ... )
 {
-    ml_element_t *update = NULL;
+    ml_element_t *update;
     vlc_array_t *array = vlc_array_new();
     int i_ret = VLC_SUCCESS;
 
@@ -280,7 +286,7 @@ int __ml_UpdateSimple( media_library_t *p_media_library,
  * If op = ML_OP_NONE, then you are connecting to a tree consisting of
  * only SPECIAL nodes.
  * If op = ML_OP_NOT, then right MUST be NULL
- * op must not be ML_OP_SPECIAL, @see __ml_FtreeSpec
+ * op must not be ML_OP_SPECIAL, @see ml_FtreeSpec
  * @param left part of the tree
  * @param right part of the tree
  * @return Pointer to new tree
@@ -329,6 +335,7 @@ ml_ftree_t* ml_OpConnectChilds( ml_op_e op, ml_ftree_t* left,
     return p_parent;
 }
 
+#undef ml_FtreeSpec
 /**
  * @brief Attaches a special node to a tree
  * @param tree Tree to attach special node to
@@ -338,7 +345,7 @@ ml_ftree_t* ml_OpConnectChilds( ml_op_e op, ml_ftree_t* left,
  * @return Pointer to new tree
  * @note Use the helpers
  */
-ml_ftree_t* __ml_FtreeSpec( ml_ftree_t* tree,
+ml_ftree_t* ml_FtreeSpec( ml_ftree_t* tree,
                                           ml_select_e crit,
                                           int limit,
                                           char* sort )