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 void 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 priv->cbs->on_event(p_input, event, priv->cbs_data);
36}
37
38/*****************************************************************************
39 * Event for input.c
40 *****************************************************************************/
41static inline void input_SendEventDead(input_thread_t *p_input)
42{
43 input_SendEvent(p_input, &(struct vlc_input_event) {
44 .type = INPUT_EVENT_DEAD,
45 });
46}
47
48static inline void input_SendEventCapabilities(input_thread_t *p_input,
49 int i_capabilities)
50{
51 input_SendEvent(p_input, &(struct vlc_input_event) {
53 .capabilities = i_capabilities
54 });
55}
56
57static 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)
61{
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 });
66}
67
68static 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)
74{
75 input_SendEvent(p_input, &(struct vlc_input_event) {
77 .output_clock = { id, master, system_ts, ts, rate,
78 frame_rate, frame_rate_base }
79 });
80}
81
82static inline void input_SendEventStatistics(input_thread_t *p_input,
83 const struct input_stats_t *stats)
84{
85 input_SendEvent(p_input, &(struct vlc_input_event) {
87 .stats = stats,
88 });
89}
90
91static inline void input_SendEventRate(input_thread_t *p_input, float rate)
92{
93 input_SendEvent(p_input, &(struct vlc_input_event) {
94 .type = INPUT_EVENT_RATE,
95 .rate = rate,
96 });
97}
98
99static inline void input_SendEventRecord(input_thread_t *p_input,
100 bool b_recording)
101{
102 input_SendEvent(p_input, &(struct vlc_input_event) {
103 .type = INPUT_EVENT_RECORD,
104 .record = b_recording
105 });
106}
107
108static inline void input_SendEventTitle(input_thread_t *p_input,
109 const struct vlc_input_event_title *title)
110{
111 input_SendEvent(p_input, &(struct vlc_input_event) {
112 .type = INPUT_EVENT_TITLE,
113 .title = *title
114 });
115}
116
117static inline void input_SendEventSeekpoint(input_thread_t *p_input,
118 int i_title, int i_seekpoint)
119{
120 input_SendEvent(p_input, &(struct vlc_input_event) {
121 .type = INPUT_EVENT_CHAPTER,
122 .chapter = { i_title, i_seekpoint }
123 });
124}
125
126static inline void input_SendEventSignal(input_thread_t *p_input,
127 double f_quality, double f_strength)
128{
129 input_SendEvent(p_input, &(struct vlc_input_event) {
130 .type = INPUT_EVENT_SIGNAL,
131 .signal = { f_quality, f_strength }
132 });
133}
134
135static inline void input_SendEventState(input_thread_t *p_input, int i_state,
136 vlc_tick_t state_date)
137{
138 input_SendEvent(p_input, &(struct vlc_input_event) {
139 .type = INPUT_EVENT_STATE,
140 .state = { i_state, state_date, },
141 });
142}
143
144static inline void input_SendEventCache(input_thread_t *p_input, double f_level)
145{
146 input_SendEvent(p_input, &(struct vlc_input_event) {
147 .type = INPUT_EVENT_CACHE,
148 .cache = f_level
149 });
150}
151
152static inline void input_SendEventMeta(input_thread_t *p_input)
153{
154 input_SendEvent(p_input, &(struct vlc_input_event) {
155 .type = INPUT_EVENT_ITEM_META,
156 });
157}
158
159static inline void input_SendEventMetaInfo(input_thread_t *p_input)
160{
161 input_SendEvent(p_input, &(struct vlc_input_event) {
162 .type = INPUT_EVENT_ITEM_INFO,
163 });
164}
165
166static inline void input_SendEventMetaEpg(input_thread_t *p_input)
167{
168 input_SendEvent(p_input, &(struct vlc_input_event) {
169 .type = INPUT_EVENT_ITEM_EPG,
170 });
171}
172
173static inline void input_SendEventSubsFPS(input_thread_t *p_input, float fps)
174{
175 input_SendEvent(p_input, &(struct vlc_input_event) {
176 .type = INPUT_EVENT_SUBS_FPS,
177 .subs_fps = fps,
178 });
179}
180
181/*****************************************************************************
182 * Event for es_out.c
183 *****************************************************************************/
184static inline void input_SendEventProgramAdd(input_thread_t *p_input,
185 int i_program, const char *psz_text)
186{
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
193 }
194 });
195}
197 int i_program, const char *psz_text)
198{
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
205 }
206 });
207}
208static inline void input_SendEventProgramDel(input_thread_t *p_input,
209 int i_program)
210{
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
216 }
217 });
218}
220 int i_program)
221{
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
227 }
228 });
229}
231 int i_group, bool b_scrambled)
232{
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
239 }
240 });
241}
242
243static inline void input_SendEventEs(input_thread_t *p_input,
244 const struct vlc_input_event_es *es_event)
245{
246 input_SendEvent(p_input, &(struct vlc_input_event) {
247 .type = INPUT_EVENT_ES,
248 .es = *es_event,
249 });
250}
251
252static inline void input_SendEventParsing(input_thread_t *p_input,
253 input_item_node_t *p_root)
254{
255 input_SendEvent(p_input, &(struct vlc_input_event) {
256 .type = INPUT_EVENT_SUBITEMS,
257 .subitems = p_root,
258 });
259}
260
261static inline void input_SendEventVbiPage(input_thread_t *p_input, unsigned page)
262{
263 input_SendEvent(p_input, &(struct vlc_input_event) {
264 .type = INPUT_EVENT_VBI_PAGE,
265 .vbi_page = page,
266 });
267}
268
270 bool transparent)
271{
272 input_SendEvent(p_input, &(struct vlc_input_event) {
274 .vbi_transparent = transparent,
275 });
276}
277
278/*****************************************************************************
279 * Event for resource.c
280 *****************************************************************************/
281static inline void input_SendEventVout(input_thread_t *p_input,
282 const struct vlc_input_event_vout *event)
283{
284 input_SendEvent(p_input, &(struct vlc_input_event) {
285 .type = INPUT_EVENT_VOUT,
286 .vout = *event,
287 });
288}
289
290/*****************************************************************************
291 * Event for control.c/input.c
292 *****************************************************************************/
293static inline void input_SendEventBookmark(input_thread_t *p_input)
294{
295 input_SendEvent(p_input, &(struct vlc_input_event) {
297 });
298}
299
300#endif
static void input_SendEventMetaEpg(input_thread_t *p_input)
Definition event.h:166
static void input_SendEventRecord(input_thread_t *p_input, bool b_recording)
Definition event.h:99
static void input_SendEventProgramSelect(input_thread_t *p_input, int i_program)
Definition event.h:219
static void input_SendEventDead(input_thread_t *p_input)
Definition event.h:41
static void input_SendEventRate(input_thread_t *p_input, float rate)
Definition event.h:91
static void input_SendEventMeta(input_thread_t *p_input)
Definition event.h:152
static void input_SendEventProgramAdd(input_thread_t *p_input, int i_program, const char *psz_text)
Definition event.h:184
static void input_SendEvent(input_thread_t *p_input, const struct vlc_input_event *event)
Definition event.h:30
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)
Definition event.h:57
static void input_SendEventEs(input_thread_t *p_input, const struct vlc_input_event_es *es_event)
Definition event.h:243
static void input_SendEventVbiTransparency(input_thread_t *p_input, bool transparent)
Definition event.h:269
static void input_SendEventSeekpoint(input_thread_t *p_input, int i_title, int i_seekpoint)
Definition event.h:117
static void input_SendEventBookmark(input_thread_t *p_input)
Definition event.h:293
static void input_SendEventCapabilities(input_thread_t *p_input, int i_capabilities)
Definition event.h:48
static void input_SendEventTitle(input_thread_t *p_input, const struct vlc_input_event_title *title)
Definition event.h:108
static void input_SendEventSubsFPS(input_thread_t *p_input, float fps)
Definition event.h:173
static void input_SendEventProgramUpdated(input_thread_t *p_input, int i_program, const char *psz_text)
Definition event.h:196
static void input_SendEventState(input_thread_t *p_input, int i_state, vlc_tick_t state_date)
Definition event.h:135
static void input_SendEventVout(input_thread_t *p_input, const struct vlc_input_event_vout *event)
Definition event.h:281
static void input_SendEventProgramDel(input_thread_t *p_input, int i_program)
Definition event.h:208
static void input_SendEventStatistics(input_thread_t *p_input, const struct input_stats_t *stats)
Definition event.h:82
static void input_SendEventVbiPage(input_thread_t *p_input, unsigned page)
Definition event.h:261
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:68
static void input_SendEventParsing(input_thread_t *p_input, input_item_node_t *p_root)
Definition event.h:252
static void input_SendEventProgramScrambled(input_thread_t *p_input, int i_group, bool b_scrambled)
Definition event.h:230
static void input_SendEventCache(input_thread_t *p_input, double f_level)
Definition event.h:144
static void input_SendEventSignal(input_thread_t *p_input, double f_quality, double f_strength)
Definition event.h:126
static void input_SendEventMetaInfo(input_thread_t *p_input)
Definition event.h:159
@ 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:530
Definition vlc_input_item.h:204
Definition vlc_input_item.h:529
Private input fields.
Definition input_internal.h:460
const struct vlc_input_thread_callbacks * cbs
Definition input_internal.h:463
void * cbs_data
Definition input_internal.h:464
Main structure representing an input thread.
Definition input_internal.h:44
Opaque structure representing an ES (Elementary Stream) track.
Definition es_out.c:104
Definition input_internal.h:227
Definition input_internal.h:190
Definition input_internal.h:262
Definition input_internal.h:285
void(* on_event)(input_thread_t *input, const struct vlc_input_event *event, void *userdata)
Definition input_internal.h:338
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