dxva2: warn when closing the device handle failed
[vlc.git] / src / libvlc.h
blob7d7982157edf588137d7a6cb3693feefd20dcfe6
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;
33 * OS-specific initialization
35 void system_Init ( void );
36 void system_Configure ( libvlc_int_t *, int, const char *const [] );
37 #if defined(_WIN32) || defined(__OS2__)
38 void system_End(void);
39 #ifndef __OS2__
40 size_t EnumClockSource( vlc_object_t *, const char *, char ***, char *** );
41 #endif
42 #endif
43 void vlc_CPU_init(void);
44 void vlc_CPU_dump(vlc_object_t *);
47 * Threads subsystem
50 /* This cannot be used as is from plugins yet: */
51 int vlc_clone_detach (vlc_thread_t *, void *(*)(void *), void *, int);
53 int vlc_set_priority( vlc_thread_t, int );
55 void vlc_threads_setup (libvlc_int_t *);
57 void vlc_trace (const char *fn, const char *file, unsigned line);
58 #define vlc_backtrace() vlc_trace(__func__, __FILE__, __LINE__)
60 #if (defined (LIBVLC_USE_PTHREAD) || defined(__ANDROID__)) && !defined (NDEBUG)
61 void vlc_assert_locked (vlc_mutex_t *);
62 #else
63 # define vlc_assert_locked( m ) (void)m
64 #endif
67 * Logging
69 typedef struct vlc_logger_t vlc_logger_t;
71 int vlc_LogPreinit(libvlc_int_t *);
72 int vlc_LogInit(libvlc_int_t *);
73 void vlc_LogDeinit(libvlc_int_t *);
76 * LibVLC exit event handling
78 typedef struct vlc_exit
80 vlc_mutex_t lock;
81 void (*handler) (void *);
82 void *opaque;
83 } vlc_exit_t;
85 void vlc_ExitInit( vlc_exit_t * );
86 void vlc_ExitDestroy( vlc_exit_t * );
89 * LibVLC objects stuff
92 /**
93 * Creates a VLC object.
95 * Note that because the object name pointer must remain valid, potentially
96 * even after the destruction of the object (through the message queues), this
97 * function CANNOT be exported to plugins as is. In this case, the old
98 * vlc_object_create() must be used instead.
100 * @param p_this an existing VLC object
101 * @param i_size byte size of the object structure
102 * @param psz_type object type name
103 * @return the created object, or NULL.
105 extern void *
106 vlc_custom_create (vlc_object_t *p_this, size_t i_size, const char *psz_type);
107 #define vlc_custom_create(o, s, n) \
108 vlc_custom_create(VLC_OBJECT(o), s, n)
111 * Assign a name to an object for vlc_object_find_name().
113 extern int vlc_object_set_name(vlc_object_t *, const char *);
114 #define vlc_object_set_name(o, n) vlc_object_set_name(VLC_OBJECT(o), n)
116 /* Types */
117 typedef void (*vlc_destructor_t) (struct vlc_object_t *);
118 void vlc_object_set_destructor (vlc_object_t *, vlc_destructor_t);
119 #define vlc_object_set_destructor(a,b) \
120 vlc_object_set_destructor (VLC_OBJECT(a), b)
123 * Allocates an object resource.
125 * @param size storage size in bytes of the resource data
126 * @param release callback to release the resource
128 * @return a pointer to the (uninitialized) storage space, or NULL on error
130 void *vlc_objres_new(size_t size, void (*release)(void *));
133 * Pushes an object resource on the object resources stack.
135 * @param obj object to allocate the resource for
136 * @param data resource base address (as returned by vlc_objres_new())
138 void vlc_objres_push(vlc_object_t *obj, void *data);
141 * Releases all resources of an object.
143 * All resources added with vlc_objres_add() are released in reverse order.
144 * The resource list is reset to empty.
146 * @param obj object whose resources to release
148 void vlc_objres_clear(vlc_object_t *obj);
151 * Releases one object resource explicitly.
153 * If a resource associated with an object needs to be released explicitly
154 * earlier than normal, call this function. This is relatively slow and should
155 * be avoided.
157 * @param obj object whose resource to release
158 * @param data private data for the comparison function
159 * @param match comparison function to match the targeted resource
161 void vlc_objres_remove(vlc_object_t *obj, void *data,
162 bool (*match)(void *, void *));
164 #define ZOOM_SECTION N_("Zoom")
165 #define ZOOM_QUARTER_KEY_TEXT N_("1:4 Quarter")
166 #define ZOOM_HALF_KEY_TEXT N_("1:2 Half")
167 #define ZOOM_ORIGINAL_KEY_TEXT N_("1:1 Original")
168 #define ZOOM_DOUBLE_KEY_TEXT N_("2:1 Double")
171 * Private LibVLC instance data.
173 typedef struct vlc_dialog_provider vlc_dialog_provider;
174 typedef struct vlc_keystore vlc_keystore;
175 typedef struct vlc_actions_t vlc_actions_t;
177 typedef struct libvlc_priv_t
179 libvlc_int_t public_data;
181 /* Logging */
182 bool b_stats; ///< Whether to collect stats
184 /* Singleton objects */
185 vlc_logger_t *logger;
186 vlm_t *p_vlm; ///< the VLM singleton (or NULL)
187 vlc_dialog_provider *p_dialog_provider; ///< dialog provider
188 vlc_keystore *p_memory_keystore; ///< memory keystore
189 struct playlist_t *playlist; ///< Playlist for interfaces
190 struct playlist_preparser_t *parser; ///< Input item meta data handler
191 vlc_actions_t *actions; ///< Hotkeys handler
193 /* Exit callback */
194 vlc_exit_t exit;
195 } libvlc_priv_t;
197 static inline libvlc_priv_t *libvlc_priv (libvlc_int_t *libvlc)
199 return container_of(libvlc, libvlc_priv_t, public_data);
202 int intf_InsertItem(libvlc_int_t *, const char *mrl, unsigned optc,
203 const char * const *optv, unsigned flags);
204 void intf_DestroyAll( libvlc_int_t * );
206 #define libvlc_stats( o ) (libvlc_priv((VLC_OBJECT(o))->obj.libvlc)->b_stats)
209 * Variables stuff
211 void var_OptionParse (vlc_object_t *, const char *, bool trusted);
214 * Stats stuff
216 enum
218 STATS_COUNTER,
219 STATS_DERIVATIVE,
222 typedef struct counter_sample_t
224 uint64_t value;
225 mtime_t date;
226 } counter_sample_t;
228 typedef struct counter_t
230 int i_compute_type;
231 int i_samples;
232 counter_sample_t ** pp_samples;
234 mtime_t last_update;
235 } counter_t;
237 enum
239 STATS_INPUT_BITRATE,
240 STATS_READ_BYTES,
241 STATS_READ_PACKETS,
242 STATS_DEMUX_READ,
243 STATS_DEMUX_BITRATE,
244 STATS_DEMUX_CORRUPTED,
245 STATS_DEMUX_DISCONTINUITY,
246 STATS_PLAYED_ABUFFERS,
247 STATS_LOST_ABUFFERS,
248 STATS_DECODED_AUDIO,
249 STATS_DECODED_VIDEO,
250 STATS_DECODED_SUB,
251 STATS_CLIENT_CONNECTIONS,
252 STATS_ACTIVE_CONNECTIONS,
253 STATS_SOUT_SENT_PACKETS,
254 STATS_SOUT_SENT_BYTES,
255 STATS_SOUT_SEND_BITRATE,
256 STATS_DISPLAYED_PICTURES,
257 STATS_LOST_PICTURES,
260 counter_t * stats_CounterCreate (int);
261 void stats_Update (counter_t *, uint64_t, uint64_t *);
262 void stats_CounterClean (counter_t * );
264 void stats_ComputeInputStats(input_thread_t*, input_stats_t*);
265 void stats_ReinitInputStats(input_stats_t *);
267 #endif