libvlc_media_list.h 6.36 KB
Newer Older
1 2 3
/*****************************************************************************
 * libvlc_media_list.h:  libvlc_media_list API
 *****************************************************************************
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
4
 * Copyright (C) 1998-2008 VLC authors and VideoLAN
5 6 7 8
 * $Id$
 *
 * Authors: Pierre d'Herbemont
 *
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
9 10 11
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
12 13 14 15
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
16 17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
18
 *
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
19 20 21
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 23
 *****************************************************************************/

24 25
#ifndef LIBVLC_MEDIA_LIST_H
#define LIBVLC_MEDIA_LIST_H 1
26

27 28 29 30 31
/**
 * \file
 * This file defines libvlc_media_list API
 */

32 33 34 35
# ifdef __cplusplus
extern "C" {
# endif

36
/** \defgroup libvlc_media_list LibVLC media list
37
 * \ingroup libvlc
38
 * A LibVLC media list holds multiple @ref libvlc_media_t media descriptors.
39 40 41
 * @{
 */

42 43
typedef struct libvlc_media_list_t libvlc_media_list_t;

44 45 46
/**
 * Create an empty media list.
 *
47
 * \param p_instance libvlc instance
48
 * \return empty media list, or NULL on error
49
 */
50
LIBVLC_API libvlc_media_list_t *
51
    libvlc_media_list_new( libvlc_instance_t *p_instance );
52

53 54 55 56 57
/**
 * Release media list created with libvlc_media_list_new().
 *
 * \param p_ml a media list created with libvlc_media_list_new()
 */
58
LIBVLC_API void
59
    libvlc_media_list_release( libvlc_media_list_t *p_ml );
60

61 62 63 64 65
/**
 * Retain reference to a media list
 *
 * \param p_ml a media list created with libvlc_media_list_new()
 */
66
LIBVLC_API void
67
    libvlc_media_list_retain( libvlc_media_list_t *p_ml );
68

69
LIBVLC_DEPRECATED int
70
    libvlc_media_list_add_file_content( libvlc_media_list_t * p_ml,
71
                                        const char * psz_uri );
72

73 74 75 76 77 78
/**
 * Associate media instance with this media list instance.
 * If another media instance was present it will be released.
 * The libvlc_media_list_lock should NOT be held upon entering this function.
 *
 * \param p_ml a media list instance
79
 * \param p_md media instance to add
80
 */
81
LIBVLC_API void
82
libvlc_media_list_set_media( libvlc_media_list_t *p_ml, libvlc_media_t *p_md );
83

84 85 86 87 88 89 90 91
/**
 * Get media instance from this media list instance. This action will increase
 * the refcount on the media instance.
 * The libvlc_media_list_lock should NOT be held upon entering this function.
 *
 * \param p_ml a media list instance
 * \return media instance
 */
92
LIBVLC_API libvlc_media_t *
93
    libvlc_media_list_media( libvlc_media_list_t *p_ml );
94

95 96 97 98 99
/**
 * Add media instance to media list
 * The libvlc_media_list_lock should be held upon entering this function.
 *
 * \param p_ml a media list instance
100
 * \param p_md a media instance
101
 * \return 0 on success, -1 if the media list is read-only
102
 */
103
LIBVLC_API int
104
libvlc_media_list_add_media( libvlc_media_list_t *p_ml, libvlc_media_t *p_md );
105 106 107 108 109 110

/**
 * Insert media instance in media list on a position
 * The libvlc_media_list_lock should be held upon entering this function.
 *
 * \param p_ml a media list instance
111
 * \param p_md a media instance
112
 * \param i_pos position in array where to insert
113
 * \return 0 on success, -1 if the media list is read-only
114
 */
115
LIBVLC_API int
116 117
libvlc_media_list_insert_media( libvlc_media_list_t *p_ml,
                                libvlc_media_t *p_md, int i_pos );
118

119 120 121 122 123 124
/**
 * Remove media instance from media list on a position
 * The libvlc_media_list_lock should be held upon entering this function.
 *
 * \param p_ml a media list instance
 * \param i_pos position in array where to insert
125
 * \return 0 on success, -1 if the list is read-only or the item was not found
126
 */
127
LIBVLC_API int
128
libvlc_media_list_remove_index( libvlc_media_list_t *p_ml, int i_pos );
129

130 131 132 133 134 135 136
/**
 * Get count on media list items
 * The libvlc_media_list_lock should be held upon entering this function.
 *
 * \param p_ml a media list instance
 * \return number of items in media list
 */
137
LIBVLC_API int
138
    libvlc_media_list_count( libvlc_media_list_t *p_ml );
139

140 141 142 143 144 145
/**
 * List media instance in media list at a position
 * The libvlc_media_list_lock should be held upon entering this function.
 *
 * \param p_ml a media list instance
 * \param i_pos position in array where to insert
146 147 148
 * \return media instance at position i_pos, or NULL if not found.
 * In case of success, libvlc_media_retain() is called to increase the refcount
 * on the media.
149
 */
150
LIBVLC_API libvlc_media_t *
151
    libvlc_media_list_item_at_index( libvlc_media_list_t *p_ml, int i_pos );
152
/**
153
 * Find index position of List media instance in media list.
154 155 156 157
 * Warning: the function will return the first matched position.
 * The libvlc_media_list_lock should be held upon entering this function.
 *
 * \param p_ml a media list instance
158
 * \param p_md media instance
159
 * \return position of media instance or -1 if media not found
160
 */
161
LIBVLC_API int
162
    libvlc_media_list_index_of_item( libvlc_media_list_t *p_ml,
163
                                     libvlc_media_t *p_md );
164

165 166 167 168
/**
 * This indicates if this media list is read-only from a user point of view
 *
 * \param p_ml media list instance
169
 * \return 1 on readonly, 0 on readwrite
170 171
 *
 * \libvlc_return_bool
172
 */
173
LIBVLC_API int
174
    libvlc_media_list_is_readonly( libvlc_media_list_t * p_ml );
175

176 177 178 179 180
/**
 * Get lock on media list items
 *
 * \param p_ml a media list instance
 */
181
LIBVLC_API void
182
    libvlc_media_list_lock( libvlc_media_list_t *p_ml );
183 184 185 186 187 188 189

/**
 * Release lock on media list items
 * The libvlc_media_list_lock should be held upon entering this function.
 *
 * \param p_ml a media list instance
 */
190
LIBVLC_API void
191
    libvlc_media_list_unlock( libvlc_media_list_t *p_ml );
192

193 194 195 196 197 198 199
/**
 * Get libvlc_event_manager from this media list instance.
 * The p_event_manager is immutable, so you don't have to hold the lock
 *
 * \param p_ml a media list instance
 * \return libvlc_event_manager
 */
200
LIBVLC_API libvlc_event_manager_t *
201
    libvlc_media_list_event_manager( libvlc_media_list_t *p_ml );
202 203 204 205 206 207 208 209

/** @} media_list */

# ifdef __cplusplus
}
# endif

#endif /* _LIBVLC_MEDIA_LIST_H */