]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_structures.h
control/media_discoverer.c: Forward started and ended event.
[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  * Tag
57  *****************************************************************************/
58 /** defgroup libvlc_tag Tag
59  * \ingroup libvlc
60  * LibVLC Tag  support in media descriptor
61  * @{
62  */
63
64 typedef struct libvlc_tag_query_t libvlc_tag_query_t;
65 typedef char * libvlc_tag_t;
66
67 /**@} */
68
69 /*****************************************************************************
70  * Media Descriptor
71  *****************************************************************************/
72 /** defgroup libvlc_media_descriptor MediaDescriptor
73  * \ingroup libvlc
74  * LibVLC Media Descriptor handling
75  * @{
76  */
77
78 /* Meta Handling */
79 /** defgroup libvlc_meta Meta
80  * \ingroup libvlc_media_descriptor
81  * LibVLC Media Meta
82  * @{
83  */
84
85 typedef enum libvlc_meta_t {
86     libvlc_meta_Title,
87     libvlc_meta_Artist,
88     libvlc_meta_Genre,
89     libvlc_meta_Copyright,
90     libvlc_meta_Album,
91     libvlc_meta_TrackNumber,
92     libvlc_meta_Description,
93     libvlc_meta_Rating,
94     libvlc_meta_Date,
95     libvlc_meta_Setting,
96     libvlc_meta_URL,
97     libvlc_meta_Language,
98     libvlc_meta_NowPlaying,
99     libvlc_meta_Publisher,
100     libvlc_meta_EncodedBy,
101     libvlc_meta_ArtworkURL,
102     libvlc_meta_TrackID
103 } libvlc_meta_t;
104
105 /**@} */
106
107 typedef struct libvlc_media_descriptor_t libvlc_media_descriptor_t;
108
109 /**@} */
110
111
112 /*****************************************************************************
113  * Media Instance
114  *****************************************************************************/
115 /** defgroup libvlc_media_instance MediaInstance
116  * \ingroup libvlc
117  * LibVLC Media Instance handling
118  * @{
119  */
120
121 typedef struct libvlc_media_instance_t libvlc_media_instance_t;
122
123 typedef enum libvlc_state_t
124 {
125     libvlc_NothingSpecial,
126     libvlc_Stopped,
127     libvlc_Opening,
128     libvlc_Buffering,
129     libvlc_Ended,
130     libvlc_Error,
131     libvlc_Playing,
132     libvlc_Paused
133 } libvlc_state_t;
134
135 /**@} */
136
137 /*****************************************************************************
138  * Media List
139  *****************************************************************************/
140 /** defgroup libvlc_media_list MediaList
141  * \ingroup libvlc
142  * LibVLC Media List handling
143  * @{
144  */
145
146 typedef struct libvlc_media_list_t libvlc_media_list_t;
147 typedef struct libvlc_media_list_view_t libvlc_media_list_view_t;
148
149 /**@} */
150
151 /*****************************************************************************
152  * Dynamic Media List
153  *****************************************************************************/
154 /** defgroup libvlc_media_list MediaList
155  * \ingroup libvlc
156  * LibVLC Dynamic Media list: Media list with content synchronized with
157  * an other playlist
158  * @{
159  */
160
161 typedef struct libvlc_dynamic_media_list_t libvlc_dynamic_media_list_t;
162
163 /**@} */
164
165 /*****************************************************************************
166  * Media List Player
167  *****************************************************************************/
168 /** defgroup libvlc_media_list_player MediaListPlayer
169  * \ingroup libvlc
170  * LibVLC Media List Player handling
171  * @{
172  */
173
174 typedef struct libvlc_media_list_player_t libvlc_media_list_player_t;
175
176 /**@} */
177
178 /*****************************************************************************
179  * Media Library
180  *****************************************************************************/
181 /** defgroup libvlc_media_library Media Library
182  * \ingroup libvlc
183  * LibVLC Media Library
184  * @{
185  */
186
187 typedef struct libvlc_media_library_t libvlc_media_library_t;
188
189 /**@} */
190
191 /*****************************************************************************
192  * Playlist
193  *****************************************************************************/
194 /** defgroup libvlc_playlist Playlist
195  * \ingroup libvlc
196  * LibVLC Playlist handling
197  * @{
198  */
199
200 typedef struct libvlc_playlist_item_t
201 {
202     int i_id;
203     char * psz_uri;
204     char * psz_name;
205
206 } libvlc_playlist_item_t;
207
208 /**@} */
209
210
211 /*****************************************************************************
212  * Video
213  *****************************************************************************/
214 /** defgroup libvlc_video Video
215  * \ingroup libvlc
216  * LibVLC Video handling
217  * @{
218  */
219  
220 /**
221 * Downcast to this general type as placeholder for a platform specific one, such as:
222 *  Drawable on X11,
223 *  CGrafPort on MacOSX,
224 *  HWND on win32
225 */
226 typedef int libvlc_drawable_t;
227
228 /**
229 * Rectangle type for video geometry
230 */
231 typedef struct libvlc_rectangle_t
232 {
233     int top, left;
234     int bottom, right;
235 }
236 libvlc_rectangle_t;
237
238 /**@} */
239
240
241 /*****************************************************************************
242  * Services/Media Discovery
243  *****************************************************************************/
244 /** defgroup libvlc_media_discoverer Media Discoverer
245  * \ingroup libvlc
246  * LibVLC Media Discoverer
247  * @{
248  */
249
250 typedef struct libvlc_media_discoverer_t libvlc_media_discoverer_t;
251
252 /**@} */
253
254 /*****************************************************************************
255  * Message log handling
256  *****************************************************************************/
257
258 /** defgroup libvlc_log Log
259  * \ingroup libvlc
260  * LibVLC Message Logging
261  * @{
262  */
263
264 /** This structure is opaque. It represents a libvlc log instance */
265 typedef struct libvlc_log_t libvlc_log_t;
266
267 /** This structure is opaque. It represents a libvlc log iterator */
268 typedef struct libvlc_log_iterator_t libvlc_log_iterator_t;
269
270 typedef struct libvlc_log_message_t
271 {
272     unsigned    sizeof_msg;   /* sizeof() of message structure, must be filled in by user */
273     int         i_severity;   /* 0=INFO, 1=ERR, 2=WARN, 3=DBG */
274     const char *psz_type;     /* module type */
275     const char *psz_name;     /* module name */
276     const char *psz_header;   /* optional header */
277     const char *psz_message;  /* message */
278 } libvlc_log_message_t;
279
280 /**@} */
281
282 /*****************************************************************************
283  * Callbacks handling
284  *****************************************************************************/
285
286 /** defgroup libvlc_callbacks Callbacks
287  * \ingroup libvlc
288  * LibVLC Event Callbacks
289  * @{
290  */
291  
292 /**
293  * Available events: (XXX: being reworked)
294  * - libvlc_MediaInstanceReachedEnd
295  */
296
297 typedef enum libvlc_event_type_t {
298     libvlc_MediaDescriptorMetaChanged,
299     libvlc_MediaDescriptorSubItemAdded,
300     libvlc_MediaDescriptorDurationChanged,
301     libvlc_MediaDescriptorPreparsedChanged,
302     libvlc_MediaDescriptorFreed,
303     libvlc_MediaDescriptorStateChanged,
304
305     libvlc_MediaInstancePlayed,
306     libvlc_MediaInstancePaused,
307     libvlc_MediaInstanceReachedEnd,
308     libvlc_MediaInstancePositionChanged,
309
310     libvlc_MediaListItemAdded,
311     libvlc_MediaListWillAddItem,
312     libvlc_MediaListItemDeleted,
313     libvlc_MediaListWillDeleteItem,
314
315     libvlc_MediaListViewItemAdded,
316     libvlc_MediaListViewWillAddItem,
317     libvlc_MediaListViewItemDeleted,
318     libvlc_MediaListViewWillDeleteItem,
319
320     libvlc_MediaListPlayerPlayed,
321     libvlc_MediaListPlayerNextItemSet,
322     libvlc_MediaListPlayerStopped,
323
324     libvlc_MediaDiscovererStarted,
325     libvlc_MediaDiscovererEnded
326
327 } libvlc_event_type_t;
328
329 /**
330  * An Event
331  * \param type the even type
332  * \param p_obj the sender object
333  * \param u Event dependent content
334  */
335
336 typedef struct libvlc_event_t
337 {
338     libvlc_event_type_t type;
339     void * p_obj;
340     union event_type_specific
341     {
342         /* media descriptor */
343         struct
344         {
345             libvlc_meta_t meta_type;
346         } media_descriptor_meta_changed;
347         struct
348         {
349             libvlc_media_descriptor_t * new_child;
350         } media_descriptor_subitem_added;
351         struct
352         {
353             vlc_int64_t new_duration;
354         } media_descriptor_duration_changed;
355         struct
356         {
357             int new_status;
358         } media_descriptor_preparsed_changed;
359         struct
360         {
361             libvlc_media_descriptor_t * md;
362         } media_descriptor_freed;
363         struct
364         {
365             libvlc_state_t new_state;
366         } media_descriptor_state_changed;
367             
368         /* media instance */
369         struct
370         {
371             long int new_position;
372         } media_instance_position_changed;
373
374         /* media list */
375         struct
376         {
377             libvlc_media_descriptor_t * item;
378             int index;
379         } media_list_item_added;
380         struct
381         {
382             libvlc_media_descriptor_t * item;
383             int index;
384         } media_list_will_add_item;
385         struct
386         {
387             libvlc_media_descriptor_t * item;
388             int index;
389         } media_list_item_deleted;
390         struct
391         {
392             libvlc_media_descriptor_t * item;
393             int index;
394         } media_list_will_delete_item;
395
396         /* media list view */
397         struct
398         {
399             libvlc_media_descriptor_t * item;
400             int index;
401         } media_list_view_item_added;
402         struct
403         {
404             libvlc_media_descriptor_t * item;
405             int index;
406         } media_list_view_will_add_item;
407         struct
408         {
409             libvlc_media_descriptor_t * item;
410             int index;
411         } media_list_view_item_deleted;
412         struct
413         {
414             libvlc_media_descriptor_t * item;
415             int index;
416         } media_list_view_will_delete_item;
417         /* media list view */
418         struct
419         {
420             void * unused;
421         } media_media_discoverer_started;
422         struct
423         {
424             void * unused;
425         } media_media_discoverer_ended;
426
427     } u;
428 } libvlc_event_t;
429
430 /**
431  * Event manager that belongs to a libvlc object, and from whom events can
432  * be received.
433  */
434
435 typedef struct libvlc_event_manager_t libvlc_event_manager_t;
436
437 /**
438  * Callback function notification
439  * \param p_event the event triggering the callback
440  */
441
442 typedef void ( *libvlc_callback_t )( const libvlc_event_t *, void * );
443
444 /**@} */
445
446 # ifdef __cplusplus
447 }
448 # endif
449
450 #endif