]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_structures.h
libvlc_exception:
[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_Stopped,
126     libvlc_Opening,
127     libvlc_Buffering,
128     libvlc_Ended,
129     libvlc_Error,
130     libvlc_Playing,
131     libvlc_Paused
132 } libvlc_state_t;
133
134 /**@} */
135
136 /*****************************************************************************
137  * Media List
138  *****************************************************************************/
139 /** defgroup libvlc_media_list MediaList
140  * \ingroup libvlc
141  * LibVLC Media List handling
142  * @{
143  */
144
145 typedef struct libvlc_media_list_t libvlc_media_list_t;
146 typedef struct libvlc_media_list_view_t libvlc_media_list_view_t;
147
148 /**@} */
149
150 /*****************************************************************************
151  * Dynamic Media List
152  *****************************************************************************/
153 /** defgroup libvlc_media_list MediaList
154  * \ingroup libvlc
155  * LibVLC Dynamic Media list: Media list with content synchronized with
156  * an other playlist
157  * @{
158  */
159
160 typedef struct libvlc_dynamic_media_list_t libvlc_dynamic_media_list_t;
161
162 /**@} */
163
164 /*****************************************************************************
165  * Media List Player
166  *****************************************************************************/
167 /** defgroup libvlc_media_list_player MediaListPlayer
168  * \ingroup libvlc
169  * LibVLC Media List Player handling
170  * @{
171  */
172
173 typedef struct libvlc_media_list_player_t libvlc_media_list_player_t;
174
175 /**@} */
176
177 /*****************************************************************************
178  * Media Library
179  *****************************************************************************/
180 /** defgroup libvlc_media_library Media Library
181  * \ingroup libvlc
182  * LibVLC Media Library
183  * @{
184  */
185
186 typedef struct libvlc_media_library_t libvlc_media_library_t;
187
188 /**@} */
189
190 /*****************************************************************************
191  * Playlist
192  *****************************************************************************/
193 /** defgroup libvlc_playlist Playlist
194  * \ingroup libvlc
195  * LibVLC Playlist handling
196  * @{
197  */
198
199 typedef struct libvlc_playlist_item_t
200 {
201     int i_id;
202     char * psz_uri;
203     char * psz_name;
204
205 } libvlc_playlist_item_t;
206
207 /**@} */
208
209
210 /*****************************************************************************
211  * Video
212  *****************************************************************************/
213 /** defgroup libvlc_video Video
214  * \ingroup libvlc
215  * LibVLC Video handling
216  * @{
217  */
218  
219 /**
220 * Downcast to this general type as placeholder for a platform specific one, such as:
221 *  Drawable on X11,
222 *  CGrafPort on MacOSX,
223 *  HWND on win32
224 */
225 typedef int libvlc_drawable_t;
226
227 /**
228 * Rectangle type for video geometry
229 */
230 typedef struct libvlc_rectangle_t
231 {
232     int top, left;
233     int bottom, right;
234 }
235 libvlc_rectangle_t;
236
237 /**@} */
238
239
240 /*****************************************************************************
241  * Services/Media Discovery
242  *****************************************************************************/
243 /** defgroup libvlc_media_discoverer Media Discoverer
244  * \ingroup libvlc
245  * LibVLC Media Discoverer
246  * @{
247  */
248
249 typedef struct libvlc_media_discoverer_t libvlc_media_discoverer_t;
250
251 /**@} */
252
253 /*****************************************************************************
254  * Message log handling
255  *****************************************************************************/
256
257 /** defgroup libvlc_log Log
258  * \ingroup libvlc
259  * LibVLC Message Logging
260  * @{
261  */
262
263 /** This structure is opaque. It represents a libvlc log instance */
264 typedef struct libvlc_log_t libvlc_log_t;
265
266 /** This structure is opaque. It represents a libvlc log iterator */
267 typedef struct libvlc_log_iterator_t libvlc_log_iterator_t;
268
269 typedef struct libvlc_log_message_t
270 {
271     unsigned    sizeof_msg;   /* sizeof() of message structure, must be filled in by user */
272     int         i_severity;   /* 0=INFO, 1=ERR, 2=WARN, 3=DBG */
273     const char *psz_type;     /* module type */
274     const char *psz_name;     /* module name */
275     const char *psz_header;   /* optional header */
276     const char *psz_message;  /* message */
277 } libvlc_log_message_t;
278
279 /**@} */
280
281 /*****************************************************************************
282  * Callbacks handling
283  *****************************************************************************/
284
285 /** defgroup libvlc_callbacks Callbacks
286  * \ingroup libvlc
287  * LibVLC Event Callbacks
288  * @{
289  */
290  
291 /**
292  * Available events: (XXX: being reworked)
293  * - libvlc_MediaInstanceReachedEnd
294  */
295
296 typedef enum libvlc_event_type_t {
297     libvlc_MediaDescriptorMetaChanged,
298     libvlc_MediaDescriptorSubItemAdded,
299     libvlc_MediaDescriptorDurationChanged,
300     libvlc_MediaDescriptorPreparsedChanged,
301
302     libvlc_MediaInstancePlayed,
303     libvlc_MediaInstancePaused,
304     libvlc_MediaInstanceReachedEnd,
305     libvlc_MediaInstancePositionChanged,
306
307     libvlc_MediaListItemAdded,
308     libvlc_MediaListItemDeleted,
309
310     libvlc_MediaListPlayerPlayed,
311     libvlc_MediaListPlayerNextItemSet,
312     libvlc_MediaListPlayerStopped,
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         struct
339         {
340             vlc_int64_t new_duration;
341         } media_descriptor_duration_changed;
342         struct
343         {
344             int new_status;
345         } media_descriptor_preparsed_changed;
346             
347         /* media instance */
348         struct
349         {
350             long int new_position;
351         } media_instance_position_changed;
352
353         /* media list */
354         struct
355         {
356             libvlc_media_descriptor_t * item;
357             int index;
358         } media_list_item_added;
359         struct
360         {
361             libvlc_media_descriptor_t * item;
362             int index;
363         } media_list_item_deleted;
364     } u;
365 } libvlc_event_t;
366
367 /**
368  * Event manager that belongs to a libvlc object, and from whom events can
369  * be received.
370  */
371
372 typedef struct libvlc_event_manager_t libvlc_event_manager_t;
373
374 /**
375  * Callback function notification
376  * \param p_event the event triggering the callback
377  */
378
379 typedef void ( *libvlc_callback_t )( const libvlc_event_t *, void * );
380
381 /**@} */
382
383 # ifdef __cplusplus
384 }
385 # endif
386
387 #endif