input: rename vlc_input_event_times variables
[vlc.git] / src / input / event.h
blobdd9aec4a871a1ed3bac99a6966ef3312510c193f
1 /*****************************************************************************
2 * event.h: Input event functions
3 *****************************************************************************
4 * Copyright (C) 2008 Laurent Aimar
6 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ fr>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 #ifndef LIBVLC_INPUT_EVENT_H
24 #define LIBVLC_INPUT_EVENT_H 1
26 #include <vlc_common.h>
27 #include <vlc_input.h>
28 #include "input_internal.h"
30 static inline void input_SendEvent(input_thread_t *p_input,
31 const struct vlc_input_event *event)
33 input_thread_private_t *priv = input_priv(p_input);
34 if(priv->events_cb)
35 priv->events_cb(p_input, event, priv->events_data);
38 /*****************************************************************************
39 * Event for input.c
40 *****************************************************************************/
41 static inline void input_SendEventDead(input_thread_t *p_input)
43 input_SendEvent(p_input, &(struct vlc_input_event) {
44 .type = INPUT_EVENT_DEAD,
45 });
48 static inline void input_SendEventCapabilities(input_thread_t *p_input,
49 int i_capabilities)
51 input_SendEvent(p_input, &(struct vlc_input_event) {
52 .type = INPUT_EVENT_CAPABILITIES,
53 .capabilities = i_capabilities
54 });
57 static inline void input_SendEventTimes(input_thread_t *p_input,
58 double f_position, vlc_tick_t i_time,
59 vlc_tick_t i_normal_time,
60 vlc_tick_t i_length)
62 input_SendEvent(p_input, &(struct vlc_input_event) {
63 .type = INPUT_EVENT_TIMES,
64 .times = { f_position, i_time, i_normal_time, i_length }
65 });
68 static inline void input_SendEventOutputClock(input_thread_t *p_input,
69 vlc_es_id_t *id, bool master,
70 vlc_tick_t system_ts,
71 vlc_tick_t ts, double rate,
72 unsigned frame_rate,
73 unsigned frame_rate_base)
75 input_SendEvent(p_input, &(struct vlc_input_event) {
76 .type = INPUT_EVENT_OUTPUT_CLOCK,
77 .output_clock = { id, master, system_ts, ts, rate,
78 frame_rate, frame_rate_base }
79 });
82 static inline void input_SendEventStatistics(input_thread_t *p_input,
83 const struct input_stats_t *stats)
85 input_SendEvent(p_input, &(struct vlc_input_event) {
86 .type = INPUT_EVENT_STATISTICS,
87 .stats = stats,
88 });
91 static inline void input_SendEventRate(input_thread_t *p_input, float rate)
93 input_SendEvent(p_input, &(struct vlc_input_event) {
94 .type = INPUT_EVENT_RATE,
95 .rate = rate,
96 });
99 static inline void input_SendEventRecord(input_thread_t *p_input,
100 bool b_recording)
102 input_SendEvent(p_input, &(struct vlc_input_event) {
103 .type = INPUT_EVENT_RECORD,
104 .record = b_recording
108 static inline void input_SendEventTitle(input_thread_t *p_input,
109 const struct vlc_input_event_title *title)
111 input_SendEvent(p_input, &(struct vlc_input_event) {
112 .type = INPUT_EVENT_TITLE,
113 .title = *title
117 static inline void input_SendEventSeekpoint(input_thread_t *p_input,
118 int i_title, int i_seekpoint)
120 input_SendEvent(p_input, &(struct vlc_input_event) {
121 .type = INPUT_EVENT_CHAPTER,
122 .chapter = { i_title, i_seekpoint }
126 static inline void input_SendEventSignal(input_thread_t *p_input,
127 double f_quality, double f_strength)
129 input_SendEvent(p_input, &(struct vlc_input_event) {
130 .type = INPUT_EVENT_SIGNAL,
131 .signal = { f_quality, f_strength }
135 static inline void input_SendEventState(input_thread_t *p_input, int i_state,
136 vlc_tick_t state_date)
138 input_SendEvent(p_input, &(struct vlc_input_event) {
139 .type = INPUT_EVENT_STATE,
140 .state = { i_state, state_date, },
144 static inline void input_SendEventCache(input_thread_t *p_input, double f_level)
146 input_SendEvent(p_input, &(struct vlc_input_event) {
147 .type = INPUT_EVENT_CACHE,
148 .cache = f_level
152 static inline void input_SendEventMeta(input_thread_t *p_input)
154 input_SendEvent(p_input, &(struct vlc_input_event) {
155 .type = INPUT_EVENT_ITEM_META,
159 static inline void input_SendEventMetaInfo(input_thread_t *p_input)
161 input_SendEvent(p_input, &(struct vlc_input_event) {
162 .type = INPUT_EVENT_ITEM_INFO,
166 static inline void input_SendEventMetaEpg(input_thread_t *p_input)
168 input_SendEvent(p_input, &(struct vlc_input_event) {
169 .type = INPUT_EVENT_ITEM_EPG,
173 static inline void input_SendEventSubsFPS(input_thread_t *p_input, float fps)
175 input_SendEvent(p_input, &(struct vlc_input_event) {
176 .type = INPUT_EVENT_SUBS_FPS,
177 .subs_fps = fps,
181 /*****************************************************************************
182 * Event for es_out.c
183 *****************************************************************************/
184 static inline void input_SendEventProgramAdd(input_thread_t *p_input,
185 int i_program, const char *psz_text)
187 input_SendEvent(p_input, &(struct vlc_input_event) {
188 .type = INPUT_EVENT_PROGRAM,
189 .program = {
190 .action = VLC_INPUT_PROGRAM_ADDED,
191 .id = i_program,
192 .title = psz_text
196 static inline void input_SendEventProgramUpdated(input_thread_t *p_input,
197 int i_program, const char *psz_text)
199 input_SendEvent(p_input, &(struct vlc_input_event) {
200 .type = INPUT_EVENT_PROGRAM,
201 .program = {
202 .action = VLC_INPUT_PROGRAM_UPDATED,
203 .id = i_program,
204 .title = psz_text
208 static inline void input_SendEventProgramDel(input_thread_t *p_input,
209 int i_program)
211 input_SendEvent(p_input, &(struct vlc_input_event) {
212 .type = INPUT_EVENT_PROGRAM,
213 .program = {
214 .action = VLC_INPUT_PROGRAM_DELETED,
215 .id = i_program
219 static inline void input_SendEventProgramSelect(input_thread_t *p_input,
220 int i_program)
222 input_SendEvent(p_input, &(struct vlc_input_event) {
223 .type = INPUT_EVENT_PROGRAM,
224 .program = {
225 .action = VLC_INPUT_PROGRAM_SELECTED,
226 .id = i_program
230 static inline void input_SendEventProgramScrambled(input_thread_t *p_input,
231 int i_group, bool b_scrambled)
233 input_SendEvent(p_input, &(struct vlc_input_event) {
234 .type = INPUT_EVENT_PROGRAM,
235 .program = {
236 .action = VLC_INPUT_PROGRAM_SCRAMBLED,
237 .id = i_group,
238 .scrambled = b_scrambled
243 static inline void input_SendEventEs(input_thread_t *p_input,
244 const struct vlc_input_event_es *es_event)
246 input_SendEvent(p_input, &(struct vlc_input_event) {
247 .type = INPUT_EVENT_ES,
248 .es = *es_event,
252 static inline void input_SendEventParsing(input_thread_t *p_input,
253 input_item_node_t *p_root)
255 input_SendEvent(p_input, &(struct vlc_input_event) {
256 .type = INPUT_EVENT_SUBITEMS,
257 .subitems = p_root,
261 static inline void input_SendEventVbiPage(input_thread_t *p_input, unsigned page)
263 input_SendEvent(p_input, &(struct vlc_input_event) {
264 .type = INPUT_EVENT_VBI_PAGE,
265 .vbi_page = page,
269 static inline void input_SendEventVbiTransparency(input_thread_t *p_input,
270 bool transparent)
272 input_SendEvent(p_input, &(struct vlc_input_event) {
273 .type = INPUT_EVENT_VBI_TRANSPARENCY,
274 .vbi_transparent = transparent,
278 /*****************************************************************************
279 * Event for resource.c
280 *****************************************************************************/
281 static inline void input_SendEventVout(input_thread_t *p_input,
282 const struct vlc_input_event_vout *event)
284 input_SendEvent(p_input, &(struct vlc_input_event) {
285 .type = INPUT_EVENT_VOUT,
286 .vout = *event,
290 /*****************************************************************************
291 * Event for control.c/input.c
292 *****************************************************************************/
293 static inline void input_SendEventBookmark(input_thread_t *p_input)
295 input_SendEvent(p_input, &(struct vlc_input_event) {
296 .type = INPUT_EVENT_BOOKMARK
300 #endif