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