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
45 /*****************************************************************************
47 *****************************************************************************/
48 typedef bool vlc_bool_t;
49 typedef struct vlc_list_t vlc_list_t;
50 typedef struct vlc_object_t vlc_object_t;
52 #if (defined( WIN32 ) || defined( UNDER_CE )) && !defined( __MINGW32__ )
53 typedef signed __int64 vlc_int64_t;
55 typedef signed long long vlc_int64_t;
59 * \defgroup var_type Variable types
60 * These are the different types a vlc variable can have.
63 #define VLC_VAR_VOID 0x0010
64 #define VLC_VAR_BOOL 0x0020
65 #define VLC_VAR_INTEGER 0x0030
66 #define VLC_VAR_HOTKEY 0x0031
67 #define VLC_VAR_STRING 0x0040
68 #define VLC_VAR_MODULE 0x0041
69 #define VLC_VAR_FILE 0x0042
70 #define VLC_VAR_DIRECTORY 0x0043
71 #define VLC_VAR_VARIABLE 0x0044
72 #define VLC_VAR_FLOAT 0x0050
73 #define VLC_VAR_TIME 0x0060
74 #define VLC_VAR_ADDRESS 0x0070
75 #define VLC_VAR_MUTEX 0x0080
76 #define VLC_VAR_LIST 0x0090
89 vlc_object_t * p_object;
93 struct { char *psz_name; int i_object_id; } var;
95 /* Make sure the structure is at least 64bits */
96 struct { char a, b, c, d, e, f, g, h; } padding;
106 vlc_value_t * p_values;
111 /*****************************************************************************
113 *****************************************************************************/
114 #define VLC_SUCCESS -0 /* No error */
115 #define VLC_ENOMEM -1 /* Not enough memory */
116 #define VLC_ETHREAD -2 /* Thread error */
117 #define VLC_ETIMEOUT -3 /* Timeout */
119 #define VLC_ENOMOD -10 /* Module not found */
121 #define VLC_ENOOBJ -20 /* Object not found */
122 #define VLC_EBADOBJ -21 /* Bad object type */
124 #define VLC_ENOVAR -30 /* Variable not found */
125 #define VLC_EBADVAR -31 /* Bad variable value */
127 #define VLC_ENOITEM -40 /**< Item not found */
129 #define VLC_EEXIT -255 /* Program exited */
130 #define VLC_EEXITSUCCESS -999 /* Program exited successfully */
131 #define VLC_EGENERIC -666 /* Generic error */
133 /*****************************************************************************
135 *****************************************************************************/
136 #define VLC_FALSE false
137 #define VLC_TRUE true
139 /*****************************************************************************
141 *****************************************************************************/
143 /* Used by VLC_AddTarget() */
144 #define PLAYLIST_INSERT 0x0001
145 #define PLAYLIST_APPEND 0x0002
146 #define PLAYLIST_GO 0x0004
147 #define PLAYLIST_PREPARSE 0x0008
148 #define PLAYLIST_SPREPARSE 0x0010
149 #define PLAYLIST_NO_REBUILD 0x0020
151 #define PLAYLIST_END -666
153 /*****************************************************************************
154 * Required internal headers
155 *****************************************************************************/
156 #if defined( __LIBVLC__ )
157 # include "vlc_common.h"
160 /*****************************************************************************
161 * Shared library Export macros
162 *****************************************************************************/
163 #ifndef VLC_PUBLIC_API
164 # define VLC_PUBLIC_API extern
167 /*****************************************************************************
169 *****************************************************************************/
171 #ifndef VLC_DEPRECATED_API
173 /* Avoid unuseful warnings from libvlc with our deprecated APIs */
174 # define VLC_DEPRECATED_API VLC_PUBLIC_API
175 # else /* __LIBVLC__ */
176 # if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
177 # define VLC_DEPRECATED_API VLC_PUBLIC_API __attribute__((deprecated))
179 # define VLC_DEPRECATED_API VLC_PUBLIC_API
181 # endif /* __LIBVLC__ */
184 /*****************************************************************************
185 * Exported libvlc API
186 *****************************************************************************/
187 #if !defined( __LIBVLC__ )
188 /* Otherwise they are declared and exported in vlc_common.h */
190 * Retrieve libvlc version
192 * \return a string containing the libvlc version
194 VLC_DEPRECATED_API char const * VLC_Version ( void );
197 * Retrieve libvlc compile time
199 * \return a string containing the libvlc compile time
201 VLC_DEPRECATED_API char const * VLC_CompileTime ( void );
204 * Retrieve the username of the libvlc builder
206 * \return a string containing the username of the libvlc builder
208 VLC_DEPRECATED_API char const * VLC_CompileBy ( void );
211 * Retrieve the host of the libvlc builder
213 * \return a string containing the host of the libvlc builder
215 VLC_DEPRECATED_API char const * VLC_CompileHost ( void );
218 * Retrieve the domain name of the host of the libvlc builder
220 * \return a string containing the domain name of the host of the libvlc builder
222 VLC_DEPRECATED_API char const * VLC_CompileDomain ( void );
225 * Retrieve libvlc compiler version
227 * \return a string containing the libvlc compiler version
229 VLC_DEPRECATED_API char const * VLC_Compiler ( void );
232 * Retrieve libvlc changeset
234 * \return a string containing the libvlc subversion changeset
236 VLC_DEPRECATED_API char const * VLC_Changeset ( void );
239 * Return an error string
241 * \param i_err an error code
242 * \return an error string
244 VLC_DEPRECATED_API char const * VLC_Error ( int i_err );
246 #endif /* __LIBVLC__ */
251 * This function allocates a vlc_t structure and returns a negative value
252 * in case of failure. Also, the thread system is initialized
254 * \return vlc object id or an error code
256 VLC_PUBLIC_API int VLC_Create( void );
259 * Initialize a vlc_t structure
261 * This function initializes a previously allocated vlc_t structure:
263 * - gettext initialization
264 * - message queue, module bank and playlist initialization
265 * - configuration and commandline parsing
267 * \param i_object a vlc object id
268 * \param i_argc the number of arguments
269 * \param ppsz_argv an array of arguments
270 * \return VLC_SUCCESS on success
272 VLC_PUBLIC_API int VLC_Init( int, int, const char *[] );
277 * This function opens an interface plugin and runs it. If b_block is set
278 * to 0, VLC_AddIntf will return immediately and let the interface run in a
279 * separate thread. If b_block is set to 1, VLC_AddIntf will continue until
280 * user requests to quit.
282 * \param i_object a vlc object id
283 * \param psz_module a vlc module name of an interface
284 * \param b_block make this interface blocking
285 * \param b_play start playing when the interface is done loading
286 * \return VLC_SUCCESS on success
288 VLC_PUBLIC_API int VLC_AddIntf( int, char const *, vlc_bool_t, vlc_bool_t );
293 * This function sets p_libvlc->b_die to VLC_TRUE, but does not do any other
294 * task. It is your duty to call VLC_CleanUp and VLC_Destroy afterwards.
296 * \param i_object a vlc object id
297 * \return VLC_SUCCESS on success
299 VLC_PUBLIC_API int VLC_Die( int );
302 * Clean up all the intf, playlist, vout and aout
304 * This function requests all intf, playlist, vout and aout objects to finish
305 * and CleanUp. Only a blank VLC object should remain after this.
307 * \note This function was previously called VLC_Stop
309 * \param i_object a vlc object id
310 * \return VLC_SUCCESS on success
312 VLC_PUBLIC_API int VLC_CleanUp( int );
315 * Destroy all threads and the VLC object
317 * This function requests the running threads to finish, waits for their
318 * termination, and destroys their structure.
319 * Then it will de-init all VLC object initializations.
321 * \param i_object a vlc object id
322 * \return VLC_SUCCESS on success
324 VLC_PUBLIC_API int VLC_Destroy( int );
329 * This function sets a variable of VLC
331 * \note Was previously called VLC_Set
333 * \param i_object a vlc object id
334 * \param psz_var a vlc variable name
335 * \param value a vlc_value_t structure
336 * \return VLC_SUCCESS on success
338 VLC_DEPRECATED_API int VLC_VariableSet( int, char const *, vlc_value_t );
343 * This function gets the value of a variable of VLC
344 * It stores it in the p_value argument
346 * \note Was previously called VLC_Get
348 * \param i_object a vlc object id
349 * \param psz_var a vlc variable name
350 * \param p_value a pointer to a vlc_value_t structure
351 * \return VLC_SUCCESS on success
353 VLC_DEPRECATED_API int VLC_VariableGet( int, char const *, vlc_value_t * );
356 * Get a VLC variable type
358 * This function gets the type of a variable of VLC
359 * It stores it in the p_type argument
361 * \param i_object a vlc object id
362 * \param psz_var a vlc variable name
363 * \param pi_type a pointer to an integer
364 * \return VLC_SUCCESS on success
366 VLC_DEPRECATED_API int VLC_VariableType( int, char const *, int * );
369 * Add a target to the current playlist
371 * This funtion will add a target to the current playlist. If a playlist does
372 * not exist, it will be created.
374 * \param i_object a vlc object id
375 * \param psz_target the URI of the target to play
376 * \param ppsz_options an array of strings with input options (ie. :input-repeat)
377 * \param i_options the amount of options in the ppsz_options array
378 * \param i_mode the insert mode to insert the target into the playlist (PLAYLIST_* defines)
379 * \param i_pos the position at which to add the new target (PLAYLIST_END for end)
380 * \return the item id on success and -1 on error
382 VLC_PUBLIC_API int VLC_AddTarget( int, char const *, const char **, int, int, int );
385 * Start the playlist and play the currently selected playlist item
387 * If there is something in the playlist, and the playlist is not running,
388 * then start the playlist and play the currently selected playlist item.
389 * If an item is currently paused, then resume it.
391 * \param i_object a vlc object id
392 * \return VLC_SUCCESS on success
394 VLC_DEPRECATED_API int VLC_Play( int );
397 * Pause the currently playing item. Resume it if already paused
399 * If an item is currently playing then pause it.
400 * If the item is already paused, then resume playback.
402 * \param i_object a vlc object id
403 * \return VLC_SUCCESS on success
405 VLC_DEPRECATED_API int VLC_Pause( int );
410 * If an item is currently playing then stop it.
411 * Set the playlist to a stopped state.
413 * \note This function is new. The old VLC_Stop is now called VLC_CleanUp
415 * \param i_object a vlc object id
416 * \return VLC_SUCCESS on success
418 VLC_DEPRECATED_API int VLC_Stop( int );
421 * Tell if VLC is playing
423 * If an item is currently playing, it returns
424 * VLC_TRUE, else VLC_FALSE
426 * \param i_object a vlc object id
427 * \return VLC_TRUE or VLC_FALSE
429 VLC_DEPRECATED_API vlc_bool_t VLC_IsPlaying( int );
432 * Get the current position in a input
434 * Return the current position as a float
435 * This method should be used for time sliders etc
436 * \note For some inputs, this will be unknown.
438 * \param i_object a vlc object id
439 * \return a float in the range of 0.0 - 1.0
441 VLC_DEPRECATED_API float VLC_PositionGet( int );
444 * Set the current position in a input
446 * Set the current position as a float
447 * This method should be used for time sliders etc
448 * \note For some inputs, this will be unknown.
450 * \param i_object a vlc object id
451 * \param i_position a float in the range of 0.0 - 1.0
452 * \return a float in the range of 0.0 - 1.0
454 VLC_DEPRECATED_API float VLC_PositionSet( int, float );
457 * Get the current position in a input
459 * Return the current position in seconds from the start.
460 * \note For some inputs, this will be unknown.
462 * \param i_object a vlc object id
463 * \return the offset from 0:00 in seconds
465 VLC_DEPRECATED_API int VLC_TimeGet( int );
468 * Seek to a position in the current input
470 * Seek i_seconds in the current input. If b_relative is set,
471 * then the seek will be relative to the current position, otherwise
472 * it will seek to i_seconds from the beginning of the input.
473 * \note For some inputs, this will be unknown.
475 * \param i_object a vlc object id
476 * \param i_seconds seconds from current position or from beginning of input
477 * \param b_relative seek relative from current position
478 * \return VLC_SUCCESS on success
480 VLC_DEPRECATED_API int VLC_TimeSet( int, int, vlc_bool_t );
483 * Get the total length of a input
485 * Return the total length in seconds from the current input.
486 * \note For some inputs, this will be unknown.
488 * \param i_object a vlc object id
489 * \return the length in seconds
491 VLC_DEPRECATED_API int VLC_LengthGet( int );
494 * Play the input faster than realtime
496 * 2x, 4x, 8x faster than realtime
497 * \note For some inputs, this will be impossible.
499 * \param i_object a vlc object id
500 * \return the current speedrate
502 VLC_DEPRECATED_API float VLC_SpeedFaster( int );
505 * Play the input slower than realtime
507 * 1/2x, 1/4x, 1/8x slower than realtime
508 * \note For some inputs, this will be impossible.
510 * \param i_object a vlc object id
511 * \return the current speedrate
513 VLC_DEPRECATED_API float VLC_SpeedSlower( int );
516 * Return the current playlist item
518 * \param i_object a vlc object id
519 * \return the index of the playlistitem that is currently selected for play
521 VLC_DEPRECATED_API int VLC_PlaylistIndex( int );
524 * Total amount of items in the playlist
526 * \param i_object a vlc object id
527 * \return amount of playlist items
529 VLC_DEPRECATED_API int VLC_PlaylistNumberOfItems( int );
534 * Skip to the next playlistitem and play it.
536 * \param i_object a vlc object id
537 * \return VLC_SUCCESS on success
539 VLC_DEPRECATED_API int VLC_PlaylistNext( int );
542 * Previous playlist item
544 * Skip to the previous playlistitem and play it.
546 * \param i_object a vlc object id
547 * \return VLC_SUCCESS on success
549 VLC_DEPRECATED_API int VLC_PlaylistPrev( int );
552 * Clear the contents of the playlist
554 * Completly empty the entire playlist.
556 * \note Was previously called VLC_ClearPlaylist
558 * \param i_object a vlc object id
559 * \return VLC_SUCCESS on success
561 VLC_DEPRECATED_API int VLC_PlaylistClear( int );
566 * \param i_object a vlc object id
567 * \param i_volume something in a range from 0-200
568 * \return the new volume (range 0-200 %)
570 VLC_DEPRECATED_API int VLC_VolumeSet( int, int );
573 * Get the current volume
575 * Retrieve the current volume.
577 * \param i_object a vlc object id
578 * \return the current volume (range 0-200 %)
580 VLC_DEPRECATED_API int VLC_VolumeGet( int );
583 * Mute/Unmute the volume
585 * \param i_object a vlc object id
586 * \return VLC_SUCCESS on success
588 VLC_DEPRECATED_API int VLC_VolumeMute( int );
591 * Toggle Fullscreen mode
593 * Switch between normal and fullscreen video
595 * \param i_object a vlc object id
596 * \return VLC_SUCCESS on success
598 VLC_DEPRECATED_API int VLC_FullScreen( int );
605 #define LICENSE_MSG \
606 _("This program comes with NO WARRANTY, to the extent permitted by " \
607 "law.\nYou may redistribute it under the terms of the GNU General " \
608 "Public License;\nsee the file named COPYING for details.\n" \
609 "Written by the VideoLAN team; see the AUTHORS file.\n")
611 #endif /* <vlc/vlc.h> */