1 /*****************************************************************************
2  * libvlc_events.h:  libvlc_events external API structure
3  *****************************************************************************
4  * Copyright (C) 1998-2010 VLC authors and VideoLAN
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 it
11  * under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software Foundation,
22  * 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 typedef struct libvlc_renderer_item_t libvlc_renderer_item_t;
38 
39 /**
40  * \ingroup libvlc_event
41  * @{
42  */
43 
44 /**
45  * Event types
46  */
47 enum libvlc_event_e {
48     /* Append new event types at the end of a category.
49      * Do not remove, insert or re-order any entry.
50      * Keep this in sync with lib/event.c:libvlc_event_type_name(). */
51     libvlc_MediaMetaChanged=0,
52     libvlc_MediaSubItemAdded,
53     libvlc_MediaDurationChanged,
54     libvlc_MediaParsedChanged,
55     libvlc_MediaFreed,
56     libvlc_MediaStateChanged,
57     libvlc_MediaSubItemTreeAdded,
58 
59     libvlc_MediaPlayerMediaChanged=0x100,
60     libvlc_MediaPlayerNothingSpecial,
61     libvlc_MediaPlayerOpening,
62     libvlc_MediaPlayerBuffering,
63     libvlc_MediaPlayerPlaying,
64     libvlc_MediaPlayerPaused,
65     libvlc_MediaPlayerStopped,
66     libvlc_MediaPlayerForward,
67     libvlc_MediaPlayerBackward,
68     libvlc_MediaPlayerEndReached,
69     libvlc_MediaPlayerEncounteredError,
70     libvlc_MediaPlayerTimeChanged,
71     libvlc_MediaPlayerPositionChanged,
72     libvlc_MediaPlayerSeekableChanged,
73     libvlc_MediaPlayerPausableChanged,
74     libvlc_MediaPlayerTitleChanged,
75     libvlc_MediaPlayerSnapshotTaken,
76     libvlc_MediaPlayerLengthChanged,
77     libvlc_MediaPlayerVout,
78     libvlc_MediaPlayerScrambledChanged,
79     libvlc_MediaPlayerESAdded,
80     libvlc_MediaPlayerESDeleted,
81     libvlc_MediaPlayerESSelected,
82     libvlc_MediaPlayerCorked,
83     libvlc_MediaPlayerUncorked,
84     libvlc_MediaPlayerMuted,
85     libvlc_MediaPlayerUnmuted,
86     libvlc_MediaPlayerAudioVolume,
87     libvlc_MediaPlayerAudioDevice,
88     libvlc_MediaPlayerChapterChanged,
89 
90     libvlc_MediaListItemAdded=0x200,
91     libvlc_MediaListWillAddItem,
92     libvlc_MediaListItemDeleted,
93     libvlc_MediaListWillDeleteItem,
94     libvlc_MediaListEndReached,
95 
96     libvlc_MediaListViewItemAdded=0x300,
97     libvlc_MediaListViewWillAddItem,
98     libvlc_MediaListViewItemDeleted,
99     libvlc_MediaListViewWillDeleteItem,
100 
101     libvlc_MediaListPlayerPlayed=0x400,
102     libvlc_MediaListPlayerNextItemSet,
103     libvlc_MediaListPlayerStopped,
104 
105     /**
106      * \deprecated Useless event, it will be triggered only when calling
107      * libvlc_media_discoverer_start()
108      */
109     libvlc_MediaDiscovererStarted=0x500,
110     /**
111      * \deprecated Useless event, it will be triggered only when calling
112      * libvlc_media_discoverer_stop()
113      */
114     libvlc_MediaDiscovererEnded,
115 
116     libvlc_RendererDiscovererItemAdded,
117     libvlc_RendererDiscovererItemDeleted,
118 
119     libvlc_VlmMediaAdded=0x600,
120     libvlc_VlmMediaRemoved,
121     libvlc_VlmMediaChanged,
122     libvlc_VlmMediaInstanceStarted,
123     libvlc_VlmMediaInstanceStopped,
124     libvlc_VlmMediaInstanceStatusInit,
125     libvlc_VlmMediaInstanceStatusOpening,
126     libvlc_VlmMediaInstanceStatusPlaying,
127     libvlc_VlmMediaInstanceStatusPause,
128     libvlc_VlmMediaInstanceStatusEnd,
129     libvlc_VlmMediaInstanceStatusError
130 };
131 
132 /**
133  * A LibVLC event
134  */
135 typedef struct libvlc_event_t
136 {
137     int   type; /**< Event type (see @ref libvlc_event_e) */
138     void *p_obj; /**< Object emitting the event */
139     union
140     {
141         /* media descriptor */
142         struct
143         {
144             libvlc_meta_t meta_type;
145         } media_meta_changed;
146         struct
147         {
148             libvlc_media_t * new_child;
149         } media_subitem_added;
150         struct
151         {
152             int64_t new_duration;
153         } media_duration_changed;
154         struct
155         {
156             int new_status; /**< see @ref libvlc_media_parsed_status_t */
157         } media_parsed_changed;
158         struct
159         {
160             libvlc_media_t * md;
161         } media_freed;
162         struct
163         {
164             int new_state; /**< see @ref libvlc_state_t */
165         } media_state_changed;
166         struct
167         {
168             libvlc_media_t * item;
169         } media_subitemtree_added;
170 
171         /* media instance */
172         struct
173         {
174             float new_cache;
175         } media_player_buffering;
176         struct
177         {
178             int new_chapter;
179         } media_player_chapter_changed;
180         struct
181         {
182             float new_position;
183         } media_player_position_changed;
184         struct
185         {
186             libvlc_time_t new_time;
187         } media_player_time_changed;
188         struct
189         {
190             int new_title;
191         } media_player_title_changed;
192         struct
193         {
194             int new_seekable;
195         } media_player_seekable_changed;
196         struct
197         {
198             int new_pausable;
199         } media_player_pausable_changed;
200         struct
201         {
202             int new_scrambled;
203         } media_player_scrambled_changed;
204         struct
205         {
206             int new_count;
207         } media_player_vout;
208 
209         /* media list */
210         struct
211         {
212             libvlc_media_t * item;
213             int index;
214         } media_list_item_added;
215         struct
216         {
217             libvlc_media_t * item;
218             int index;
219         } media_list_will_add_item;
220         struct
221         {
222             libvlc_media_t * item;
223             int index;
224         } media_list_item_deleted;
225         struct
226         {
227             libvlc_media_t * item;
228             int index;
229         } media_list_will_delete_item;
230 
231         /* media list player */
232         struct
233         {
234             libvlc_media_t * item;
235         } media_list_player_next_item_set;
236 
237         /* snapshot taken */
238         struct
239         {
240              char* psz_filename ;
241         } media_player_snapshot_taken ;
242 
243         /* Length changed */
244         struct
245         {
246             libvlc_time_t   new_length;
247         } media_player_length_changed;
248 
249         /* VLM media */
250         struct
251         {
252             const char * psz_media_name;
253             const char * psz_instance_name;
254         } vlm_media_event;
255 
256         /* Extra MediaPlayer */
257         struct
258         {
259             libvlc_media_t * new_media;
260         } media_player_media_changed;
261 
262         struct
263         {
264             libvlc_track_type_t i_type;
265             int                 i_id;
266         } media_player_es_changed;
267 
268         struct
269         {
270             float volume;
271         } media_player_audio_volume;
272 
273         struct
274         {
275             const char *device;
276         } media_player_audio_device;
277 
278         struct
279         {
280             libvlc_renderer_item_t *item;
281         } renderer_discoverer_item_added;
282         struct
283         {
284             libvlc_renderer_item_t *item;
285         } renderer_discoverer_item_deleted;
286     } u; /**< Type-dependent event description */
287 } libvlc_event_t;
288 
289 
290 /**@} */
291 
292 # ifdef __cplusplus
293 }
294 # endif
295 
296 #endif /* _LIBVLC_EVENTS_H */
297