LGPL
[vlc.git] / include / vlc / libvlc_events.h
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 /**
38  * \ingroup libvlc_event
39  * @{
40  */
41
42 /**
43  * Event types
44  */
45 enum libvlc_event_e {
46     /* Append new event types at the end of a category.
47      * Do not remove, insert or re-order any entry.
48      * Keep this in sync with lib/event.c:libvlc_event_type_name(). */
49     libvlc_MediaMetaChanged=0,
50     libvlc_MediaSubItemAdded,
51     libvlc_MediaDurationChanged,
52     libvlc_MediaParsedChanged,
53     libvlc_MediaFreed,
54     libvlc_MediaStateChanged,
55
56     libvlc_MediaPlayerMediaChanged=0x100,
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     libvlc_MediaPlayerTitleChanged,
72     libvlc_MediaPlayerSnapshotTaken,
73     libvlc_MediaPlayerLengthChanged,
74     libvlc_MediaPlayerVout,
75
76     libvlc_MediaListItemAdded=0x200,
77     libvlc_MediaListWillAddItem,
78     libvlc_MediaListItemDeleted,
79     libvlc_MediaListWillDeleteItem,
80
81     libvlc_MediaListViewItemAdded=0x300,
82     libvlc_MediaListViewWillAddItem,
83     libvlc_MediaListViewItemDeleted,
84     libvlc_MediaListViewWillDeleteItem,
85
86     libvlc_MediaListPlayerPlayed=0x400,
87     libvlc_MediaListPlayerNextItemSet,
88     libvlc_MediaListPlayerStopped,
89
90     libvlc_MediaDiscovererStarted=0x500,
91     libvlc_MediaDiscovererEnded,
92
93     libvlc_VlmMediaAdded=0x600,
94     libvlc_VlmMediaRemoved,
95     libvlc_VlmMediaChanged,
96     libvlc_VlmMediaInstanceStarted,
97     libvlc_VlmMediaInstanceStopped,
98     libvlc_VlmMediaInstanceStatusInit,
99     libvlc_VlmMediaInstanceStatusOpening,
100     libvlc_VlmMediaInstanceStatusPlaying,
101     libvlc_VlmMediaInstanceStatusPause,
102     libvlc_VlmMediaInstanceStatusEnd,
103     libvlc_VlmMediaInstanceStatusError
104 };
105
106 /**
107  * A LibVLC event
108  */
109 typedef struct libvlc_event_t
110 {
111     int   type; /**< Event type (see @ref libvlc_event_e) */
112     void *p_obj; /**< Object emitting the event */
113     union
114     {
115         /* media descriptor */
116         struct
117         {
118             libvlc_meta_t meta_type;
119         } media_meta_changed;
120         struct
121         {
122             libvlc_media_t * new_child;
123         } media_subitem_added;
124         struct
125         {
126             int64_t new_duration;
127         } media_duration_changed;
128         struct
129         {
130             int new_status;
131         } media_parsed_changed;
132         struct
133         {
134             libvlc_media_t * md;
135         } media_freed;
136         struct
137         {
138             libvlc_state_t new_state;
139         } media_state_changed;
140
141         /* media instance */
142         struct
143         {
144             float new_cache;
145         } media_player_buffering;
146         struct
147         {
148             float new_position;
149         } media_player_position_changed;
150         struct
151         {
152             libvlc_time_t new_time;
153         } media_player_time_changed;
154         struct
155         {
156             int new_title;
157         } media_player_title_changed;
158         struct
159         {
160             int new_seekable;
161         } media_player_seekable_changed;
162         struct
163         {
164             int new_pausable;
165         } media_player_pausable_changed;
166         struct
167         {
168             int new_count;
169         } media_player_vout;
170
171         /* media list */
172         struct
173         {
174             libvlc_media_t * item;
175             int index;
176         } media_list_item_added;
177         struct
178         {
179             libvlc_media_t * item;
180             int index;
181         } media_list_will_add_item;
182         struct
183         {
184             libvlc_media_t * item;
185             int index;
186         } media_list_item_deleted;
187         struct
188         {
189             libvlc_media_t * item;
190             int index;
191         } media_list_will_delete_item;
192
193         /* media list player */
194         struct
195         {
196             libvlc_media_t * item;
197         } media_list_player_next_item_set;
198
199         /* snapshot taken */
200         struct
201         {
202              char* psz_filename ;
203         } media_player_snapshot_taken ;
204
205         /* Length changed */
206         struct
207         {
208             libvlc_time_t   new_length;
209         } media_player_length_changed;
210
211         /* VLM media */
212         struct
213         {
214             const char * psz_media_name;
215             const char * psz_instance_name;
216         } vlm_media_event;
217
218         /* Extra MediaPlayer */
219         struct
220         {
221             libvlc_media_t * new_media;
222         } media_player_media_changed;
223     } u; /**< Type-dependent event description */
224 } libvlc_event_t;
225
226
227 /**@} */
228
229 # ifdef __cplusplus
230 }
231 # endif
232
233 #endif /* _LIBVLC_EVENTS_H */