]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_events.h
libvlc_MediaPlayerSnapshotTaken Event creation
[vlc] / include / vlc / libvlc_events.h
1 /*****************************************************************************
2  * libvlc_events.h:  libvlc_events external API structure
3  *****************************************************************************
4  * Copyright (C) 1998-2008 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 /**
29  * \file
30  * This file defines libvlc_event external API
31  */
32
33 # ifdef __cplusplus
34 extern "C" {
35 # endif
36
37 /*****************************************************************************
38  * Events handling
39  *****************************************************************************/
40
41 /** \defgroup libvlc_event libvlc_event
42  * \ingroup libvlc_core
43  * LibVLC Available Events
44  * @{
45  */
46
47 typedef enum libvlc_event_type_t {
48     libvlc_MediaMetaChanged,
49     libvlc_MediaSubItemAdded,
50     libvlc_MediaDurationChanged,
51     libvlc_MediaPreparsedChanged,
52     libvlc_MediaFreed,
53     libvlc_MediaStateChanged,
54
55     libvlc_MediaPlayerNothingSpecial,
56     libvlc_MediaPlayerOpening,
57     libvlc_MediaPlayerBuffering,
58     libvlc_MediaPlayerPlaying,
59     libvlc_MediaPlayerPaused,
60     libvlc_MediaPlayerStopped,
61     libvlc_MediaPlayerForward,
62     libvlc_MediaPlayerBackward,
63     libvlc_MediaPlayerEndReached,
64     libvlc_MediaPlayerEncounteredError,
65     libvlc_MediaPlayerTimeChanged,
66     libvlc_MediaPlayerPositionChanged,
67     libvlc_MediaPlayerSeekableChanged,
68     libvlc_MediaPlayerPausableChanged,
69
70     libvlc_MediaListItemAdded,
71     libvlc_MediaListWillAddItem,
72     libvlc_MediaListItemDeleted,
73     libvlc_MediaListWillDeleteItem,
74
75     libvlc_MediaListViewItemAdded,
76     libvlc_MediaListViewWillAddItem,
77     libvlc_MediaListViewItemDeleted,
78     libvlc_MediaListViewWillDeleteItem,
79
80     libvlc_MediaListPlayerPlayed,
81     libvlc_MediaListPlayerNextItemSet,
82     libvlc_MediaListPlayerStopped,
83
84     libvlc_MediaDiscovererStarted,
85     libvlc_MediaDiscovererEnded,
86
87     libvlc_MediaPlayerTitleChanged,
88     libvlc_MediaPlayerSnapshotTaken
89
90 } libvlc_event_type_t;
91
92 /**
93  * An Event
94  * \param type the even type
95  * \param p_obj the sender object
96  * \param u Event dependent content
97  */
98
99 typedef struct libvlc_event_t
100 {
101     libvlc_event_type_t type;
102     void * p_obj;
103     union event_type_specific
104     {
105         /* media descriptor */
106         struct
107         {
108             libvlc_meta_t meta_type;
109         } media_meta_changed;
110         struct
111         {
112             libvlc_media_t * new_child;
113         } media_subitem_added;
114         struct
115         {
116             int64_t new_duration;
117         } media_duration_changed;
118         struct
119         {
120             int new_status;
121         } media_preparsed_changed;
122         struct
123         {
124             libvlc_media_t * md;
125         } media_freed;
126         struct
127         {
128             libvlc_state_t new_state;
129         } media_state_changed;
130
131         /* media instance */
132         struct
133         {
134             float new_position;
135         } media_player_position_changed;
136         struct
137         {
138             libvlc_time_t new_time;
139         } media_player_time_changed;
140         struct
141         {
142             int new_title;
143         } media_player_title_changed;
144         struct
145         {
146             libvlc_time_t new_seekable;
147         } media_player_seekable_changed;
148         struct
149         {
150             libvlc_time_t new_pausable;
151         } media_player_pausable_changed;
152
153         /* media list */
154         struct
155         {
156             libvlc_media_t * item;
157             int index;
158         } media_list_item_added;
159         struct
160         {
161             libvlc_media_t * item;
162             int index;
163         } media_list_will_add_item;
164         struct
165         {
166             libvlc_media_t * item;
167             int index;
168         } media_list_item_deleted;
169         struct
170         {
171             libvlc_media_t * item;
172             int index;
173         } media_list_will_delete_item;
174
175         /* media list view */
176         struct
177         {
178             libvlc_media_t * item;
179             int index;
180         } media_list_view_item_added;
181         struct
182         {
183             libvlc_media_t * item;
184             int index;
185         } media_list_view_will_add_item;
186         struct
187         {
188             libvlc_media_t * item;
189             int index;
190         } media_list_view_item_deleted;
191         struct
192         {
193             libvlc_media_t * item;
194             int index;
195         } media_list_view_will_delete_item;
196
197         /* media discoverer */
198         struct
199         {
200             void * unused;
201         } media_media_discoverer_started;
202         struct
203         {
204             void * unused;
205         } media_media_discoverer_ended;
206
207         /* snapshot taken */
208         struct
209         {
210              char* psz_filename ;
211         } media_player_snapshot_taken ;
212
213     } u;
214 } libvlc_event_t;
215
216 /**
217  * Event manager that belongs to a libvlc object, and from whom events can
218  * be received.
219  */
220
221 typedef struct libvlc_event_manager_t libvlc_event_manager_t;
222
223 /**
224  * Callback function notification
225  * \param p_event the event triggering the callback
226  */
227
228 typedef void ( *libvlc_callback_t )( const libvlc_event_t *, void * );
229
230 /**@} */
231
232 # ifdef __cplusplus
233 }
234 # endif
235
236 #endif /* _LIBVLC_EVENTS_H */