00001 /***************************************************************************** 00002 * libvlc_media_list.h: libvlc_media_list API 00003 ***************************************************************************** 00004 * Copyright (C) 1998-2008 VLC authors and VideoLAN 00005 * $Id: 015824bf54e656cc67838452c7e99a00a452af6e $ 00006 * 00007 * Authors: Pierre d'Herbemont 00008 * 00009 * This program is free software; you can redistribute it and/or modify it 00010 * under the terms of the GNU Lesser General Public License as published by 00011 * the Free Software Foundation; either version 2.1 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public License 00020 * along with this program; if not, write to the Free Software Foundation, 00021 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 00022 *****************************************************************************/ 00023 00024 #ifndef LIBVLC_MEDIA_LIST_H 00025 #define LIBVLC_MEDIA_LIST_H 1 00026 00027 /** 00028 * \file 00029 * This file defines libvlc_media_list API 00030 */ 00031 00032 # ifdef __cplusplus 00033 extern "C" { 00034 # endif 00035 00036 /** \defgroup libvlc_media_list LibVLC media list 00037 * \ingroup libvlc 00038 * A LibVLC media list holds multiple @ref libvlc_media_t media descriptors. 00039 * @{ 00040 */ 00041 00042 typedef struct libvlc_media_list_t libvlc_media_list_t; 00043 00044 /** 00045 * Create an empty media list. 00046 * 00047 * \param p_instance libvlc instance 00048 * \return empty media list, or NULL on error 00049 */ 00050 LIBVLC_API libvlc_media_list_t * 00051 libvlc_media_list_new( libvlc_instance_t *p_instance ); 00052 00053 /** 00054 * Release media list created with libvlc_media_list_new(). 00055 * 00056 * \param p_ml a media list created with libvlc_media_list_new() 00057 */ 00058 LIBVLC_API void 00059 libvlc_media_list_release( libvlc_media_list_t *p_ml ); 00060 00061 /** 00062 * Retain reference to a media list 00063 * 00064 * \param p_ml a media list created with libvlc_media_list_new() 00065 */ 00066 LIBVLC_API void 00067 libvlc_media_list_retain( libvlc_media_list_t *p_ml ); 00068 00069 LIBVLC_DEPRECATED int 00070 libvlc_media_list_add_file_content( libvlc_media_list_t * p_ml, 00071 const char * psz_uri ); 00072 00073 /** 00074 * Associate media instance with this media list instance. 00075 * If another media instance was present it will be released. 00076 * The libvlc_media_list_lock should NOT be held upon entering this function. 00077 * 00078 * \param p_ml a media list instance 00079 * \param p_md media instance to add 00080 */ 00081 LIBVLC_API void 00082 libvlc_media_list_set_media( libvlc_media_list_t *p_ml, libvlc_media_t *p_md ); 00083 00084 /** 00085 * Get media instance from this media list instance. This action will increase 00086 * the refcount on the media instance. 00087 * The libvlc_media_list_lock should NOT be held upon entering this function. 00088 * 00089 * \param p_ml a media list instance 00090 * \return media instance 00091 */ 00092 LIBVLC_API libvlc_media_t * 00093 libvlc_media_list_media( libvlc_media_list_t *p_ml ); 00094 00095 /** 00096 * Add media instance to media list 00097 * The libvlc_media_list_lock should be held upon entering this function. 00098 * 00099 * \param p_ml a media list instance 00100 * \param p_md a media instance 00101 * \return 0 on success, -1 if the media list is read-only 00102 */ 00103 LIBVLC_API int 00104 libvlc_media_list_add_media( libvlc_media_list_t *p_ml, libvlc_media_t *p_md ); 00105 00106 /** 00107 * Insert media instance in media list on a position 00108 * The libvlc_media_list_lock should be held upon entering this function. 00109 * 00110 * \param p_ml a media list instance 00111 * \param p_md a media instance 00112 * \param i_pos position in array where to insert 00113 * \return 0 on success, -1 if the media list is read-only 00114 */ 00115 LIBVLC_API int 00116 libvlc_media_list_insert_media( libvlc_media_list_t *p_ml, 00117 libvlc_media_t *p_md, int i_pos ); 00118 00119 /** 00120 * Remove media instance from media list on a position 00121 * The libvlc_media_list_lock should be held upon entering this function. 00122 * 00123 * \param p_ml a media list instance 00124 * \param i_pos position in array where to insert 00125 * \return 0 on success, -1 if the list is read-only or the item was not found 00126 */ 00127 LIBVLC_API int 00128 libvlc_media_list_remove_index( libvlc_media_list_t *p_ml, int i_pos ); 00129 00130 /** 00131 * Get count on media list items 00132 * The libvlc_media_list_lock should be held upon entering this function. 00133 * 00134 * \param p_ml a media list instance 00135 * \return number of items in media list 00136 */ 00137 LIBVLC_API int 00138 libvlc_media_list_count( libvlc_media_list_t *p_ml ); 00139 00140 /** 00141 * List media instance in media list at a position 00142 * The libvlc_media_list_lock should be held upon entering this function. 00143 * 00144 * \param p_ml a media list instance 00145 * \param i_pos position in array where to insert 00146 * \return media instance at position i_pos, or NULL if not found. 00147 * In case of success, libvlc_media_retain() is called to increase the refcount 00148 * on the media. 00149 */ 00150 LIBVLC_API libvlc_media_t * 00151 libvlc_media_list_item_at_index( libvlc_media_list_t *p_ml, int i_pos ); 00152 /** 00153 * Find index position of List media instance in media list. 00154 * Warning: the function will return the first matched position. 00155 * The libvlc_media_list_lock should be held upon entering this function. 00156 * 00157 * \param p_ml a media list instance 00158 * \param p_md media instance 00159 * \return position of media instance or -1 if media not found 00160 */ 00161 LIBVLC_API int 00162 libvlc_media_list_index_of_item( libvlc_media_list_t *p_ml, 00163 libvlc_media_t *p_md ); 00164 00165 /** 00166 * This indicates if this media list is read-only from a user point of view 00167 * 00168 * \param p_ml media list instance 00169 * \return 1 on readonly, 0 on readwrite 00170 * 00171 * \libvlc_return_bool 00172 */ 00173 LIBVLC_API int 00174 libvlc_media_list_is_readonly( libvlc_media_list_t * p_ml ); 00175 00176 /** 00177 * Get lock on media list items 00178 * 00179 * \param p_ml a media list instance 00180 */ 00181 LIBVLC_API void 00182 libvlc_media_list_lock( libvlc_media_list_t *p_ml ); 00183 00184 /** 00185 * Release lock on media list items 00186 * The libvlc_media_list_lock should be held upon entering this function. 00187 * 00188 * \param p_ml a media list instance 00189 */ 00190 LIBVLC_API void 00191 libvlc_media_list_unlock( libvlc_media_list_t *p_ml ); 00192 00193 /** 00194 * Get libvlc_event_manager from this media list instance. 00195 * The p_event_manager is immutable, so you don't have to hold the lock 00196 * 00197 * \param p_ml a media list instance 00198 * \return libvlc_event_manager 00199 */ 00200 LIBVLC_API libvlc_event_manager_t * 00201 libvlc_media_list_event_manager( libvlc_media_list_t *p_ml ); 00202 00203 /** @} media_list */ 00204 00205 # ifdef __cplusplus 00206 } 00207 # endif 00208 00209 #endif /* _LIBVLC_MEDIA_LIST_H */
1.7.1