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 * Shared library Export macros
160 *****************************************************************************/
161 #if defined(WIN32) && defined(DLL_EXPORT)
162 # define VLC_PUBLIC_API extern __declspec(dllexport)
164 # define VLC_PUBLIC_API extern __attribute__((visibility("default")))
167 /*****************************************************************************
168 * Exported libvlc API
169 *****************************************************************************/
170 #if !defined( __LIBVLC__ )
171 /* Otherwise they are declared and exported in vlc_common.h */
173 * Retrieve libvlc version
175 * \return a string containing the libvlc version
177 VLC_PUBLIC_API char const * VLC_Version ( void );
180 * Retrieve libvlc compile time
182 * \return a string containing the libvlc compile time
184 VLC_PUBLIC_API char const * VLC_CompileTime ( void );
187 * Retrieve the username of the libvlc builder
189 * \return a string containing the username of the libvlc builder
191 VLC_PUBLIC_API char const * VLC_CompileBy ( void );
194 * Retrieve the host of the libvlc builder
196 * \return a string containing the host of the libvlc builder
198 VLC_PUBLIC_API char const * VLC_CompileHost ( void );
201 * Retrieve the domain name of the host of the libvlc builder
203 * \return a string containing the domain name of the host of the libvlc builder
205 VLC_PUBLIC_API char const * VLC_CompileDomain ( void );
208 * Retrieve libvlc compiler version
210 * \return a string containing the libvlc compiler version
212 VLC_PUBLIC_API char const * VLC_Compiler ( void );
215 * Retrieve libvlc changeset
217 * \return a string containing the libvlc subversion changeset
219 VLC_PUBLIC_API char const * VLC_Changeset ( void );
222 * Return an error string
224 * \param i_err an error code
225 * \return an error string
227 VLC_PUBLIC_API char const * VLC_Error ( int i_err );
229 #endif /* __LIBVLC__ */
234 * This function allocates a vlc_t structure and returns a negative value
235 * in case of failure. Also, the thread system is initialized
237 * \return vlc object id or an error code
239 VLC_PUBLIC_API int VLC_Create( void );
242 * Initialize a vlc_t structure
244 * This function initializes a previously allocated vlc_t structure:
246 * - gettext initialization
247 * - message queue, module bank and playlist initialization
248 * - configuration and commandline parsing
250 * \param i_object a vlc object id
251 * \param i_argc the number of arguments
252 * \param ppsz_argv an array of arguments
253 * \return VLC_SUCCESS on success
255 VLC_PUBLIC_API int VLC_Init( int, int, char *[] );
260 * This function opens an interface plugin and runs it. If b_block is set
261 * to 0, VLC_AddIntf will return immediately and let the interface run in a
262 * separate thread. If b_block is set to 1, VLC_AddIntf will continue until
263 * user requests to quit.
265 * \param i_object a vlc object id
266 * \param psz_module a vlc module name of an interface
267 * \param b_block make this interface blocking
268 * \param b_play start playing when the interface is done loading
269 * \return VLC_SUCCESS on success
271 VLC_PUBLIC_API int VLC_AddIntf( int, char const *, vlc_bool_t, vlc_bool_t );
276 * This function sets p_vlc->b_die to VLC_TRUE, but does not do any other
277 * task. It is your duty to call VLC_CleanUp and VLC_Destroy afterwards.
279 * \param i_object a vlc object id
280 * \return VLC_SUCCESS on success
282 VLC_PUBLIC_API int VLC_Die( int );
285 * Clean up all the intf, playlist, vout and aout
287 * This function requests all intf, playlist, vout and aout objects to finish
288 * and CleanUp. Only a blank VLC object should remain after this.
290 * \note This function was previously called VLC_Stop
292 * \param i_object a vlc object id
293 * \return VLC_SUCCESS on success
295 VLC_PUBLIC_API int VLC_CleanUp( int );
298 * Destroy all threads and the VLC object
300 * This function requests the running threads to finish, waits for their
301 * termination, and destroys their structure.
302 * Then it will de-init all VLC object initializations.
304 * \param i_object a vlc object id
305 * \return VLC_SUCCESS on success
307 VLC_PUBLIC_API int VLC_Destroy( int );
312 * This function sets a variable of VLC
314 * \note Was previously called VLC_Set
316 * \param i_object a vlc object id
317 * \param psz_var a vlc variable name
318 * \param value a vlc_value_t structure
319 * \return VLC_SUCCESS on success
321 VLC_PUBLIC_API int VLC_VariableSet( int, char const *, vlc_value_t );
326 * This function gets the value of a variable of VLC
327 * It stores it in the p_value argument
329 * \note Was previously called VLC_Get
331 * \param i_object a vlc object id
332 * \param psz_var a vlc variable name
333 * \param p_value a pointer to a vlc_value_t structure
334 * \return VLC_SUCCESS on success
336 VLC_PUBLIC_API int VLC_VariableGet( int, char const *, vlc_value_t * );
339 * Get a VLC variable type
341 * This function gets the type of a variable of VLC
342 * It stores it in the p_type argument
344 * \param i_object a vlc object id
345 * \param psz_var a vlc variable name
346 * \param pi_type a pointer to an integer
347 * \return VLC_SUCCESS on success
349 VLC_PUBLIC_API int VLC_VariableType( int, char const *, int * );
352 * Add a target to the current playlist
354 * This funtion will add a target to the current playlist. If a playlist does
355 * not exist, it will be created.
357 * \param i_object a vlc object id
358 * \param psz_target the URI of the target to play
359 * \param ppsz_options an array of strings with input options (ie. :input-repeat)
360 * \param i_options the amount of options in the ppsz_options array
361 * \param i_mode the insert mode to insert the target into the playlist (PLAYLIST_* defines)
362 * \param i_pos the position at which to add the new target (PLAYLIST_END for end)
363 * \return VLC_SUCCESS on success
365 VLC_PUBLIC_API int VLC_AddTarget( int, char const *, const char **, int, int, int );
368 * Start the playlist and play the currently selected playlist item
370 * If there is something in the playlist, and the playlist is not running,
371 * then start the playlist and play the currently selected playlist item.
372 * If an item is currently paused, then resume it.
374 * \param i_object a vlc object id
375 * \return VLC_SUCCESS on success
377 VLC_PUBLIC_API int VLC_Play( int );
380 * Pause the currently playing item. Resume it if already paused
382 * If an item is currently playing then pause it.
383 * If the item is already paused, then resume playback.
385 * \param i_object a vlc object id
386 * \return VLC_SUCCESS on success
388 VLC_PUBLIC_API int VLC_Pause( int );
393 * If an item is currently playing then stop it.
394 * Set the playlist to a stopped state.
396 * \note This function is new. The old VLC_Stop is now called VLC_CleanUp
398 * \param i_object a vlc object id
399 * \return VLC_SUCCESS on success
401 VLC_PUBLIC_API int VLC_Stop( int );
404 * Tell if VLC is playing
406 * If an item is currently playing, it returns
407 * VLC_TRUE, else VLC_FALSE
409 * \param i_object a vlc object id
410 * \return VLC_TRUE or VLC_FALSE
412 VLC_PUBLIC_API vlc_bool_t VLC_IsPlaying( int );
415 * Get the current position in a input
417 * Return the current position as a float
418 * This method should be used for time sliders etc
419 * \note For some inputs, this will be unknown.
421 * \param i_object a vlc object id
422 * \return a float in the range of 0.0 - 1.0
424 VLC_PUBLIC_API float VLC_PositionGet( int );
427 * Set the current position in a input
429 * Set the current position as a float
430 * This method should be used for time sliders etc
431 * \note For some inputs, this will be unknown.
433 * \param i_object a vlc object id
434 * \param i_position a float in the range of 0.0 - 1.0
435 * \return a float in the range of 0.0 - 1.0
437 VLC_PUBLIC_API float VLC_PositionSet( int, float );
440 * Get the current position in a input
442 * Return the current position in seconds from the start.
443 * \note For some inputs, this will be unknown.
445 * \param i_object a vlc object id
446 * \return the offset from 0:00 in seconds
448 VLC_PUBLIC_API int VLC_TimeGet( int );
451 * Seek to a position in the current input
453 * Seek i_seconds in the current input. If b_relative is set,
454 * then the seek will be relative to the current position, otherwise
455 * it will seek to i_seconds from the beginning of the input.
456 * \note For some inputs, this will be unknown.
458 * \param i_object a vlc object id
459 * \param i_seconds seconds from current position or from beginning of input
460 * \param b_relative seek relative from current position
461 * \return VLC_SUCCESS on success
463 VLC_PUBLIC_API int VLC_TimeSet( int, int, vlc_bool_t );
466 * Get the total length of a input
468 * Return the total length in seconds from the current input.
469 * \note For some inputs, this will be unknown.
471 * \param i_object a vlc object id
472 * \return the length in seconds
474 VLC_PUBLIC_API int VLC_LengthGet( int );
477 * Play the input faster than realtime
479 * 2x, 4x, 8x faster than realtime
480 * \note For some inputs, this will be impossible.
482 * \param i_object a vlc object id
483 * \return the current speedrate
485 VLC_PUBLIC_API float VLC_SpeedFaster( int );
488 * Play the input slower than realtime
490 * 1/2x, 1/4x, 1/8x slower than realtime
491 * \note For some inputs, this will be impossible.
493 * \param i_object a vlc object id
494 * \return the current speedrate
496 VLC_PUBLIC_API float VLC_SpeedSlower( int );
499 * Return the current playlist item
501 * \param i_object a vlc object id
502 * \return the index of the playlistitem that is currently selected for play
504 VLC_PUBLIC_API int VLC_PlaylistIndex( int );
507 * Total amount of items in the playlist
509 * \param i_object a vlc object id
510 * \return amount of playlist items
512 VLC_PUBLIC_API int VLC_PlaylistNumberOfItems( int );
517 * Skip to the next playlistitem and play it.
519 * \param i_object a vlc object id
520 * \return VLC_SUCCESS on success
522 VLC_PUBLIC_API int VLC_PlaylistNext( int );
525 * Previous playlist item
527 * Skip to the previous playlistitem and play it.
529 * \param i_object a vlc object id
530 * \return VLC_SUCCESS on success
532 VLC_PUBLIC_API int VLC_PlaylistPrev( int );
535 * Clear the contents of the playlist
537 * Completly empty the entire playlist.
539 * \note Was previously called VLC_ClearPlaylist
541 * \param i_object a vlc object id
542 * \return VLC_SUCCESS on success
544 VLC_PUBLIC_API int VLC_PlaylistClear( int );
549 * \param i_object a vlc object id
550 * \param i_volume something in a range from 0-200
551 * \return the new volume (range 0-200 %)
553 VLC_PUBLIC_API int VLC_VolumeSet( int, int );
556 * Get the current volume
558 * Retrieve the current volume.
560 * \param i_object a vlc object id
561 * \return the current volume (range 0-200 %)
563 VLC_PUBLIC_API int VLC_VolumeGet( int );
566 * Mute/Unmute the volume
568 * \param i_object a vlc object id
569 * \return VLC_SUCCESS on success
571 VLC_PUBLIC_API int VLC_VolumeMute( int );
574 * Toggle Fullscreen mode
576 * Switch between normal and fullscreen video
578 * \param i_object a vlc object id
579 * \return VLC_SUCCESS on success
581 VLC_PUBLIC_API int VLC_FullScreen( int );
588 #define LICENSE_MSG \
589 _("This program comes with NO WARRANTY, to the extent permitted by " \
590 "law.\nYou may redistribute it under the terms of the GNU General " \
591 "Public License;\nsee the file named COPYING for details.\n" \
592 "Written by the VideoLAN team; see the AUTHORS file.\n")
594 #endif /* <vlc/vlc.h> */