]> git.sesse.net Git - vlc/blob - include/vlc/deprecated.h
include/vlc: Headers clean up.
[vlc] / include / vlc / deprecated.h
1 /*****************************************************************************
2  * deprecated.h:  libvlc deprecated API
3  *****************************************************************************
4  * Copyright (C) 1998-2005 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef _LIBVLC_DEPRECATED_H
26 #define _LIBVLC_DEPRECATED_H 1
27
28 # ifdef __cplusplus
29 extern "C" {
30 # endif
31
32
33 /*****************************************************************************
34  * Playlist (Deprecated)
35  *****************************************************************************/
36 /** \defgroup libvlc_playlist Playlist (Deprecated)
37  * \ingroup libvlc
38  * LibVLC Playlist handling (Deprecated)
39  * @deprecated Use media_list
40  * @{
41  */
42
43 /**
44  * Set the playlist's loop attribute. If set, the playlist runs continuously
45  * and wraps around when it reaches the end.
46  *
47  * \param p_instance the playlist instance
48  * \param loop the loop attribute. 1 sets looping, 0 disables it
49  * \param p_e an initialized exception pointer
50  */
51 VLC_DEPRECATED_API void libvlc_playlist_loop( libvlc_instance_t* , int,
52                                           libvlc_exception_t * );
53
54 /**
55  * Start playing.
56  *
57  * Additionnal playlist item options can be specified for addition to the
58  * item before it is played.
59  *
60  * \param p_instance the playlist instance
61  * \param i_id the item to play. If this is a negative number, the next
62  *        item will be selected. Otherwise, the item with the given ID will be
63  *        played
64  * \param i_options the number of options to add to the item
65  * \param ppsz_options the options to add to the item
66  * \param p_e an initialized exception pointer
67  */
68 VLC_DEPRECATED_API void libvlc_playlist_play( libvlc_instance_t*, int, int,
69                                           char **, libvlc_exception_t * );
70
71 /**
72  * Toggle the playlist's pause status.
73  *
74  * If the playlist was running, it is paused. If it was paused, it is resumed.
75  *
76  * \param p_instance the playlist instance to pause
77  * \param p_e an initialized exception pointer
78  */
79 VLC_DEPRECATED_API void libvlc_playlist_pause( libvlc_instance_t *,
80                                            libvlc_exception_t * );
81
82 /**
83  * Checks whether the playlist is running
84  *
85  * \param p_instance the playlist instance
86  * \param p_e an initialized exception pointer
87  * \return 0 if the playlist is stopped or paused, 1 if it is running
88  */
89 VLC_DEPRECATED_API int libvlc_playlist_isplaying( libvlc_instance_t *,
90                                               libvlc_exception_t * );
91
92 /**
93  * Get the number of items in the playlist
94  *
95  * \param p_instance the playlist instance
96  * \param p_e an initialized exception pointer
97  * \return the number of items
98  */
99 VLC_DEPRECATED_API int libvlc_playlist_items_count( libvlc_instance_t *,
100                                                 libvlc_exception_t * );
101
102 /**
103  * Lock the playlist.
104  *
105  * \param p_instance the playlist instance
106  */
107 VLC_DEPRECATED_API void libvlc_playlist_lock( libvlc_instance_t * );
108
109 /**
110  * Unlock the playlist.
111  *
112  * \param p_instance the playlist instance
113  */
114 VLC_DEPRECATED_API void libvlc_playlist_unlock( libvlc_instance_t * );
115
116 /**
117  * Stop playing.
118  *
119  * \param p_instance the playlist instance to stop
120  * \param p_e an initialized exception pointer
121  */
122 VLC_DEPRECATED_API void libvlc_playlist_stop( libvlc_instance_t *,
123                                           libvlc_exception_t * );
124
125 /**
126  * Go to the next playlist item. If the playlist was stopped, playback
127  * is started.
128  *
129  * \param p_instance the playlist instance
130  * \param p_e an initialized exception pointer
131  */
132 VLC_DEPRECATED_API void libvlc_playlist_next( libvlc_instance_t *,
133                                           libvlc_exception_t * );
134
135 /**
136  * Go to the previous playlist item. If the playlist was stopped, playback
137  * is started.
138  *
139  * \param p_instance the playlist instance
140  * \param p_e an initialized exception pointer
141  */
142 VLC_DEPRECATED_API void libvlc_playlist_prev( libvlc_instance_t *,
143                                           libvlc_exception_t * );
144
145 /**
146  * Empty a playlist. All items in the playlist are removed.
147  *
148  * \param p_instance the playlist instance
149  * \param p_e an initialized exception pointer
150  */
151 VLC_DEPRECATED_API void libvlc_playlist_clear( libvlc_instance_t *,
152                                            libvlc_exception_t * );
153
154 /**
155  * Append an item to the playlist. The item is added at the end. If more
156  * advanced options are required, \see libvlc_playlist_add_extended instead.
157  *
158  * \param p_instance the playlist instance
159  * \param psz_uri the URI to open, using VLC format
160  * \param psz_name a name that you might want to give or NULL
161  * \param p_e an initialized exception pointer
162  * \return the identifier of the new item
163  */
164 VLC_DEPRECATED_API int libvlc_playlist_add( libvlc_instance_t *, const char *,
165                                         const char *, libvlc_exception_t * );
166
167 /**
168  * Append an item to the playlist. The item is added at the end, with
169  * additional input options.
170  *
171  * \param p_instance the playlist instance
172  * \param psz_uri the URI to open, using VLC format
173  * \param psz_name a name that you might want to give or NULL
174  * \param i_options the number of options to add
175  * \param ppsz_options strings representing the options to add
176  * \param p_e an initialized exception pointer
177  * \return the identifier of the new item
178  */
179 VLC_DEPRECATED_API int libvlc_playlist_add_extended( libvlc_instance_t *, const char *,
180                                                  const char *, int, const char **,
181                                                  libvlc_exception_t * );
182
183 /**
184  * Delete the playlist item with the given ID.
185  *
186  * \param p_instance the playlist instance
187  * \param i_id the id to remove
188  * \param p_e an initialized exception pointer
189  * \return 0 in case of success, a non-zero value otherwise
190  */
191 VLC_DEPRECATED_API int libvlc_playlist_delete_item( libvlc_instance_t *, int,
192                                                 libvlc_exception_t * );
193
194 /** Get the input that is currently being played by the playlist.
195  *
196  * \param p_instance the playlist instance to use
197  * \param p_e an initialized exception pointern
198  * \return a media instance object
199  */
200 VLC_DEPRECATED_API libvlc_media_instance_t * libvlc_playlist_get_media_instance(
201                                 libvlc_instance_t *, libvlc_exception_t * );
202
203 /** @}*/
204
205 /**
206  * \defgroup libvlc_old Libvlc Old (Deprecated)
207  * This is libvlc, the base library of the VLC program. (Deprecated)
208  * This is the legacy API. Please consider using the new libvlc API
209  *
210  * @deprecated
211  * @{
212  */
213
214 /*****************************************************************************
215  * Our custom types
216  *****************************************************************************/
217 typedef bool vlc_bool_t;
218 typedef struct vlc_list_t vlc_list_t;
219 typedef struct vlc_object_t vlc_object_t;
220
221 /**
222  * \defgroup var_type Variable types
223  * These are the different types a vlc variable can have.
224  * @{
225  */
226 #define VLC_VAR_VOID      0x0010
227 #define VLC_VAR_BOOL      0x0020
228 #define VLC_VAR_INTEGER   0x0030
229 #define VLC_VAR_HOTKEY    0x0031
230 #define VLC_VAR_STRING    0x0040
231 #define VLC_VAR_MODULE    0x0041
232 #define VLC_VAR_FILE      0x0042
233 #define VLC_VAR_DIRECTORY 0x0043
234 #define VLC_VAR_VARIABLE  0x0044
235 #define VLC_VAR_FLOAT     0x0050
236 #define VLC_VAR_TIME      0x0060
237 #define VLC_VAR_ADDRESS   0x0070
238 #define VLC_VAR_MUTEX     0x0080
239 #define VLC_VAR_LIST      0x0090
240 /**@}*/
241
242 /**
243  * VLC value structure
244  */
245 typedef union
246 {
247     int             i_int;
248     vlc_bool_t      b_bool;
249     float           f_float;
250     char *          psz_string;
251     void *          p_address;
252     vlc_object_t *  p_object;
253     vlc_list_t *    p_list;
254     vlc_int64_t     i_time;
255
256     struct { char *psz_name; int i_object_id; } var;
257
258    /* Make sure the structure is at least 64bits */
259     struct { char a, b, c, d, e, f, g, h; } padding;
260
261 } vlc_value_t;
262
263 /**
264  * VLC list structure
265  */
266 struct vlc_list_t
267 {
268     int             i_count;
269     vlc_value_t *   p_values;
270     int *           pi_types;
271
272 };
273
274 /*****************************************************************************
275  * Error values
276  *****************************************************************************/
277 #define VLC_SUCCESS         -0                                   /* No error */
278 #define VLC_ENOMEM          -1                          /* Not enough memory */
279 #define VLC_ETHREAD         -2                               /* Thread error */
280 #define VLC_ETIMEOUT        -3                                    /* Timeout */
281
282 #define VLC_ENOMOD         -10                           /* Module not found */
283
284 #define VLC_ENOOBJ         -20                           /* Object not found */
285 #define VLC_EBADOBJ        -21                            /* Bad object type */
286
287 #define VLC_ENOVAR         -30                         /* Variable not found */
288 #define VLC_EBADVAR        -31                         /* Bad variable value */
289
290 #define VLC_ENOITEM        -40                           /**< Item not found */
291
292 #define VLC_EEXIT         -255                             /* Program exited */
293 #define VLC_EEXITSUCCESS  -999                /* Program exited successfully */
294 #define VLC_EGENERIC      -666                              /* Generic error */
295
296 /*****************************************************************************
297  * Booleans
298  *****************************************************************************/
299 #define VLC_FALSE false
300 #define VLC_TRUE  true
301
302 /*****************************************************************************
303  * Playlist
304  *****************************************************************************/
305
306 /* Used by VLC_AddTarget() */
307 #define PLAYLIST_INSERT          0x0001
308 #define PLAYLIST_APPEND          0x0002
309 #define PLAYLIST_GO              0x0004
310 #define PLAYLIST_PREPARSE        0x0008
311 #define PLAYLIST_SPREPARSE       0x0010
312 #define PLAYLIST_NO_REBUILD      0x0020
313
314 #define PLAYLIST_END           -666
315
316 /*****************************************************************************
317  * Required internal headers
318  *****************************************************************************/
319 #if defined( __LIBVLC__ )
320 #   include "vlc_common.h"
321 #endif
322
323
324 /*****************************************************************************
325  * Exported vlc API (Deprecated)
326  *****************************************************************************/
327
328 #if !defined( __LIBVLC__ )
329 /* Otherwise they are declared and exported in vlc_common.h */
330 /**
331  * Retrieve libvlc version
332  *
333  * \return a string containing the libvlc version
334  */
335 VLC_DEPRECATED_API char const * VLC_Version ( void );
336
337 /**
338  * Retrieve libvlc compile time
339  *
340  * \return a string containing the libvlc compile time
341  */
342 VLC_DEPRECATED_API char const * VLC_CompileTime ( void );
343
344 /**
345  * Retrieve the username of the libvlc builder
346  *
347  * \return a string containing the username of the libvlc builder
348  */
349 VLC_DEPRECATED_API char const * VLC_CompileBy ( void );
350
351 /**
352  * Retrieve the host of the libvlc builder
353  *
354  * \return a string containing the host of the libvlc builder
355  */
356 VLC_DEPRECATED_API char const * VLC_CompileHost ( void );
357
358 /**
359  * Retrieve the domain name of the host of the libvlc builder
360  *
361  * \return a string containing the domain name of the host of the libvlc builder
362  */
363 VLC_DEPRECATED_API char const * VLC_CompileDomain ( void );
364
365 /**
366  * Retrieve libvlc compiler version
367  *
368  * \return a string containing the libvlc compiler version
369  */
370 VLC_DEPRECATED_API char const * VLC_Compiler ( void );
371
372 /**
373  * Retrieve libvlc changeset
374  *
375  * \return a string containing the libvlc subversion changeset
376  */
377 VLC_DEPRECATED_API char const * VLC_Changeset ( void );
378
379 /**
380  * Return an error string
381  *
382  * \param i_err an error code
383  * \return an error string
384  */
385 VLC_DEPRECATED_API char const * VLC_Error ( int i_err );
386
387 #endif /* __LIBVLC__ */
388
389 /**
390  * Initialize libvlc
391  *
392  * This function allocates a vlc_t structure and returns a negative value
393  * in case of failure. Also, the thread system is initialized
394  *
395  * \return vlc object id or an error code
396  */
397 VLC_DEPRECATED_API int     VLC_Create( void );
398
399 /**
400  * Initialize a vlc_t structure
401  *
402  * This function initializes a previously allocated vlc_t structure:
403  *  - CPU detection
404  *  - gettext initialization
405  *  - message queue, module bank and playlist initialization
406  *  - configuration and commandline parsing
407  *
408  *  \param i_object a vlc object id
409  *  \param i_argc the number of arguments
410  *  \param ppsz_argv an array of arguments
411  *  \return VLC_SUCCESS on success
412  */
413 VLC_DEPRECATED_API int     VLC_Init( int, int, const char *[] );
414
415 /**
416  * Add an interface
417  *
418  * This function opens an interface plugin and runs it. If b_block is set
419  * to 0, VLC_AddIntf will return immediately and let the interface run in a
420  * separate thread. If b_block is set to 1, VLC_AddIntf will continue until
421  * user requests to quit.
422  *
423  * \param i_object a vlc object id
424  * \param psz_module a vlc module name of an interface
425  * \param b_block make this interface blocking
426  * \param b_play start playing when the interface is done loading
427  * \return VLC_SUCCESS on success
428  */
429 VLC_DEPRECATED_API int     VLC_AddIntf( int, char const *, vlc_bool_t, vlc_bool_t );
430
431 /**
432  * Ask vlc to die
433  *
434  * This function sets p_libvlc->b_die to VLC_TRUE, but does not do any other
435  * task. It is your duty to call VLC_CleanUp and VLC_Destroy afterwards.
436  *
437  * \param i_object a vlc object id
438  * \return VLC_SUCCESS on success
439  */
440 VLC_DEPRECATED_API int     VLC_Die( int );
441
442 /**
443  * Clean up all the intf, playlist, vout and aout
444  *
445  * This function requests all intf, playlist, vout and aout objects to finish
446  * and CleanUp. Only a blank VLC object should remain after this.
447  *
448  * \note This function was previously called VLC_Stop
449  *
450  * \param i_object a vlc object id
451  * \return VLC_SUCCESS on success
452  */
453 VLC_DEPRECATED_API int     VLC_CleanUp( int );
454
455 /**
456  * Destroy all threads and the VLC object
457  *
458  * This function requests the running threads to finish, waits for their
459  * termination, and destroys their structure.
460  * Then it will de-init all VLC object initializations.
461  *
462  * \param i_object a vlc object id
463  * \return VLC_SUCCESS on success
464  */
465 VLC_DEPRECATED_API int     VLC_Destroy( int );
466
467 /**
468  * Set a VLC variable
469  *
470  * This function sets a variable of VLC
471  *
472  * \note Was previously called VLC_Set
473  *
474  * \param i_object a vlc object id
475  * \param psz_var a vlc variable name
476  * \param value a vlc_value_t structure
477  * \return VLC_SUCCESS on success
478  */
479 VLC_DEPRECATED_API int     VLC_VariableSet( int, char const *, vlc_value_t );
480
481 /**
482  * Get a VLC variable
483  *
484  * This function gets the value of a variable of VLC
485  * It stores it in the p_value argument
486  *
487  * \note Was previously called VLC_Get
488  *
489  * \param i_object a vlc object id
490  * \param psz_var a vlc variable name
491  * \param p_value a pointer to a vlc_value_t structure
492  * \return VLC_SUCCESS on success
493  */
494 VLC_DEPRECATED_API int     VLC_VariableGet( int, char const *, vlc_value_t * );
495
496 /**
497  * Get a VLC variable type
498  *
499  * This function gets the type of a variable of VLC
500  * It stores it in the p_type argument
501  *
502  * \param i_object a vlc object id
503  * \param psz_var a vlc variable name
504  * \param pi_type a pointer to an integer
505  * \return VLC_SUCCESS on success
506  */
507 VLC_DEPRECATED_API int     VLC_VariableType( int, char const *, int * );
508
509 /**
510  * Add a target to the current playlist
511  *
512  * This funtion will add a target to the current playlist. If a playlist does
513  * not exist, it will be created.
514  *
515  * \param i_object a vlc object id
516  * \param psz_target the URI of the target to play
517  * \param ppsz_options an array of strings with input options (ie. :input-repeat)
518  * \param i_options the amount of options in the ppsz_options array
519  * \param i_mode the insert mode to insert the target into the playlist (PLAYLIST_* defines)
520  * \param i_pos the position at which to add the new target (PLAYLIST_END for end)
521  * \return the item id on success and -1 on error
522  */
523 VLC_DEPRECATED_API int     VLC_AddTarget( int, char const *, const char **, int, int, int );
524
525 /**
526  * Start the playlist and play the currently selected playlist item
527  *
528  * If there is something in the playlist, and the playlist is not running,
529  * then start the playlist and play the currently selected playlist item.
530  * If an item is currently paused, then resume it.
531  *
532  * \param i_object a vlc object id
533  * \return VLC_SUCCESS on success
534  */
535 VLC_DEPRECATED_API int     VLC_Play( int );
536
537 /**
538  * Pause the currently playing item. Resume it if already paused
539  *
540  * If an item is currently playing then pause it.
541  * If the item is already paused, then resume playback.
542  *
543  * \param i_object a vlc object id
544  * \return VLC_SUCCESS on success
545  */
546 VLC_DEPRECATED_API int     VLC_Pause( int );
547
548 /**
549  * Stop the playlist
550  *
551  * If an item is currently playing then stop it.
552  * Set the playlist to a stopped state.
553  *
554  * \note This function is new. The old VLC_Stop is now called VLC_CleanUp
555  *
556  * \param i_object a vlc object id
557  * \return VLC_SUCCESS on success
558  */
559 VLC_DEPRECATED_API int             VLC_Stop( int );
560
561 /**
562  * Tell if VLC is playing
563  *
564  * If an item is currently playing, it returns
565  * VLC_TRUE, else VLC_FALSE
566  *
567  * \param i_object a vlc object id
568  * \return VLC_TRUE or VLC_FALSE
569  */
570 VLC_DEPRECATED_API vlc_bool_t      VLC_IsPlaying( int );
571
572 /**
573  * Get the current position in a input
574  *
575  * Return the current position as a float
576  * This method should be used for time sliders etc
577  * \note For some inputs, this will be unknown.
578  *
579  * \param i_object a vlc object id
580  * \return a float in the range of 0.0 - 1.0
581  */
582 VLC_DEPRECATED_API float           VLC_PositionGet( int );
583
584 /**
585  * Set the current position in a input
586  *
587  * Set the current position as a float
588  * This method should be used for time sliders etc
589  * \note For some inputs, this will be unknown.
590  *
591  * \param i_object a vlc object id
592  * \param i_position a float in the range of 0.0 - 1.0
593  * \return a float in the range of 0.0 - 1.0
594  */
595 VLC_DEPRECATED_API float           VLC_PositionSet( int, float );
596
597 /**
598  * Get the current position in a input
599  *
600  * Return the current position in seconds from the start.
601  * \note For some inputs, this will be unknown.
602  *
603  * \param i_object a vlc object id
604  * \return the offset from 0:00 in seconds
605  */
606 VLC_DEPRECATED_API int             VLC_TimeGet( int );
607
608 /**
609  * Seek to a position in the current input
610  *
611  * Seek i_seconds in the current input. If b_relative is set,
612  * then the seek will be relative to the current position, otherwise
613  * it will seek to i_seconds from the beginning of the input.
614  * \note For some inputs, this will be unknown.
615  *
616  * \param i_object a vlc object id
617  * \param i_seconds seconds from current position or from beginning of input
618  * \param b_relative seek relative from current position
619  * \return VLC_SUCCESS on success
620  */
621 VLC_DEPRECATED_API int             VLC_TimeSet( int, int, vlc_bool_t );
622
623 /**
624  * Get the total length of a input
625  *
626  * Return the total length in seconds from the current input.
627  * \note For some inputs, this will be unknown.
628  *
629  * \param i_object a vlc object id
630  * \return the length in seconds
631  */
632 VLC_DEPRECATED_API int             VLC_LengthGet( int );
633
634 /**
635  * Play the input faster than realtime
636  *
637  * 2x, 4x, 8x faster than realtime
638  * \note For some inputs, this will be impossible.
639  *
640  * \param i_object a vlc object id
641  * \return the current speedrate
642  */
643 VLC_DEPRECATED_API float           VLC_SpeedFaster( int );
644
645 /**
646  * Play the input slower than realtime
647  *
648  * 1/2x, 1/4x, 1/8x slower than realtime
649  * \note For some inputs, this will be impossible.
650  *
651  * \param i_object a vlc object id
652  * \return the current speedrate
653  */
654 VLC_DEPRECATED_API float           VLC_SpeedSlower( int );
655
656 /**
657  * Return the current playlist item
658  *
659  * \param i_object a vlc object id
660  * \return the index of the playlistitem that is currently selected for play
661  */
662 VLC_DEPRECATED_API int             VLC_PlaylistIndex( int );
663
664 /**
665  * Total amount of items in the playlist
666  *
667  * \param i_object a vlc object id
668  * \return amount of playlist items
669  */
670 VLC_DEPRECATED_API int             VLC_PlaylistNumberOfItems( int );
671
672 /**
673  * Next playlist item
674  *
675  * Skip to the next playlistitem and play it.
676  *
677  * \param i_object a vlc object id
678  * \return VLC_SUCCESS on success
679  */
680 VLC_DEPRECATED_API int             VLC_PlaylistNext( int );
681
682 /**
683  * Previous playlist item
684  *
685  * Skip to the previous playlistitem and play it.
686  *
687  * \param i_object a vlc object id
688  * \return VLC_SUCCESS on success
689  */
690 VLC_DEPRECATED_API int             VLC_PlaylistPrev( int );
691
692 /**
693  * Clear the contents of the playlist
694  *
695  * Completly empty the entire playlist.
696  *
697  * \note Was previously called VLC_ClearPlaylist
698  *
699  * \param i_object a vlc object id
700  * \return VLC_SUCCESS on success
701  */
702 VLC_DEPRECATED_API int             VLC_PlaylistClear( int );
703
704 /**
705  * Change the volume
706  *
707  * \param i_object a vlc object id
708  * \param i_volume something in a range from 0-200
709  * \return the new volume (range 0-200 %)
710  */
711 VLC_DEPRECATED_API int             VLC_VolumeSet( int, int );
712
713 /**
714  * Get the current volume
715  *
716  * Retrieve the current volume.
717  *
718  * \param i_object a vlc object id
719  * \return the current volume (range 0-200 %)
720  */
721 VLC_DEPRECATED_API int             VLC_VolumeGet( int );
722
723 /**
724  * Mute/Unmute the volume
725  *
726  * \param i_object a vlc object id
727  * \return VLC_SUCCESS on success
728  */
729 VLC_DEPRECATED_API int            VLC_VolumeMute( int );
730
731 /**
732  * Toggle Fullscreen mode
733  *
734  * Switch between normal and fullscreen video
735  *
736  * \param i_object a vlc object id
737  * \return VLC_SUCCESS on success
738  */
739 VLC_DEPRECATED_API int             VLC_FullScreen( int );
740
741 /**@} */
742
743 # ifdef __cplusplus
744 }
745 # endif
746
747 #endif /* _LIBVLC_DEPRECATED_H */