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