]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_events.h
libvlc: add mouse events as libvlc_MediaPlayerEvents
[vlc] / include / vlc / libvlc_events.h
1 /*****************************************************************************
2  * libvlc_events.h:  libvlc_events external API structure
3  *****************************************************************************
4  * Copyright (C) 1998-2010 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 along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 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     /* Append new event types at the end. Do not remove, insert or
48      * re-order any entry. The cpp will prepend libvlc_ to the symbols. */
49 #define DEFINE_LIBVLC_EVENT_TYPES \
50     DEF( MediaMetaChanged ), \
51     DEF( MediaSubItemAdded ), \
52     DEF( MediaDurationChanged ), \
53     DEF( MediaPreparsedChanged ), \
54     DEF( MediaFreed ), \
55     DEF( MediaStateChanged ), \
56     \
57     DEF( MediaPlayerNothingSpecial ), \
58     DEF( MediaPlayerOpening ), \
59     DEF( MediaPlayerBuffering ), \
60     DEF( MediaPlayerPlaying ), \
61     DEF( MediaPlayerPaused ), \
62     DEF( MediaPlayerStopped ), \
63     DEF( MediaPlayerForward ), \
64     DEF( MediaPlayerBackward ), \
65     DEF( MediaPlayerEndReached ), \
66     DEF( MediaPlayerEncounteredError ), \
67     DEF( MediaPlayerTimeChanged ), \
68     DEF( MediaPlayerPositionChanged ), \
69     DEF( MediaPlayerSeekableChanged ), \
70     DEF( MediaPlayerPausableChanged ), \
71     \
72     DEF( MediaListItemAdded ), \
73     DEF( MediaListWillAddItem ), \
74     DEF( MediaListItemDeleted ), \
75     DEF( MediaListWillDeleteItem ), \
76     \
77     DEF( MediaListViewItemAdded ), \
78     DEF( MediaListViewWillAddItem ), \
79     DEF( MediaListViewItemDeleted ), \
80     DEF( MediaListViewWillDeleteItem ), \
81     \
82     DEF( MediaListPlayerPlayed ), \
83     DEF( MediaListPlayerNextItemSet ), \
84     DEF( MediaListPlayerStopped ), \
85     \
86     DEF( MediaDiscovererStarted ), \
87     DEF( MediaDiscovererEnded ), \
88     \
89     DEF( MediaPlayerTitleChanged ), \
90     DEF( MediaPlayerSnapshotTaken ), \
91     DEF( MediaPlayerLengthChanged ), \
92     \
93     DEF( VlmMediaAdded ), \
94     DEF( VlmMediaRemoved ), \
95     DEF( VlmMediaChanged ), \
96     DEF( VlmMediaInstanceStarted ), \
97     DEF( VlmMediaInstanceStopped ), \
98     DEF( VlmMediaInstanceStatusInit ), \
99     DEF( VlmMediaInstanceStatusOpening ), \
100     DEF( VlmMediaInstanceStatusPlaying ), \
101     DEF( VlmMediaInstanceStatusPause ), \
102     DEF( VlmMediaInstanceStatusEnd ), \
103     DEF( VlmMediaInstanceStatusError ), \
104     \
105     DEF( MediaPlayerMediaChanged ), \
106     \
107     DEF( MediaPlayerMouseMoved ), \
108     DEF( MediaPlayerMouseButton ), \
109     DEF( MediaPlayerMouseClick ), \
110     DEF( MediaPlayerMouseObject ), \
111     \
112 /* New event types HERE */
113
114 #ifdef __cplusplus
115 enum libvlc_event_type_e {
116 #else
117 enum libvlc_event_type_t {
118 #endif
119 #define DEF(a) libvlc_##a
120     DEFINE_LIBVLC_EVENT_TYPES
121     libvlc_num_event_types
122 #undef  DEF
123 };
124
125 /* Implementing libvlc_event_type_name() needs the definition too. */
126 #ifndef LIBVLC_EVENT_TYPES_KEEP_DEFINE
127 #undef  DEFINE_LIBVLC_EVENT_TYPES
128 #endif
129
130 /**
131  * An Event
132  * \param type the even type
133  * \param p_obj the sender object
134  * \param u Event dependent content
135  */
136
137 struct libvlc_event_t
138 {
139     libvlc_event_type_t type;
140     void * p_obj;
141     union event_type_specific
142     {
143         /* media descriptor */
144         struct
145         {
146             libvlc_meta_t meta_type;
147         } media_meta_changed;
148         struct
149         {
150             libvlc_media_t * new_child;
151         } media_subitem_added;
152         struct
153         {
154             int64_t new_duration;
155         } media_duration_changed;
156         struct
157         {
158             int new_status;
159         } media_preparsed_changed;
160         struct
161         {
162             libvlc_media_t * md;
163         } media_freed;
164         struct
165         {
166             libvlc_state_t new_state;
167         } media_state_changed;
168
169         /* media instance */
170         struct
171         {
172             float new_position;
173         } media_player_position_changed;
174         struct
175         {
176             libvlc_time_t new_time;
177         } media_player_time_changed;
178         struct
179         {
180             int new_title;
181         } media_player_title_changed;
182         struct
183         {
184             int new_seekable;
185         } media_player_seekable_changed;
186         struct
187         {
188             int new_pausable;
189         } media_player_pausable_changed;
190
191         /* media list */
192         struct
193         {
194             libvlc_media_t * item;
195             int index;
196         } media_list_item_added;
197         struct
198         {
199             libvlc_media_t * item;
200             int index;
201         } media_list_will_add_item;
202         struct
203         {
204             libvlc_media_t * item;
205             int index;
206         } media_list_item_deleted;
207         struct
208         {
209             libvlc_media_t * item;
210             int index;
211         } media_list_will_delete_item;
212
213         /* media list player */
214         struct
215         {
216             libvlc_media_t * item;
217         } media_list_player_next_item_set;
218
219         /* snapshot taken */
220         struct
221         {
222              char* psz_filename ;
223         } media_player_snapshot_taken ;
224
225         /* Length changed */
226         struct
227         {
228             libvlc_time_t   new_length;
229         } media_player_length_changed;
230
231         /* VLM media */
232         struct
233         {
234             const char * psz_media_name;
235             const char * psz_instance_name;
236         } vlm_media_event;
237
238         /* Extra MediaPlayer */
239         struct
240         {
241             libvlc_media_t * new_media;
242         } media_player_media_changed;
243
244         /* Mouse events */
245         struct
246         {
247             int x;
248             int y;
249         } media_player_mouse_moved;
250
251         struct
252         {
253             int mb_left;
254             int mb_center;
255             int mb_right;
256             int mb_wheel_up;
257             int mb_wheel_down;
258         } media_player_mouse_button;
259
260         struct
261         {
262             int clicked;
263         } media_player_mouse_clicked;
264
265         struct
266         {
267             int moved;
268         } media_player_mouse_object;
269
270     } u;
271 };
272
273
274 /**@} */
275
276 # ifdef __cplusplus
277 }
278 # endif
279
280 #endif /* _LIBVLC_EVENTS_H */