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 );
280 * \param self the mediacontrol instance
281 * \param exception an initialized exception pointer
284 mediacontrol_playlist_next_item( mediacontrol_Instance *self,
285 mediacontrol_Exception *exception );
287 /*****************************************************************************
289 *****************************************************************************/
292 * \param self the mediacontrol instance
293 * \param a_position the desired position (ignored for now)
294 * \param exception an initialized exception pointer
295 * \return a RGBpicture
297 mediacontrol_RGBPicture *
298 mediacontrol_snapshot( mediacontrol_Instance *self,
299 const mediacontrol_Position *a_position,
300 mediacontrol_Exception *exception );
302 /* Return a NULL terminated list */
304 * Get a list of all cached snapshots (unimplemented)
305 * \param self the mediacontrol instance
306 * \param exception an initialized exception pointer
307 * \return a NULL-terminated list of RGBpicture
309 mediacontrol_RGBPicture **
310 mediacontrol_all_snapshots( mediacontrol_Instance *self,
311 mediacontrol_Exception *exception );
314 * Displays the message string, between "begin" and "end" positions.
315 * \param self the mediacontrol instance
316 * \param message the message to display
317 * \param begin the begin position
318 * \param end the end position
319 * \param exception an initialized exception pointer
321 void mediacontrol_display_text( mediacontrol_Instance *self,
323 const mediacontrol_Position *begin,
324 const mediacontrol_Position *end,
325 mediacontrol_Exception *exception );
328 * Get information about a stream
329 * \param self the mediacontrol instance
330 * \param a_key the time unit
331 * \param exception an initialized exception pointer
332 * \return a mediacontrol_StreamInformation
334 mediacontrol_StreamInformation *
335 mediacontrol_get_stream_information( mediacontrol_Instance *self,
336 mediacontrol_PositionKey a_key,
337 mediacontrol_Exception *exception );
340 * Get the current audio level, normalized in [0..100]
341 * \param self the mediacontrol instance
342 * \param exception an initialized exception pointer
346 mediacontrol_sound_get_volume( mediacontrol_Instance *self,
347 mediacontrol_Exception *exception );
349 * Set the audio level
350 * \param self the mediacontrol instance
351 * \param volume the volume (normalized in [0..100])
352 * \param exception an initialized exception pointer
354 void mediacontrol_sound_set_volume( mediacontrol_Instance *self,
355 const unsigned short volume,
356 mediacontrol_Exception *exception );
359 * Set the video output window
360 * \param self the mediacontrol instance
361 * \param visual_id the Xid or HWND, depending on the platform
362 * \param exception an initialized exception pointer
364 vlc_bool_t mediacontrol_set_visual( mediacontrol_Instance *self,
365 WINDOWHANDLE visual_id,
366 mediacontrol_Exception *exception );
369 * Get the current playing rate, in percent
370 * \param self the mediacontrol instance
371 * \param exception an initialized exception pointer
374 int mediacontrol_get_rate( mediacontrol_Instance *self,
375 mediacontrol_Exception *exception );
378 * Set the playing rate, in percent
379 * \param self the mediacontrol instance
380 * \param rate the desired rate
381 * \param exception an initialized exception pointer
383 void mediacontrol_set_rate( mediacontrol_Instance *self,
385 mediacontrol_Exception *exception );
388 * Get current fullscreen status
389 * \param self the mediacontrol instance
390 * \param exception an initialized exception pointer
391 * \return the fullscreen status
393 int mediacontrol_get_fullscreen( mediacontrol_Instance *self,
394 mediacontrol_Exception *exception );
397 * Set fullscreen status
398 * \param self the mediacontrol instance
399 * \param b_fullscreen the desired status
400 * \param exception an initialized exception pointer
402 void mediacontrol_set_fullscreen( mediacontrol_Instance *self,
403 const int b_fullscreen,
404 mediacontrol_Exception *exception );