VLC 4.0.0-dev
Loading...
Searching...
No Matches
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
29# ifdef __cplusplus
30extern "C" {
31# endif
32
33extern const char psz_vlc_changeset[];
34
35typedef struct variable_t variable_t;
36
37/*
38 * OS-specific initialization
39 */
40void system_Init ( void );
41void system_Configure ( libvlc_int_t *, int, const char *const [] );
42#if defined(_WIN32) || defined(__OS2__)
43void system_End(void);
44#endif
46
47/*
48 * Threads subsystem
49 */
50
52
53void vlc_trace (const char *fn, const char *file, unsigned line);
54#define vlc_backtrace() vlc_trace(__func__, __FILE__, __LINE__)
55
56/*
57 * Logging
58 */
59typedef struct vlc_logger vlc_logger_t;
60typedef struct vlc_tracer vlc_tracer_t;
61
64
65/*
66 * LibVLC exit event handling
67 */
68typedef struct vlc_exit
69{
71 void (*handler) (void *);
72 void *opaque;
74
75void vlc_ExitInit( vlc_exit_t * );
76
77/*
78 * LibVLC objects stuff
79 */
80
81/**
82 * Initializes a VLC object.
83 *
84 * @param obj storage space for object to initialize [OUT]
85 * @param parent parent object (or NULL to initialize the root) [IN]
86 * @param type_name object type name
87 *
88 * @note The type name pointer must remain valid even after the object is
89 * deinitialized, as it might be passed by address to log message queue.
90 * Using constant string literals is appropriate.
91 *
92 * @retval 0 on success
93 * @retval -1 on (out of memory) error
94 */
96 const char *type_name);
97
98/**
99 * Deinitializes a VLC object.
100 *
101 * This frees resources allocated by vlc_object_init().
102 */
104
105/**
106 * Creates a VLC object.
107 *
108 * Note that because the object name pointer must remain valid, potentially
109 * even after the destruction of the object (through the message queues), this
110 * function CANNOT be exported to plugins as is. In this case, the old
111 * vlc_object_create() must be used instead.
112 *
113 * @param p_this an existing VLC object
114 * @param i_size byte size of the object structure
115 * @param psz_type object type name
116 * @return the created object, or NULL.
117 */
118extern void *
119vlc_custom_create (vlc_object_t *p_this, size_t i_size, const char *psz_type);
120#define vlc_custom_create(o, s, n) \
121 vlc_custom_create(VLC_OBJECT(o), s, n)
122
123/**
124 * Allocates an object resource.
125 *
126 * @param size storage size in bytes of the resource data
127 * @param release callback to release the resource
128 *
129 * @return a pointer to the (uninitialized) storage space, or NULL on error
130 */
131void *vlc_objres_new(size_t size, void (*release)(void *));
132
133/**
134 * Pushes an object resource on the object resources stack.
135 *
136 * @param obj object to allocate the resource for
137 * @param data resource base address (as returned by vlc_objres_new())
138 */
139void vlc_objres_push(vlc_object_t *obj, void *data);
140
141/**
142 * Releases all resources of an object.
143 *
144 * All resources added with vlc_objres_add() are released in reverse order.
145 * The resource list is reset to empty.
146 *
147 * @param obj object whose resources to release
148 */
150
151/**
152 * Releases one object resource explicitly.
153 *
154 * If a resource associated with an object needs to be released explicitly
155 * earlier than normal, call this function. This is relatively slow and should
156 * be avoided.
157 *
158 * @param obj object whose resource to release
159 * @param data private data for the comparison function
160 * @param match comparison function to match the targeted resource
161 */
162void vlc_objres_remove(vlc_object_t *obj, void *data,
163 bool (*match)(void *, void *));
164
165/**
166 * Private LibVLC instance data.
167 */
174
175typedef struct libvlc_priv_t
176{
178
179 /* Singleton objects */
180 vlc_mutex_t lock; ///< protect playlist and interfaces
181 vlm_t *p_vlm; ///< the VLM singleton (or NULL)
183 vlc_keystore *p_memory_keystore; ///< memory keystore
184 intf_thread_t *interfaces; ///< Linked-list of interfaces
186 struct vlc_preparser_t *parser; ///< Input item meta data handler
188 vlc_actions_t *actions; ///< Hotkeys handler
189 struct vlc_medialibrary_t *p_media_library; ///< Media library instance
190 struct vlc_thumbnailer_t *p_thumbnailer; ///< Lazily instantiated media thumbnailer
191 struct vlc_tracer *tracer; ///< Tracer callbacks
192
193 /* Exit callback */
196
197static inline libvlc_priv_t *libvlc_priv (libvlc_int_t *libvlc)
198{
199 return container_of(libvlc, libvlc_priv_t, public_data);
200}
201
202int intf_InsertItem(libvlc_int_t *, const char *mrl, unsigned optc,
203 const char * const *optv, unsigned flags);
205
208 const struct vlc_metadata_cbs *cbs,
209 void *cbs_userdata,
210 int timeout, void *id);
211
212/*
213 * Variables stuff
214 */
215void var_OptionParse (vlc_object_t *, const char *, bool trusted);
216
217# ifdef __cplusplus
218} // extern "C"
219# endif
220
221#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:65
static libvlc_priv_t * libvlc_priv(libvlc_int_t *libvlc)
Definition libvlc.h:197
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:908
struct vlc_exit vlc_exit_t
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:168
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:98
void vlc_ExitInit(vlc_exit_t *)
Definition exit.c:30
#define vlc_custom_create(o, s, n)
Definition libvlc.h:120
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:173
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:49
void vlc_objres_clear(vlc_object_t *obj)
Releases all resources of an object.
Definition objres.c:85
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:457
Describes an input and is used to spawn input_thread_t objects.
Definition vlc_input_item.h:98
Describe all interface-specific data of the interface thread.
Definition vlc_interface.h:51
Definition vlc_objects.h:103
Definition libvlc.h:176
vlc_keystore * p_memory_keystore
memory keystore
Definition libvlc.h:183
struct vlc_thumbnailer_t * p_thumbnailer
Lazily instantiated media thumbnailer.
Definition libvlc.h:190
struct vlc_preparser_t * parser
Input item meta data handler.
Definition libvlc.h:186
struct vlc_tracer * tracer
Tracer callbacks.
Definition libvlc.h:191
vlc_playlist_t * main_playlist
Definition libvlc.h:185
libvlc_int_t public_data
Definition libvlc.h:177
intf_thread_t * interfaces
Linked-list of interfaces.
Definition libvlc.h:184
vlc_actions_t * actions
Hotkeys handler.
Definition libvlc.h:188
vlc_mutex_t lock
protect playlist and interfaces
Definition libvlc.h:180
struct vlc_medialibrary_t * p_media_library
Media library instance.
Definition libvlc.h:189
vlc_media_source_provider_t * media_source_provider
Definition libvlc.h:187
vlc_exit_t exit
Definition libvlc.h:194
vlm_t * p_vlm
the VLM singleton (or NULL)
Definition libvlc.h:181
vlc_dialog_provider * p_dialog_provider
dialog provider
Definition libvlc.h:182
The structure describing a variable.
Definition variables.c:69
Definition actions.c:417
Definition dialog.c:38
Definition libvlc.h:69
void * opaque
Definition libvlc.h:72
vlc_mutex_t lock
Definition libvlc.h:70
void(* handler)(void *)
Definition libvlc.h:71
Definition vlc_keystore.h:302
Definition messages.c:85
Definition media_source.c:52
Definition medialibrary.c:42
Definition vlc_input_item.h:531
Mutex.
Definition vlc_threads.h:143
VLC object common members.
Definition vlc_objects.h:53
Definition playlist.h:48
Definition preparser.c:35
Definition thumbnailer.c:32
Definition tracer.c:36
Definition vlm_internal.h:76
#define container_of(ptr, type, member)
Definition vlc_common.h:1067
This file defines functions, structures and enums for input items in vlc.
input_item_meta_request_option_t
Definition vlc_input_item.h:508