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
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);
40 size_t EnumClockSource( const char *, char ***, char *** );
43 void vlc_CPU_dump(vlc_object_t
*);
49 /* This cannot be used as is from plugins yet: */
50 int vlc_clone_detach (vlc_thread_t
*, void *(*)(void *), void *, int);
52 int vlc_set_priority( vlc_thread_t
, int );
54 void vlc_threads_setup (libvlc_int_t
*);
56 void vlc_trace (const char *fn
, const char *file
, unsigned line
);
57 #define vlc_backtrace() vlc_trace(__func__, __FILE__, __LINE__)
59 #if (defined (LIBVLC_USE_PTHREAD) || defined(__ANDROID__)) && !defined (NDEBUG)
60 void vlc_assert_locked (vlc_mutex_t
*);
62 # define vlc_assert_locked( m ) (void)m
68 typedef struct vlc_logger_t vlc_logger_t
;
70 int vlc_LogPreinit(libvlc_int_t
*);
71 int vlc_LogInit(libvlc_int_t
*);
72 void vlc_LogDeinit(libvlc_int_t
*);
75 * LibVLC exit event handling
77 typedef struct vlc_exit
80 void (*handler
) (void *);
84 void vlc_ExitInit( vlc_exit_t
* );
85 void vlc_ExitDestroy( vlc_exit_t
* );
88 * LibVLC objects stuff
92 * Creates a VLC object.
94 * Note that because the object name pointer must remain valid, potentially
95 * even after the destruction of the object (through the message queues), this
96 * function CANNOT be exported to plugins as is. In this case, the old
97 * vlc_object_create() must be used instead.
99 * @param p_this an existing VLC object
100 * @param i_size byte size of the object structure
101 * @param psz_type object type name
102 * @return the created object, or NULL.
105 vlc_custom_create (vlc_object_t
*p_this
, size_t i_size
, const char *psz_type
);
106 #define vlc_custom_create(o, s, n) \
107 vlc_custom_create(VLC_OBJECT(o), s, n)
110 * Assign a name to an object for vlc_object_find_name().
112 extern int vlc_object_set_name(vlc_object_t
*, const char *);
113 #define vlc_object_set_name(o, n) vlc_object_set_name(VLC_OBJECT(o), n)
116 typedef void (*vlc_destructor_t
) (struct vlc_object_t
*);
117 void vlc_object_set_destructor (vlc_object_t
*, vlc_destructor_t
);
118 #define vlc_object_set_destructor(a,b) \
119 vlc_object_set_destructor (VLC_OBJECT(a), b)
122 * Allocates an object resource.
124 * @param size storage size in bytes of the resource data
125 * @param release callback to release the resource
127 * @return a pointer to the (uninitialized) storage space, or NULL on error
129 void *vlc_objres_new(size_t size
, void (*release
)(void *));
132 * Pushes an object resource on the object resources stack.
134 * @param obj object to allocate the resource for
135 * @param data resource base address (as returned by vlc_objres_new())
137 void vlc_objres_push(vlc_object_t
*obj
, void *data
);
140 * Releases all resources of an object.
142 * All resources added with vlc_objres_add() are released in reverse order.
143 * The resource list is reset to empty.
145 * @param obj object whose resources to release
147 void vlc_objres_clear(vlc_object_t
*obj
);
150 * Releases one object resource explicitly.
152 * If a resource associated with an object needs to be released explicitly
153 * earlier than normal, call this function. This is relatively slow and should
156 * @param obj object whose resource to release
157 * @param data private data for the comparison function
158 * @param match comparison function to match the targeted resource
160 void vlc_objres_remove(vlc_object_t
*obj
, void *data
,
161 bool (*match
)(void *, void *));
163 #define ZOOM_SECTION N_("Zoom")
164 #define ZOOM_QUARTER_KEY_TEXT N_("1:4 Quarter")
165 #define ZOOM_HALF_KEY_TEXT N_("1:2 Half")
166 #define ZOOM_ORIGINAL_KEY_TEXT N_("1:1 Original")
167 #define ZOOM_DOUBLE_KEY_TEXT N_("2:1 Double")
170 * Private LibVLC instance data.
172 typedef struct vlc_dialog_provider vlc_dialog_provider
;
173 typedef struct vlc_keystore vlc_keystore
;
174 typedef struct vlc_actions_t vlc_actions_t
;
176 typedef struct libvlc_priv_t
178 libvlc_int_t public_data
;
180 /* Singleton objects */
181 vlc_logger_t
*logger
;
182 vlm_t
*p_vlm
; ///< the VLM singleton (or NULL)
183 vlc_dialog_provider
*p_dialog_provider
; ///< dialog provider
184 vlc_keystore
*p_memory_keystore
; ///< memory keystore
185 struct playlist_t
*playlist
; ///< Playlist for interfaces
186 struct input_preparser_t
*parser
; ///< Input item meta data handler
187 vlc_actions_t
*actions
; ///< Hotkeys handler
193 static inline libvlc_priv_t
*libvlc_priv (libvlc_int_t
*libvlc
)
195 return container_of(libvlc
, libvlc_priv_t
, public_data
);
198 int intf_InsertItem(libvlc_int_t
*, const char *mrl
, unsigned optc
,
199 const char * const *optv
, unsigned flags
);
200 void intf_DestroyAll( libvlc_int_t
* );
205 void var_OptionParse (vlc_object_t
*, const char *, bool trusted
);