]> git.sesse.net Git - vlc/blob - include/vlc/common.h
Merge branch 'master' of git@git.videolan.org:vlc
[vlc] / include / vlc / common.h
1 /*****************************************************************************
2  * vlc.h: global header for libvlc (old-style)
3  *****************************************************************************
4  * Copyright (C) 1998-2004 the VideoLAN team
5  * $Id$
6  *
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>
11  *
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.
16  *
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.
21  *
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  *****************************************************************************/
26
27 /**
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
31  *
32  * @{
33  */
34
35
36 #ifndef _VLC_COMMON_H
37 #define _VLC_COMMON_H 1
38
39 # ifdef __cplusplus
40 extern "C" {
41 # else
42 #  include <stdbool.h>
43 # endif
44
45 /*****************************************************************************
46  * Our custom types
47  *****************************************************************************/
48 typedef struct vlc_list_t vlc_list_t; /* (shouldn't be exposed) */
49 typedef struct vlc_object_t vlc_object_t; /* (shouldn't be exposed) */
50
51 #if (defined( WIN32 ) || defined( UNDER_CE )) && !defined( __MINGW32__ )
52 typedef signed __int64 vlc_int64_t;
53 # else
54 typedef signed long long vlc_int64_t;
55 #endif
56
57 /**
58  * VLC value structure (shouldn't be exposed)
59  */
60 typedef union
61 {
62     int             i_int;
63     bool      b_bool;
64     float           f_float;
65     char *          psz_string;
66     void *          p_address;
67     vlc_object_t *  p_object;
68     vlc_list_t *    p_list;
69     vlc_int64_t     i_time;
70
71     struct { char *psz_name; int i_object_id; } var;
72
73    /* Make sure the structure is at least 64bits */
74     struct { char a, b, c, d, e, f, g, h; } padding;
75
76 } vlc_value_t;
77
78 /**
79  * VLC list structure  (shouldn't be exposed)
80  */
81 struct vlc_list_t
82 {
83     int             i_count;
84     vlc_value_t *   p_values;
85     int *           pi_types;
86
87 };
88
89 /*****************************************************************************
90  * Error values (shouldn't be exposed)
91  *****************************************************************************/
92 #define VLC_SUCCESS         -0                                   /* No error */
93 #define VLC_ENOMEM          -1                          /* Not enough memory */
94 #define VLC_ETHREAD         -2                               /* Thread error */
95 #define VLC_ETIMEOUT        -3                                    /* Timeout */
96
97 #define VLC_ENOMOD         -10                           /* Module not found */
98
99 #define VLC_ENOOBJ         -20                           /* Object not found */
100 #define VLC_EBADOBJ        -21                            /* Bad object type */
101
102 #define VLC_ENOVAR         -30                         /* Variable not found */
103 #define VLC_EBADVAR        -31                         /* Bad variable value */
104
105 #define VLC_ENOITEM        -40                           /**< Item not found */
106
107 #define VLC_EEXIT         -255                             /* Program exited */
108 #define VLC_EEXITSUCCESS  -999                /* Program exited successfully */
109 #define VLC_EGENERIC      -666                              /* Generic error */
110
111 /**
112  * \defgroup var_type Variable types  (shouldn't be exposed)
113  * These are the different types a vlc variable can have.
114  * @{
115  */
116 #define VLC_VAR_VOID      0x0010
117 #define VLC_VAR_BOOL      0x0020
118 #define VLC_VAR_INTEGER   0x0030
119 #define VLC_VAR_HOTKEY    0x0031
120 #define VLC_VAR_STRING    0x0040
121 #define VLC_VAR_MODULE    0x0041
122 #define VLC_VAR_FILE      0x0042
123 #define VLC_VAR_DIRECTORY 0x0043
124 #define VLC_VAR_VARIABLE  0x0044
125 #define VLC_VAR_FLOAT     0x0050
126 #define VLC_VAR_TIME      0x0060
127 #define VLC_VAR_ADDRESS   0x0070
128 #define VLC_VAR_MUTEX     0x0080
129 #define VLC_VAR_LIST      0x0090
130 /**@}*/
131
132 /*****************************************************************************
133  * Required internal headers
134  *****************************************************************************/
135 #if defined( __LIBVLC__ )
136 #   include "vlc_common.h"
137 #endif
138
139
140 /*****************************************************************************
141  * Shared library Export macros
142  *****************************************************************************/
143 #ifndef VLC_PUBLIC_API
144 #  define VLC_PUBLIC_API extern
145 #endif
146
147 /*****************************************************************************
148  * Compiler specific
149  *****************************************************************************/
150
151 #ifndef VLC_DEPRECATED_API
152 # ifdef __LIBVLC__
153 /* Avoid unuseful warnings from libvlc with our deprecated APIs */
154 #    define VLC_DEPRECATED_API VLC_PUBLIC_API
155 # else /* __LIBVLC__ */
156 #  if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
157 #    define VLC_DEPRECATED_API VLC_PUBLIC_API __attribute__((deprecated))
158 #  else
159 #    define VLC_DEPRECATED_API VLC_PUBLIC_API
160 #  endif
161 # endif /* __LIBVLC__ */
162 #endif
163
164
165 # ifdef __cplusplus
166 }
167 # endif
168
169
170 #endif /* _VLC_COMMON_H */