1 /*****************************************************************************
2 * vlc.h: global header for libvlc (old-style)
3 *****************************************************************************
4 * Copyright (C) 1998-2004 the VideoLAN team
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 *****************************************************************************/
28 * \defgroup libvlc_old Libvlc Old
29 * This is libvlc, the base library of the VLC program.
30 * This is the legacy API. Please consider using the new libvlc API
43 /*****************************************************************************
45 *****************************************************************************/
46 typedef int vlc_bool_t;
47 typedef struct vlc_list_t vlc_list_t;
48 typedef struct vlc_object_t vlc_object_t;
50 #if (defined( WIN32 ) || defined( UNDER_CE )) && !defined( __MINGW32__ )
51 typedef signed __int64 vlc_int64_t;
53 typedef signed long long vlc_int64_t;
57 * \defgroup var_type Variable types
58 * These are the different types a vlc variable can have.
61 #define VLC_VAR_VOID 0x0010
62 #define VLC_VAR_BOOL 0x0020
63 #define VLC_VAR_INTEGER 0x0030
64 #define VLC_VAR_HOTKEY 0x0031
65 #define VLC_VAR_STRING 0x0040
66 #define VLC_VAR_MODULE 0x0041
67 #define VLC_VAR_FILE 0x0042
68 #define VLC_VAR_DIRECTORY 0x0043
69 #define VLC_VAR_VARIABLE 0x0044
70 #define VLC_VAR_FLOAT 0x0050
71 #define VLC_VAR_TIME 0x0060
72 #define VLC_VAR_ADDRESS 0x0070
73 #define VLC_VAR_MUTEX 0x0080
74 #define VLC_VAR_LIST 0x0090
87 vlc_object_t * p_object;
91 struct { char *psz_name; int i_object_id; } var;
93 /* Make sure the structure is at least 64bits */
94 struct { char a, b, c, d, e, f, g, h; } padding;
104 vlc_value_t * p_values;
109 /*****************************************************************************
111 *****************************************************************************/
112 #define VLC_SUCCESS -0 /* No error */
113 #define VLC_ENOMEM -1 /* Not enough memory */
114 #define VLC_ETHREAD -2 /* Thread error */
115 #define VLC_ETIMEOUT -3 /* Timeout */
117 #define VLC_ENOMOD -10 /* Module not found */
119 #define VLC_ENOOBJ -20 /* Object not found */
120 #define VLC_EBADOBJ -21 /* Bad object type */
122 #define VLC_ENOVAR -30 /* Variable not found */
123 #define VLC_EBADVAR -31 /* Bad variable value */
125 #define VLC_ENOITEM -40 /**< Item not found */
127 #define VLC_EEXIT -255 /* Program exited */
128 #define VLC_EEXITSUCCESS -999 /* Program exited successfully */
129 #define VLC_EGENERIC -666 /* Generic error */
131 /*****************************************************************************
133 *****************************************************************************/
137 /*****************************************************************************
139 *****************************************************************************/
141 /* Used by VLC_AddTarget() */
142 #define PLAYLIST_INSERT 0x0001
143 #define PLAYLIST_APPEND 0x0002
144 #define PLAYLIST_GO 0x0004
145 #define PLAYLIST_PREPARSE 0x0008
146 #define PLAYLIST_SPREPARSE 0x0010
147 #define PLAYLIST_NO_REBUILD 0x0020
149 #define PLAYLIST_END -666
151 /*****************************************************************************
152 * Required internal headers
153 *****************************************************************************/
154 #if defined( __LIBVLC__ )
155 # include "vlc_common.h"
158 /*****************************************************************************
159 * Exported libvlc API
160 *****************************************************************************/
161 #if !defined( __LIBVLC__ )
162 /* Otherwise they are declared and exported in vlc_common.h */
164 * Retrieve libvlc version
166 * \return a string containing the libvlc version
168 char const * VLC_Version ( void );
171 * Retrieve libvlc compile time
173 * \return a string containing the libvlc compile time
175 char const * VLC_CompileTime ( void );
178 * Retrieve the username of the libvlc builder
180 * \return a string containing the username of the libvlc builder
182 char const * VLC_CompileBy ( void );
185 * Retrieve the host of the libvlc builder
187 * \return a string containing the host of the libvlc builder
189 char const * VLC_CompileHost ( void );
192 * Retrieve the domain name of the host of the libvlc builder
194 * \return a string containing the domain name of the host of the libvlc builder
196 char const * VLC_CompileDomain ( void );
199 * Retrieve libvlc compiler version
201 * \return a string containing the libvlc compiler version
203 char const * VLC_Compiler ( void );
206 * Retrieve libvlc changeset
208 * \return a string containing the libvlc subversion changeset
210 char const * VLC_Changeset ( void );
213 * Return an error string
215 * \param i_err an error code
216 * \return an error string
218 char const * VLC_Error ( int i_err );
220 #endif /* __LIBVLC__ */
225 * This function allocates a vlc_t structure and returns a negative value
226 * in case of failure. Also, the thread system is initialized
228 * \return vlc object id or an error code
230 int VLC_Create( void );
233 * Initialize a vlc_t structure
235 * This function initializes a previously allocated vlc_t structure:
237 * - gettext initialization
238 * - message queue, module bank and playlist initialization
239 * - configuration and commandline parsing
241 * \param i_object a vlc object id
242 * \param i_argc the number of arguments
243 * \param ppsz_argv an array of arguments
244 * \return VLC_SUCCESS on success
246 int VLC_Init( int, int, char *[] );
251 * This function opens an interface plugin and runs it. If b_block is set
252 * to 0, VLC_AddIntf will return immediately and let the interface run in a
253 * separate thread. If b_block is set to 1, VLC_AddIntf will continue until
254 * user requests to quit.
256 * \param i_object a vlc object id
257 * \param psz_module a vlc module name of an interface
258 * \param b_block make this interface blocking
259 * \param b_play start playing when the interface is done loading
260 * \return VLC_SUCCESS on success
262 int VLC_AddIntf( int, char const *, vlc_bool_t, vlc_bool_t );
267 * This function sets p_vlc->b_die to VLC_TRUE, but does not do any other
268 * task. It is your duty to call VLC_CleanUp and VLC_Destroy afterwards.
270 * \param i_object a vlc object id
271 * \return VLC_SUCCESS on success
276 * Clean up all the intf, playlist, vout and aout
278 * This function requests all intf, playlist, vout and aout objects to finish
279 * and CleanUp. Only a blank VLC object should remain after this.
281 * \note This function was previously called VLC_Stop
283 * \param i_object a vlc object id
284 * \return VLC_SUCCESS on success
286 int VLC_CleanUp( int );
289 * Destroy all threads and the VLC object
291 * This function requests the running threads to finish, waits for their
292 * termination, and destroys their structure.
293 * Then it will de-init all VLC object initializations.
295 * \param i_object a vlc object id
296 * \return VLC_SUCCESS on success
298 int VLC_Destroy( int );
303 * This function sets a variable of VLC
305 * \note Was previously called VLC_Set
307 * \param i_object a vlc object id
308 * \param psz_var a vlc variable name
309 * \param value a vlc_value_t structure
310 * \return VLC_SUCCESS on success
312 int VLC_VariableSet( int, char const *, vlc_value_t );
317 * This function gets the value of a variable of VLC
318 * It stores it in the p_value argument
320 * \note Was previously called VLC_Get
322 * \param i_object a vlc object id
323 * \param psz_var a vlc variable name
324 * \param p_value a pointer to a vlc_value_t structure
325 * \return VLC_SUCCESS on success
327 int VLC_VariableGet( int, char const *, vlc_value_t * );
330 * Get a VLC variable type
332 * This function gets the type of a variable of VLC
333 * It stores it in the p_type argument
335 * \param i_object a vlc object id
336 * \param psz_var a vlc variable name
337 * \param pi_type a pointer to an integer
338 * \return VLC_SUCCESS on success
340 int VLC_VariableType( int, char const *, int * );
343 * Add a target to the current playlist
345 * This funtion will add a target to the current playlist. If a playlist does
346 * not exist, it will be created.
348 * \param i_object a vlc object id
349 * \param psz_target the URI of the target to play
350 * \param ppsz_options an array of strings with input options (ie. :input-repeat)
351 * \param i_options the amount of options in the ppsz_options array
352 * \param i_mode the insert mode to insert the target into the playlist (PLAYLIST_* defines)
353 * \param i_pos the position at which to add the new target (PLAYLIST_END for end)
354 * \return VLC_SUCCESS on success
356 int VLC_AddTarget( int, char const *, const char **, int, int, int );
359 * Start the playlist and play the currently selected playlist item
361 * If there is something in the playlist, and the playlist is not running,
362 * then start the playlist and play the currently selected playlist item.
363 * If an item is currently paused, then resume it.
365 * \param i_object a vlc object id
366 * \return VLC_SUCCESS on success
371 * Pause the currently playing item. Resume it if already paused
373 * If an item is currently playing then pause it.
374 * If the item is already paused, then resume playback.
376 * \param i_object a vlc object id
377 * \return VLC_SUCCESS on success
379 int VLC_Pause( int );
384 * If an item is currently playing then stop it.
385 * Set the playlist to a stopped state.
387 * \note This function is new. The old VLC_Stop is now called VLC_CleanUp
389 * \param i_object a vlc object id
390 * \return VLC_SUCCESS on success
395 * Tell if VLC is playing
397 * If an item is currently playing, it returns
398 * VLC_TRUE, else VLC_FALSE
400 * \param i_object a vlc object id
401 * \return VLC_TRUE or VLC_FALSE
403 vlc_bool_t VLC_IsPlaying( int );
406 * Get the current position in a input
408 * Return the current position as a float
409 * This method should be used for time sliders etc
410 * \note For some inputs, this will be unknown.
412 * \param i_object a vlc object id
413 * \return a float in the range of 0.0 - 1.0
415 float VLC_PositionGet( int );
418 * Set the current position in a input
420 * Set the current position as a float
421 * This method should be used for time sliders etc
422 * \note For some inputs, this will be unknown.
424 * \param i_object a vlc object id
425 * \param i_position a float in the range of 0.0 - 1.0
426 * \return a float in the range of 0.0 - 1.0
428 float VLC_PositionSet( int, float );
431 * Get the current position in a input
433 * Return the current position in seconds from the start.
434 * \note For some inputs, this will be unknown.
436 * \param i_object a vlc object id
437 * \return the offset from 0:00 in seconds
439 int VLC_TimeGet( int );
442 * Seek to a position in the current input
444 * Seek i_seconds in the current input. If b_relative is set,
445 * then the seek will be relative to the current position, otherwise
446 * it will seek to i_seconds from the beginning of the input.
447 * \note For some inputs, this will be unknown.
449 * \param i_object a vlc object id
450 * \param i_seconds seconds from current position or from beginning of input
451 * \param b_relative seek relative from current position
452 * \return VLC_SUCCESS on success
454 int VLC_TimeSet( int, int, vlc_bool_t );
457 * Get the total length of a input
459 * Return the total length in seconds from the current input.
460 * \note For some inputs, this will be unknown.
462 * \param i_object a vlc object id
463 * \return the length in seconds
465 int VLC_LengthGet( int );
468 * Play the input faster than realtime
470 * 2x, 4x, 8x faster than realtime
471 * \note For some inputs, this will be impossible.
473 * \param i_object a vlc object id
474 * \return the current speedrate
476 float VLC_SpeedFaster( int );
479 * Play the input slower than realtime
481 * 1/2x, 1/4x, 1/8x slower than realtime
482 * \note For some inputs, this will be impossible.
484 * \param i_object a vlc object id
485 * \return the current speedrate
487 float VLC_SpeedSlower( int );
490 * Return the current playlist item
492 * \param i_object a vlc object id
493 * \return the index of the playlistitem that is currently selected for play
495 int VLC_PlaylistIndex( int );
498 * Total amount of items in the playlist
500 * \param i_object a vlc object id
501 * \return amount of playlist items
503 int VLC_PlaylistNumberOfItems( int );
508 * Skip to the next playlistitem and play it.
510 * \param i_object a vlc object id
511 * \return VLC_SUCCESS on success
513 int VLC_PlaylistNext( int );
516 * Previous playlist item
518 * Skip to the previous playlistitem and play it.
520 * \param i_object a vlc object id
521 * \return VLC_SUCCESS on success
523 int VLC_PlaylistPrev( int );
526 * Clear the contents of the playlist
528 * Completly empty the entire playlist.
530 * \note Was previously called VLC_ClearPlaylist
532 * \param i_object a vlc object id
533 * \return VLC_SUCCESS on success
535 int VLC_PlaylistClear( int );
540 * \param i_object a vlc object id
541 * \param i_volume something in a range from 0-200
542 * \return the new volume (range 0-200 %)
544 int VLC_VolumeSet( int, int );
547 * Get the current volume
549 * Retrieve the current volume.
551 * \param i_object a vlc object id
552 * \return the current volume (range 0-200 %)
554 int VLC_VolumeGet( int );
557 * Mute/Unmute the volume
559 * \param i_object a vlc object id
560 * \return VLC_SUCCESS on success
562 int VLC_VolumeMute( int );
565 * Toggle Fullscreen mode
567 * Switch between normal and fullscreen video
569 * \param i_object a vlc object id
570 * \return VLC_SUCCESS on success
572 int VLC_FullScreen( int );
579 #define LICENSE_MSG \
580 _("This program comes with NO WARRANTY, to the extent permitted by " \
581 "law.\nYou may redistribute it under the terms of the GNU General " \
582 "Public License;\nsee the file named COPYING for details.\n" \
583 "Written by the VideoLAN team; see the AUTHORS file.\n")
585 #endif /* <vlc/vlc.h> */