]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_media_list.h
LibVLC: remove last exception
[vlc] / include / vlc / libvlc_media_list.h
1 /*****************************************************************************
2  * libvlc_media_list.h:  libvlc_media_list API
3  *****************************************************************************
4  * Copyright (C) 1998-2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Pierre d'Herbemont
8  *
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.
13  *
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.
18  *
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  *****************************************************************************/
23
24 #ifndef LIBVLC_MEDIA_LIST_H
25 #define LIBVLC_MEDIA_LIST_H 1
26
27 /**
28  * \file
29  * This file defines libvlc_media_list API
30  */
31
32 # ifdef __cplusplus
33 extern "C" {
34 # endif
35
36 /*****************************************************************************
37  * Media List
38  *****************************************************************************/
39 /** \defgroup libvlc_media_list libvlc_media_list
40  * \ingroup libvlc
41  * LibVLC Media List, a media list holds multiple media descriptors
42  * @{
43  */
44
45 typedef struct libvlc_media_list_t libvlc_media_list_t;
46 typedef struct libvlc_media_list_view_t libvlc_media_list_view_t;
47
48 /**
49  * Create an empty media list.
50  *
51  * \param p_libvlc libvlc instance
52  * \return empty media list, or NULL on error
53  */
54 VLC_PUBLIC_API libvlc_media_list_t *
55     libvlc_media_list_new( libvlc_instance_t * );
56
57 /**
58  * Release media list created with libvlc_media_list_new().
59  *
60  * \param p_ml a media list created with libvlc_media_list_new()
61  */
62 VLC_PUBLIC_API void
63     libvlc_media_list_release( libvlc_media_list_t * );
64
65 /**
66  * Retain reference to a media list
67  *
68  * \param p_ml a media list created with libvlc_media_list_new()
69  */
70 VLC_PUBLIC_API void
71     libvlc_media_list_retain( libvlc_media_list_t * );
72
73 VLC_DEPRECATED_API int
74     libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
75                                         const char * psz_uri );
76
77 /**
78  * Associate media instance with this media list instance.
79  * If another media instance was present it will be released.
80  * The libvlc_media_list_lock should NOT be held upon entering this function.
81  *
82  * \param p_ml a media list instance
83  * \param p_mi media instance to add
84  */
85 VLC_PUBLIC_API void
86 libvlc_media_list_set_media( libvlc_media_list_t *p_ml, libvlc_media_t *p_md );
87
88 /**
89  * Get media instance from this media list instance. This action will increase
90  * the refcount on the media instance.
91  * The libvlc_media_list_lock should NOT be held upon entering this function.
92  *
93  * \param p_ml a media list instance
94  * \return media instance
95  */
96 VLC_PUBLIC_API libvlc_media_t *
97     libvlc_media_list_media( libvlc_media_list_t *p_ml );
98
99 /**
100  * Add media instance to media list
101  * The libvlc_media_list_lock should be held upon entering this function.
102  *
103  * \param p_ml a media list instance
104  * \param p_mi a media instance
105  * \return 0 on success, -1 if the media list is read-only
106  */
107 VLC_PUBLIC_API int
108 libvlc_media_list_add_media( libvlc_media_list_t *, libvlc_media_t * );
109
110 /**
111  * Insert media instance in media list on a position
112  * The libvlc_media_list_lock should be held upon entering this function.
113  *
114  * \param p_ml a media list instance
115  * \param p_mi a media instance
116  * \param i_pos position in array where to insert
117  * \return 0 on success, -1 if the media list si read-only
118  */
119 VLC_PUBLIC_API int
120 libvlc_media_list_insert_media( libvlc_media_list_t *,
121                                 libvlc_media_t *, int );
122
123 /**
124  * Remove media instance from media list on a position
125  * The libvlc_media_list_lock should be held upon entering this function.
126  *
127  * \param p_ml a media list instance
128  * \param i_pos position in array where to insert
129  * \return 0 on success, -1 if the list is read-only or the item was not found
130  */
131 VLC_PUBLIC_API int
132 libvlc_media_list_remove_index( libvlc_media_list_t *, int );
133
134 /**
135  * Get count on media list items
136  * The libvlc_media_list_lock should be held upon entering this function.
137  *
138  * \param p_ml a media list instance
139  * \return number of items in media list
140  */
141 VLC_PUBLIC_API int
142     libvlc_media_list_count( libvlc_media_list_t *p_ml );
143
144 /**
145  * List media instance in media list at a position
146  * The libvlc_media_list_lock should be held upon entering this function.
147  *
148  * \param p_ml a media list instance
149  * \param i_pos position in array where to insert
150  * \return media instance at position i_pos, or NULL if not found.
151  * In case of success, libvlc_media_retain() is called to increase the refcount
152  * on the media.
153  */
154 VLC_PUBLIC_API libvlc_media_t *
155     libvlc_media_list_item_at_index( libvlc_media_list_t *, int );
156 /**
157  * Find index position of List media instance in media list.
158  * Warning: the function will return the first matched position.
159  * The libvlc_media_list_lock should be held upon entering this function.
160  *
161  * \param p_ml a media list instance
162  * \param p_mi media list instance
163  * \return position of media instance
164  */
165 VLC_PUBLIC_API int
166     libvlc_media_list_index_of_item( libvlc_media_list_t *p_ml,
167                                      libvlc_media_t *p_mi );
168
169 /**
170  * This indicates if this media list is read-only from a user point of view
171  *
172  * \param p_ml media list instance
173  * \return 0 on readonly, 1 on readwrite
174  */
175 VLC_PUBLIC_API int
176     libvlc_media_list_is_readonly( libvlc_media_list_t * p_mlist );
177
178 /**
179  * Get lock on media list items
180  *
181  * \param p_ml a media list instance
182  */
183 VLC_PUBLIC_API void
184     libvlc_media_list_lock( libvlc_media_list_t * );
185
186 /**
187  * Release lock on media list items
188  * The libvlc_media_list_lock should be held upon entering this function.
189  *
190  * \param p_ml a media list instance
191  */
192 VLC_PUBLIC_API void
193     libvlc_media_list_unlock( libvlc_media_list_t * );
194
195 /**
196  * Get a flat media list view of media list items
197  *
198  * \param p_ml a media list instance
199  * \param p_ex an excpetion instance
200  * \return flat media list view instance
201  */
202 VLC_PUBLIC_API libvlc_media_list_view_t *
203     libvlc_media_list_flat_view( libvlc_media_list_t *,
204                                  libvlc_exception_t * );
205
206 /**
207  * Get a hierarchical media list view of media list items
208  *
209  * \param p_ml a media list instance
210  * \return hierarchical media list view instance
211  */
212 VLC_PUBLIC_API libvlc_media_list_view_t *
213     libvlc_media_list_hierarchical_view( libvlc_media_list_t * );
214
215 VLC_PUBLIC_API libvlc_media_list_view_t *
216     libvlc_media_list_hierarchical_node_view( libvlc_media_list_t * p_ml );
217
218 /**
219  * Get libvlc_event_manager from this media list instance.
220  * The p_event_manager is immutable, so you don't have to hold the lock
221  *
222  * \param p_ml a media list instance
223  * \return libvlc_event_manager
224  */
225 VLC_PUBLIC_API libvlc_event_manager_t *
226     libvlc_media_list_event_manager( libvlc_media_list_t *p_ml );
227
228 /** @} media_list */
229
230 # ifdef __cplusplus
231 }
232 # endif
233
234 #endif /* _LIBVLC_MEDIA_LIST_H */