Debian Codegraph @

samples/vlc-sample/src/libvlc.h

raw symbols SCIP
1 /*****************************************************************************
2 * libvlc.h: Internal libvlc generic/misc declaration
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001, 2002 VLC authors and VideoLAN
5 * Copyright © 2006-2007 Rémi Denis-Courmont
6 * $Id: 21bdfdcfba26f0a50e775a077df02a1debe88ba6 $
7 *
8 * Authors: Vincent Seguin <[email protected]>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
24
25 #ifndef LIBVLC_LIBVLC_H
26 # define LIBVLC_LIBVLC_H 1
27
28 extern const char psz_vlc_changeset[];
29
30 typedef struct variable_t variable_t;
31
32 /* Actions (hot keys) */
33 struct vlc_actions;
34 struct vlc_actions *vlc_InitActions (libvlc_int_t *);
35 extern void vlc_DeinitActions (libvlc_int_t *, struct vlc_actions *);
36
37 /*
38 * OS-specific initialization
39 */
40 void system_Init ( void );
41 void system_Configure ( libvlc_int_t *, int, const char *const [] );
42 #if defined(_WIN32) || defined(__OS2__)
43 void system_End(void);
44 #ifndef __OS2__
45 size_t EnumClockSource( vlc_object_t *, const char *, char ***, char *** );
46 #endif
47 #endif
48 void vlc_CPU_init(void);
49 void vlc_CPU_dump(vlc_object_t *);
50
51 /*
52 * Threads subsystem
53 */
54
55 /* This cannot be used as is from plugins yet: */
56 int vlc_clone_detach (vlc_thread_t *, void *(*)(void *), void *, int);
57
58 int vlc_set_priority( vlc_thread_t, int );
59
60 void vlc_threads_setup (libvlc_int_t *);
61
62 void vlc_trace (const char *fn, const char *file, unsigned line);
63 #define vlc_backtrace() vlc_trace(__func__, __FILE__, __LINE__)
64
65 #if (defined (LIBVLC_USE_PTHREAD) || defined(__ANDROID__)) && !defined (NDEBUG)
66 void vlc_assert_locked (vlc_mutex_t *);
67 #else
68 # define vlc_assert_locked( m ) (void)m
69 #endif
70
71 /*
72 * Logging
73 */
74 typedef struct vlc_logger_t vlc_logger_t;
75
76 int vlc_LogPreinit(libvlc_int_t *);
77 int vlc_LogInit(libvlc_int_t *);
78 void vlc_LogDeinit(libvlc_int_t *);
79
80 /*
81 * LibVLC exit event handling
82 */
83 typedef struct vlc_exit
84 {
85 vlc_mutex_t lock;
86 void (*handler) (void *);
87 void *opaque;
88 } vlc_exit_t;
89
90 void vlc_ExitInit( vlc_exit_t * );
91 void vlc_ExitDestroy( vlc_exit_t * );
92
93 /*
94 * LibVLC objects stuff
95 */
96
97 /**
98 * Creates a VLC object.
99 *
100 * Note that because the object name pointer must remain valid, potentially
101 * even after the destruction of the object (through the message queues), this
102 * function CANNOT be exported to plugins as is. In this case, the old
103 * vlc_object_create() must be used instead.
104 *
105 * @param p_this an existing VLC object
106 * @param i_size byte size of the object structure
107 * @param psz_type object type name
108 * @return the created object, or NULL.
109 */
110 extern void *
111 vlc_custom_create (vlc_object_t *p_this, size_t i_size, const char *psz_type);
112 #define vlc_custom_create(o, s, n) \
113 vlc_custom_create(VLC_OBJECT(o), s, n)
114
115 /**
116 * Assign a name to an object for vlc_object_find_name().
117 */
118 extern int vlc_object_set_name(vlc_object_t *, const char *);
119 #define vlc_object_set_name(o, n) vlc_object_set_name(VLC_OBJECT(o), n)
120
121 /* Types */
122 typedef void (*vlc_destructor_t) (struct vlc_object_t *);
123 void vlc_object_set_destructor (vlc_object_t *, vlc_destructor_t);
124 #define vlc_object_set_destructor(a,b) \
125 vlc_object_set_destructor (VLC_OBJECT(a), b)
126
127 #define ZOOM_SECTION N_("Zoom")
128 #define ZOOM_QUARTER_KEY_TEXT N_("1:4 Quarter")
129 #define ZOOM_HALF_KEY_TEXT N_("1:2 Half")
130 #define ZOOM_ORIGINAL_KEY_TEXT N_("1:1 Original")
131 #define ZOOM_DOUBLE_KEY_TEXT N_("2:1 Double")
132
133 /**
134 * Private LibVLC instance data.
135 */
136 typedef struct vlc_dialog_provider vlc_dialog_provider;
137 typedef struct vlc_keystore vlc_keystore;
138
139 typedef struct libvlc_priv_t
140 {
141 libvlc_int_t public_data;
142
143 /* Logging */
144 bool b_stats; ///< Whether to collect stats
145
146 /* Singleton objects */
147 vlc_logger_t *logger;
148 vlm_t *p_vlm; ///< the VLM singleton (or NULL)
149 vlc_dialog_provider *p_dialog_provider; ///< dialog provider
150 vlc_keystore *p_memory_keystore; ///< memory keystore
151 struct playlist_t *playlist; ///< Playlist for interfaces
152 struct playlist_preparser_t *parser; ///< Input item meta data handler
153 struct vlc_actions *actions; ///< Hotkeys handler
154
155 /* Exit callback */
156 vlc_exit_t exit;
157 } libvlc_priv_t;
158
159 static inline libvlc_priv_t *libvlc_priv (libvlc_int_t *libvlc)
160 {
161 return (libvlc_priv_t *)libvlc;
162 }
163
164 void intf_InsertItem(libvlc_int_t *, const char *mrl, unsigned optc,
165 const char * const *optv, unsigned flags);
166 void intf_DestroyAll( libvlc_int_t * );
167
168 #define libvlc_stats( o ) (libvlc_priv((VLC_OBJECT(o))->p_libvlc)->b_stats)
169
170 /*
171 * Variables stuff
172 */
173 void var_OptionParse (vlc_object_t *, const char *, bool trusted);
174
175 /*
176 * Stats stuff
177 */
178 enum
179 {
180 STATS_COUNTER,
181 STATS_DERIVATIVE,
182 };
183
184 typedef struct counter_sample_t
185 {
186 uint64_t value;
187 mtime_t date;
188 } counter_sample_t;
189
190 typedef struct counter_t
191 {
192 int i_compute_type;
193 int i_samples;
194 counter_sample_t ** pp_samples;
195
196 mtime_t last_update;
197 } counter_t;
198
199 enum
200 {
201 STATS_INPUT_BITRATE,
202 STATS_READ_BYTES,
203 STATS_READ_PACKETS,
204 STATS_DEMUX_READ,
205 STATS_DEMUX_BITRATE,
206 STATS_DEMUX_CORRUPTED,
207 STATS_DEMUX_DISCONTINUITY,
208 STATS_PLAYED_ABUFFERS,
209 STATS_LOST_ABUFFERS,
210 STATS_DECODED_AUDIO,
211 STATS_DECODED_VIDEO,
212 STATS_DECODED_SUB,
213 STATS_CLIENT_CONNECTIONS,
214 STATS_ACTIVE_CONNECTIONS,
215 STATS_SOUT_SENT_PACKETS,
216 STATS_SOUT_SENT_BYTES,
217 STATS_SOUT_SEND_BITRATE,
218 STATS_DISPLAYED_PICTURES,
219 STATS_LOST_PICTURES,
220 };
221
222 counter_t * stats_CounterCreate (int);
223 void stats_Update (counter_t *, uint64_t, uint64_t *);
224 void stats_CounterClean (counter_t * );
225
226 void stats_ComputeInputStats(input_thread_t*, input_stats_t*);
227 void stats_ReinitInputStats(input_stats_t *);
228
229 #endif