]> git.sesse.net Git - vlc/blob - include/vlc/mediacontrol.h
Rewrite a useful tooltip for Windows DShow.
[vlc] / include / vlc / mediacontrol.h
1 /*****************************************************************************
2  * control.h: global header for mediacontrol
3  *****************************************************************************
4  * Copyright (C) 2005 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Olivier Aubert <olivier.aubert@liris.univ-lyon1.fr>
8  *
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.
13  *
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.
18  *
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  *****************************************************************************/
23
24 /**
25  * \defgroup mediacontrol MediaControl
26  * This is the MediaControl API, * intended to provide a generic API to movie players.
27  *
28  * @{
29  */
30
31
32 #ifndef _VLC_CONTROL_H
33 #define _VLC_CONTROL_H 1
34
35 # ifdef __cplusplus
36 extern "C" {
37 # endif
38
39 #if defined( WIN32 )
40 #include <windows.h>
41 typedef HWND WINDOWHANDLE;
42 #else
43 typedef int WINDOWHANDLE;
44 #endif
45
46 #include <vlc/libvlc.h>
47 #include <vlc/mediacontrol_structures.h>
48
49 /**
50  * mediacontrol_Instance is an opaque structure, defined in
51  * mediacontrol_internal.h. API users do not have to mess with it.
52  */
53 typedef struct mediacontrol_Instance mediacontrol_Instance;
54
55 /**************************************************************************
56  *  Helper functions
57  ***************************************************************************/
58
59 /**
60  * Free a RGBPicture structure.
61  * \param pic: the RGBPicture structure
62  */
63 VLC_PUBLIC_API void mediacontrol_RGBPicture__free( mediacontrol_RGBPicture *pic );
64
65 VLC_PUBLIC_API void mediacontrol_PlaylistSeq__free( mediacontrol_PlaylistSeq *ps );
66
67 /**
68  * Free a StreamInformation structure.
69  * \param pic: the StreamInformation structure
70  */
71 VLC_PUBLIC_API void
72 mediacontrol_StreamInformation__free( mediacontrol_StreamInformation* p_si );
73
74 /**
75  * Instanciate and initialize an exception structure.
76  * \return the exception
77  */
78 VLC_PUBLIC_API mediacontrol_Exception *
79   mediacontrol_exception_create( void );
80
81 /**
82  * Initialize an existing exception structure.
83  * \param p_exception the exception to initialize.
84  */
85 VLC_PUBLIC_API void
86   mediacontrol_exception_init( mediacontrol_Exception *exception );
87
88 /**
89  * Clean up an existing exception structure after use.
90  * \param p_exception the exception to clean up.
91  */
92 VLC_PUBLIC_API void
93 mediacontrol_exception_cleanup( mediacontrol_Exception *exception );
94
95 /**
96  * Free an exception structure created with mediacontrol_exception_create().
97  * \return the exception
98  */
99 VLC_PUBLIC_API void mediacontrol_exception_free(mediacontrol_Exception *exception);
100
101 /*****************************************************************************
102  * Core functions
103  *****************************************************************************/
104
105 /**
106  * Create a MediaControl instance with parameters
107  * \param argc the number of arguments
108  * \param argv parameters
109  * \param exception an initialized exception pointer
110  * \return a mediacontrol_Instance
111  */
112 VLC_PUBLIC_API mediacontrol_Instance *
113 mediacontrol_new( int argc, char **argv, mediacontrol_Exception *exception );
114
115 /**
116  * Create a MediaControl instance from an existing libvlc instance
117  * \param p_instance the libvlc instance
118  * \param exception an initialized exception pointer
119  * \return a mediacontrol_Instance
120  */
121 VLC_PUBLIC_API mediacontrol_Instance *
122 mediacontrol_new_from_instance( libvlc_instance_t* p_instance,
123                 mediacontrol_Exception *exception );
124
125 /**
126  * Get the associated libvlc instance
127  * \param self: the mediacontrol instance
128  * \return a libvlc instance
129  */
130 VLC_PUBLIC_API libvlc_instance_t*
131 mediacontrol_get_libvlc_instance( mediacontrol_Instance* self );
132
133 /**
134  * Get the associated libvlc_media_player
135  * \param self: the mediacontrol instance
136  * \return a libvlc_media_player_t instance
137  */
138 VLC_PUBLIC_API libvlc_media_player_t*
139 mediacontrol_get_media_player( mediacontrol_Instance* self );
140
141 /**
142  * Get the current position
143  * \param self the mediacontrol instance
144  * \param an_origin the position origin
145  * \param a_key the position unit
146  * \param exception an initialized exception pointer
147  * \return a mediacontrol_Position
148  */
149 VLC_PUBLIC_API mediacontrol_Position * mediacontrol_get_media_position(
150                          mediacontrol_Instance *self,
151                          const mediacontrol_PositionOrigin an_origin,
152                          const mediacontrol_PositionKey a_key,
153                          mediacontrol_Exception *exception );
154
155 /**
156  * Set the position
157  * \param self the mediacontrol instance
158  * \param a_position a mediacontrol_Position
159  * \param exception an initialized exception pointer
160  */
161 VLC_PUBLIC_API void mediacontrol_set_media_position( mediacontrol_Instance *self,
162                                       const mediacontrol_Position *a_position,
163                                       mediacontrol_Exception *exception );
164
165 /**
166  * Play the movie at a given position
167  * \param self the mediacontrol instance
168  * \param a_position a mediacontrol_Position
169  * \param exception an initialized exception pointer
170  */
171 VLC_PUBLIC_API void mediacontrol_start( mediacontrol_Instance *self,
172                          const mediacontrol_Position *a_position,
173                          mediacontrol_Exception *exception );
174
175 /**
176  * Pause the movie at a given position
177  * \param self the mediacontrol instance
178  * \param exception an initialized exception pointer
179  */
180 VLC_PUBLIC_API void mediacontrol_pause( mediacontrol_Instance *self,
181                          mediacontrol_Exception *exception );
182
183 /**
184  * Resume the movie at a given position
185  * \param self the mediacontrol instance
186  * \param exception an initialized exception pointer
187  */
188 VLC_PUBLIC_API void mediacontrol_resume( mediacontrol_Instance *self,
189                           mediacontrol_Exception *exception );
190
191 /**
192  * Stop the movie at a given position
193  * \param self the mediacontrol instance
194  * \param exception an initialized exception pointer
195  */
196 VLC_PUBLIC_API void mediacontrol_stop( mediacontrol_Instance *self,
197                         mediacontrol_Exception *exception );
198
199 /**
200  * Exit the player
201  * \param self the mediacontrol instance
202  */
203 VLC_PUBLIC_API void mediacontrol_exit( mediacontrol_Instance *self );
204
205 /**
206  * Set the MRL to be played.
207  * \param self the mediacontrol instance
208  * \param psz_file the MRL
209  * \param exception an initialized exception pointer
210  */
211 VLC_PUBLIC_API void mediacontrol_set_mrl( mediacontrol_Instance *self,
212                                      const char* psz_file,
213                                      mediacontrol_Exception *exception );
214
215 /**
216  * Get the MRL to be played.
217  * \param self the mediacontrol instance
218  * \param exception an initialized exception pointer
219  */
220 VLC_PUBLIC_API char * mediacontrol_get_mrl( mediacontrol_Instance *self,
221                                             mediacontrol_Exception *exception );
222
223 /*****************************************************************************
224  * A/V functions
225  *****************************************************************************/
226 /**
227  * Get a snapshot
228  * \param self the mediacontrol instance
229  * \param a_position the desired position (ignored for now)
230  * \param exception an initialized exception pointer
231  * \return a RGBpicture
232  */
233 VLC_PUBLIC_API mediacontrol_RGBPicture *
234   mediacontrol_snapshot( mediacontrol_Instance *self,
235                          const mediacontrol_Position *a_position,
236                          mediacontrol_Exception *exception );
237
238 /**
239  *  Displays the message string, between "begin" and "end" positions.
240  * \param self the mediacontrol instance
241  * \param message the message to display
242  * \param begin the begin position
243  * \param end the end position
244  * \param exception an initialized exception pointer
245  */
246 VLC_PUBLIC_API void mediacontrol_display_text( mediacontrol_Instance *self,
247                                 const char *message,
248                                 const mediacontrol_Position *begin,
249                                 const mediacontrol_Position *end,
250                                 mediacontrol_Exception *exception );
251
252 /**
253  *  Get information about a stream
254  * \param self the mediacontrol instance
255  * \param a_key the time unit
256  * \param exception an initialized exception pointer
257  * \return a mediacontrol_StreamInformation
258  */
259 VLC_PUBLIC_API mediacontrol_StreamInformation *
260   mediacontrol_get_stream_information( mediacontrol_Instance *self,
261                                        mediacontrol_PositionKey a_key,
262                                        mediacontrol_Exception *exception );
263
264 /**
265  * Get the current audio level, normalized in [0..100]
266  * \param self the mediacontrol instance
267  * \param exception an initialized exception pointer
268  * \return the volume
269  */
270 VLC_PUBLIC_API unsigned short
271   mediacontrol_sound_get_volume( mediacontrol_Instance *self,
272                                  mediacontrol_Exception *exception );
273 /**
274  * Set the audio level
275  * \param self the mediacontrol instance
276  * \param volume the volume (normalized in [0..100])
277  * \param exception an initialized exception pointer
278  */
279 VLC_PUBLIC_API void mediacontrol_sound_set_volume( mediacontrol_Instance *self,
280                                     const unsigned short volume,
281                                     mediacontrol_Exception *exception );
282
283 /**
284  * Set the video output window
285  * \param self the mediacontrol instance
286  * \param visual_id the Xid or HWND, depending on the platform
287  * \param exception an initialized exception pointer
288  */
289 VLC_PUBLIC_API int mediacontrol_set_visual( mediacontrol_Instance *self,
290                                     WINDOWHANDLE visual_id,
291                                     mediacontrol_Exception *exception );
292
293 /**
294  * Get the current playing rate, in percent
295  * \param self the mediacontrol instance
296  * \param exception an initialized exception pointer
297  * \return the rate
298  */
299 VLC_PUBLIC_API int mediacontrol_get_rate( mediacontrol_Instance *self,
300                mediacontrol_Exception *exception );
301
302 /**
303  * Set the playing rate, in percent
304  * \param self the mediacontrol instance
305  * \param rate the desired rate
306  * \param exception an initialized exception pointer
307  */
308 VLC_PUBLIC_API void mediacontrol_set_rate( mediacontrol_Instance *self,
309                 const int rate,
310                 mediacontrol_Exception *exception );
311
312 /**
313  * Get current fullscreen status
314  * \param self the mediacontrol instance
315  * \param exception an initialized exception pointer
316  * \return the fullscreen status
317  */
318 VLC_PUBLIC_API int mediacontrol_get_fullscreen( mediacontrol_Instance *self,
319                  mediacontrol_Exception *exception );
320
321 /**
322  * Set fullscreen status
323  * \param self the mediacontrol instance
324  * \param b_fullscreen the desired status
325  * \param exception an initialized exception pointer
326  */
327 VLC_PUBLIC_API void mediacontrol_set_fullscreen( mediacontrol_Instance *self,
328                   const int b_fullscreen,
329                   mediacontrol_Exception *exception );
330
331 # ifdef __cplusplus
332 }
333 # endif
334
335 #endif
336
337 /** @} */