include/vlc: Headers clean up.
[vlc.git] / include / vlc / libvlc_events.h
1 /*****************************************************************************
2  * libvlc_events.h:  libvlc_events external API structure
3  *****************************************************************************
4  * Copyright (C) 1998-2007 the VideoLAN team
5  * $Id $
6  *
7  * Authors: Filippo Carone <littlejohn@videolan.org>
8  *          Pierre d'Herbemont <pdherbemont@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef _LIBVLC_EVENTS_H
26 #define _LIBVLC_EVENTS_H 1
27
28 # ifdef __cplusplus
29 extern "C" {
30 # endif
31
32 /*****************************************************************************
33  * Events handling
34  *****************************************************************************/
35
36 /** \defgroup libvlc_events Events
37  * \ingroup libvlc
38  * LibVLC Available Events
39  * @{
40  */
41
42 typedef enum libvlc_event_type_t {
43     libvlc_MediaDescriptorMetaChanged,
44     libvlc_MediaDescriptorSubItemAdded,
45     libvlc_MediaDescriptorDurationChanged,
46     libvlc_MediaDescriptorPreparsedChanged,
47     libvlc_MediaDescriptorFreed,
48     libvlc_MediaDescriptorStateChanged,
49
50     libvlc_MediaInstancePlayed,
51     libvlc_MediaInstancePaused,
52     libvlc_MediaInstanceReachedEnd,
53     libvlc_MediaInstanceEncounteredError,
54     libvlc_MediaInstanceTimeChanged,
55     libvlc_MediaInstancePositionChanged,
56     libvlc_MediaInstanceSeekableChanged,
57     libvlc_MediaInstancePausableChanged,
58
59     libvlc_MediaListItemAdded,
60     libvlc_MediaListWillAddItem,
61     libvlc_MediaListItemDeleted,
62     libvlc_MediaListWillDeleteItem,
63
64     libvlc_MediaListViewItemAdded,
65     libvlc_MediaListViewWillAddItem,
66     libvlc_MediaListViewItemDeleted,
67     libvlc_MediaListViewWillDeleteItem,
68
69     libvlc_MediaListPlayerPlayed,
70     libvlc_MediaListPlayerNextItemSet,
71     libvlc_MediaListPlayerStopped,
72
73     libvlc_MediaDiscovererStarted,
74     libvlc_MediaDiscovererEnded
75
76 } libvlc_event_type_t;
77
78 /**
79  * An Event
80  * \param type the even type
81  * \param p_obj the sender object
82  * \param u Event dependent content
83  */
84
85 typedef struct libvlc_event_t
86 {
87     libvlc_event_type_t type;
88     void * p_obj;
89     union event_type_specific
90     {
91         /* media descriptor */
92         struct
93         {
94             libvlc_meta_t meta_type;
95         } media_descriptor_meta_changed;
96         struct
97         {
98             libvlc_media_descriptor_t * new_child;
99         } media_descriptor_subitem_added;
100         struct
101         {
102             vlc_int64_t new_duration;
103         } media_descriptor_duration_changed;
104         struct
105         {
106             int new_status;
107         } media_descriptor_preparsed_changed;
108         struct
109         {
110             libvlc_media_descriptor_t * md;
111         } media_descriptor_freed;
112         struct
113         {
114             libvlc_state_t new_state;
115         } media_descriptor_state_changed;
116
117         /* media instance */
118         struct
119         {
120             float new_position;
121         } media_instance_position_changed;
122         struct
123         {
124             libvlc_time_t new_time;
125         } media_instance_time_changed;
126         struct
127         {
128             libvlc_time_t new_seekable;
129         } media_instance_seekable_changed;
130         struct
131         {
132             libvlc_time_t new_pausable;
133         } media_instance_pausable_changed;
134
135         /* media list */
136         struct
137         {
138             libvlc_media_descriptor_t * item;
139             int index;
140         } media_list_item_added;
141         struct
142         {
143             libvlc_media_descriptor_t * item;
144             int index;
145         } media_list_will_add_item;
146         struct
147         {
148             libvlc_media_descriptor_t * item;
149             int index;
150         } media_list_item_deleted;
151         struct
152         {
153             libvlc_media_descriptor_t * item;
154             int index;
155         } media_list_will_delete_item;
156
157         /* media list view */
158         struct
159         {
160             libvlc_media_descriptor_t * item;
161             int index;
162         } media_list_view_item_added;
163         struct
164         {
165             libvlc_media_descriptor_t * item;
166             int index;
167         } media_list_view_will_add_item;
168         struct
169         {
170             libvlc_media_descriptor_t * item;
171             int index;
172         } media_list_view_item_deleted;
173         struct
174         {
175             libvlc_media_descriptor_t * item;
176             int index;
177         } media_list_view_will_delete_item;
178
179         /* media discoverer */
180         struct
181         {
182             void * unused;
183         } media_media_discoverer_started;
184         struct
185         {
186             void * unused;
187         } media_media_discoverer_ended;
188
189     } u;
190 } libvlc_event_t;
191
192 /**
193  * Event manager that belongs to a libvlc object, and from whom events can
194  * be received.
195  */
196
197 typedef struct libvlc_event_manager_t libvlc_event_manager_t;
198
199 /**
200  * Callback function notification
201  * \param p_event the event triggering the callback
202  */
203
204 typedef void ( *libvlc_callback_t )( const libvlc_event_t *, void * );
205
206 /**@} */
207
208 # ifdef __cplusplus
209 }
210 # endif
211
212 #endif /* _LIBVLC_EVENTS_H */