VLC 4.0.0-dev
libvlc.h
Go to the documentation of this file.
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 *
7 * Authors: Vincent Seguin <seguin@via.ecp.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
23
24#ifndef LIBVLC_LIBVLC_H
25# define LIBVLC_LIBVLC_H 1
26
27#include <vlc_input_item.h>
28
29extern const char psz_vlc_changeset[];
30
31typedef struct variable_t variable_t;
32
33/*
34 * OS-specific initialization
35 */
36void system_Init ( void );
37void system_Configure ( libvlc_int_t *, int, const char *const [] );
38#if defined(_WIN32) || defined(__OS2__)
39void system_End(void);
40#endif
42
43/*
44 * Threads subsystem
45 */
46
48
49void vlc_trace (const char *fn, const char *file, unsigned line);
50#define vlc_backtrace() vlc_trace(__func__, __FILE__, __LINE__)
51
52/*
53 * Logging
54 */
55typedef struct vlc_logger vlc_logger_t;
56
59
60/*
61 * Tracing
62 */
63typedef struct vlc_tracer vlc_tracer_t;
64
67
68/*
69 * LibVLC exit event handling
70 */
71typedef struct vlc_exit
72{
74 void (*handler) (void *);
75 void *opaque;
77
78void vlc_ExitInit( vlc_exit_t * );
79
80/*
81 * LibVLC objects stuff
82 */
83
84/**
85 * Initializes a VLC object.
86 *
87 * @param obj storage space for object to initialize [OUT]
88 * @param parent parent object (or NULL to initialize the root) [IN]
89 * @param type_name object type name
90 *
91 * @note The type name pointer must remain valid even after the object is
92 * deinitialized, as it might be passed by address to log message queue.
93 * Using constant string literals is appropriate.
94 *
95 * @retval 0 on success
96 * @retval -1 on (out of memory) error
97 */
99 const char *type_name);
100
101/**
102 * Deinitializes a VLC object.
103 *
104 * This frees resources allocated by vlc_object_init().
105 */
107
108/**
109 * Creates a VLC object.
110 *
111 * Note that because the object name pointer must remain valid, potentially
112 * even after the destruction of the object (through the message queues), this
113 * function CANNOT be exported to plugins as is. In this case, the old
114 * vlc_object_create() must be used instead.
115 *
116 * @param p_this an existing VLC object
117 * @param i_size byte size of the object structure
118 * @param psz_type object type name
119 * @return the created object, or NULL.
120 */
121extern void *
122vlc_custom_create (vlc_object_t *p_this, size_t i_size, const char *psz_type);
123#define vlc_custom_create(o, s, n) \
124 vlc_custom_create(VLC_OBJECT(o), s, n)
125
126/**
127 * Allocates an object resource.
128 *
129 * @param size storage size in bytes of the resource data
130 * @param release callback to release the resource
131 *
132 * @return a pointer to the (uninitialized) storage space, or NULL on error
133 */
134void *vlc_objres_new(size_t size, void (*release)(void *));
135
136/**
137 * Pushes an object resource on the object resources stack.
138 *
139 * @param obj object to allocate the resource for
140 * @param data resource base address (as returned by vlc_objres_new())
141 */
142void vlc_objres_push(vlc_object_t *obj, void *data);
143
144/**
145 * Releases all resources of an object.
146 *
147 * All resources added with vlc_objres_add() are released in reverse order.
148 * The resource list is reset to empty.
149 *
150 * @param obj object whose resources to release
151 */
153
154/**
155 * Releases one object resource explicitly.
156 *
157 * If a resource associated with an object needs to be released explicitly
158 * earlier than normal, call this function. This is relatively slow and should
159 * be avoided.
160 *
161 * @param obj object whose resource to release
162 * @param data private data for the comparison function
163 * @param match comparison function to match the targeted resource
164 */
165void vlc_objres_remove(vlc_object_t *obj, void *data,
166 bool (*match)(void *, void *));
167
168/**
169 * Private LibVLC instance data.
170 */
177
178typedef struct libvlc_priv_t
179{
181
182 /* Singleton objects */
183 vlc_mutex_t lock; ///< protect playlist and interfaces
184 vlm_t *p_vlm; ///< the VLM singleton (or NULL)
186 vlc_keystore *p_memory_keystore; ///< memory keystore
187 intf_thread_t *interfaces; ///< Linked-list of interfaces
189 struct vlc_preparser_t *parser; ///< Input item meta data handler
191 vlc_actions_t *actions; ///< Hotkeys handler
192 struct vlc_medialibrary_t *p_media_library; ///< Media library instance
193 struct vlc_thumbnailer_t *p_thumbnailer; ///< Lazily instantiated media thumbnailer
194 struct vlc_tracer *tracer; ///< Tracer callbacks
195
196 /* Exit callback */
199
200static inline libvlc_priv_t *libvlc_priv (libvlc_int_t *libvlc)
201{
202 return container_of(libvlc, libvlc_priv_t, public_data);
203}
204
205int intf_InsertItem(libvlc_int_t *, const char *mrl, unsigned optc,
206 const char * const *optv, unsigned flags);
208
211 const struct vlc_metadata_cbs *cbs,
212 void *cbs_userdata,
213 int timeout, void *id);
214
215/*
216 * Variables stuff
217 */
218void var_OptionParse (vlc_object_t *, const char *, bool trusted);
219
220#endif
#define VLC_USED
Definition: fourcc_gen.c:32
void system_End(void)
Cleans up after system_Init() and system_Configure().
Definition: specific.c:272
void vlc_objres_push(vlc_object_t *obj, void *data)
Pushes an object resource on the object resources stack.
Definition: objres.c:64
static libvlc_priv_t * libvlc_priv(libvlc_int_t *libvlc)
Definition: libvlc.h:200
struct libvlc_priv_t libvlc_priv_t
void intf_DestroyAll(libvlc_int_t *)
Stops and destroys all interfaces, then the playlist.
Definition: interface.c:292
void vlc_object_deinit(vlc_object_t *obj)
Deinitializes a VLC object.
Definition: objects.c:127
void vlc_LogInit(libvlc_int_t *)
Initializes the messages logging subsystem and drain the early messages to the configured log.
Definition: messages.c:425
void var_OptionParse(vlc_object_t *, const char *, bool trusted)
Parse a stringified option This function parse a string option and create the associated object varia...
Definition: variables.c:909
struct vlc_exit vlc_exit_t
void vlc_tracer_Destroy(libvlc_int_t *)
Definition: tracer.c:102
int vlc_object_init(vlc_object_t *obj, vlc_object_t *parent, const char *type_name)
Initializes a VLC object.
void vlc_trace(const char *fn, const char *file, unsigned line)
Print a backtrace to the standard error for debugging purpose.
Definition: thread.c:70
void system_Init(void)
Initializes MME timer, Winsock.
Definition: specific.c:167
int vlc_LogPreinit(libvlc_int_t *)
Performs preinitialization of the messages logging subsystem.
Definition: messages.c:443
void vlc_objres_remove(vlc_object_t *obj, void *data, bool(*match)(void *, void *))
Releases one object resource explicitly.
Definition: objres.c:97
void vlc_tracer_Init(libvlc_int_t *)
Initializes the messages tracing system.
Definition: tracer.c:95
void vlc_ExitInit(vlc_exit_t *)
Definition: exit.c:30
#define vlc_custom_create(o, s, n)
Definition: libvlc.h:123
const char psz_vlc_changeset[]
void vlc_CPU_dump(vlc_object_t *)
Definition: cpu.c:160
void system_Configure(libvlc_int_t *, int, const char *const [])
Definition: specific.c:172
int intf_InsertItem(libvlc_int_t *, const char *mrl, unsigned optc, const char *const *optv, unsigned flags)
Inserts an item in the playlist.
Definition: interface.c:203
void vlc_threads_setup(libvlc_int_t *)
Definition: thread.c:86
void * vlc_objres_new(size_t size, void(*release)(void *))
Allocates an object resource.
Definition: objres.c:48
void vlc_objres_clear(vlc_object_t *obj)
Releases all resources of an object.
Definition: objres.c:84
int vlc_MetadataRequest(libvlc_int_t *libvlc, input_item_t *item, input_item_meta_request_option_t i_options, const struct vlc_metadata_cbs *cbs, void *cbs_userdata, int timeout, void *id)
Definition: libvlc.c:453
Describes an input and is used to spawn input_thread_t objects.
Definition: vlc_input_item.h:89
Describe all interface-specific data of the interface thread.
Definition: vlc_interface.h:51
Definition: vlc_objects.h:91
Definition: libvlc.h:179
vlc_keystore * p_memory_keystore
memory keystore
Definition: libvlc.h:186
struct vlc_thumbnailer_t * p_thumbnailer
Lazily instantiated media thumbnailer.
Definition: libvlc.h:193
struct vlc_preparser_t * parser
Input item meta data handler.
Definition: libvlc.h:189
struct vlc_tracer * tracer
Tracer callbacks.
Definition: libvlc.h:194
vlc_playlist_t * main_playlist
Definition: libvlc.h:188
libvlc_int_t public_data
Definition: libvlc.h:180
intf_thread_t * interfaces
Linked-list of interfaces.
Definition: libvlc.h:187
vlc_actions_t * actions
Hotkeys handler.
Definition: libvlc.h:191
vlc_mutex_t lock
protect playlist and interfaces
Definition: libvlc.h:183
struct vlc_medialibrary_t * p_media_library
Media library instance.
Definition: libvlc.h:192
vlc_media_source_provider_t * media_source_provider
Definition: libvlc.h:190
vlc_exit_t exit
Definition: libvlc.h:197
vlm_t * p_vlm
the VLM singleton (or NULL)
Definition: libvlc.h:184
vlc_dialog_provider * p_dialog_provider
dialog provider
Definition: libvlc.h:185
The structure describing a variable.
Definition: variables.c:69
Definition: actions.c:417
Definition: dialog.c:38
Definition: libvlc.h:72
void * opaque
Definition: libvlc.h:75
vlc_mutex_t lock
Definition: libvlc.h:73
void(* handler)(void *)
Definition: libvlc.h:74
Definition: vlc_keystore.h:297
Definition: messages.c:85
Definition: media_source.c:52
Definition: medialibrary.c:42
Definition: vlc_input_item.h:501
Mutex.
Definition: vlc_threads.h:195
VLC object common members.
Definition: vlc_objects.h:45
Definition: playlist.h:49
Definition: preparser.c:35
Definition: thumbnailer.c:32
Definition: tracer.c:36
Definition: vlm_internal.h:78
#define container_of(ptr, type, member)
Definition: vlc_common.h:1153
This file defines functions, structures and enums for input items in vlc.
input_item_meta_request_option_t
Definition: vlc_input_item.h:478