codec: spudec: force osd start time for forced spu overlays
[vlc.git] / src / libvlc.h
blob299795c549df0a435d35053c5fe3a501be3c5746
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$
8 * Authors: Vincent Seguin <seguin@via.ecp.fr>
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.
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.
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 *****************************************************************************/
25 #ifndef LIBVLC_LIBVLC_H
26 # define LIBVLC_LIBVLC_H 1
28 extern const char psz_vlc_changeset[];
30 typedef struct variable_t variable_t;
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 *);
38 * OS-specific initialization
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 *);
52 * Threads subsystem
55 /* This cannot be used as is from plugins yet: */
56 int vlc_clone_detach (vlc_thread_t *, void *(*)(void *), void *, int);
58 int vlc_set_priority( vlc_thread_t, int );
60 void vlc_threads_setup (libvlc_int_t *);
62 void vlc_trace (const char *fn, const char *file, unsigned line);
63 #define vlc_backtrace() vlc_trace(__func__, __FILE__, __LINE__)
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
72 * Logging
74 typedef struct vlc_logger_t vlc_logger_t;
76 int vlc_LogPreinit(libvlc_int_t *);
77 int vlc_LogInit(libvlc_int_t *);
78 void vlc_LogDeinit(libvlc_int_t *);
81 * LibVLC exit event handling
83 typedef struct vlc_exit
85 vlc_mutex_t lock;
86 void (*handler) (void *);
87 void *opaque;
88 } vlc_exit_t;
90 void vlc_ExitInit( vlc_exit_t * );
91 void vlc_ExitDestroy( vlc_exit_t * );
94 * LibVLC objects stuff
97 /**
98 * Creates a VLC object.
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.
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.
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)
116 * Assign a name to an object for vlc_object_find_name().
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)
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)
128 * Allocates an object resource.
130 * @param size storage size in bytes of the resource data
131 * @param release callback to release the resource
133 * @return a pointer to the (uninitialized) storage space, or NULL on error
135 void *vlc_objres_new(size_t size, void (*release)(void *));
138 * Pushes an object resource on the object resources stack.
140 * @param obj object to allocate the resource for
141 * @param data resource base address (as returned by vlc_objres_new())
143 void vlc_objres_push(vlc_object_t *obj, void *data);
146 * Releases all resources of an object.
148 * All resources added with vlc_objres_add() are released in reverse order.
149 * The resource list is reset to empty.
151 * @param obj object whose resources to release
153 void vlc_objres_clear(vlc_object_t *obj);
156 * Releases one object resource explicitly.
158 * If a resource associated with an object needs to be released explicitly
159 * earlier than normal, call this function. This is relatively slow and should
160 * be avoided.
162 * @param obj object whose resource to release
163 * @param data private data for the comparison function
164 * @param match comparison function to match the targeted resource
166 void vlc_objres_remove(vlc_object_t *obj, void *data,
167 bool (*match)(void *, void *));
169 #define ZOOM_SECTION N_("Zoom")
170 #define ZOOM_QUARTER_KEY_TEXT N_("1:4 Quarter")
171 #define ZOOM_HALF_KEY_TEXT N_("1:2 Half")
172 #define ZOOM_ORIGINAL_KEY_TEXT N_("1:1 Original")
173 #define ZOOM_DOUBLE_KEY_TEXT N_("2:1 Double")
176 * Private LibVLC instance data.
178 typedef struct vlc_dialog_provider vlc_dialog_provider;
179 typedef struct vlc_keystore vlc_keystore;
181 typedef struct libvlc_priv_t
183 libvlc_int_t public_data;
185 /* Logging */
186 bool b_stats; ///< Whether to collect stats
188 /* Singleton objects */
189 vlc_logger_t *logger;
190 vlm_t *p_vlm; ///< the VLM singleton (or NULL)
191 vlc_dialog_provider *p_dialog_provider; ///< dialog provider
192 vlc_keystore *p_memory_keystore; ///< memory keystore
193 struct playlist_t *playlist; ///< Playlist for interfaces
194 struct playlist_preparser_t *parser; ///< Input item meta data handler
195 struct vlc_actions *actions; ///< Hotkeys handler
197 /* Exit callback */
198 vlc_exit_t exit;
199 } libvlc_priv_t;
201 static inline libvlc_priv_t *libvlc_priv (libvlc_int_t *libvlc)
203 return container_of(libvlc, libvlc_priv_t, public_data);
206 int intf_InsertItem(libvlc_int_t *, const char *mrl, unsigned optc,
207 const char * const *optv, unsigned flags);
208 void intf_DestroyAll( libvlc_int_t * );
210 #define libvlc_stats( o ) (libvlc_priv((VLC_OBJECT(o))->obj.libvlc)->b_stats)
213 * Variables stuff
215 void var_OptionParse (vlc_object_t *, const char *, bool trusted);
218 * Stats stuff
220 enum
222 STATS_COUNTER,
223 STATS_DERIVATIVE,
226 typedef struct counter_sample_t
228 uint64_t value;
229 mtime_t date;
230 } counter_sample_t;
232 typedef struct counter_t
234 int i_compute_type;
235 int i_samples;
236 counter_sample_t ** pp_samples;
238 mtime_t last_update;
239 } counter_t;
241 enum
243 STATS_INPUT_BITRATE,
244 STATS_READ_BYTES,
245 STATS_READ_PACKETS,
246 STATS_DEMUX_READ,
247 STATS_DEMUX_BITRATE,
248 STATS_DEMUX_CORRUPTED,
249 STATS_DEMUX_DISCONTINUITY,
250 STATS_PLAYED_ABUFFERS,
251 STATS_LOST_ABUFFERS,
252 STATS_DECODED_AUDIO,
253 STATS_DECODED_VIDEO,
254 STATS_DECODED_SUB,
255 STATS_CLIENT_CONNECTIONS,
256 STATS_ACTIVE_CONNECTIONS,
257 STATS_SOUT_SENT_PACKETS,
258 STATS_SOUT_SENT_BYTES,
259 STATS_SOUT_SEND_BITRATE,
260 STATS_DISPLAYED_PICTURES,
261 STATS_LOST_PICTURES,
264 counter_t * stats_CounterCreate (int);
265 void stats_Update (counter_t *, uint64_t, uint64_t *);
266 void stats_CounterClean (counter_t * );
268 void stats_ComputeInputStats(input_thread_t*, input_stats_t*);
269 void stats_ReinitInputStats(input_stats_t *);
271 #endif