]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_structures.h
control/tree.c: Notify subtree/addition removal.
[vlc] / include / vlc / libvlc_structures.h
1 /*****************************************************************************
2  * libvlc.h:  libvlc_* new external API structures
3  *****************************************************************************
4  * Copyright (C) 1998-2007 the VideoLAN team
5  * $Id $
6  *
7  * Authors: Filippo Carone <littlejohn@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 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 General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef _LIBVLC_STRUCTURES_H
25 #define _LIBVLC_STRUCTURES_H 1
26
27 #include <vlc/vlc.h>
28
29 # ifdef __cplusplus
30 extern "C" {
31 # endif
32
33 /** This structure is opaque. It represents a libvlc instance */
34 typedef struct libvlc_instance_t libvlc_instance_t;
35
36 /*****************************************************************************
37  * Exceptions
38  *****************************************************************************/
39
40 /** defgroup libvlc_exception Exceptions
41  * \ingroup libvlc
42  * LibVLC Exceptions handling
43  * @{
44  */
45
46 typedef struct libvlc_exception_t
47 {
48     int b_raised;
49     int i_code;
50     char *psz_message;
51 } libvlc_exception_t;
52
53 /**@} */
54
55 /*****************************************************************************
56  * Tree
57  *****************************************************************************/
58 /** defgroup libvlc_tree Tree
59  * \ingroup libvlc
60  * LibVLC Tree 
61  * @{
62  */
63
64 typedef void (*libvlc_retain_function)(void *);
65 typedef void (*libvlc_release_function)(void *);
66
67 typedef struct libvlc_tree_t libvlc_tree_t;
68
69 /**@} */
70
71 /*****************************************************************************
72  * Tag
73  *****************************************************************************/
74 /** defgroup libvlc_tag Tag
75  * \ingroup libvlc
76  * LibVLC Tag  support in media descriptor
77  * @{
78  */
79
80 typedef struct libvlc_tag_query_t libvlc_tag_query_t;
81 typedef char * libvlc_tag_t;
82
83 /**@} */
84
85 /*****************************************************************************
86  * Media Descriptor
87  *****************************************************************************/
88 /** defgroup libvlc_media_descriptor MediaDescriptor
89  * \ingroup libvlc
90  * LibVLC Media Descriptor handling
91  * @{
92  */
93
94 /* Meta Handling */
95 /** defgroup libvlc_meta Meta
96  * \ingroup libvlc_media_descriptor
97  * LibVLC Media Meta
98  * @{
99  */
100
101 typedef enum libvlc_meta_t {
102     libvlc_meta_Title,
103     libvlc_meta_Artist,
104     libvlc_meta_Genre,
105     libvlc_meta_Copyright,
106     libvlc_meta_Album,
107     libvlc_meta_TrackNumber,
108     libvlc_meta_Description,
109     libvlc_meta_Rating,
110     libvlc_meta_Date,
111     libvlc_meta_Setting,
112     libvlc_meta_URL,
113     libvlc_meta_Language,
114     libvlc_meta_NowPlaying,
115     libvlc_meta_Publisher,
116     libvlc_meta_EncodedBy,
117     libvlc_meta_ArtworkURL,
118     libvlc_meta_TrackID
119 } libvlc_meta_t;
120
121 /**@} */
122
123 typedef struct libvlc_media_descriptor_t libvlc_media_descriptor_t;
124
125 /**@} */
126
127
128 /*****************************************************************************
129  * Media Instance
130  *****************************************************************************/
131 /** defgroup libvlc_media_instance MediaInstance
132  * \ingroup libvlc
133  * LibVLC Media Instance handling
134  * @{
135  */
136
137 typedef struct libvlc_media_instance_t libvlc_media_instance_t;
138
139 /**@} */
140
141 /*****************************************************************************
142  * Media List
143  *****************************************************************************/
144 /** defgroup libvlc_media_list MediaList
145  * \ingroup libvlc
146  * LibVLC Media List handling
147  * @{
148  */
149
150 typedef struct libvlc_media_list_t libvlc_media_list_t;
151
152 /**@} */
153
154 /*****************************************************************************
155  * Dynamic Media List
156  *****************************************************************************/
157 /** defgroup libvlc_media_list MediaList
158  * \ingroup libvlc
159  * LibVLC Dynamic Media list: Media list with content synchronized with
160  * an other playlist
161  * @{
162  */
163
164 typedef struct libvlc_dynamic_media_list_t libvlc_dynamic_media_list_t;
165
166 /**@} */
167
168 /*****************************************************************************
169  * Media List Player
170  *****************************************************************************/
171 /** defgroup libvlc_media_list_player MediaListPlayer
172  * \ingroup libvlc
173  * LibVLC Media List Player handling
174  * @{
175  */
176
177 typedef struct libvlc_media_list_player_t libvlc_media_list_player_t;
178
179 /**@} */
180
181 /*****************************************************************************
182  * Media Library
183  *****************************************************************************/
184 /** defgroup libvlc_media_library Media Library
185  * \ingroup libvlc
186  * LibVLC Media Library
187  * @{
188  */
189
190 typedef struct libvlc_media_library_t libvlc_media_library_t;
191
192 /**@} */
193
194 /*****************************************************************************
195  * Playlist
196  *****************************************************************************/
197 /** defgroup libvlc_playlist Playlist
198  * \ingroup libvlc
199  * LibVLC Playlist handling
200  * @{
201  */
202
203 typedef struct libvlc_playlist_item_t
204 {
205     int i_id;
206     char * psz_uri;
207     char * psz_name;
208
209 } libvlc_playlist_item_t;
210
211 /**@} */
212
213
214 /*****************************************************************************
215  * Video
216  *****************************************************************************/
217 /** defgroup libvlc_video Video
218  * \ingroup libvlc
219  * LibVLC Video handling
220  * @{
221  */
222     
223 /**
224 * Downcast to this general type as placeholder for a platform specific one, such as:
225 *  Drawable on X11,
226 *  CGrafPort on MacOSX,
227 *  HWND on win32
228 */
229 typedef int libvlc_drawable_t;
230
231 /**
232 * Rectangle type for video geometry
233 */
234 typedef struct libvlc_rectangle_t
235 {
236     int top, left;
237     int bottom, right;
238 }
239 libvlc_rectangle_t;
240
241 /**@} */
242
243
244 /*****************************************************************************
245  * Services/Media Discovery
246  *****************************************************************************/
247 /** defgroup libvlc_media_discoverer Media Discoverer
248  * \ingroup libvlc
249  * LibVLC Media Discoverer
250  * @{
251  */
252
253 typedef struct libvlc_media_discoverer_t libvlc_media_discoverer_t;
254
255 /**@} */
256
257 /*****************************************************************************
258  * Message log handling
259  *****************************************************************************/
260
261 /** defgroup libvlc_log Log
262  * \ingroup libvlc
263  * LibVLC Message Logging
264  * @{
265  */
266
267 /** This structure is opaque. It represents a libvlc log instance */
268 typedef struct libvlc_log_t libvlc_log_t;
269
270 /** This structure is opaque. It represents a libvlc log iterator */
271 typedef struct libvlc_log_iterator_t libvlc_log_iterator_t;
272
273 typedef struct libvlc_log_message_t
274 {
275     unsigned    sizeof_msg;   /* sizeof() of message structure, must be filled in by user */
276     int         i_severity;   /* 0=INFO, 1=ERR, 2=WARN, 3=DBG */
277     const char *psz_type;     /* module type */
278     const char *psz_name;     /* module name */
279     const char *psz_header;   /* optional header */
280     const char *psz_message;  /* message */
281 } libvlc_log_message_t;
282
283 /**@} */
284
285 /*****************************************************************************
286  * Callbacks handling
287  *****************************************************************************/
288
289 /** defgroup libvlc_callbacks Callbacks
290  * \ingroup libvlc
291  * LibVLC Event Callbacks
292  * @{
293  */
294     
295 /**
296  * Available events: (XXX: being reworked)
297  * - libvlc_MediaInstanceReachedEnd
298  */
299
300 typedef enum libvlc_event_type_t {
301     libvlc_MediaDescriptorMetaChanged,
302     libvlc_MediaDescriptorSubItemAdded,
303
304     libvlc_MediaInstanceReachedEnd,
305
306     libvlc_MediaListItemAdded,
307     libvlc_MediaListItemDeleted,
308     libvlc_MediaListItemChanged,
309
310     libvlc_TreeSubtreeAdded,
311     libvlc_TreeSubtreeDeleted,
312     libvlc_TreeItemValueChanged,
313
314 } libvlc_event_type_t;
315
316 /**
317  * An Event
318  * \param type the even type
319  * \param p_obj the sender object
320  * \param u Event dependent content
321  */
322
323 typedef struct libvlc_event_t
324 {
325     libvlc_event_type_t type;
326     void * p_obj;
327     union event_type_specific
328     {
329         /* media descriptor */
330         struct
331         {
332             libvlc_meta_t meta_type;
333         } media_descriptor_meta_changed;
334         struct
335         {
336             libvlc_media_descriptor_t * new_child;
337         } media_descriptor_subitem_added;
338
339         /* media list */
340         struct
341         {
342             libvlc_media_descriptor_t * item;
343             int index;
344         } media_list_item_added;
345         struct
346         {
347             libvlc_media_descriptor_t * item;
348             int index;
349         } media_list_item_deleted;
350         struct
351         {
352             libvlc_media_descriptor_t * item;
353             int index;
354         } media_list_item_changed;
355
356         /* Tree */
357         struct
358         {
359             libvlc_tree_t * subtree;
360             int index;
361         } tree_subtree_added;
362         struct
363         {
364             libvlc_tree_t * subtree;
365             int index;
366         } tree_subtree_deleted;
367         struct
368         {
369             void * new_value;
370         } tree_item_value_changed;
371
372     } u;
373 } libvlc_event_t;
374
375 /**
376  * Event manager that belongs to a libvlc object, and from whom events can
377  * be received.
378  */
379
380 typedef struct libvlc_event_manager_t libvlc_event_manager_t;
381
382 /**
383  * Callback function notification
384  * \param p_event the event triggering the callback
385  */
386
387 typedef void ( *libvlc_callback_t )( const libvlc_event_t *, void * );
388
389 /**@} */
390
391 # ifdef __cplusplus
392 }
393 # endif
394
395 #endif