VLC 4.0.0-dev
Loading...
Searching...
No Matches
event.h
Go to the documentation of this file.
1/*****************************************************************************
2 * event.h: Input event functions
3 *****************************************************************************
4 * Copyright (C) 2008 Laurent Aimar
5 *
6 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ fr>
7 *
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.
12 *
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.
17 *
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 *****************************************************************************/
22
23#ifndef LIBVLC_INPUT_EVENT_H
24#define LIBVLC_INPUT_EVENT_H 1
25
26#include <vlc_common.h>
27#include <vlc_input.h>
28#include "input_internal.h"
29
30static inline bool input_SendEvent(input_thread_t *p_input,
31 const struct vlc_input_event *event)
32{
33 input_thread_private_t *priv = input_priv(p_input);
34 if (priv->cbs != NULL && priv->cbs->on_event != NULL)
35 {
36 return priv->cbs->on_event(p_input, event, priv->cbs_data);
37 }
38 else
39 return false;
40
41}
42
43/*****************************************************************************
44 * Event for input.c
45 *****************************************************************************/
46static inline void input_SendEventDead(input_thread_t *p_input)
47{
48 input_SendEvent(p_input, &(struct vlc_input_event) {
49 .type = INPUT_EVENT_DEAD,
50 });
51}
52
53static inline void input_SendEventCapabilities(input_thread_t *p_input,
54 int i_capabilities)
55{
56 input_SendEvent(p_input, &(struct vlc_input_event) {
58 .capabilities = i_capabilities
59 });
60}
61
62static inline void input_SendEventTimes(input_thread_t *p_input,
63 double f_position, vlc_tick_t i_time,
64 vlc_tick_t i_normal_time,
65 vlc_tick_t i_length,
66 bool b_live)
67{
68 input_SendEvent(p_input, &(struct vlc_input_event) {
69 .type = INPUT_EVENT_TIMES,
70 .times = { f_position, i_time, i_normal_time, i_length, b_live }
71 });
72}
73
74static inline void input_SendEventOutputClock(input_thread_t *p_input,
75 vlc_es_id_t *id, bool master,
76 vlc_tick_t system_ts,
77 vlc_tick_t ts, double rate,
78 unsigned frame_rate,
79 unsigned frame_rate_base)
80{
81 input_SendEvent(p_input, &(struct vlc_input_event) {
83 .output_clock = { id, master, system_ts, ts, rate,
84 frame_rate, frame_rate_base }
85 });
86}
87
88static inline void input_SendEventStatistics(input_thread_t *p_input,
89 const struct input_stats_t *stats)
90{
91 input_SendEvent(p_input, &(struct vlc_input_event) {
93 .stats = stats,
94 });
95}
96
97static inline void input_SendEventRate(input_thread_t *p_input, float rate)
98{
99 input_SendEvent(p_input, &(struct vlc_input_event) {
100 .type = INPUT_EVENT_RATE,
101 .rate = rate,
102 });
103}
104
105static inline void input_SendEventRecord(input_thread_t *p_input,
106 bool b_recording)
107{
108 input_SendEvent(p_input, &(struct vlc_input_event) {
109 .type = INPUT_EVENT_RECORD,
110 .record = b_recording
111 });
112}
113
114static inline void input_SendEventTitle(input_thread_t *p_input,
115 const struct vlc_input_event_title *title)
116{
117 input_SendEvent(p_input, &(struct vlc_input_event) {
118 .type = INPUT_EVENT_TITLE,
119 .title = *title
120 });
121}
122
123static inline void input_SendEventSeekpoint(input_thread_t *p_input,
124 int i_title, int i_seekpoint)
125{
126 input_SendEvent(p_input, &(struct vlc_input_event) {
127 .type = INPUT_EVENT_CHAPTER,
128 .chapter = { i_title, i_seekpoint }
129 });
130}
131
132static inline void input_SendEventSignal(input_thread_t *p_input,
133 double f_quality, double f_strength)
134{
135 input_SendEvent(p_input, &(struct vlc_input_event) {
136 .type = INPUT_EVENT_SIGNAL,
137 .signal = { f_quality, f_strength }
138 });
139}
140
141static inline void input_SendEventState(input_thread_t *p_input, int i_state,
142 vlc_tick_t state_date)
143{
144 input_SendEvent(p_input, &(struct vlc_input_event) {
145 .type = INPUT_EVENT_STATE,
146 .state = { i_state, state_date, },
147 });
148}
149
150static inline void input_SendEventCache(input_thread_t *p_input, double f_level)
151{
152 input_SendEvent(p_input, &(struct vlc_input_event) {
153 .type = INPUT_EVENT_CACHE,
154 .cache = f_level
155 });
156}
157
158static inline void input_SendEventMeta(input_thread_t *p_input)
159{
160 input_SendEvent(p_input, &(struct vlc_input_event) {
161 .type = INPUT_EVENT_ITEM_META,
162 });
163}
164
165static inline void input_SendEventMetaInfo(input_thread_t *p_input)
166{
167 input_SendEvent(p_input, &(struct vlc_input_event) {
168 .type = INPUT_EVENT_ITEM_INFO,
169 });
170}
171
172static inline void input_SendEventMetaEpg(input_thread_t *p_input)
173{
174 input_SendEvent(p_input, &(struct vlc_input_event) {
175 .type = INPUT_EVENT_ITEM_EPG,
176 });
177}
178
179static inline void input_SendEventSubsFPS(input_thread_t *p_input, float fps)
180{
181 input_SendEvent(p_input, &(struct vlc_input_event) {
182 .type = INPUT_EVENT_SUBS_FPS,
183 .subs_fps = fps,
184 });
185}
186
187/*****************************************************************************
188 * Event for es_out.c
189 *****************************************************************************/
190static inline void input_SendEventProgramAdd(input_thread_t *p_input,
191 int i_program, const char *psz_text)
192{
193 input_SendEvent(p_input, &(struct vlc_input_event) {
194 .type = INPUT_EVENT_PROGRAM,
195 .program = {
196 .action = VLC_INPUT_PROGRAM_ADDED,
197 .id = i_program,
198 .title = psz_text
199 }
200 });
201}
203 int i_program, const char *psz_text)
204{
205 input_SendEvent(p_input, &(struct vlc_input_event) {
206 .type = INPUT_EVENT_PROGRAM,
207 .program = {
208 .action = VLC_INPUT_PROGRAM_UPDATED,
209 .id = i_program,
210 .title = psz_text
211 }
212 });
213}
214static inline void input_SendEventProgramDel(input_thread_t *p_input,
215 int i_program)
216{
217 input_SendEvent(p_input, &(struct vlc_input_event) {
218 .type = INPUT_EVENT_PROGRAM,
219 .program = {
220 .action = VLC_INPUT_PROGRAM_DELETED,
221 .id = i_program
222 }
223 });
224}
226 int i_program)
227{
228 input_SendEvent(p_input, &(struct vlc_input_event) {
229 .type = INPUT_EVENT_PROGRAM,
230 .program = {
231 .action = VLC_INPUT_PROGRAM_SELECTED,
232 .id = i_program
233 }
234 });
235}
237 int i_group, bool b_scrambled)
238{
239 input_SendEvent(p_input, &(struct vlc_input_event) {
240 .type = INPUT_EVENT_PROGRAM,
241 .program = {
242 .action = VLC_INPUT_PROGRAM_SCRAMBLED,
243 .id = i_group,
244 .scrambled = b_scrambled
245 }
246 });
247}
248
249static inline void input_SendEventEs(input_thread_t *p_input,
250 const struct vlc_input_event_es *es_event)
251{
252 input_SendEvent(p_input, &(struct vlc_input_event) {
253 .type = INPUT_EVENT_ES,
254 .es = *es_event,
255 });
256}
257
258static inline bool input_SendEventParsing(input_thread_t *p_input,
259 input_item_node_t *p_root)
260{
261 return input_SendEvent(p_input, &(struct vlc_input_event) {
262 .type = INPUT_EVENT_SUBITEMS,
263 .subitems = p_root,
264 });
265}
266
267static inline void input_SendEventVbiPage(input_thread_t *p_input, unsigned page)
268{
269 input_SendEvent(p_input, &(struct vlc_input_event) {
270 .type = INPUT_EVENT_VBI_PAGE,
271 .vbi_page = page,
272 });
273}
274
276 bool transparent)
277{
278 input_SendEvent(p_input, &(struct vlc_input_event) {
280 .vbi_transparent = transparent,
281 });
282}
283
284/*****************************************************************************
285 * Event for resource.c
286 *****************************************************************************/
287static inline void input_SendEventVout(input_thread_t *p_input,
288 const struct vlc_input_event_vout *event)
289{
290 input_SendEvent(p_input, &(struct vlc_input_event) {
291 .type = INPUT_EVENT_VOUT,
292 .vout = *event,
293 });
294}
295
296/*****************************************************************************
297 * Event for control.c/input.c
298 *****************************************************************************/
299static inline void input_SendEventBookmark(input_thread_t *p_input)
300{
301 input_SendEvent(p_input, &(struct vlc_input_event) {
303 });
304}
305
306#endif
static bool input_SendEventParsing(input_thread_t *p_input, input_item_node_t *p_root)
Definition event.h:258
static bool input_SendEvent(input_thread_t *p_input, const struct vlc_input_event *event)
Definition event.h:30
static void input_SendEventMetaEpg(input_thread_t *p_input)
Definition event.h:172
static void input_SendEventRecord(input_thread_t *p_input, bool b_recording)
Definition event.h:105
static void input_SendEventProgramSelect(input_thread_t *p_input, int i_program)
Definition event.h:225
static void input_SendEventDead(input_thread_t *p_input)
Definition event.h:46
static void input_SendEventRate(input_thread_t *p_input, float rate)
Definition event.h:97
static void input_SendEventMeta(input_thread_t *p_input)
Definition event.h:158
static void input_SendEventProgramAdd(input_thread_t *p_input, int i_program, const char *psz_text)
Definition event.h:190
static void input_SendEventTimes(input_thread_t *p_input, double f_position, vlc_tick_t i_time, vlc_tick_t i_normal_time, vlc_tick_t i_length, bool b_live)
Definition event.h:62
static void input_SendEventEs(input_thread_t *p_input, const struct vlc_input_event_es *es_event)
Definition event.h:249
static void input_SendEventVbiTransparency(input_thread_t *p_input, bool transparent)
Definition event.h:275
static void input_SendEventSeekpoint(input_thread_t *p_input, int i_title, int i_seekpoint)
Definition event.h:123
static void input_SendEventBookmark(input_thread_t *p_input)
Definition event.h:299
static void input_SendEventCapabilities(input_thread_t *p_input, int i_capabilities)
Definition event.h:53
static void input_SendEventTitle(input_thread_t *p_input, const struct vlc_input_event_title *title)
Definition event.h:114
static void input_SendEventSubsFPS(input_thread_t *p_input, float fps)
Definition event.h:179
static void input_SendEventProgramUpdated(input_thread_t *p_input, int i_program, const char *psz_text)
Definition event.h:202
static void input_SendEventState(input_thread_t *p_input, int i_state, vlc_tick_t state_date)
Definition event.h:141
static void input_SendEventVout(input_thread_t *p_input, const struct vlc_input_event_vout *event)
Definition event.h:287
static void input_SendEventProgramDel(input_thread_t *p_input, int i_program)
Definition event.h:214
static void input_SendEventStatistics(input_thread_t *p_input, const struct input_stats_t *stats)
Definition event.h:88
static void input_SendEventVbiPage(input_thread_t *p_input, unsigned page)
Definition event.h:267
static void input_SendEventOutputClock(input_thread_t *p_input, vlc_es_id_t *id, bool master, vlc_tick_t system_ts, vlc_tick_t ts, double rate, unsigned frame_rate, unsigned frame_rate_base)
Definition event.h:74
static void input_SendEventProgramScrambled(input_thread_t *p_input, int i_group, bool b_scrambled)
Definition event.h:236
static void input_SendEventCache(input_thread_t *p_input, double f_level)
Definition event.h:150
static void input_SendEventSignal(input_thread_t *p_input, double f_quality, double f_strength)
Definition event.h:132
static void input_SendEventMetaInfo(input_thread_t *p_input)
Definition event.h:165
@ INPUT_EVENT_SUBITEMS
Definition input_internal.h:135
@ INPUT_EVENT_CHAPTER
Definition input_internal.h:102
@ INPUT_EVENT_ITEM_EPG
Definition input_internal.h:118
@ INPUT_EVENT_OUTPUT_CLOCK
Definition input_internal.h:96
@ INPUT_EVENT_SIGNAL
Definition input_internal.h:123
@ INPUT_EVENT_ITEM_META
Definition input_internal.h:114
@ INPUT_EVENT_RATE
Definition input_internal.h:87
@ INPUT_EVENT_TITLE
Definition input_internal.h:100
@ INPUT_EVENT_DEAD
Definition input_internal.h:84
@ INPUT_EVENT_ES
Definition input_internal.h:108
@ INPUT_EVENT_RECORD
Definition input_internal.h:111
@ INPUT_EVENT_CAPABILITIES
Definition input_internal.h:90
@ INPUT_EVENT_STATISTICS
Definition input_internal.h:121
@ INPUT_EVENT_ITEM_INFO
Definition input_internal.h:116
@ INPUT_EVENT_BOOKMARK
Definition input_internal.h:126
@ INPUT_EVENT_PROGRAM
Definition input_internal.h:106
@ INPUT_EVENT_TIMES
Definition input_internal.h:93
@ INPUT_EVENT_STATE
Definition input_internal.h:82
@ INPUT_EVENT_VOUT
Definition input_internal.h:132
@ INPUT_EVENT_SUBS_FPS
Definition input_internal.h:143
@ INPUT_EVENT_VBI_PAGE
Definition input_internal.h:138
@ INPUT_EVENT_CACHE
Definition input_internal.h:129
@ INPUT_EVENT_VBI_TRANSPARENCY
Definition input_internal.h:140
static input_thread_private_t * input_priv(input_thread_t *input)
Definition input_internal.h:529
Definition vlc_input_item.h:204
Definition vlc_input_item.h:529
Private input fields.
Definition input_internal.h:459
const struct vlc_input_thread_callbacks * cbs
Definition input_internal.h:462
void * cbs_data
Definition input_internal.h:463
Main structure representing an input thread.
Definition input_internal.h:44
Opaque structure representing an ES (Elementary Stream) track.
Definition es_out.c:105
Definition input_internal.h:228
Definition input_internal.h:191
Definition input_internal.h:263
Definition input_internal.h:286
bool(* on_event)(input_thread_t *input, const struct vlc_input_event *event, void *userdata)
Definition input_internal.h:337
This file is a collection of common definitions and types.
Input thread interface.
int64_t vlc_tick_t
High precision date or time interval.
Definition vlc_tick.h:48