]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_structures.h
vlc/libvlc.h: Use libvlc_time_t.
[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_MediaInstanceTimeChanged,
322     libvlc_MediaInstancePositionChanged,
323
324     libvlc_MediaListItemAdded,
325     libvlc_MediaListWillAddItem,
326     libvlc_MediaListItemDeleted,
327     libvlc_MediaListWillDeleteItem,
328
329     libvlc_MediaListViewItemAdded,
330     libvlc_MediaListViewWillAddItem,
331     libvlc_MediaListViewItemDeleted,
332     libvlc_MediaListViewWillDeleteItem,
333
334     libvlc_MediaListPlayerPlayed,
335     libvlc_MediaListPlayerNextItemSet,
336     libvlc_MediaListPlayerStopped,
337
338     libvlc_MediaDiscovererStarted,
339     libvlc_MediaDiscovererEnded
340
341 } libvlc_event_type_t;
342
343 /**
344  * An Event
345  * \param type the even type
346  * \param p_obj the sender object
347  * \param u Event dependent content
348  */
349
350 typedef struct libvlc_event_t
351 {
352     libvlc_event_type_t type;
353     void * p_obj;
354     union event_type_specific
355     {
356         /* media descriptor */
357         struct
358         {
359             libvlc_meta_t meta_type;
360         } media_descriptor_meta_changed;
361         struct
362         {
363             libvlc_media_descriptor_t * new_child;
364         } media_descriptor_subitem_added;
365         struct
366         {
367             vlc_int64_t new_duration;
368         } media_descriptor_duration_changed;
369         struct
370         {
371             int new_status;
372         } media_descriptor_preparsed_changed;
373         struct
374         {
375             libvlc_media_descriptor_t * md;
376         } media_descriptor_freed;
377         struct
378         {
379             libvlc_state_t new_state;
380         } media_descriptor_state_changed;
381             
382         /* media instance */
383         struct
384         {
385             float new_position;
386         } media_instance_position_changed;
387         struct
388         {
389             libvlc_time_t new_time;
390         } media_instance_time_changed;
391
392         /* media list */
393         struct
394         {
395             libvlc_media_descriptor_t * item;
396             int index;
397         } media_list_item_added;
398         struct
399         {
400             libvlc_media_descriptor_t * item;
401             int index;
402         } media_list_will_add_item;
403         struct
404         {
405             libvlc_media_descriptor_t * item;
406             int index;
407         } media_list_item_deleted;
408         struct
409         {
410             libvlc_media_descriptor_t * item;
411             int index;
412         } media_list_will_delete_item;
413
414         /* media list view */
415         struct
416         {
417             libvlc_media_descriptor_t * item;
418             int index;
419         } media_list_view_item_added;
420         struct
421         {
422             libvlc_media_descriptor_t * item;
423             int index;
424         } media_list_view_will_add_item;
425         struct
426         {
427             libvlc_media_descriptor_t * item;
428             int index;
429         } media_list_view_item_deleted;
430         struct
431         {
432             libvlc_media_descriptor_t * item;
433             int index;
434         } media_list_view_will_delete_item;
435
436         /* media discoverer */
437         struct
438         {
439             void * unused;
440         } media_media_discoverer_started;
441         struct
442         {
443             void * unused;
444         } media_media_discoverer_ended;
445
446     } u;
447 } libvlc_event_t;
448
449 /**
450  * Event manager that belongs to a libvlc object, and from whom events can
451  * be received.
452  */
453
454 typedef struct libvlc_event_manager_t libvlc_event_manager_t;
455
456 /**
457  * Callback function notification
458  * \param p_event the event triggering the callback
459  */
460
461 typedef void ( *libvlc_callback_t )( const libvlc_event_t *, void * );
462
463 /**@} */
464
465 # ifdef __cplusplus
466 }
467 # endif
468
469 #endif