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
46 * Create an empty media list.
48 * \param p_libvlc libvlc instance
49 * \param p_e an initialized exception pointer
50 * \return empty media list
52 VLC_PUBLIC_API libvlc_media_list_t *
53 libvlc_media_list_new( libvlc_instance_t *, libvlc_exception_t * );
56 * Release media list created with libvlc_media_list_new().
58 * \param p_ml a media list created with libvlc_media_list_new()
61 libvlc_media_list_release( libvlc_media_list_t * );
64 * Retain reference to a media list
66 * \param p_ml a media list created with libvlc_media_list_new()
69 libvlc_media_list_retain( libvlc_media_list_t * );
71 VLC_DEPRECATED_API void
72 libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
74 libvlc_exception_t * p_e );
77 * Associate media instance with this media list instance.
78 * If another media instance was present it will be released.
79 * The libvlc_media_list_lock should NOT be held upon entering this function.
81 * \param p_ml a media list instance
82 * \param p_mi media instance to add
83 * \param p_e initialized exception object
86 libvlc_media_list_set_media( libvlc_media_list_t *,
88 libvlc_exception_t *);
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 * \param p_e initialized exception object
97 * \return media instance
99 VLC_PUBLIC_API libvlc_media_t *
100 libvlc_media_list_media( libvlc_media_list_t *,
101 libvlc_exception_t *);
104 * Add media instance to media list
105 * The libvlc_media_list_lock should be held upon entering this function.
107 * \param p_ml a media list instance
108 * \param p_mi a media instance
109 * \param p_e initialized exception object
112 libvlc_media_list_add_media( libvlc_media_list_t *,
114 libvlc_exception_t * );
117 * Insert media instance in media list on a position
118 * The libvlc_media_list_lock should be held upon entering this function.
120 * \param p_ml a media list instance
121 * \param p_mi a media instance
122 * \param i_pos position in array where to insert
123 * \param p_e initialized exception object
126 libvlc_media_list_insert_media( libvlc_media_list_t *,
129 libvlc_exception_t * );
131 * Remove media instance from media list on a position
132 * The libvlc_media_list_lock should be held upon entering this function.
134 * \param p_ml a media list instance
135 * \param i_pos position in array where to insert
136 * \param p_e initialized exception object
139 libvlc_media_list_remove_index( libvlc_media_list_t *, int,
140 libvlc_exception_t * );
143 * Get count on media list items
144 * The libvlc_media_list_lock should be held upon entering this function.
146 * \param p_ml a media list instance
147 * \param p_e initialized exception object
148 * \return number of items in media list
151 libvlc_media_list_count( libvlc_media_list_t * p_mlist,
152 libvlc_exception_t * p_e );
155 * List media instance in media list at a position
156 * The libvlc_media_list_lock should be held upon entering this function.
158 * \param p_ml a media list instance
159 * \param i_pos position in array where to insert
160 * \param p_e initialized exception object
161 * \return media instance at position i_pos and libvlc_media_retain() has been called to increase the refcount on this object.
163 VLC_PUBLIC_API libvlc_media_t *
164 libvlc_media_list_item_at_index( libvlc_media_list_t *, int,
165 libvlc_exception_t * );
167 * Find index position of List media instance in media list.
168 * Warning: the function will return the first matched position.
169 * The libvlc_media_list_lock should be held upon entering this function.
171 * \param p_ml a media list instance
172 * \param p_mi media list instance
173 * \param p_e initialized exception object
174 * \return position of media instance
177 libvlc_media_list_index_of_item( libvlc_media_list_t *,
179 libvlc_exception_t * );
182 * This indicates if this media list is read-only from a user point of view
184 * \param p_ml media list instance
185 * \return 0 on readonly, 1 on readwrite
188 libvlc_media_list_is_readonly( libvlc_media_list_t * p_mlist );
191 * Get lock on media list items
193 * \param p_ml a media list instance
196 libvlc_media_list_lock( libvlc_media_list_t * );
199 * Release lock on media list items
200 * The libvlc_media_list_lock should be held upon entering this function.
202 * \param p_ml a media list instance
205 libvlc_media_list_unlock( libvlc_media_list_t * );
208 * Get a flat media list view of media list items
210 * \param p_ml a media list instance
211 * \param p_ex an excpetion instance
212 * \return flat media list view instance
214 VLC_PUBLIC_API libvlc_media_list_view_t *
215 libvlc_media_list_flat_view( libvlc_media_list_t *,
216 libvlc_exception_t * );
219 * Get a hierarchical media list view of media list items
221 * \param p_ml a media list instance
222 * \param p_ex an excpetion instance
223 * \return hierarchical media list view instance
225 VLC_PUBLIC_API libvlc_media_list_view_t *
226 libvlc_media_list_hierarchical_view( libvlc_media_list_t *,
227 libvlc_exception_t * );
229 VLC_PUBLIC_API libvlc_media_list_view_t *
230 libvlc_media_list_hierarchical_node_view( libvlc_media_list_t *,
231 libvlc_exception_t * );
234 * Get libvlc_event_manager from this media list instance.
235 * The p_event_manager is immutable, so you don't have to hold the lock
237 * \param p_ml a media list instance
238 * \param p_ex an excpetion instance
239 * \return libvlc_event_manager
241 VLC_PUBLIC_API libvlc_event_manager_t *
242 libvlc_media_list_event_manager( libvlc_media_list_t *,
243 libvlc_exception_t * );
245 /*****************************************************************************
247 *****************************************************************************/
248 /** \defgroup libvlc_media_list_view libvlc_media_list_view
249 * \ingroup libvlc_media_list
250 * LibVLC Media List View, represent a media_list using a different layout
254 * Retain reference to a media list view
256 * \param p_mlv a media list view created with libvlc_media_list_view_new()
259 libvlc_media_list_view_retain( libvlc_media_list_view_t * p_mlv );
262 * Release reference to a media list view. If the refcount reaches 0, then
263 * the object will be released.
265 * \param p_mlv a media list view created with libvlc_media_list_view_new()
268 libvlc_media_list_view_release( libvlc_media_list_view_t * p_mlv );
271 * Get libvlc_event_manager from this media list view instance.
272 * The p_event_manager is immutable, so you don't have to hold the lock
274 * \param p_mlv a media list view instance
275 * \return libvlc_event_manager
277 VLC_PUBLIC_API libvlc_event_manager_t *
278 libvlc_media_list_view_event_manager( libvlc_media_list_view_t * p_mlv );
281 * Get count on media list view items
283 * \param p_mlv a media list view instance
284 * \param p_e initialized exception object
285 * \return number of items in media list view
288 libvlc_media_list_view_count( libvlc_media_list_view_t * p_mlv,
289 libvlc_exception_t * p_e );
292 * List media instance in media list view at an index position
294 * \param p_mlv a media list view instance
295 * \param i_index index position in array where to insert
296 * \param p_e initialized exception object
297 * \return media instance at position i_pos and libvlc_media_retain() has been called to increase the refcount on this object.
299 VLC_PUBLIC_API libvlc_media_t *
300 libvlc_media_list_view_item_at_index( libvlc_media_list_view_t * p_mlv,
302 libvlc_exception_t * p_e );
304 VLC_PUBLIC_API libvlc_media_list_view_t *
305 libvlc_media_list_view_children_at_index( libvlc_media_list_view_t * p_mlv,
307 libvlc_exception_t * p_e );
309 VLC_PUBLIC_API libvlc_media_list_view_t *
310 libvlc_media_list_view_children_for_item( libvlc_media_list_view_t * p_mlv,
311 libvlc_media_t * p_md,
312 libvlc_exception_t * p_e );
315 * Get index position of media instance in media list view.
316 * The function will return the first occurence.
318 * \param p_mlv a media list view instance
319 * \param p_md media instance
320 * \param p_e initialized exception object
321 * \return index position in array of p_md
324 libvlc_media_list_view_index_of_item( libvlc_media_list_view_t * p_mlv,
325 libvlc_media_t * p_md,
326 libvlc_exception_t * p_e );
329 * Insert media instance in media list view at index position
331 * \param p_mlv a media list view instance
332 * \param p_md media instance
333 * \param index position in array where to insert
334 * \param p_e initialized exception object
337 libvlc_media_list_view_insert_at_index( libvlc_media_list_view_t * p_mlv,
338 libvlc_media_t * p_md,
340 libvlc_exception_t * p_e );
343 * Remove media instance in media list view from index position
345 * \param p_mlv a media list view instance
346 * \param index position in array of media instance to remove
347 * \param p_e initialized exception object
350 libvlc_media_list_view_remove_at_index( libvlc_media_list_view_t * p_mlv,
352 libvlc_exception_t * p_e );
355 libvlc_media_list_view_add_item( libvlc_media_list_view_t * p_mlv,
356 libvlc_media_t * p_md,
357 libvlc_exception_t * p_e );
359 VLC_PUBLIC_API libvlc_media_list_t *
360 libvlc_media_list_view_parent_media_list( libvlc_media_list_view_t * p_mlv,
361 libvlc_exception_t * p_e );
363 /** @} media_list_view */
365 /*****************************************************************************
367 *****************************************************************************/
368 /** \defgroup libvlc_media_list_player libvlc_media_list_player
369 * \ingroup libvlc_media_list_player
370 * LibVLC Media List Player, play a media_list. You can see that as a media
376 * Create new media_list_player.
378 * \param p_instance libvlc instance
379 * \param p_e initialized exception instance
380 * \return media list player instance
382 VLC_PUBLIC_API libvlc_media_list_player_t *
383 libvlc_media_list_player_new( libvlc_instance_t * p_instance,
384 libvlc_exception_t * p_e );
387 * Release media_list_player.
389 * \param p_mlp media list player instance
392 libvlc_media_list_player_release( libvlc_media_list_player_t * p_mlp );
395 * Replace media player in media_list_player with this instance.
397 * \param p_mlp media list player instance
398 * \param p_mi media player instance
399 * \param p_e initialized exception instance
402 libvlc_media_list_player_set_media_player(
403 libvlc_media_list_player_t * p_mlp,
404 libvlc_media_player_t * p_mi,
405 libvlc_exception_t * p_e );
408 libvlc_media_list_player_set_media_list(
409 libvlc_media_list_player_t * p_mlp,
410 libvlc_media_list_t * p_mlist,
411 libvlc_exception_t * p_e );
416 * \param p_mlp media list player instance
417 * \param p_e initialized exception instance
420 libvlc_media_list_player_play( libvlc_media_list_player_t * p_mlp,
421 libvlc_exception_t * p_e );
426 * \param p_mlp media list player instance
427 * \param p_e initialized exception instance
430 libvlc_media_list_player_pause( libvlc_media_list_player_t * p_mlp,
431 libvlc_exception_t * p_e );
434 * Is media list playing?
436 * \param p_mlp media list player instance
437 * \param p_e initialized exception instance
438 * \return true for playing and false for not playing
441 libvlc_media_list_player_is_playing( libvlc_media_list_player_t * p_mlp,
442 libvlc_exception_t * p_e );
445 * Get current libvlc_state of media list player
447 * \param p_mlp media list player instance
448 * \param p_e initialized exception instance
449 * \return libvlc_state_t for media list player
451 VLC_PUBLIC_API libvlc_state_t
452 libvlc_media_list_player_get_state( libvlc_media_list_player_t * p_mlp,
453 libvlc_exception_t * p_e );
456 * Play media list item at position index
458 * \param p_mlp media list player instance
459 * \param i_index index in media list to play
460 * \param p_e initialized exception instance
463 libvlc_media_list_player_play_item_at_index(
464 libvlc_media_list_player_t * p_mlp,
466 libvlc_exception_t * p_e );
469 libvlc_media_list_player_play_item(
470 libvlc_media_list_player_t * p_mlp,
471 libvlc_media_t * p_md,
472 libvlc_exception_t * p_e );
475 * Stop playing media list
477 * \param p_mlp media list player instance
478 * \param p_e initialized exception instance
481 libvlc_media_list_player_stop( libvlc_media_list_player_t * p_mlp,
482 libvlc_exception_t * p_e );
485 * Play next item from media list
487 * \param p_mlp media list player instance
488 * \param p_e initialized exception instance
491 libvlc_media_list_player_next( libvlc_media_list_player_t * p_mlp,
492 libvlc_exception_t * p_e );
494 /* NOTE: shouldn't there also be a libvlc_media_list_player_prev() */
496 /** @} media_list_player */
504 #endif /* _LIBVLC_MEDIA_LIST_H */