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
40 #define WINDOWHANDLE HWND
42 #define WINDOWHANDLE int
45 #include <vlc/mediacontrol_structures.h>
48 * RGBPicture structure
49 * This generic structure holds a picture in an encoding specified by type.
58 } mediacontrol_RGBPicture;
62 * A simple list of strings.
67 } mediacontrol_PlaylistSeq;
72 } mediacontrol_Exception;
77 #define mediacontrol_PositionKeyNotSupported 1
78 #define mediacontrol_PositionOriginNotSupported 2
79 #define mediacontrol_InvalidPosition 3
80 #define mediacontrol_PlaylistException 4
81 #define mediacontrol_InternalException 5
84 * mediacontrol_Instance is an opaque structure, defined in
85 * mediacontrol_internal.h. API users do not have to mess with it.
87 typedef struct mediacontrol_Instance mediacontrol_Instance;
90 * Possible player status
92 enum mediacontrol_PlayerStatusList
94 mediacontrol_PlayingStatus, mediacontrol_PauseStatus,
95 mediacontrol_ForwardStatus, mediacontrol_BackwardStatus,
96 mediacontrol_InitStatus, mediacontrol_EndStatus,
97 mediacontrol_UndefinedStatus
99 typedef enum mediacontrol_PlayerStatusList mediacontrol_PlayerStatus;
103 * This structure allows to quickly get various informations about the stream.
106 mediacontrol_PlayerStatus streamstatus;
107 char *url; /* The URL of the current media stream */
108 vlc_int64_t position; /* actual location in the stream (in ms) */
109 vlc_int64_t length; /* total length of the stream (in ms) */
110 } mediacontrol_StreamInformation;
112 /**************************************************************************
114 ***************************************************************************/
117 * Allocate a RGBPicture structure.
118 * \param datasize: the size of the data
120 mediacontrol_RGBPicture *mediacontrol_RGBPicture__alloc( int datasize );
123 * Free a RGBPicture structure.
124 * \param pic: the RGBPicture structure
126 void mediacontrol_RGBPicture__free( mediacontrol_RGBPicture *pic );
128 mediacontrol_RGBPicture *
129 _mediacontrol_createRGBPicture( int, int, long, vlc_int64_t l_date,
132 mediacontrol_PlaylistSeq *mediacontrol_PlaylistSeq__alloc( int size );
134 void mediacontrol_PlaylistSeq__free( mediacontrol_PlaylistSeq *ps );
137 * Initialize an exception structure.
138 * \param p_exception the exception to initialize. If NULL, a new exception will be created.
139 * \return the exception
141 mediacontrol_Exception *
142 mediacontrol_exception_init( mediacontrol_Exception *exception );
145 * Free an exception structure.
146 * \return the exception
148 void mediacontrol_exception_free(mediacontrol_Exception *exception);
150 /*****************************************************************************
152 *****************************************************************************/
155 * Create a MediaControl instance with parameters
156 * \param argc the number of arguments
157 * \param argv parameters
158 * \param exception an initialized exception pointer
159 * \return a mediacontrol_Instance
161 mediacontrol_Instance *
162 mediacontrol_new( int argc, char **argv, mediacontrol_Exception *exception );
165 * Create a MediaControl instance from an existing libvlc instance
166 * \param p_instance the libvlc instance
167 * \param exception an initialized exception pointer
168 * \return a mediacontrol_Instance
170 mediacontrol_Instance *
171 mediacontrol_new_from_instance( libvlc_instance_t* p_instance,
172 mediacontrol_Exception *exception );
175 * Get the associated libvlc instance
176 * \param self: the mediacontrol instance
177 * \return a libvlc instance
180 mediacontrol_get_libvlc_instance( mediacontrol_Instance* self );
183 * Get the current position
184 * \param self the mediacontrol instance
185 * \param an_origin the position origin
186 * \param a_key the position unit
187 * \param exception an initialized exception pointer
188 * \return a mediacontrol_Position
190 mediacontrol_Position * mediacontrol_get_media_position(
191 mediacontrol_Instance *self,
192 const mediacontrol_PositionOrigin an_origin,
193 const mediacontrol_PositionKey a_key,
194 mediacontrol_Exception *exception );
198 * \param self the mediacontrol instance
199 * \param a_position a mediacontrol_Position
200 * \param exception an initialized exception pointer
202 void mediacontrol_set_media_position( mediacontrol_Instance *self,
203 const mediacontrol_Position *a_position,
204 mediacontrol_Exception *exception );
207 * Play the movie at a given position
208 * \param self the mediacontrol instance
209 * \param a_position a mediacontrol_Position
210 * \param exception an initialized exception pointer
212 void mediacontrol_start( mediacontrol_Instance *self,
213 const mediacontrol_Position *a_position,
214 mediacontrol_Exception *exception );
217 * Pause the movie at a given position
218 * \param self the mediacontrol instance
219 * \param a_position a mediacontrol_Position (ignored for now)
220 * \param exception an initialized exception pointer
222 void mediacontrol_pause( mediacontrol_Instance *self,
223 const mediacontrol_Position *a_position,
224 mediacontrol_Exception *exception );
227 * Resume the movie at a given position
228 * \param self the mediacontrol instance
229 * \param a_position a mediacontrol_Position (ignored for now)
230 * \param exception an initialized exception pointer
232 void mediacontrol_resume( mediacontrol_Instance *self,
233 const mediacontrol_Position *a_position,
234 mediacontrol_Exception *exception );
237 * Stop the movie at a given position
238 * \param self the mediacontrol instance
239 * \param a_position a mediacontrol_Position (ignored for now)
240 * \param exception an initialized exception pointer
242 void mediacontrol_stop( mediacontrol_Instance *self,
243 const mediacontrol_Position *a_position,
244 mediacontrol_Exception *exception );
248 * \param self the mediacontrol instance
250 void mediacontrol_exit( mediacontrol_Instance *self );
253 * Add a new MRL to the playlist
254 * \param self the mediacontrol instance
255 * \param psz_file the MRL
256 * \param exception an initialized exception pointer
258 void mediacontrol_playlist_add_item( mediacontrol_Instance *self,
259 const char* psz_file,
260 mediacontrol_Exception *exception );
263 * \param self the mediacontrol instance
264 * \param exception an initialized exception pointer
266 void mediacontrol_playlist_clear( mediacontrol_Instance *self,
267 mediacontrol_Exception *exception );
269 * Get a flattened view of the playlist
270 * \param self the mediacontrol instance
271 * \param exception an initialized exception pointer
272 * \return a list of strings
274 mediacontrol_PlaylistSeq *
275 mediacontrol_playlist_get_list( mediacontrol_Instance *self,
276 mediacontrol_Exception *exception );
279 /*****************************************************************************
281 *****************************************************************************/
284 * \param self the mediacontrol instance
285 * \param a_position the desired position (ignored for now)
286 * \param exception an initialized exception pointer
287 * \return a RGBpicture
289 mediacontrol_RGBPicture *
290 mediacontrol_snapshot( mediacontrol_Instance *self,
291 const mediacontrol_Position *a_position,
292 mediacontrol_Exception *exception );
294 /* Return a NULL terminated list */
296 * Get a list of all cached snapshots (unimplemented)
297 * \param self the mediacontrol instance
298 * \param exception an initialized exception pointer
299 * \return a NULL-terminated list of RGBpicture
301 mediacontrol_RGBPicture **
302 mediacontrol_all_snapshots( mediacontrol_Instance *self,
303 mediacontrol_Exception *exception );
306 * Displays the message string, between "begin" and "end" positions.
307 * \param self the mediacontrol instance
308 * \param message the message to display
309 * \param begin the begin position
310 * \param end the end position
311 * \param exception an initialized exception pointer
313 void mediacontrol_display_text( mediacontrol_Instance *self,
315 const mediacontrol_Position *begin,
316 const mediacontrol_Position *end,
317 mediacontrol_Exception *exception );
320 * Get information about a stream
321 * \param self the mediacontrol instance
322 * \param a_key the time unit
323 * \param exception an initialized exception pointer
324 * \return a mediacontrol_StreamInformation
326 mediacontrol_StreamInformation *
327 mediacontrol_get_stream_information( mediacontrol_Instance *self,
328 mediacontrol_PositionKey a_key,
329 mediacontrol_Exception *exception );
332 * Get the current audio level, normalized in [0..100]
333 * \param self the mediacontrol instance
334 * \param exception an initialized exception pointer
338 mediacontrol_sound_get_volume( mediacontrol_Instance *self,
339 mediacontrol_Exception *exception );
341 * Set the audio level
342 * \param self the mediacontrol instance
343 * \param volume the volume (normalized in [0..100])
344 * \param exception an initialized exception pointer
346 void mediacontrol_sound_set_volume( mediacontrol_Instance *self,
347 const unsigned short volume,
348 mediacontrol_Exception *exception );
351 * Set the video output window
352 * \param self the mediacontrol instance
353 * \param visual_id the Xid or HWND, depending on the platform
354 * \param exception an initialized exception pointer
356 vlc_bool_t mediacontrol_set_visual( mediacontrol_Instance *self,
357 WINDOWHANDLE visual_id,
358 mediacontrol_Exception *exception );
361 * Get the current playing rate, in percent
362 * \param self the mediacontrol instance
363 * \param exception an initialized exception pointer
366 int mediacontrol_get_rate( mediacontrol_Instance *self,
367 mediacontrol_Exception *exception );
370 * Set the playing rate, in percent
371 * \param self the mediacontrol instance
372 * \param rate the desired rate
373 * \param exception an initialized exception pointer
375 void mediacontrol_set_rate( mediacontrol_Instance *self,
377 mediacontrol_Exception *exception );
380 * Get current fullscreen status
381 * \param self the mediacontrol instance
382 * \param exception an initialized exception pointer
383 * \return the fullscreen status
385 int mediacontrol_get_fullscreen( mediacontrol_Instance *self,
386 mediacontrol_Exception *exception );
389 * Set fullscreen status
390 * \param self the mediacontrol instance
391 * \param b_fullscreen the desired status
392 * \param exception an initialized exception pointer
394 void mediacontrol_set_fullscreen( mediacontrol_Instance *self,
395 const int b_fullscreen,
396 mediacontrol_Exception *exception );