1 /*****************************************************************************
2 * control.h: global header for mediacontrol
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
7 * Authors: Olivier Aubert <olivier.aubert@liris.univ-lyon1.fr>
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.
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.
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 *****************************************************************************/
25 * \defgroup mediacontrol MediaControl
26 * This is the MediaControl API, * intended to provide a generic API to movie players.
32 #ifndef _VLC_CONTROL_H
33 #define _VLC_CONTROL_H 1
41 #define WINDOWHANDLE HWND
43 #define WINDOWHANDLE int
46 #include <vlc/mediacontrol_structures.h>
49 * RGBPicture structure
50 * This generic structure holds a picture in an encoding specified by type.
59 } mediacontrol_RGBPicture;
63 * A simple list of strings.
68 } mediacontrol_PlaylistSeq;
73 } mediacontrol_Exception;
78 #define mediacontrol_PositionKeyNotSupported 1
79 #define mediacontrol_PositionOriginNotSupported 2
80 #define mediacontrol_InvalidPosition 3
81 #define mediacontrol_PlaylistException 4
82 #define mediacontrol_InternalException 5
85 * mediacontrol_Instance is an opaque structure, defined in
86 * mediacontrol_internal.h. API users do not have to mess with it.
88 typedef struct mediacontrol_Instance mediacontrol_Instance;
91 * Possible player status
93 enum mediacontrol_PlayerStatusList
95 mediacontrol_PlayingStatus, mediacontrol_PauseStatus,
96 mediacontrol_ForwardStatus, mediacontrol_BackwardStatus,
97 mediacontrol_InitStatus, mediacontrol_EndStatus,
98 mediacontrol_UndefinedStatus
100 typedef enum mediacontrol_PlayerStatusList mediacontrol_PlayerStatus;
104 * This structure allows to quickly get various informations about the stream.
107 mediacontrol_PlayerStatus streamstatus;
108 char *url; /* The URL of the current media stream */
109 vlc_int64_t position; /* actual location in the stream (in ms) */
110 vlc_int64_t length; /* total length of the stream (in ms) */
111 } mediacontrol_StreamInformation;
113 /**************************************************************************
115 ***************************************************************************/
118 * Allocate a RGBPicture structure.
119 * \param datasize: the size of the data
121 mediacontrol_RGBPicture *mediacontrol_RGBPicture__alloc( int datasize );
124 * Free a RGBPicture structure.
125 * \param pic: the RGBPicture structure
127 VLC_PUBLIC_API void mediacontrol_RGBPicture__free( mediacontrol_RGBPicture *pic );
129 mediacontrol_RGBPicture *
130 _mediacontrol_createRGBPicture( int, int, long, vlc_int64_t l_date,
133 mediacontrol_PlaylistSeq *mediacontrol_PlaylistSeq__alloc( int size );
135 VLC_PUBLIC_API void mediacontrol_PlaylistSeq__free( mediacontrol_PlaylistSeq *ps );
138 * Initialize an exception structure.
139 * \param p_exception the exception to initialize. If NULL, a new exception will be created.
140 * \return the exception
142 VLC_PUBLIC_API mediacontrol_Exception *
143 mediacontrol_exception_init( mediacontrol_Exception *exception );
146 * Free an exception structure.
147 * \return the exception
149 VLC_PUBLIC_API void mediacontrol_exception_free(mediacontrol_Exception *exception);
151 /*****************************************************************************
153 *****************************************************************************/
156 * Create a MediaControl instance with parameters
157 * \param argc the number of arguments
158 * \param argv parameters
159 * \param exception an initialized exception pointer
160 * \return a mediacontrol_Instance
162 VLC_PUBLIC_API mediacontrol_Instance *
163 mediacontrol_new( int argc, char **argv, mediacontrol_Exception *exception );
166 * Create a MediaControl instance from an existing libvlc instance
167 * \param p_instance the libvlc instance
168 * \param exception an initialized exception pointer
169 * \return a mediacontrol_Instance
171 VLC_PUBLIC_API mediacontrol_Instance *
172 mediacontrol_new_from_instance( libvlc_instance_t* p_instance,
173 mediacontrol_Exception *exception );
176 * Get the associated libvlc instance
177 * \param self: the mediacontrol instance
178 * \return a libvlc instance
180 VLC_PUBLIC_API libvlc_instance_t*
181 mediacontrol_get_libvlc_instance( mediacontrol_Instance* self );
184 * Get the current position
185 * \param self the mediacontrol instance
186 * \param an_origin the position origin
187 * \param a_key the position unit
188 * \param exception an initialized exception pointer
189 * \return a mediacontrol_Position
191 VLC_PUBLIC_API mediacontrol_Position * mediacontrol_get_media_position(
192 mediacontrol_Instance *self,
193 const mediacontrol_PositionOrigin an_origin,
194 const mediacontrol_PositionKey a_key,
195 mediacontrol_Exception *exception );
199 * \param self the mediacontrol instance
200 * \param a_position a mediacontrol_Position
201 * \param exception an initialized exception pointer
203 VLC_PUBLIC_API void mediacontrol_set_media_position( mediacontrol_Instance *self,
204 const mediacontrol_Position *a_position,
205 mediacontrol_Exception *exception );
208 * Play the movie at a given position
209 * \param self the mediacontrol instance
210 * \param a_position a mediacontrol_Position
211 * \param exception an initialized exception pointer
213 VLC_PUBLIC_API void mediacontrol_start( mediacontrol_Instance *self,
214 const mediacontrol_Position *a_position,
215 mediacontrol_Exception *exception );
218 * Pause the movie at a given position
219 * \param self the mediacontrol instance
220 * \param a_position a mediacontrol_Position (ignored for now)
221 * \param exception an initialized exception pointer
223 VLC_PUBLIC_API void mediacontrol_pause( mediacontrol_Instance *self,
224 const mediacontrol_Position *a_position,
225 mediacontrol_Exception *exception );
228 * Resume the movie at a given position
229 * \param self the mediacontrol instance
230 * \param a_position a mediacontrol_Position (ignored for now)
231 * \param exception an initialized exception pointer
233 VLC_PUBLIC_API void mediacontrol_resume( mediacontrol_Instance *self,
234 const mediacontrol_Position *a_position,
235 mediacontrol_Exception *exception );
238 * Stop the movie at a given position
239 * \param self the mediacontrol instance
240 * \param a_position a mediacontrol_Position (ignored for now)
241 * \param exception an initialized exception pointer
243 VLC_PUBLIC_API void mediacontrol_stop( mediacontrol_Instance *self,
244 const mediacontrol_Position *a_position,
245 mediacontrol_Exception *exception );
249 * \param self the mediacontrol instance
251 VLC_PUBLIC_API void mediacontrol_exit( mediacontrol_Instance *self );
254 * Add a new MRL to the playlist
255 * \param self the mediacontrol instance
256 * \param psz_file the MRL
257 * \param exception an initialized exception pointer
259 VLC_PUBLIC_API void mediacontrol_playlist_add_item( mediacontrol_Instance *self,
260 const char* psz_file,
261 mediacontrol_Exception *exception );
264 * \param self the mediacontrol instance
265 * \param exception an initialized exception pointer
267 VLC_PUBLIC_API void mediacontrol_playlist_clear( mediacontrol_Instance *self,
268 mediacontrol_Exception *exception );
270 * Get a flattened view of the playlist
271 * \param self the mediacontrol instance
272 * \param exception an initialized exception pointer
273 * \return a list of strings
275 VLC_PUBLIC_API mediacontrol_PlaylistSeq *
276 mediacontrol_playlist_get_list( mediacontrol_Instance *self,
277 mediacontrol_Exception *exception );
281 * \param self the mediacontrol instance
282 * \param exception an initialized exception pointer
285 mediacontrol_playlist_next_item( mediacontrol_Instance *self,
286 mediacontrol_Exception *exception );
288 /*****************************************************************************
290 *****************************************************************************/
293 * \param self the mediacontrol instance
294 * \param a_position the desired position (ignored for now)
295 * \param exception an initialized exception pointer
296 * \return a RGBpicture
298 VLC_PUBLIC_API mediacontrol_RGBPicture *
299 mediacontrol_snapshot( mediacontrol_Instance *self,
300 const mediacontrol_Position *a_position,
301 mediacontrol_Exception *exception );
303 /* Return a NULL terminated list */
305 * Get a list of all cached snapshots (unimplemented)
306 * \param self the mediacontrol instance
307 * \param exception an initialized exception pointer
308 * \return a NULL-terminated list of RGBpicture
310 VLC_PUBLIC_API mediacontrol_RGBPicture **
311 mediacontrol_all_snapshots( mediacontrol_Instance *self,
312 mediacontrol_Exception *exception );
315 * Displays the message string, between "begin" and "end" positions.
316 * \param self the mediacontrol instance
317 * \param message the message to display
318 * \param begin the begin position
319 * \param end the end position
320 * \param exception an initialized exception pointer
322 VLC_PUBLIC_API void mediacontrol_display_text( mediacontrol_Instance *self,
324 const mediacontrol_Position *begin,
325 const mediacontrol_Position *end,
326 mediacontrol_Exception *exception );
329 * Get information about a stream
330 * \param self the mediacontrol instance
331 * \param a_key the time unit
332 * \param exception an initialized exception pointer
333 * \return a mediacontrol_StreamInformation
335 VLC_PUBLIC_API mediacontrol_StreamInformation *
336 mediacontrol_get_stream_information( mediacontrol_Instance *self,
337 mediacontrol_PositionKey a_key,
338 mediacontrol_Exception *exception );
341 * Get the current audio level, normalized in [0..100]
342 * \param self the mediacontrol instance
343 * \param exception an initialized exception pointer
346 VLC_PUBLIC_API unsigned short
347 mediacontrol_sound_get_volume( mediacontrol_Instance *self,
348 mediacontrol_Exception *exception );
350 * Set the audio level
351 * \param self the mediacontrol instance
352 * \param volume the volume (normalized in [0..100])
353 * \param exception an initialized exception pointer
355 VLC_PUBLIC_API void mediacontrol_sound_set_volume( mediacontrol_Instance *self,
356 const unsigned short volume,
357 mediacontrol_Exception *exception );
360 * Set the video output window
361 * \param self the mediacontrol instance
362 * \param visual_id the Xid or HWND, depending on the platform
363 * \param exception an initialized exception pointer
365 VLC_PUBLIC_API vlc_bool_t mediacontrol_set_visual( mediacontrol_Instance *self,
366 WINDOWHANDLE visual_id,
367 mediacontrol_Exception *exception );
370 * Get the current playing rate, in percent
371 * \param self the mediacontrol instance
372 * \param exception an initialized exception pointer
375 VLC_PUBLIC_API int mediacontrol_get_rate( mediacontrol_Instance *self,
376 mediacontrol_Exception *exception );
379 * Set the playing rate, in percent
380 * \param self the mediacontrol instance
381 * \param rate the desired rate
382 * \param exception an initialized exception pointer
384 VLC_PUBLIC_API void mediacontrol_set_rate( mediacontrol_Instance *self,
386 mediacontrol_Exception *exception );
389 * Get current fullscreen status
390 * \param self the mediacontrol instance
391 * \param exception an initialized exception pointer
392 * \return the fullscreen status
394 VLC_PUBLIC_API int mediacontrol_get_fullscreen( mediacontrol_Instance *self,
395 mediacontrol_Exception *exception );
398 * Set fullscreen status
399 * \param self the mediacontrol instance
400 * \param b_fullscreen the desired status
401 * \param exception an initialized exception pointer
403 VLC_PUBLIC_API void mediacontrol_set_fullscreen( mediacontrol_Instance *self,
404 const int b_fullscreen,
405 mediacontrol_Exception *exception );