1 /*****************************************************************************
2 * libvlc.h: libvlc external API
3 *****************************************************************************
4 * Copyright (C) 1998-2009 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Paul Saman <jpsaman@videolan.org>
9 * Pierre d'Herbemont <pdherbemont@videolan.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
28 * This file defines libvlc_media external API
31 #ifndef VLC_LIBVLC_MEDIA_H
32 #define VLC_LIBVLC_MEDIA_H 1
34 /*****************************************************************************
36 *****************************************************************************/
37 /** \defgroup libvlc_media libvlc_media
43 typedef struct libvlc_media_t libvlc_media_t;
46 /** defgroup libvlc_meta libvlc_meta
47 * \ingroup libvlc_media
52 typedef enum libvlc_meta_t {
56 libvlc_meta_Copyright,
58 libvlc_meta_TrackNumber,
59 libvlc_meta_Description,
65 libvlc_meta_NowPlaying,
66 libvlc_meta_Publisher,
67 libvlc_meta_EncodedBy,
68 libvlc_meta_ArtworkURL,
70 /* Add new meta types HERE */
76 * Note the order of libvlc_state_t enum must match exactly the order of
77 * @see mediacontrol_PlayerStatus, @see input_state_e enums,
78 * and VideoLAN.LibVLC.State (at bindings/cil/src/media.cs).
80 * Expected states by web plugins are:
81 * IDLE/CLOSE=0, OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4,
82 * STOPPING=5, ENDED=6, ERROR=7
84 typedef enum libvlc_state_t
86 libvlc_NothingSpecial=0,
97 * Create a media with the given MRL.
99 * \param p_instance the instance
100 * \param psz_mrl the MRL to read
101 * \param p_e an initialized exception pointer
102 * \return the newly created media
104 VLC_PUBLIC_API libvlc_media_t * libvlc_media_new(
105 libvlc_instance_t *p_instance,
106 const char * psz_mrl,
107 libvlc_exception_t *p_e );
110 * Create a media as an empty node with the passed name.
112 * \param p_instance the instance
113 * \param psz_name the name of the node
114 * \param p_e an initialized exception pointer
115 * \return the new empty media
117 VLC_PUBLIC_API libvlc_media_t * libvlc_media_new_as_node(
118 libvlc_instance_t *p_instance,
119 const char * psz_name,
120 libvlc_exception_t *p_e );
123 * Add an option to the media.
125 * This option will be used to determine how the media_player will
126 * read the media. This allows to use VLC's advanced
127 * reading/streaming options on a per-media basis.
129 * The options are detailed in vlc --long-help, for instance "--sout-all"
131 * \param p_instance the instance
132 * \param ppsz_options the options (as a string)
133 * \param p_e an initialized exception pointer
135 VLC_PUBLIC_API void libvlc_media_add_option(
136 libvlc_media_t * p_md,
137 const char * ppsz_options,
138 libvlc_exception_t * p_e );
140 * Add an option to the media from an untrusted source.
142 * This option will be used to determine how the media_player will
143 * read the media. This allows to use VLC's advanced
144 * reading/streaming options on a per-media basis.
146 * The options are detailed in vlc --long-help, for instance "--sout-all"
148 * \param p_instance the instance
149 * \param ppsz_options the options (as a string)
150 * \param p_e an initialized exception pointer
152 VLC_PUBLIC_API void libvlc_media_add_option_untrusted(
153 libvlc_media_t * p_md,
154 const char * ppsz_options,
155 libvlc_exception_t * p_e );
159 * Retain a reference to a media descriptor object (libvlc_media_t). Use
160 * libvlc_media_release() to decrement the reference count of a
161 * media descriptor object.
163 * \param p_meta_desc a media descriptor object.
165 VLC_PUBLIC_API void libvlc_media_retain(
166 libvlc_media_t *p_meta_desc );
169 * Decrement the reference count of a media descriptor object. If the
170 * reference count is 0, then libvlc_media_release() will release the
171 * media descriptor object. It will send out an libvlc_MediaFreed event
172 * to all listeners. If the media descriptor object has been released it
173 * should not be used again.
175 * \param p_meta_desc a media descriptor object.
177 VLC_PUBLIC_API void libvlc_media_release(
178 libvlc_media_t *p_meta_desc );
182 * Get the media resource locator (mrl) from a media descriptor object
184 * \param p_md a media descriptor object
185 * \param p_e an initialized exception object
186 * \return string with mrl of media descriptor object
188 VLC_PUBLIC_API char * libvlc_media_get_mrl( libvlc_media_t * p_md,
189 libvlc_exception_t * p_e );
192 * Duplicate a media descriptor object.
194 * \param p_meta_desc a media descriptor object.
196 VLC_PUBLIC_API libvlc_media_t * libvlc_media_duplicate( libvlc_media_t * );
199 * Read the meta of the media.
201 * \param p_meta_desc the media to read
202 * \param e_meta_desc the meta to read
203 * \param p_e an initialized exception pointer
204 * \return the media's meta
206 VLC_PUBLIC_API char * libvlc_media_get_meta(
207 libvlc_media_t *p_meta_desc,
208 libvlc_meta_t e_meta,
209 libvlc_exception_t *p_e );
211 * Get current state of media descriptor object. Possible media states
212 * are defined in libvlc_structures.c ( libvlc_NothingSpecial=0,
213 * libvlc_Opening, libvlc_Buffering, libvlc_Playing, libvlc_Paused,
214 * libvlc_Stopped, libvlc_Ended,
217 * @see libvlc_state_t
218 * \param p_meta_desc a media descriptor object
219 * \param p_e an initialized exception object
220 * \return state of media descriptor object
222 VLC_PUBLIC_API libvlc_state_t libvlc_media_get_state(
223 libvlc_media_t *p_meta_desc,
224 libvlc_exception_t *p_e );
228 * Get subitems of media descriptor object. This will increment
229 * the reference count of supplied media descriptor object. Use
230 * libvlc_media_list_release() to decrement the reference counting.
232 * \param p_md media descriptor object
233 * \param p_e initalized exception object
234 * \return list of media descriptor subitems or NULL
237 /* This method uses libvlc_media_list_t, however, media_list usage is optionnal
238 * and this is here for convenience */
239 #define VLC_FORWARD_DECLARE_OBJECT(a) struct a
241 VLC_PUBLIC_API VLC_FORWARD_DECLARE_OBJECT(libvlc_media_list_t *)
242 libvlc_media_subitems( libvlc_media_t *p_md,
243 libvlc_exception_t *p_e );
246 * Get event manager from media descriptor object.
247 * NOTE: this function doesn't increment reference counting.
249 * \param p_md a media descriptor object
250 * \param p_e an initialized exception object
251 * \return event manager object
253 VLC_PUBLIC_API libvlc_event_manager_t *
254 libvlc_media_event_manager( libvlc_media_t * p_md,
255 libvlc_exception_t * p_e );
258 * Get duration of media descriptor object item.
260 * \param p_md media descriptor object
261 * \param p_e an initialized exception object
262 * \return duration of media item
264 VLC_PUBLIC_API libvlc_time_t
265 libvlc_media_get_duration( libvlc_media_t * p_md,
266 libvlc_exception_t * p_e );
269 * Get preparsed status for media descriptor object.
271 * \param p_md media descriptor object
272 * \param p_e an initialized exception object
273 * \return true if media object has been preparsed otherwise it returns false
276 libvlc_media_is_preparsed( libvlc_media_t * p_md,
277 libvlc_exception_t * p_e );
280 * Sets media descriptor's user_data. user_data is specialized data
281 * accessed by the host application, VLC.framework uses it as a pointer to
282 * an native object that references a libvlc_media_t pointer
284 * \param p_md media descriptor object
285 * \param p_new_user_data pointer to user data
286 * \param p_e an initialized exception object
289 libvlc_media_set_user_data( libvlc_media_t * p_md,
290 void * p_new_user_data,
291 libvlc_exception_t * p_e);
294 * Get media descriptor's user_data. user_data is specialized data
295 * accessed by the host application, VLC.framework uses it as a pointer to
296 * an native object that references a libvlc_media_t pointer
298 * \param p_md media descriptor object
299 * \param p_e an initialized exception object
301 VLC_PUBLIC_API void *
302 libvlc_media_get_user_data( libvlc_media_t * p_md,
303 libvlc_exception_t * p_e);
307 #endif /* VLC_LIBVLC_MEDIA_H */