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