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;
48 * Create an empty media list.
50 * \param p_instance libvlc instance
51 * \return empty media list, or NULL on error
53 VLC_PUBLIC_API libvlc_media_list_t *
54 libvlc_media_list_new( libvlc_instance_t *p_instance );
57 * Release media list created with libvlc_media_list_new().
59 * \param p_ml a media list created with libvlc_media_list_new()
62 libvlc_media_list_release( libvlc_media_list_t *p_ml );
65 * Retain reference to a media list
67 * \param p_ml a media list created with libvlc_media_list_new()
70 libvlc_media_list_retain( libvlc_media_list_t *p_ml );
72 VLC_DEPRECATED_API int
73 libvlc_media_list_add_file_content( libvlc_media_list_t * p_ml,
74 const char * psz_uri );
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_md media instance to add
85 libvlc_media_list_set_media( libvlc_media_list_t *p_ml, libvlc_media_t *p_md );
88 * Get media instance from this media list instance. This action will increase
89 * the refcount on the media instance.
90 * The libvlc_media_list_lock should NOT be held upon entering this function.
92 * \param p_ml a media list instance
93 * \return media instance
95 VLC_PUBLIC_API libvlc_media_t *
96 libvlc_media_list_media( libvlc_media_list_t *p_ml );
99 * Add media instance to media list
100 * The libvlc_media_list_lock should be held upon entering this function.
102 * \param p_ml a media list instance
103 * \param p_md a media instance
104 * \return 0 on success, -1 if the media list is read-only
107 libvlc_media_list_add_media( libvlc_media_list_t *p_ml, libvlc_media_t *p_md );
110 * Insert media instance in media list on a position
111 * The libvlc_media_list_lock should be held upon entering this function.
113 * \param p_ml a media list instance
114 * \param p_md a media instance
115 * \param i_pos position in array where to insert
116 * \return 0 on success, -1 if the media list si read-only
119 libvlc_media_list_insert_media( libvlc_media_list_t *p_ml,
120 libvlc_media_t *p_md, int i_pos );
123 * Remove media instance from media list on a position
124 * The libvlc_media_list_lock should be held upon entering this function.
126 * \param p_ml a media list instance
127 * \param i_pos position in array where to insert
128 * \return 0 on success, -1 if the list is read-only or the item was not found
131 libvlc_media_list_remove_index( libvlc_media_list_t *p_ml, int i_pos );
134 * Get count on media list items
135 * The libvlc_media_list_lock should be held upon entering this function.
137 * \param p_ml a media list instance
138 * \return number of items in media list
141 libvlc_media_list_count( libvlc_media_list_t *p_ml );
144 * List media instance in media list at a position
145 * The libvlc_media_list_lock should be held upon entering this function.
147 * \param p_ml a media list instance
148 * \param i_pos position in array where to insert
149 * \return media instance at position i_pos, or NULL if not found.
150 * In case of success, libvlc_media_retain() is called to increase the refcount
153 VLC_PUBLIC_API libvlc_media_t *
154 libvlc_media_list_item_at_index( libvlc_media_list_t *p_ml, int i_pos );
156 * Find index position of List media instance in media list.
157 * Warning: the function will return the first matched position.
158 * The libvlc_media_list_lock should be held upon entering this function.
160 * \param p_ml a media list instance
161 * \param p_md media list instance
162 * \return position of media instance
165 libvlc_media_list_index_of_item( libvlc_media_list_t *p_ml,
166 libvlc_media_t *p_md );
169 * This indicates if this media list is read-only from a user point of view
171 * \param p_ml media list instance
172 * \return 0 on readonly, 1 on readwrite
175 libvlc_media_list_is_readonly( libvlc_media_list_t * p_ml );
178 * Get lock on media list items
180 * \param p_ml a media list instance
183 libvlc_media_list_lock( libvlc_media_list_t *p_ml );
186 * Release lock on media list items
187 * The libvlc_media_list_lock should be held upon entering this function.
189 * \param p_ml a media list instance
192 libvlc_media_list_unlock( libvlc_media_list_t *p_ml );
195 * Get libvlc_event_manager from this media list instance.
196 * The p_event_manager is immutable, so you don't have to hold the lock
198 * \param p_ml a media list instance
199 * \return libvlc_event_manager
201 VLC_PUBLIC_API libvlc_event_manager_t *
202 libvlc_media_list_event_manager( libvlc_media_list_t *p_ml );
210 #endif /* _LIBVLC_MEDIA_LIST_H */