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_DEPRECATED_API
164 # define VLC_DEPRECATED_API extern
167 /*****************************************************************************
169 *****************************************************************************/
171 #ifndef VLC_DEPRECATED_API
172 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
173 # define VLC_DEPRECATED_API VLC_PUBLIC_API __attribute__((deprecated))
175 # define VLC_DEPRECATED_API VLC_PUBLIC_API
179 /*****************************************************************************
180 * Exported libvlc API
181 *****************************************************************************/
182 #if !defined( __LIBVLC__ )
183 /* Otherwise they are declared and exported in vlc_common.h */
185 * Retrieve libvlc version
187 * \return a string containing the libvlc version
189 VLC_DEPRECATED_API char const * VLC_Version ( void );
192 * Retrieve libvlc compile time
194 * \return a string containing the libvlc compile time
196 VLC_DEPRECATED_API char const * VLC_CompileTime ( void );
199 * Retrieve the username of the libvlc builder
201 * \return a string containing the username of the libvlc builder
203 VLC_DEPRECATED_API char const * VLC_CompileBy ( void );
206 * Retrieve the host of the libvlc builder
208 * \return a string containing the host of the libvlc builder
210 VLC_DEPRECATED_API char const * VLC_CompileHost ( void );
213 * Retrieve the domain name of the host of the libvlc builder
215 * \return a string containing the domain name of the host of the libvlc builder
217 VLC_DEPRECATED_API char const * VLC_CompileDomain ( void );
220 * Retrieve libvlc compiler version
222 * \return a string containing the libvlc compiler version
224 VLC_DEPRECATED_API char const * VLC_Compiler ( void );
227 * Retrieve libvlc changeset
229 * \return a string containing the libvlc subversion changeset
231 VLC_DEPRECATED_API char const * VLC_Changeset ( void );
234 * Return an error string
236 * \param i_err an error code
237 * \return an error string
239 VLC_DEPRECATED_API char const * VLC_Error ( int i_err );
241 #endif /* __LIBVLC__ */
246 * This function allocates a vlc_t structure and returns a negative value
247 * in case of failure. Also, the thread system is initialized
249 * \return vlc object id or an error code
251 VLC_PUBLIC_API int VLC_Create( void );
254 * Initialize a vlc_t structure
256 * This function initializes a previously allocated vlc_t structure:
258 * - gettext initialization
259 * - message queue, module bank and playlist initialization
260 * - configuration and commandline parsing
262 * \param i_object a vlc object id
263 * \param i_argc the number of arguments
264 * \param ppsz_argv an array of arguments
265 * \return VLC_SUCCESS on success
267 VLC_PUBLIC_API int VLC_Init( int, int, const char *[] );
272 * This function opens an interface plugin and runs it. If b_block is set
273 * to 0, VLC_AddIntf will return immediately and let the interface run in a
274 * separate thread. If b_block is set to 1, VLC_AddIntf will continue until
275 * user requests to quit.
277 * \param i_object a vlc object id
278 * \param psz_module a vlc module name of an interface
279 * \param b_block make this interface blocking
280 * \param b_play start playing when the interface is done loading
281 * \return VLC_SUCCESS on success
283 VLC_PUBLIC_API int VLC_AddIntf( int, char const *, vlc_bool_t, vlc_bool_t );
288 * This function sets p_libvlc->b_die to VLC_TRUE, but does not do any other
289 * task. It is your duty to call VLC_CleanUp and VLC_Destroy afterwards.
291 * \param i_object a vlc object id
292 * \return VLC_SUCCESS on success
294 VLC_PUBLIC_API int VLC_Die( int );
297 * Clean up all the intf, playlist, vout and aout
299 * This function requests all intf, playlist, vout and aout objects to finish
300 * and CleanUp. Only a blank VLC object should remain after this.
302 * \note This function was previously called VLC_Stop
304 * \param i_object a vlc object id
305 * \return VLC_SUCCESS on success
307 VLC_PUBLIC_API int VLC_CleanUp( int );
310 * Destroy all threads and the VLC object
312 * This function requests the running threads to finish, waits for their
313 * termination, and destroys their structure.
314 * Then it will de-init all VLC object initializations.
316 * \param i_object a vlc object id
317 * \return VLC_SUCCESS on success
319 VLC_PUBLIC_API int VLC_Destroy( int );
324 * This function sets a variable of VLC
326 * \note Was previously called VLC_Set
328 * \param i_object a vlc object id
329 * \param psz_var a vlc variable name
330 * \param value a vlc_value_t structure
331 * \return VLC_SUCCESS on success
333 VLC_DEPRECATED_API int VLC_VariableSet( int, char const *, vlc_value_t );
338 * This function gets the value of a variable of VLC
339 * It stores it in the p_value argument
341 * \note Was previously called VLC_Get
343 * \param i_object a vlc object id
344 * \param psz_var a vlc variable name
345 * \param p_value a pointer to a vlc_value_t structure
346 * \return VLC_SUCCESS on success
348 VLC_DEPRECATED_API int VLC_VariableGet( int, char const *, vlc_value_t * );
351 * Get a VLC variable type
353 * This function gets the type of a variable of VLC
354 * It stores it in the p_type argument
356 * \param i_object a vlc object id
357 * \param psz_var a vlc variable name
358 * \param pi_type a pointer to an integer
359 * \return VLC_SUCCESS on success
361 VLC_DEPRECATED_API int VLC_VariableType( int, char const *, int * );
364 * Add a target to the current playlist
366 * This funtion will add a target to the current playlist. If a playlist does
367 * not exist, it will be created.
369 * \param i_object a vlc object id
370 * \param psz_target the URI of the target to play
371 * \param ppsz_options an array of strings with input options (ie. :input-repeat)
372 * \param i_options the amount of options in the ppsz_options array
373 * \param i_mode the insert mode to insert the target into the playlist (PLAYLIST_* defines)
374 * \param i_pos the position at which to add the new target (PLAYLIST_END for end)
375 * \return the item id on success and -1 on error
377 VLC_DEPRECATED_API int VLC_AddTarget( int, char const *, const char **, int, int, int );
380 * Start the playlist and play the currently selected playlist item
382 * If there is something in the playlist, and the playlist is not running,
383 * then start the playlist and play the currently selected playlist item.
384 * If an item is currently paused, then resume it.
386 * \param i_object a vlc object id
387 * \return VLC_SUCCESS on success
389 VLC_DEPRECATED_API int VLC_Play( int );
392 * Pause the currently playing item. Resume it if already paused
394 * If an item is currently playing then pause it.
395 * If the item is already paused, then resume playback.
397 * \param i_object a vlc object id
398 * \return VLC_SUCCESS on success
400 VLC_DEPRECATED_API int VLC_Pause( int );
405 * If an item is currently playing then stop it.
406 * Set the playlist to a stopped state.
408 * \note This function is new. The old VLC_Stop is now called VLC_CleanUp
410 * \param i_object a vlc object id
411 * \return VLC_SUCCESS on success
413 VLC_DEPRECATED_API int VLC_Stop( int );
416 * Tell if VLC is playing
418 * If an item is currently playing, it returns
419 * VLC_TRUE, else VLC_FALSE
421 * \param i_object a vlc object id
422 * \return VLC_TRUE or VLC_FALSE
424 VLC_DEPRECATED_API vlc_bool_t VLC_IsPlaying( int );
427 * Get the current position in a input
429 * Return 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 * \return a float in the range of 0.0 - 1.0
436 VLC_DEPRECATED_API float VLC_PositionGet( int );
439 * Set the current position in a input
441 * Set the current position as a float
442 * This method should be used for time sliders etc
443 * \note For some inputs, this will be unknown.
445 * \param i_object a vlc object id
446 * \param i_position a float in the range of 0.0 - 1.0
447 * \return a float in the range of 0.0 - 1.0
449 VLC_DEPRECATED_API float VLC_PositionSet( int, float );
452 * Get the current position in a input
454 * Return the current position in seconds from the start.
455 * \note For some inputs, this will be unknown.
457 * \param i_object a vlc object id
458 * \return the offset from 0:00 in seconds
460 VLC_DEPRECATED_API int VLC_TimeGet( int );
463 * Seek to a position in the current input
465 * Seek i_seconds in the current input. If b_relative is set,
466 * then the seek will be relative to the current position, otherwise
467 * it will seek to i_seconds from the beginning of the input.
468 * \note For some inputs, this will be unknown.
470 * \param i_object a vlc object id
471 * \param i_seconds seconds from current position or from beginning of input
472 * \param b_relative seek relative from current position
473 * \return VLC_SUCCESS on success
475 VLC_DEPRECATED_API int VLC_TimeSet( int, int, vlc_bool_t );
478 * Get the total length of a input
480 * Return the total length in seconds from the current input.
481 * \note For some inputs, this will be unknown.
483 * \param i_object a vlc object id
484 * \return the length in seconds
486 VLC_DEPRECATED_API int VLC_LengthGet( int );
489 * Play the input faster than realtime
491 * 2x, 4x, 8x faster than realtime
492 * \note For some inputs, this will be impossible.
494 * \param i_object a vlc object id
495 * \return the current speedrate
497 VLC_DEPRECATED_API float VLC_SpeedFaster( int );
500 * Play the input slower than realtime
502 * 1/2x, 1/4x, 1/8x slower than realtime
503 * \note For some inputs, this will be impossible.
505 * \param i_object a vlc object id
506 * \return the current speedrate
508 VLC_DEPRECATED_API float VLC_SpeedSlower( int );
511 * Return the current playlist item
513 * \param i_object a vlc object id
514 * \return the index of the playlistitem that is currently selected for play
516 VLC_DEPRECATED_API int VLC_PlaylistIndex( int );
519 * Total amount of items in the playlist
521 * \param i_object a vlc object id
522 * \return amount of playlist items
524 VLC_DEPRECATED_API int VLC_PlaylistNumberOfItems( int );
529 * Skip to the next playlistitem and play it.
531 * \param i_object a vlc object id
532 * \return VLC_SUCCESS on success
534 VLC_DEPRECATED_API int VLC_PlaylistNext( int );
537 * Previous playlist item
539 * Skip to the previous playlistitem and play it.
541 * \param i_object a vlc object id
542 * \return VLC_SUCCESS on success
544 VLC_DEPRECATED_API int VLC_PlaylistPrev( int );
547 * Clear the contents of the playlist
549 * Completly empty the entire playlist.
551 * \note Was previously called VLC_ClearPlaylist
553 * \param i_object a vlc object id
554 * \return VLC_SUCCESS on success
556 VLC_DEPRECATED_API int VLC_PlaylistClear( int );
561 * \param i_object a vlc object id
562 * \param i_volume something in a range from 0-200
563 * \return the new volume (range 0-200 %)
565 VLC_DEPRECATED_API int VLC_VolumeSet( int, int );
568 * Get the current volume
570 * Retrieve the current volume.
572 * \param i_object a vlc object id
573 * \return the current volume (range 0-200 %)
575 VLC_DEPRECATED_API int VLC_VolumeGet( int );
578 * Mute/Unmute the volume
580 * \param i_object a vlc object id
581 * \return VLC_SUCCESS on success
583 VLC_DEPRECATED_API int VLC_VolumeMute( int );
586 * Toggle Fullscreen mode
588 * Switch between normal and fullscreen video
590 * \param i_object a vlc object id
591 * \return VLC_SUCCESS on success
593 VLC_DEPRECATED_API int VLC_FullScreen( int );
600 #define LICENSE_MSG \
601 _("This program comes with NO WARRANTY, to the extent permitted by " \
602 "law.\nYou may redistribute it under the terms of the GNU General " \
603 "Public License;\nsee the file named COPYING for details.\n" \
604 "Written by the VideoLAN team; see the AUTHORS file.\n")
606 #endif /* <vlc/vlc.h> */