1 /*****************************************************************************
2 * vlc.h: global header for vlc
3 *****************************************************************************
4 * Copyright (C) 1998-2004 VideoLAN
7 * Authors: Vincent Seguin <seguin@via.ecp.fr>
8 * Samuel Hocevar <sam@zoy.org>
9 * Gildas Bazin <gbazin@netcourrier.com>
10 * Derk-Jan Hartman <hartman at videolan dot org>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
25 *****************************************************************************/
28 * \defgroup libvlc Libvlc
29 * This is libvlc, the base library of the VLC program.
42 /*****************************************************************************
44 *****************************************************************************/
45 typedef int vlc_bool_t
;
46 typedef struct vlc_list_t vlc_list_t
;
47 typedef struct vlc_object_t vlc_object_t
;
59 vlc_object_t
* p_object
;
62 #if (defined( WIN32 ) && !defined( __MINGW32__ )) || defined( UNDER_CE )
63 signed __int64 i_time
;
65 signed long long i_time
;
68 struct { char *psz_name
; int i_object_id
; } var
;
70 /* Make sure the structure is at least 64bits */
71 struct { char a
, b
, c
, d
, e
, f
, g
, h
; } padding
;
81 vlc_value_t
* p_values
;
86 /*****************************************************************************
88 *****************************************************************************/
89 #define VLC_SUCCESS -0 /* No error */
90 #define VLC_ENOMEM -1 /* Not enough memory */
91 #define VLC_ETHREAD -2 /* Thread error */
92 #define VLC_ETIMEOUT -3 /* Timeout */
94 #define VLC_ENOMOD -10 /* Module not found */
96 #define VLC_ENOOBJ -20 /* Object not found */
97 #define VLC_EBADOBJ -21 /* Bad object type */
99 #define VLC_ENOVAR -30 /* Variable not found */
100 #define VLC_EBADVAR -31 /* Bad variable value */
102 #define VLC_EEXIT -255 /* Program exited */
103 #define VLC_EGENERIC -666 /* Generic error */
105 /*****************************************************************************
107 *****************************************************************************/
111 /*****************************************************************************
113 *****************************************************************************/
115 /* Used by VLC_AddTarget() */
116 #define PLAYLIST_INSERT 0x0001
117 #define PLAYLIST_REPLACE 0x0002
118 #define PLAYLIST_APPEND 0x0004
119 #define PLAYLIST_GO 0x0008
120 #define PLAYLIST_CHECK_INSERT 0x0010
122 #define PLAYLIST_END -666
124 /*****************************************************************************
125 * Required internal headers
126 *****************************************************************************/
127 #if defined( __VLC__ )
128 # include "vlc_common.h"
131 /*****************************************************************************
132 * Exported libvlc API
133 *****************************************************************************/
136 * Retrieve libvlc version
138 * \return a string containing the libvlc version
140 char const * VLC_Version ( void );
143 * Return an error string
145 * \param i_err an error code
146 * \return an error string
148 char const * VLC_Error ( int i_err
);
153 * This function allocates a vlc_t structure and returns a negative value
154 * in case of failure. Also, the thread system is initialized
156 * \return vlc object id or an error code
158 int VLC_Create( void );
161 * Initialize a vlc_t structure
163 * This function initializes a previously allocated vlc_t structure:
165 * - gettext initialization
166 * - message queue, module bank and playlist initialization
167 * - configuration and commandline parsing
169 * \param i_object a vlc object id
170 * \param i_argc the number of arguments
171 * \param ppsz_argv an array of arguments
172 * \return VLC_SUCCESS on success
174 int VLC_Init( int, int, char *[] );
179 * This function opens an interface plugin and runs it. If b_block is set
180 * to 0, VLC_AddIntf will return immediately and let the interface run in a
181 * separate thread. If b_block is set to 1, VLC_AddIntf will continue until
182 * user requests to quit.
184 * \param i_object a vlc object id
185 * \param psz_module a vlc module name of an interface
186 * \param b_block make this interface blocking
187 * \param b_play start playing when the interface is done loading
188 * \return VLC_SUCCESS on success
190 int VLC_AddIntf( int, char const *, vlc_bool_t
, vlc_bool_t
);
195 * This function sets p_vlc->b_die to VLC_TRUE, but does not do any other
196 * task. It is your duty to call VLC_CleanUp and VLC_Destroy afterwards.
198 * \param i_object a vlc object id
199 * \return VLC_SUCCESS on success
204 * Clean up all the intf, playlist, vout and aout
206 * This function requests all intf, playlist, vout and aout objects to finish
207 * and CleanUp. Only a blank VLC object should remain after this.
209 * \note This function was previously called VLC_Stop
211 * \param i_object a vlc object id
212 * \return VLC_SUCCESS on success
214 int VLC_CleanUp( int );
217 * Destroy all threads and the VLC object
219 * This function requests the running threads to finish, waits for their
220 * termination, and destroys their structure.
221 * Then it will de-init all VLC object initializations.
223 * \param i_object a vlc object id
224 * \return VLC_SUCCESS on success
226 int VLC_Destroy( int );
231 * This function sets a variable of VLC
233 * \note Was previously called VLC_Set
235 * \param i_object a vlc object id
236 * \param psz_var a vlc variable name
237 * \param value a vlc_value_t structure
238 * \return VLC_SUCCESS on success
240 int VLC_VariableSet( int, char const *, vlc_value_t
);
245 * This function gets the value of a variable of VLC
246 * It stores it in the p_value argument
248 * \note Was previously called VLC_Get
250 * \param i_object a vlc object id
251 * \param psz_var a vlc variable name
252 * \param p_value a pointer to a vlc_value_t structure
253 * \return VLC_SUCCESS on success
255 int VLC_VariableGet( int, char const *, vlc_value_t
* );
258 * Add a target to the current playlist
260 * This funtion will add a target to the current playlist. If a playlist does
261 * not exist, it will be created.
263 * \param i_object a vlc object id
264 * \param psz_target the URI of the target to play
265 * \param ppsz_options an array of strings with input options (ie. :input-repeat)
266 * \param i_options the amount of options in the ppsz_options array
267 * \param i_mode the insert mode to insert the target into the playlist (PLAYLIST_* defines)
268 * \param i_pos the position at which to add the new target (PLAYLIST_END for end)
269 * \return VLC_SUCCESS on success
271 int VLC_AddTarget( int, char const *, const char **, int, int, int );
274 * Start the playlist and play the currently selected playlist item
276 * If there is something in the playlist, and the playlist is not running,
277 * then start the playlist and play the currently selected playlist item.
278 * If an item is currently paused, then resume it.
280 * \param i_object a vlc object id
281 * \return VLC_SUCCESS on success
286 * Pause the currently playing item. Resume it if already paused
288 * If an item is currently playing then pause it.
289 * If the item is already paused, then resume playback.
291 * \param i_object a vlc object id
292 * \return VLC_SUCCESS on success
294 int VLC_Pause( int );
299 * If an item is currently playing then stop it.
300 * Set the playlist to a stopped state.
302 * \note This function is new. The old VLC_Stop is now called VLC_CleanUp
304 * \param i_object a vlc object id
305 * \return VLC_SUCCESS on success
310 * Tell if VLC is playing
312 * If an item is currently playing, it returns
313 * VLC_TRUE, else VLC_FALSE
315 * \param i_object a vlc object id
316 * \return VLC_TRUE or VLC_FALSE
318 vlc_bool_t
VLC_IsPlaying( int );
321 * Get the current position in a input
323 * Return the current position as a float
324 * This method should be used for time sliders etc
325 * \note For some inputs, this will be unknown.
327 * \param i_object a vlc object id
328 * \return a float in the range of 0.0 - 1.0
330 float VLC_PositionGet( int );
333 * Set the current position in a input
335 * Set the current position as a float
336 * This method should be used for time sliders etc
337 * \note For some inputs, this will be unknown.
339 * \param i_object a vlc object id
340 * \param i_position a float in the range of 0.0 - 1.0
341 * \return a float in the range of 0.0 - 1.0
343 float VLC_PositionSet( int, float );
346 * Get the current position in a input
348 * Return the current position in seconds from the start.
349 * \note For some inputs, this will be unknown.
351 * \param i_object a vlc object id
352 * \return the offset from 0:00 in seconds
354 int VLC_TimeGet( int );
357 * Seek to a position in the current input
359 * Seek i_seconds in the current input. If b_relative is set,
360 * then the seek will be relative to the current position, otherwise
361 * it will seek to i_seconds from the beginning of the input.
362 * \note For some inputs, this will be unknown.
364 * \param i_object a vlc object id
365 * \param i_seconds seconds from current position or from beginning of input
366 * \param b_relative seek relative from current position
367 * \return VLC_SUCCESS on success
369 int VLC_TimeSet( int, int, vlc_bool_t
);
372 * Get the total length of a input
374 * Return the total length in seconds from the current input.
375 * \note For some inputs, this will be unknown.
377 * \param i_object a vlc object id
378 * \return the length in seconds
380 int VLC_LengthGet( int );
383 * Play the input faster than realtime
385 * 2x, 4x, 8x faster than realtime
386 * \note For some inputs, this will be impossible.
388 * \param i_object a vlc object id
389 * \return the current speedrate
391 float VLC_SpeedFaster( int );
394 * Play the input slower than realtime
396 * 1/2x, 1/4x, 1/8x slower than realtime
397 * \note For some inputs, this will be impossible.
399 * \param i_object a vlc object id
400 * \return the current speedrate
402 float VLC_SpeedSlower( int );
405 * Return the current playlist item
407 * \param i_object a vlc object id
408 * \return the index of the playlistitem that is currently selected for play
410 int VLC_PlaylistIndex( int );
413 * Total amount of items in the playlist
415 * \param i_object a vlc object id
416 * \return amount of playlist items
418 int VLC_PlaylistNumberOfItems( int );
423 * Skip to the next playlistitem and play it.
425 * \param i_object a vlc object id
426 * \return VLC_SUCCESS on success
428 int VLC_PlaylistNext( int );
431 * Previous playlist item
433 * Skip to the previous playlistitem and play it.
435 * \param i_object a vlc object id
436 * \return VLC_SUCCESS on success
438 int VLC_PlaylistPrev( int );
441 * Clear the contents of the playlist
443 * Completly empty the entire playlist.
445 * \note Was previously called VLC_ClearPlaylist
447 * \param i_object a vlc object id
448 * \return VLC_SUCCESS on success
450 int VLC_PlaylistClear( int );
455 * \param i_object a vlc object id
456 * \param i_volume something in a range from 0-200
457 * \return the new volume (range 0-200 %)
459 int VLC_VolumeSet( int, int );
462 * Get the current volume
464 * Retrieve the current volume.
466 * \param i_object a vlc object id
467 * \return the current volume (range 0-200 %)
469 int VLC_VolumeGet( int );
472 * Mute/Unmute the volume
474 * \param i_object a vlc object id
475 * \return VLC_SUCCESS on success
477 int VLC_VolumeMute( int );
480 * Toggle Fullscreen mode
482 * Switch between normal and fullscreen video
484 * \param i_object a vlc object id
485 * \return VLC_SUCCESS on success
487 int VLC_FullScreen( int );
494 #endif /* <vlc/vlc.h> */