]> git.sesse.net Git - vlc/blob - include/vlc/vlc.h
* ALL: Better announce system
[vlc] / include / vlc / vlc.h
1 /*****************************************************************************
2  * vlc.h: global header for vlc
3  *****************************************************************************
4  * Copyright (C) 1998, 1999, 2000 VideoLAN
5  * $Id$
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
20  *****************************************************************************/
21
22 /**
23  * \defgroup libvlc Libvlc
24  * This is libvlc.
25  *
26  * @{
27  */
28
29
30 #ifndef _VLC_VLC_H
31 #define _VLC_VLC_H 1
32
33 # ifdef __cplusplus
34 extern "C" {
35 # endif
36
37 /*****************************************************************************
38  * Our custom types
39  *****************************************************************************/
40 typedef int vlc_bool_t;
41 typedef struct vlc_list_t vlc_list_t;
42 typedef struct vlc_object_t vlc_object_t;
43
44 /**
45  * VLC value structure
46  */
47 typedef union
48 {
49     int             i_int;
50     vlc_bool_t      b_bool;
51     float           f_float;
52     char *          psz_string;
53     void *          p_address;
54     vlc_object_t *  p_object;
55     vlc_list_t *    p_list;
56
57 #if defined( WIN32 ) && !defined( __MINGW32__ )
58     signed __int64   i_time;
59 # else
60     signed long long i_time;
61 #endif
62
63     struct { char *psz_name; int i_object_id; } var;
64
65    /* Make sure the structure is at least 64bits */
66     struct { char a, b, c, d, e, f, g, h; } padding;
67
68 } vlc_value_t;
69
70 /**
71  * VLC list structure
72  */
73 struct vlc_list_t
74 {
75     int             i_count;
76     vlc_value_t *   p_values;
77     int *           pi_types;
78
79 };
80
81 /*****************************************************************************
82  * Error values
83  *****************************************************************************/
84 #define VLC_SUCCESS         -0                                   /* No error */
85 #define VLC_ENOMEM          -1                          /* Not enough memory */
86 #define VLC_ETHREAD         -2                               /* Thread error */
87 #define VLC_ETIMEOUT        -3                                    /* Timeout */
88
89 #define VLC_ENOMOD         -10                           /* Module not found */
90
91 #define VLC_ENOOBJ         -20                           /* Object not found */
92 #define VLC_EBADOBJ        -21                            /* Bad object type */
93
94 #define VLC_ENOVAR         -30                         /* Variable not found */
95 #define VLC_EBADVAR        -31                         /* Bad variable value */
96
97 #define VLC_EEXIT         -255                             /* Program exited */
98 #define VLC_EGENERIC      -666                              /* Generic error */
99
100 /*****************************************************************************
101  * Booleans
102  *****************************************************************************/
103 #define VLC_FALSE 0
104 #define VLC_TRUE  1
105
106 /*****************************************************************************
107  * Playlist
108  *****************************************************************************/
109
110 /* Used by playlist_Add */
111 #define PLAYLIST_INSERT          0x0001
112 #define PLAYLIST_REPLACE         0x0002
113 #define PLAYLIST_APPEND          0x0004
114 #define PLAYLIST_GO              0x0008
115 #define PLAYLIST_CHECK_INSERT    0x0010
116
117 #define PLAYLIST_END           -666
118
119 /**
120  * Playlist commands
121  */
122 typedef enum {
123     PLAYLIST_PLAY,                              /**< Starts playing. No arg. */
124     PLAYLIST_PAUSE,                     /**< Toggles playlist pause. No arg. */
125     PLAYLIST_STOP,                               /**< Stops playing. No arg. */
126     PLAYLIST_SKIP,                               /**< Skip X items and play. */
127     PLAYLIST_GOTO,                                       /**< Goto Xth item. */
128     PLAYLIST_MODE                                /**< Set playlist mode. ??? */
129 } playlist_command_t;
130
131 /*****************************************************************************
132  * Required internal headers
133  *****************************************************************************/
134 #if defined( __VLC__ )
135 #   include "vlc_common.h"
136 #endif
137
138 /*****************************************************************************
139  * Exported libvlc API
140  *****************************************************************************/
141
142 /**
143  * Retrieve libvlc version
144  *
145  * \return a string containing the libvlc version
146  */
147 char const * VLC_Version ( void );
148
149 /**
150  * Return an error string
151  *
152  * \param i_err an error code
153  * \return an error string
154  */
155 char const * VLC_Error ( int i_err );
156
157 /**
158  * Initialize libvlc
159  *
160  * This function allocates a vlc_t structure and returns a negative value
161  * in case of failure. Also, the thread system is initialized
162  *
163  * \return vlc object id or an error code
164  */
165 int     VLC_Create       ( void );
166
167 /**
168  * Initialize a vlc_t structure
169  *
170  * This function initializes a previously allocated vlc_t structure:
171  *  - CPU detection
172  *  - gettext initialization
173  *  - message queue, module bank and playlist initialization
174  *  - configuration and commandline parsing
175  *
176  *  \param i_object a vlc object id
177  *  \param i_argc the number of arguments
178  *  \param ppsz_argv an array of arguments
179  *  \return VLC_SUCCESS on success
180  */
181 int     VLC_Init         ( int, int, char *[] );
182
183 /**
184  * Ask vlc to die
185  *
186  * This function sets p_vlc->b_die to VLC_TRUE, but does not do any other
187  * task. It is your duty to call VLC_End and VLC_Destroy afterwards.
188  *
189  * \param i_object a vlc object id
190  * \return VLC_SUCCESS on success
191  */
192 int     VLC_Die          ( int );
193
194 /**
195  * Stop playing and destroy everything.
196  *
197  * This function requests the running threads to finish, waits for their
198  * termination, and destroys their structure.
199  * \param i_object a vlc object id
200  * \return VLC_SUCCESS on success
201  */
202 int     VLC_Destroy      ( int );
203
204 /**
205  * Set a VLC variable
206  *
207  * This function sets a variable of VLC
208  *
209  * \param i_object a vlc object id
210  * \param psz_var a vlc variable name
211  * \param value a vlc_value_t structure
212  * \return VLC_SUCCESS on success
213  */
214 int     VLC_Set          ( int, char const *, vlc_value_t );
215
216 /**
217  * Get a VLC variable
218  *
219  * This function gets the value of a variable of VLC
220  * It stores it in the p_value argument
221  *
222  * \param i_object a vlc object id
223  * \param psz_var a vlc variable name
224  * \param p_value a pointer to a vlc_value_t structure
225  * \return VLC_SUCCESS on success
226  */
227 int     VLC_Get          ( int, char const *, vlc_value_t * );
228
229 int     VLC_AddIntf      ( int, char const *, vlc_bool_t );
230 int     VLC_AddTarget    ( int, char const *, const char **, int, int, int );
231
232 int     VLC_Play         ( int );
233 int     VLC_Pause        ( int );
234 int     VLC_Stop         ( int );
235 int     VLC_FullScreen   ( int );
236 int     VLC_ClearPlaylist( int );
237 vlc_bool_t VLC_IsPlaying ( int );
238
239 # ifdef __cplusplus
240 }
241 # endif
242
243 #endif /* <vlc/vlc.h> */