00001 /***************************************************************************** 00002 * libvlc.h: libvlc external API 00003 ***************************************************************************** 00004 * Copyright (C) 1998-2009 the VideoLAN team 00005 * $Id: c3cd38d045fd20f6ef8023977b92613637ff5fb1 $ 00006 * 00007 * Authors: Clément Stenac <zorglub@videolan.org> 00008 * Jean-Paul Saman <jpsaman@videolan.org> 00009 * Pierre d'Herbemont <pdherbemont@videolan.org> 00010 * 00011 * This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 00024 *****************************************************************************/ 00025 00026 /** 00027 * \file 00028 * This file defines libvlc_media external API 00029 */ 00030 00031 #ifndef VLC_LIBVLC_MEDIA_H 00032 #define VLC_LIBVLC_MEDIA_H 1 00033 00034 /***************************************************************************** 00035 * media 00036 *****************************************************************************/ 00037 /** \defgroup libvlc_media libvlc_media 00038 * \ingroup libvlc 00039 * LibVLC Media 00040 * @{ 00041 */ 00042 00043 typedef struct libvlc_media_t libvlc_media_t; 00044 00045 /* Meta Handling */ 00046 /** defgroup libvlc_meta libvlc_meta 00047 * \ingroup libvlc_media 00048 * LibVLC Media Meta 00049 * @{ 00050 */ 00051 00052 typedef enum libvlc_meta_t { 00053 libvlc_meta_Title, 00054 libvlc_meta_Artist, 00055 libvlc_meta_Genre, 00056 libvlc_meta_Copyright, 00057 libvlc_meta_Album, 00058 libvlc_meta_TrackNumber, 00059 libvlc_meta_Description, 00060 libvlc_meta_Rating, 00061 libvlc_meta_Date, 00062 libvlc_meta_Setting, 00063 libvlc_meta_URL, 00064 libvlc_meta_Language, 00065 libvlc_meta_NowPlaying, 00066 libvlc_meta_Publisher, 00067 libvlc_meta_EncodedBy, 00068 libvlc_meta_ArtworkURL, 00069 libvlc_meta_TrackID, 00070 /* Add new meta types HERE */ 00071 } libvlc_meta_t; 00072 00073 /** @}*/ 00074 00075 /** 00076 * Note the order of libvlc_state_t enum must match exactly the order of 00077 * @see mediacontrol_PlayerStatus, @see input_state_e enums, 00078 * and VideoLAN.LibVLC.State (at bindings/cil/src/media.cs). 00079 * 00080 * Expected states by web plugins are: 00081 * IDLE/CLOSE=0, OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4, 00082 * STOPPING=5, ENDED=6, ERROR=7 00083 */ 00084 typedef enum libvlc_state_t 00085 { 00086 libvlc_NothingSpecial=0, 00087 libvlc_Opening, 00088 libvlc_Buffering, 00089 libvlc_Playing, 00090 libvlc_Paused, 00091 libvlc_Stopped, 00092 libvlc_Ended, 00093 libvlc_Error 00094 } libvlc_state_t; 00095 00096 typedef enum libvlc_media_option_t 00097 { 00098 libvlc_media_option_trusted = 0x2, 00099 libvlc_media_option_unique = 0x100 00100 } libvlc_media_option_t; 00101 00102 /** 00103 * Create a media with the given MRL. 00104 * 00105 * \param p_instance the instance 00106 * \param psz_mrl the MRL to read 00107 * \param p_e an initialized exception pointer 00108 * \return the newly created media 00109 */ 00110 VLC_PUBLIC_API libvlc_media_t * libvlc_media_new( 00111 libvlc_instance_t *p_instance, 00112 const char * psz_mrl, 00113 libvlc_exception_t *p_e ); 00114 00115 /** 00116 * Create a media as an empty node with the passed name. 00117 * 00118 * \param p_instance the instance 00119 * \param psz_name the name of the node 00120 * \param p_e an initialized exception pointer 00121 * \return the new empty media 00122 */ 00123 VLC_PUBLIC_API libvlc_media_t * libvlc_media_new_as_node( 00124 libvlc_instance_t *p_instance, 00125 const char * psz_name, 00126 libvlc_exception_t *p_e ); 00127 00128 /** 00129 * Add an option to the media. 00130 * 00131 * This option will be used to determine how the media_player will 00132 * read the media. This allows to use VLC's advanced 00133 * reading/streaming options on a per-media basis. 00134 * 00135 * The options are detailed in vlc --long-help, for instance "--sout-all" 00136 * 00137 * \param p_instance the instance 00138 * \param ppsz_options the options (as a string) 00139 */ 00140 VLC_PUBLIC_API void libvlc_media_add_option( 00141 libvlc_media_t * p_md, 00142 const char * ppsz_options ); 00143 00144 /** 00145 * Add an option to the media with configurable flags. 00146 * 00147 * This option will be used to determine how the media_player will 00148 * read the media. This allows to use VLC's advanced 00149 * reading/streaming options on a per-media basis. 00150 * 00151 * The options are detailed in vlc --long-help, for instance "--sout-all" 00152 * 00153 * \param p_instance the instance 00154 * \param ppsz_options the options (as a string) 00155 * \param i_flags the flags for this option 00156 */ 00157 VLC_PUBLIC_API void libvlc_media_add_option_flag( 00158 libvlc_media_t * p_md, 00159 const char * ppsz_options, 00160 libvlc_media_option_t i_flags ); 00161 00162 00163 /** 00164 * Retain a reference to a media descriptor object (libvlc_media_t). Use 00165 * libvlc_media_release() to decrement the reference count of a 00166 * media descriptor object. 00167 * 00168 * \param p_meta_desc a media descriptor object. 00169 */ 00170 VLC_PUBLIC_API void libvlc_media_retain( 00171 libvlc_media_t *p_meta_desc ); 00172 00173 /** 00174 * Decrement the reference count of a media descriptor object. If the 00175 * reference count is 0, then libvlc_media_release() will release the 00176 * media descriptor object. It will send out an libvlc_MediaFreed event 00177 * to all listeners. If the media descriptor object has been released it 00178 * should not be used again. 00179 * 00180 * \param p_meta_desc a media descriptor object. 00181 */ 00182 VLC_PUBLIC_API void libvlc_media_release( 00183 libvlc_media_t *p_meta_desc ); 00184 00185 00186 /** 00187 * Get the media resource locator (mrl) from a media descriptor object 00188 * 00189 * \param p_md a media descriptor object 00190 * \return string with mrl of media descriptor object 00191 */ 00192 VLC_PUBLIC_API char * libvlc_media_get_mrl( libvlc_media_t * p_md ); 00193 00194 /** 00195 * Duplicate a media descriptor object. 00196 * 00197 * \param p_meta_desc a media descriptor object. 00198 */ 00199 VLC_PUBLIC_API libvlc_media_t * libvlc_media_duplicate( libvlc_media_t * ); 00200 00201 /** 00202 * Read the meta of the media. 00203 * 00204 * \param p_meta_desc the media to read 00205 * \param e_meta the meta to read 00206 * \return the media's meta 00207 */ 00208 VLC_PUBLIC_API char * libvlc_media_get_meta( 00209 libvlc_media_t *p_meta_desc, 00210 libvlc_meta_t e_meta ); 00211 00212 /** 00213 * Get current state of media descriptor object. Possible media states 00214 * are defined in libvlc_structures.c ( libvlc_NothingSpecial=0, 00215 * libvlc_Opening, libvlc_Buffering, libvlc_Playing, libvlc_Paused, 00216 * libvlc_Stopped, libvlc_Ended, 00217 * libvlc_Error). 00218 * 00219 * @see libvlc_state_t 00220 * \param p_meta_desc a media descriptor object 00221 * \return state of media descriptor object 00222 */ 00223 VLC_PUBLIC_API libvlc_state_t libvlc_media_get_state( 00224 libvlc_media_t *p_meta_desc ); 00225 00226 00227 /** 00228 * Get subitems of media descriptor object. This will increment 00229 * the reference count of supplied media descriptor object. Use 00230 * libvlc_media_list_release() to decrement the reference counting. 00231 * 00232 * \param p_md media descriptor object 00233 * \return list of media descriptor subitems or NULL 00234 */ 00235 00236 /* This method uses libvlc_media_list_t, however, media_list usage is optionnal 00237 * and this is here for convenience */ 00238 #define VLC_FORWARD_DECLARE_OBJECT(a) struct a 00239 00240 VLC_PUBLIC_API VLC_FORWARD_DECLARE_OBJECT(libvlc_media_list_t *) 00241 libvlc_media_subitems( libvlc_media_t *p_md ); 00242 00243 /** 00244 * Get event manager from media descriptor object. 00245 * NOTE: this function doesn't increment reference counting. 00246 * 00247 * \param p_md a media descriptor object 00248 * \return event manager object 00249 */ 00250 VLC_PUBLIC_API libvlc_event_manager_t * 00251 libvlc_media_event_manager( libvlc_media_t * p_md ); 00252 00253 /** 00254 * Get duration (in ms) of media descriptor object item. 00255 * 00256 * \param p_md media descriptor object 00257 * \param p_e an initialized exception object 00258 * \return duration of media item 00259 */ 00260 VLC_PUBLIC_API libvlc_time_t 00261 libvlc_media_get_duration( libvlc_media_t * p_md, 00262 libvlc_exception_t * p_e ); 00263 00264 /** 00265 * Get preparsed status for media descriptor object. 00266 * 00267 * \param p_md media descriptor object 00268 * \return true if media object has been preparsed otherwise it returns false 00269 */ 00270 VLC_PUBLIC_API int 00271 libvlc_media_is_preparsed( libvlc_media_t * p_md ); 00272 00273 /** 00274 * Sets media descriptor's user_data. user_data is specialized data 00275 * accessed by the host application, VLC.framework uses it as a pointer to 00276 * an native object that references a libvlc_media_t pointer 00277 * 00278 * \param p_md media descriptor object 00279 * \param p_new_user_data pointer to user data 00280 */ 00281 VLC_PUBLIC_API void 00282 libvlc_media_set_user_data( libvlc_media_t * p_md, 00283 void * p_new_user_data ); 00284 00285 /** 00286 * Get media descriptor's user_data. user_data is specialized data 00287 * accessed by the host application, VLC.framework uses it as a pointer to 00288 * an native object that references a libvlc_media_t pointer 00289 * 00290 * \param p_md media descriptor object 00291 */ 00292 VLC_PUBLIC_API void * 00293 libvlc_media_get_user_data( libvlc_media_t * p_md ); 00294 00295 /** @}*/ 00296 00297 #endif /* VLC_LIBVLC_MEDIA_H */
1.5.6