1 /*****************************************************************************
2 * libvlc_media_list.h: libvlc_media_list API
3 *****************************************************************************
4 * Copyright (C) 1998-2008 VLC authors and VideoLAN
6 * Authors: Pierre d'Herbemont
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 #ifndef LIBVLC_MEDIA_LIST_H
24 #define LIBVLC_MEDIA_LIST_H 1
30 /** \defgroup libvlc_media_list LibVLC media list
32 * A LibVLC media list holds multiple @ref libvlc_media_t media descriptors.
35 * LibVLC media list (playlist) external API
38 typedef struct libvlc_media_list_t libvlc_media_list_t
;
41 * Create an empty media list.
43 * \return empty media list, or NULL on error
45 LIBVLC_API libvlc_media_list_t
*libvlc_media_list_new(void);
48 * Release media list created with libvlc_media_list_new().
50 * \param p_ml a media list created with libvlc_media_list_new()
53 libvlc_media_list_release( libvlc_media_list_t
*p_ml
);
56 * Retain reference to a media list
58 * \param p_ml a media list created with libvlc_media_list_new()
61 libvlc_media_list_retain( libvlc_media_list_t
*p_ml
);
64 * Associate media instance with this media list instance.
65 * If another media instance was present it will be released.
66 * The libvlc_media_list_lock should NOT be held upon entering this function.
68 * \param p_ml a media list instance
69 * \param p_md media instance to add
72 libvlc_media_list_set_media( libvlc_media_list_t
*p_ml
, libvlc_media_t
*p_md
);
75 * Get media instance from this media list instance. This action will increase
76 * the refcount on the media instance.
77 * The libvlc_media_list_lock should NOT be held upon entering this function.
79 * \param p_ml a media list instance
80 * \return media instance
82 LIBVLC_API libvlc_media_t
*
83 libvlc_media_list_media( libvlc_media_list_t
*p_ml
);
86 * Add media instance to media list
87 * The libvlc_media_list_lock should be held upon entering this function.
89 * \param p_ml a media list instance
90 * \param p_md a media instance
91 * \return 0 on success, -1 if the media list is read-only
94 libvlc_media_list_add_media( libvlc_media_list_t
*p_ml
, libvlc_media_t
*p_md
);
97 * Insert media instance in media list on a position
98 * The libvlc_media_list_lock should be held upon entering this function.
100 * \param p_ml a media list instance
101 * \param p_md a media instance
102 * \param i_pos position in array where to insert
103 * \return 0 on success, -1 if the media list is read-only
106 libvlc_media_list_insert_media( libvlc_media_list_t
*p_ml
,
107 libvlc_media_t
*p_md
, int i_pos
);
110 * Remove media instance from 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 i_pos position in array where to insert
115 * \return 0 on success, -1 if the list is read-only or the item was not found
118 libvlc_media_list_remove_index( libvlc_media_list_t
*p_ml
, int i_pos
);
121 * Get count on media list items
122 * The libvlc_media_list_lock should be held upon entering this function.
124 * \param p_ml a media list instance
125 * \return number of items in media list
128 libvlc_media_list_count( libvlc_media_list_t
*p_ml
);
131 * List media instance in media list at 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 * \return media instance at position i_pos, or NULL if not found.
137 * In case of success, libvlc_media_retain() is called to increase the refcount
140 LIBVLC_API libvlc_media_t
*
141 libvlc_media_list_item_at_index( libvlc_media_list_t
*p_ml
, int i_pos
);
143 * Find index position of List media instance in media list.
144 * Warning: the function will return the first matched position.
145 * The libvlc_media_list_lock should be held upon entering this function.
147 * \param p_ml a media list instance
148 * \param p_md media instance
149 * \return position of media instance or -1 if media not found
152 libvlc_media_list_index_of_item( libvlc_media_list_t
*p_ml
,
153 libvlc_media_t
*p_md
);
156 * This indicates if this media list is read-only from a user point of view
158 * \param p_ml media list instance
159 * \retval true read-only
160 * \retval false read/write
162 LIBVLC_API
bool libvlc_media_list_is_readonly(libvlc_media_list_t
*p_ml
);
165 * Get lock on media list items
167 * \param p_ml a media list instance
170 libvlc_media_list_lock( libvlc_media_list_t
*p_ml
);
173 * Release lock on media list items
174 * The libvlc_media_list_lock should be held upon entering this function.
176 * \param p_ml a media list instance
179 libvlc_media_list_unlock( libvlc_media_list_t
*p_ml
);
182 * Get libvlc_event_manager from this media list instance.
183 * The p_event_manager is immutable, so you don't have to hold the lock
185 * \param p_ml a media list instance
186 * \return libvlc_event_manager
188 LIBVLC_API libvlc_event_manager_t
*
189 libvlc_media_list_event_manager( libvlc_media_list_t
*p_ml
);
197 #endif /* _LIBVLC_MEDIA_LIST_H */