1 /*****************************************************************************
2 * libvlc_media_list.h: libvlc_media_list API
3 *****************************************************************************
4 * Copyright (C) 1998-2008 the VideoLAN team
7 * Authors: Pierre d'Herbemont
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef LIBVLC_MEDIA_LIST_H
25 #define LIBVLC_MEDIA_LIST_H 1
29 * This file defines libvlc_media_list API
36 /*****************************************************************************
38 *****************************************************************************/
39 /** \defgroup libvlc_media_list libvlc_media_list
41 * LibVLC Media List, a media list holds multiple media descriptors
45 typedef struct libvlc_media_list_t libvlc_media_list_t;
46 typedef struct libvlc_media_list_view_t libvlc_media_list_view_t;
49 * Create an empty media list.
51 * \param p_libvlc libvlc instance
52 * \param p_e an initialized exception pointer
53 * \return empty media list
55 VLC_PUBLIC_API libvlc_media_list_t *
56 libvlc_media_list_new( libvlc_instance_t *, libvlc_exception_t * );
59 * Release media list created with libvlc_media_list_new().
61 * \param p_ml a media list created with libvlc_media_list_new()
64 libvlc_media_list_release( libvlc_media_list_t * );
67 * Retain reference to a media list
69 * \param p_ml a media list created with libvlc_media_list_new()
72 libvlc_media_list_retain( libvlc_media_list_t * );
74 VLC_DEPRECATED_API void
75 libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
77 libvlc_exception_t * p_e );
80 * Associate media instance with this media list instance.
81 * If another media instance was present it will be released.
82 * The libvlc_media_list_lock should NOT be held upon entering this function.
84 * \param p_ml a media list instance
85 * \param p_mi media instance to add
88 libvlc_media_list_set_media( libvlc_media_list_t *p_ml, libvlc_media_t *p_md );
91 * Get media instance from this media list instance. This action will increase
92 * the refcount on the media instance.
93 * The libvlc_media_list_lock should NOT be held upon entering this function.
95 * \param p_ml a media list instance
96 * \return media instance
98 VLC_PUBLIC_API libvlc_media_t *
99 libvlc_media_list_media( libvlc_media_list_t *p_ml );
102 * Add media instance to media list
103 * The libvlc_media_list_lock should be held upon entering this function.
105 * \param p_ml a media list instance
106 * \param p_mi a media instance
107 * \param p_e initialized exception object
110 libvlc_media_list_add_media( libvlc_media_list_t *,
112 libvlc_exception_t * );
115 * Insert media instance in media list on a position
116 * The libvlc_media_list_lock should be held upon entering this function.
118 * \param p_ml a media list instance
119 * \param p_mi a media instance
120 * \param i_pos position in array where to insert
121 * \param p_e initialized exception object
124 libvlc_media_list_insert_media( libvlc_media_list_t *,
127 libvlc_exception_t * );
129 * Remove media instance from media list on a position
130 * The libvlc_media_list_lock should be held upon entering this function.
132 * \param p_ml a media list instance
133 * \param i_pos position in array where to insert
134 * \param p_e initialized exception object
137 libvlc_media_list_remove_index( libvlc_media_list_t *, int,
138 libvlc_exception_t * );
141 * Get count on media list items
142 * The libvlc_media_list_lock should be held upon entering this function.
144 * \param p_ml a media list instance
145 * \return number of items in media list
148 libvlc_media_list_count( libvlc_media_list_t *p_ml );
151 * List media instance in media list at a position
152 * The libvlc_media_list_lock should be held upon entering this function.
154 * \param p_ml a media list instance
155 * \param i_pos position in array where to insert
156 * \param p_e initialized exception object
157 * \return media instance at position i_pos and libvlc_media_retain() has been called to increase the refcount on this object.
159 VLC_PUBLIC_API libvlc_media_t *
160 libvlc_media_list_item_at_index( libvlc_media_list_t *, int,
161 libvlc_exception_t * );
163 * Find index position of List media instance in media list.
164 * Warning: the function will return the first matched position.
165 * The libvlc_media_list_lock should be held upon entering this function.
167 * \param p_ml a media list instance
168 * \param p_mi media list instance
169 * \return position of media instance
172 libvlc_media_list_index_of_item( libvlc_media_list_t *p_ml,
173 libvlc_media_t *p_mi );
176 * This indicates if this media list is read-only from a user point of view
178 * \param p_ml media list instance
179 * \return 0 on readonly, 1 on readwrite
182 libvlc_media_list_is_readonly( libvlc_media_list_t * p_mlist );
185 * Get lock on media list items
187 * \param p_ml a media list instance
190 libvlc_media_list_lock( libvlc_media_list_t * );
193 * Release lock on media list items
194 * The libvlc_media_list_lock should be held upon entering this function.
196 * \param p_ml a media list instance
199 libvlc_media_list_unlock( libvlc_media_list_t * );
202 * Get a flat media list view of media list items
204 * \param p_ml a media list instance
205 * \param p_ex an excpetion instance
206 * \return flat media list view instance
208 VLC_PUBLIC_API libvlc_media_list_view_t *
209 libvlc_media_list_flat_view( libvlc_media_list_t *,
210 libvlc_exception_t * );
213 * Get a hierarchical media list view of media list items
215 * \param p_ml a media list instance
216 * \param p_ex an exception instance
217 * \return hierarchical media list view instance
219 VLC_PUBLIC_API libvlc_media_list_view_t *
220 libvlc_media_list_hierarchical_view( libvlc_media_list_t *,
221 libvlc_exception_t * );
223 VLC_PUBLIC_API libvlc_media_list_view_t *
224 libvlc_media_list_hierarchical_node_view( libvlc_media_list_t * p_ml,
225 libvlc_exception_t * p_ex);
228 * Get libvlc_event_manager from this media list instance.
229 * The p_event_manager is immutable, so you don't have to hold the lock
231 * \param p_ml a media list instance
232 * \return libvlc_event_manager
234 VLC_PUBLIC_API libvlc_event_manager_t *
235 libvlc_media_list_event_manager( libvlc_media_list_t *p_ml );
243 #endif /* _LIBVLC_MEDIA_LIST_H */