]> git.sesse.net Git - vlc/blobdiff - src/control/libvlc_internal.h
Reference count libvlc. API break.
[vlc] / src / control / libvlc_internal.h
index 79c1b6d3df752b0f8dd5d430a0831e7f689551a8..764cd6adf7c6a93fcb12b4be2f5358e5eb2a7260 100644 (file)
@@ -39,7 +39,7 @@ extern "C" {
  * Internal creation and destruction functions
  ***************************************************************************/
 VLC_EXPORT (libvlc_int_t *, libvlc_InternalCreate, ( void ) );
-VLC_EXPORT (int, libvlc_InternalInit, ( libvlc_int_t *, int, char *ppsz_argv[] ) );
+VLC_EXPORT (int, libvlc_InternalInit, ( libvlc_int_t *, int, const char *ppsz_argv[] ) );
 VLC_EXPORT (int, libvlc_InternalCleanup, ( libvlc_int_t * ) );
 VLC_EXPORT (int, libvlc_InternalDestroy, ( libvlc_int_t *, vlc_bool_t ) );
 
@@ -67,6 +67,7 @@ struct libvlc_instance_t
     libvlc_int_t *p_libvlc_int;
     vlm_t        *p_vlm;
     int           b_playlist_locked;
+    unsigned      ref_count;
     vlc_mutex_t   instance_lock;
     vlc_mutex_t   event_callback_lock;
     struct libvlc_callback_entry_list_t *p_callback_list;
@@ -88,6 +89,7 @@ struct libvlc_media_descriptor_t
     vlc_dictionary_t   tags; /* To be merged with core's meta soon */
     struct libvlc_media_list_t *p_subitems; /* A media descriptor can have
                                            * Sub item */
+    void *p_user_data; /* Allows for VLC.framework to hook into media descriptor without creating a new VLCMedia object. */
 };
 
 struct libvlc_tag_query_t
@@ -100,16 +102,51 @@ struct libvlc_tag_query_t
 
 struct libvlc_media_list_t
 {
-    libvlc_event_manager_t * p_event_manager;
-    libvlc_instance_t *      p_libvlc_instance;
-    int                      i_refcount;
-    vlc_mutex_t              object_lock;
-    char *                   psz_name; /* Usually NULL */
-    DECL_ARRAY(void *)       items;
-    
+    libvlc_event_manager_t *    p_event_manager;
+    libvlc_instance_t *         p_libvlc_instance;
+    int                         i_refcount;
+    vlc_mutex_t                 object_lock;
+    libvlc_media_descriptor_t * p_md; /* The media_descriptor from which the
+                                       * mlist comes, if any. */
+    vlc_array_t                items;
     /* Other way to see that media list */
     /* Used in flat_media_list.c */
-    libvlc_media_list_t *    p_flat_mlist;
+    libvlc_media_list_t *       p_flat_mlist;
+};
+
+typedef int (*libvlc_media_list_view_release_func_t)( libvlc_media_list_view_t * p_mlv ) ;
+
+typedef int (*libvlc_media_list_view_count_func_t)( struct libvlc_media_list_view_t * p_mlv,
+        libvlc_exception_t * ) ;
+
+typedef libvlc_media_descriptor_t *
+        (*libvlc_media_list_view_item_at_index_func_t)(
+                struct libvlc_media_list_view_t * p_mlv,
+                int index,
+                libvlc_exception_t * ) ;
+
+/* A way to see a media list */
+struct libvlc_media_list_view_t
+{
+    libvlc_event_manager_t *    p_event_manager;
+    libvlc_instance_t *         p_libvlc_instance;
+    int                         i_refcount;
+    vlc_mutex_t                 object_lock;
+    
+    libvlc_media_list_t *       p_mlist;
+
+    struct libvlc_media_list_view_private_t * p_this_view_data;
+
+    /* Accessors */
+    libvlc_media_list_view_count_func_t         pf_count;
+    libvlc_media_list_view_item_at_index_func_t pf_item_at_index;
+
+    libvlc_media_list_view_release_func_t       pf_release;
+
+    /* Notification callback */
+    void (*pf_ml_item_added)(const libvlc_event_t *, void *);
+    void (*pf_ml_item_removed)(const libvlc_event_t *, void *);
 };
 
 struct libvlc_dynamic_media_list_t
@@ -134,18 +171,20 @@ struct libvlc_media_instance_t
     libvlc_media_descriptor_t * p_md; /* current media descriptor */
     libvlc_event_manager_t *    p_event_manager;
     libvlc_drawable_t           drawable;
+    
+    vlc_bool_t        b_own_its_input_thread;
 };
 
 struct libvlc_media_list_player_t
 {
-    libvlc_event_manager_t * p_event_manager;
-    libvlc_instance_t *      p_libvlc_instance;
-    int                      i_refcount;
-    vlc_mutex_t              object_lock;
-    int                      i_current_playing_index;
+    libvlc_event_manager_t *    p_event_manager;
+    libvlc_instance_t *         p_libvlc_instance;
+    int                         i_refcount;
+    vlc_mutex_t                 object_lock;
+    libvlc_media_list_path_t    current_playing_item_path;
     libvlc_media_descriptor_t * p_current_playing_item;
-    libvlc_media_list_t *    p_mlist;
-    libvlc_media_instance_t *  p_mi;
+    libvlc_media_list_t *       p_mlist;
+    libvlc_media_instance_t *   p_mi;
 };
 
 struct libvlc_media_library_t
@@ -164,7 +203,7 @@ struct libvlc_media_discoverer_t
     libvlc_media_list_t *    p_mlist;
 };
 
-/* 
+/*
  * Event Handling
  */
 /* Example usage
@@ -246,8 +285,19 @@ VLC_EXPORT (libvlc_media_descriptor_t *, libvlc_media_descriptor_new_from_input_
 VLC_EXPORT (libvlc_media_descriptor_t *, libvlc_media_descriptor_duplicate,
                         ( libvlc_media_descriptor_t * ) );
 
-/* Media List */
-VLC_EXPORT ( void, libvlc_media_list_flat_media_list_release, ( libvlc_media_list_t * ) );
+/* Media List View */
+VLC_EXPORT ( libvlc_media_list_view_t *, libvlc_media_list_view_new,
+                          ( libvlc_media_list_t * p_mlist,
+                            libvlc_media_list_view_count_func_t pf_count,
+                            libvlc_media_list_view_item_at_index_func_t pf_item_at_index,
+                            libvlc_media_list_view_release_func_t pf_release,
+                            void * this_view_data,
+                            libvlc_exception_t * p_e ) );
+
+VLC_EXPORT ( void, libvlc_media_list_view_set_ml_notification_callback, (
+                libvlc_media_list_view_t * p_mlv,
+                void (*item_added)(const libvlc_event_t *, void *),
+                void (*item_removed)(const libvlc_event_t *, void *) ));
 
 /* Events */
 VLC_EXPORT (void, libvlc_event_init, ( libvlc_instance_t *p_instance, libvlc_exception_t *p_e ) );