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