]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_structures.h
control/media_descriptor.c: Forward vlc_InputItemSubItemAdded 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 Query
57  *****************************************************************************/
58 /** defgroup libvlc_tag_query Tag Query
59  * \ingroup libvlc
60  * LibVLC Tag Query support in media descriptor
61  * @{
62  */
63
64 typedef struct libvlc_tag_query_t libvlc_tag_query_t;
65
66 /**@} */
67
68 /*****************************************************************************
69  * Media Descriptor
70  *****************************************************************************/
71 /** defgroup libvlc_media_descriptor MediaDescriptor
72  * \ingroup libvlc
73  * LibVLC Media Descriptor handling
74  * @{
75  */
76
77 /* Meta Handling */
78 /** defgroup libvlc_meta Meta
79  * \ingroup libvlc_media_descriptor
80  * LibVLC Media Meta
81  * @{
82  */
83
84 typedef enum libvlc_meta_t {
85     libvlc_meta_Title,
86     libvlc_meta_Artist,
87     libvlc_meta_Genre,
88     libvlc_meta_Copyright,
89     libvlc_meta_Album,
90     libvlc_meta_TrackNumber,
91     libvlc_meta_Description,
92     libvlc_meta_Rating,
93     libvlc_meta_Date,
94     libvlc_meta_Setting,
95     libvlc_meta_URL,
96     libvlc_meta_Language,
97     libvlc_meta_NowPlaying,
98     libvlc_meta_Publisher,
99     libvlc_meta_EncodedBy,
100     libvlc_meta_ArtworkURL,
101     libvlc_meta_TrackID
102 } libvlc_meta_t;
103
104 /**@} */
105
106 typedef struct libvlc_media_descriptor_t libvlc_media_descriptor_t;
107
108 /**@} */
109
110
111 /*****************************************************************************
112  * Media Instance
113  *****************************************************************************/
114 /** defgroup libvlc_media_instance MediaInstance
115  * \ingroup libvlc
116  * LibVLC Media Instance handling
117  * @{
118  */
119
120 typedef struct libvlc_media_instance_t libvlc_media_instance_t;
121
122 /**@} */
123
124 /*****************************************************************************
125  * Media List
126  *****************************************************************************/
127 /** defgroup libvlc_media_list MediaList
128  * \ingroup libvlc
129  * LibVLC Media List handling
130  * @{
131  */
132
133 typedef struct libvlc_media_list_t libvlc_media_list_t;
134
135 /**@} */
136
137 /*****************************************************************************
138  * Media List Player
139  *****************************************************************************/
140 /** defgroup libvlc_media_list_player MediaListPlayer
141  * \ingroup libvlc
142  * LibVLC Media List Player handling
143  * @{
144  */
145
146 typedef struct libvlc_media_list_player_t libvlc_media_list_player_t;
147
148 /**@} */
149
150 /*****************************************************************************
151  * Playlist
152  *****************************************************************************/
153 /** defgroup libvlc_playlist Playlist
154  * \ingroup libvlc
155  * LibVLC Playlist handling
156  * @{
157  */
158
159 typedef struct libvlc_playlist_item_t
160 {
161     int i_id;
162     char * psz_uri;
163     char * psz_name;
164
165 } libvlc_playlist_item_t;
166
167 /**@} */
168
169
170 /*****************************************************************************
171  * Video
172  *****************************************************************************/
173 /** defgroup libvlc_video Video
174  * \ingroup libvlc
175  * LibVLC Video handling
176  * @{
177  */
178     
179 /**
180 * Downcast to this general type as placeholder for a platform specific one, such as:
181 *  Drawable on X11,
182 *  CGrafPort on MacOSX,
183 *  HWND on win32
184 */
185 typedef int libvlc_drawable_t;
186
187 /**
188 * Rectangle type for video geometry
189 */
190 typedef struct libvlc_rectangle_t
191 {
192     int top, left;
193     int bottom, right;
194 }
195 libvlc_rectangle_t;
196
197 /**@} */
198
199
200 /*****************************************************************************
201  * Message log handling
202  *****************************************************************************/
203
204 /** defgroup libvlc_log Log
205  * \ingroup libvlc
206  * LibVLC Message Logging
207  * @{
208  */
209
210 /** This structure is opaque. It represents a libvlc log instance */
211 typedef struct libvlc_log_t libvlc_log_t;
212
213 /** This structure is opaque. It represents a libvlc log iterator */
214 typedef struct libvlc_log_iterator_t libvlc_log_iterator_t;
215
216 typedef struct libvlc_log_message_t
217 {
218     unsigned    sizeof_msg;   /* sizeof() of message structure, must be filled in by user */
219     int         i_severity;   /* 0=INFO, 1=ERR, 2=WARN, 3=DBG */
220     const char *psz_type;     /* module type */
221     const char *psz_name;     /* module name */
222     const char *psz_header;   /* optional header */
223     const char *psz_message;  /* message */
224 } libvlc_log_message_t;
225
226 /**@} */
227
228 /*****************************************************************************
229  * Callbacks handling
230  *****************************************************************************/
231
232 /** defgroup libvlc_callbacks Callbacks
233  * \ingroup libvlc
234  * LibVLC Event Callbacks
235  * @{
236  */
237     
238 /**
239  * Available events: (XXX: being reworked)
240  * - libvlc_MediaInstanceReachedEnd
241  */
242
243 typedef enum libvlc_event_type_t {
244     libvlc_MediaDescriptorMetaChanged,
245     libvlc_MediaDescriptorSubItemAdded,
246     libvlc_MediaInstanceReachedEnd,
247     libvlc_MediaListItemAdded,
248     libvlc_MediaListItemDeleted,
249     libvlc_MediaListItemChanged,
250 } libvlc_event_type_t;
251
252 /**
253  * An Event
254  * \param type the even type
255  * \param p_obj the sender object
256  * \param u Event dependent content
257  */
258
259 typedef struct libvlc_event_t
260 {
261     libvlc_event_type_t type;
262     void * p_obj;
263     union event_type_specific
264     {
265         struct
266         {
267             libvlc_meta_t meta_type;
268         } media_descriptor_meta_changed;
269         struct
270         {
271             libvlc_media_descriptor_t * new_child;
272         } media_descriptor_subitem_added;
273         struct
274         {
275             libvlc_media_descriptor_t * item;
276             int index;
277         } media_list_item_added;
278         struct
279         {
280             libvlc_media_descriptor_t * item;
281             int index;
282         } media_list_item_deleted;
283         struct
284         {
285             libvlc_media_descriptor_t * item;
286             int index;
287         } media_list_item_changed;
288     } u;
289 } libvlc_event_t;
290
291 /**
292  * Event manager that belongs to a libvlc object, and from whom events can
293  * be received.
294  */
295
296 typedef struct libvlc_event_manager_t libvlc_event_manager_t;
297
298 /**
299  * Callback function notification
300  * \param p_event the event triggering the callback
301  */
302
303 typedef void ( *libvlc_callback_t )( const libvlc_event_t *, void * );
304
305 /**@} */
306
307 # ifdef __cplusplus
308 }
309 # endif
310
311 #endif