]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_media_list.h
Remove libvlc_get_vlc_instance hack from libvlc
[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 void
74     libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
75                                         const char * psz_uri,
76                                         libvlc_exception_t * p_e );
77
78 /**
79  * Associate media instance with this media list instance.
80  * If another media instance was present it will be released.
81  * The libvlc_media_list_lock should NOT be held upon entering this function.
82  *
83  * \param p_ml a media list instance
84  * \param p_mi media instance to add
85  */
86 VLC_PUBLIC_API void
87 libvlc_media_list_set_media( libvlc_media_list_t *p_ml, libvlc_media_t *p_md );
88
89 /**
90  * Get media instance from this media list instance. This action will increase
91  * the refcount on the media instance.
92  * The libvlc_media_list_lock should NOT be held upon entering this function.
93  *
94  * \param p_ml a media list instance
95  * \return media instance
96  */
97 VLC_PUBLIC_API libvlc_media_t *
98     libvlc_media_list_media( libvlc_media_list_t *p_ml );
99
100 /**
101  * Add media instance to media list
102  * The libvlc_media_list_lock should be held upon entering this function.
103  *
104  * \param p_ml a media list instance
105  * \param p_mi a media instance
106  * \param p_e initialized exception object
107  */
108 VLC_PUBLIC_API void
109     libvlc_media_list_add_media( libvlc_media_list_t *,
110                                             libvlc_media_t *,
111                                             libvlc_exception_t * );
112
113 /**
114  * Insert media instance in media list on a position
115  * The libvlc_media_list_lock should be held upon entering this function.
116  *
117  * \param p_ml a media list instance
118  * \param p_mi a media instance
119  * \param i_pos position in array where to insert
120  * \param p_e initialized exception object
121  */
122 VLC_PUBLIC_API void
123     libvlc_media_list_insert_media( libvlc_media_list_t *,
124                                                libvlc_media_t *,
125                                                int,
126                                                libvlc_exception_t * );
127 /**
128  * Remove media instance from media list on a position
129  * The libvlc_media_list_lock should be held upon entering this function.
130  *
131  * \param p_ml a media list instance
132  * \param i_pos position in array where to insert
133  * \param p_e initialized exception object
134  */
135 VLC_PUBLIC_API void
136     libvlc_media_list_remove_index( libvlc_media_list_t *, int,
137                                     libvlc_exception_t * );
138
139 /**
140  * Get count on media list items
141  * The libvlc_media_list_lock should be held upon entering this function.
142  *
143  * \param p_ml a media list instance
144  * \return number of items in media list
145  */
146 VLC_PUBLIC_API int
147     libvlc_media_list_count( libvlc_media_list_t *p_ml );
148
149 /**
150  * List media instance in media list at a position
151  * The libvlc_media_list_lock should be held upon entering this function.
152  *
153  * \param p_ml a media list instance
154  * \param i_pos position in array where to insert
155  * \param p_e initialized exception object
156  * \return media instance at position i_pos and libvlc_media_retain() has been called to increase the refcount on this object.
157  */
158 VLC_PUBLIC_API libvlc_media_t *
159     libvlc_media_list_item_at_index( libvlc_media_list_t *, int,
160                                      libvlc_exception_t * );
161 /**
162  * Find index position of List media instance in media list.
163  * Warning: the function will return the first matched position.
164  * The libvlc_media_list_lock should be held upon entering this function.
165  *
166  * \param p_ml a media list instance
167  * \param p_mi media list instance
168  * \return position of media instance
169  */
170 VLC_PUBLIC_API int
171     libvlc_media_list_index_of_item( libvlc_media_list_t *p_ml,
172                                      libvlc_media_t *p_mi );
173
174 /**
175  * This indicates if this media list is read-only from a user point of view
176  *
177  * \param p_ml media list instance
178  * \return 0 on readonly, 1 on readwrite
179  */
180 VLC_PUBLIC_API int
181     libvlc_media_list_is_readonly( libvlc_media_list_t * p_mlist );
182
183 /**
184  * Get lock on media list items
185  *
186  * \param p_ml a media list instance
187  */
188 VLC_PUBLIC_API void
189     libvlc_media_list_lock( libvlc_media_list_t * );
190
191 /**
192  * Release lock on media list items
193  * The libvlc_media_list_lock should be held upon entering this function.
194  *
195  * \param p_ml a media list instance
196  */
197 VLC_PUBLIC_API void
198     libvlc_media_list_unlock( libvlc_media_list_t * );
199
200 /**
201  * Get a flat media list view of media list items
202  *
203  * \param p_ml a media list instance
204  * \param p_ex an excpetion instance
205  * \return flat media list view instance
206  */
207 VLC_PUBLIC_API libvlc_media_list_view_t *
208     libvlc_media_list_flat_view( libvlc_media_list_t *,
209                                  libvlc_exception_t * );
210
211 /**
212  * Get a hierarchical media list view of media list items
213  *
214  * \param p_ml a media list instance
215  * \return hierarchical media list view instance
216  */
217 VLC_PUBLIC_API libvlc_media_list_view_t *
218     libvlc_media_list_hierarchical_view( libvlc_media_list_t * );
219
220 VLC_PUBLIC_API libvlc_media_list_view_t *
221     libvlc_media_list_hierarchical_node_view( libvlc_media_list_t * p_ml );
222
223 /**
224  * Get libvlc_event_manager from this media list instance.
225  * The p_event_manager is immutable, so you don't have to hold the lock
226  *
227  * \param p_ml a media list instance
228  * \return libvlc_event_manager
229  */
230 VLC_PUBLIC_API libvlc_event_manager_t *
231     libvlc_media_list_event_manager( libvlc_media_list_t *p_ml );
232
233 /** @} media_list */
234
235 # ifdef __cplusplus
236 }
237 # endif
238
239 #endif /* _LIBVLC_MEDIA_LIST_H */