]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_events.h
libvlc: add libvlc_MediaInstanceStopped
[vlc] / 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_MediaInstanceEndReached,
53     libvlc_MediaInstanceStopped,
54     libvlc_MediaInstanceEncounteredError,
55     libvlc_MediaInstanceTimeChanged,
56     libvlc_MediaInstancePositionChanged,
57     libvlc_MediaInstanceSeekableChanged,
58     libvlc_MediaInstancePausableChanged,
59
60     libvlc_MediaListItemAdded,
61     libvlc_MediaListWillAddItem,
62     libvlc_MediaListItemDeleted,
63     libvlc_MediaListWillDeleteItem,
64
65     libvlc_MediaListViewItemAdded,
66     libvlc_MediaListViewWillAddItem,
67     libvlc_MediaListViewItemDeleted,
68     libvlc_MediaListViewWillDeleteItem,
69
70     libvlc_MediaListPlayerPlayed,
71     libvlc_MediaListPlayerNextItemSet,
72     libvlc_MediaListPlayerStopped,
73
74     libvlc_MediaDiscovererStarted,
75     libvlc_MediaDiscovererEnded
76
77 } libvlc_event_type_t;
78
79 /**
80  * An Event
81  * \param type the even type
82  * \param p_obj the sender object
83  * \param u Event dependent content
84  */
85
86 typedef struct libvlc_event_t
87 {
88     libvlc_event_type_t type;
89     void * p_obj;
90     union event_type_specific
91     {
92         /* media descriptor */
93         struct
94         {
95             libvlc_meta_t meta_type;
96         } media_meta_changed;
97         struct
98         {
99             libvlc_media_t * new_child;
100         } media_subitem_added;
101         struct
102         {
103             vlc_int64_t new_duration;
104         } media_duration_changed;
105         struct
106         {
107             int new_status;
108         } media_preparsed_changed;
109         struct
110         {
111             libvlc_media_t * md;
112         } media_freed;
113         struct
114         {
115             libvlc_state_t new_state;
116         } media_state_changed;
117
118         /* media instance */
119         struct
120         {
121             float new_position;
122         } media_player_position_changed;
123         struct
124         {
125             libvlc_time_t new_time;
126         } media_player_time_changed;
127         struct
128         {
129             libvlc_time_t new_seekable;
130         } media_player_seekable_changed;
131         struct
132         {
133             libvlc_time_t new_pausable;
134         } media_player_pausable_changed;
135
136         /* media list */
137         struct
138         {
139             libvlc_media_t * item;
140             int index;
141         } media_list_item_added;
142         struct
143         {
144             libvlc_media_t * item;
145             int index;
146         } media_list_will_add_item;
147         struct
148         {
149             libvlc_media_t * item;
150             int index;
151         } media_list_item_deleted;
152         struct
153         {
154             libvlc_media_t * item;
155             int index;
156         } media_list_will_delete_item;
157
158         /* media list view */
159         struct
160         {
161             libvlc_media_t * item;
162             int index;
163         } media_list_view_item_added;
164         struct
165         {
166             libvlc_media_t * item;
167             int index;
168         } media_list_view_will_add_item;
169         struct
170         {
171             libvlc_media_t * item;
172             int index;
173         } media_list_view_item_deleted;
174         struct
175         {
176             libvlc_media_t * item;
177             int index;
178         } media_list_view_will_delete_item;
179
180         /* media discoverer */
181         struct
182         {
183             void * unused;
184         } media_media_discoverer_started;
185         struct
186         {
187             void * unused;
188         } media_media_discoverer_ended;
189
190     } u;
191 } libvlc_event_t;
192
193 /**
194  * Event manager that belongs to a libvlc object, and from whom events can
195  * be received.
196  */
197
198 typedef struct libvlc_event_manager_t libvlc_event_manager_t;
199
200 /**
201  * Callback function notification
202  * \param p_event the event triggering the callback
203  */
204
205 typedef void ( *libvlc_callback_t )( const libvlc_event_t *, void * );
206
207 /**@} */
208
209 # ifdef __cplusplus
210 }
211 # endif
212
213 #endif /* _LIBVLC_EVENTS_H */