VLC  4.0.0-dev
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 
30 static 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->events_cb)
35  priv->events_cb(p_input, event, priv->events_data);
36 }
37 
38 /*****************************************************************************
39  * Event for input.c
40  *****************************************************************************/
41 static 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 
48 static 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 
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)
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 
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)
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 
82 static 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) {
86  .type = INPUT_EVENT_STATISTICS,
87  .stats = stats,
88  });
89 }
90 
91 static 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 
99 static 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 
108 static 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 
117 static 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 
126 static 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 
135 static 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 
144 static 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 
152 static 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 
159 static 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 
166 static 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 
173 static 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  *****************************************************************************/
184 static 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 }
196 static inline void input_SendEventProgramUpdated(input_thread_t *p_input,
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 }
208 static 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 }
219 static inline void input_SendEventProgramSelect(input_thread_t *p_input,
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 
243 static 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 
252 static 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 
261 static 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 
269 static inline void input_SendEventVbiTransparency(input_thread_t *p_input,
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  *****************************************************************************/
281 static 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  *****************************************************************************/
293 static inline void input_SendEventBookmark(input_thread_t *p_input)
294 {
295  input_SendEvent(p_input, &(struct vlc_input_event) {
296  .type = INPUT_EVENT_BOOKMARK
297  });
298 }
299 
300 #endif
static void input_SendEventSeekpoint(input_thread_t *p_input, int i_title, int i_seekpoint)
Definition: event.h:117
Definition: input_internal.h:128
Definition: input_internal.h:117
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
input_thread_events_cb events_cb
Definition: input_internal.h:469
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_SendEventMetaEpg(input_thread_t *p_input)
Definition: event.h:166
Definition: input_internal.h:142
Definition: vlc_input_item.h:191
Definition: input_internal.h:218
Definition: input_internal.h:120
static void input_SendEventCache(input_thread_t *p_input, double f_level)
Definition: event.h:144
This file is a collection of common definitions and types.
Definition: input_internal.h:86
static void input_SendEventDead(input_thread_t *p_input)
Definition: event.h:41
Definition: input_internal.h:107
Private input fields.
Definition: input_internal.h:465
static void input_SendEventParsing(input_thread_t *p_input, input_item_node_t *p_root)
Definition: event.h:252
Definition: input_internal.h:89
Definition: input_internal.h:139
Definition: input_internal.h:125
Definition: input_internal.h:137
Definition: input_internal.h:180
int64_t vlc_tick_t
High precision date or time interval.
Definition: vlc_tick.h:45
Definition: input_internal.h:101
static void input_SendEventStatistics(input_thread_t *p_input, const struct input_stats_t *stats)
Definition: event.h:82
Definition: input_internal.h:92
Definition: input_internal.h:113
Definition: input_internal.h:83
static input_thread_private_t * input_priv(input_thread_t *input)
Definition: input_internal.h:540
static void input_SendEventRecord(input_thread_t *p_input, bool b_recording)
Definition: event.h:99
Definition: input_internal.h:110
void * events_data
Definition: input_internal.h:470
Opaque structure representing an ES (Elementary Stream) track.
Definition: es_out.c:92
static void input_SendEventMeta(input_thread_t *p_input)
Definition: event.h:152
static void input_SendEventProgramDel(input_thread_t *p_input, int i_program)
Definition: event.h:208
static void input_SendEventProgramSelect(input_thread_t *p_input, int i_program)
Definition: event.h:219
static void input_SendEvent(input_thread_t *p_input, const struct vlc_input_event *event)
Definition: event.h:30
Definition: input_internal.h:122
Main structure representing an input thread.
Definition: input_internal.h:48
Definition: input_internal.h:95
Definition: input_internal.h:81
static void input_SendEventCapabilities(input_thread_t *p_input, int i_capabilities)
Definition: event.h:48
static void input_SendEventSignal(input_thread_t *p_input, double f_quality, double f_strength)
Definition: event.h:126
static void input_SendEventRate(input_thread_t *p_input, float rate)
Definition: event.h:91
Definition: input_internal.h:261
static void input_SendEventBookmark(input_thread_t *p_input)
Definition: event.h:293
static void input_SendEventTitle(input_thread_t *p_input, const struct vlc_input_event_title *title)
Definition: event.h:108
Definition: vlc_input_item.h:504
Definition: input_internal.h:99
Definition: input_internal.h:105
Input thread interface.
Definition: input_internal.h:250
static void input_SendEventProgramScrambled(input_thread_t *p_input, int i_group, bool b_scrambled)
Definition: event.h:230
Definition: input_internal.h:134
Definition: input_internal.h:115
static void input_SendEventVbiTransparency(input_thread_t *p_input, bool transparent)
Definition: event.h:269
static void input_SendEventVout(input_thread_t *p_input, const struct vlc_input_event_vout *event)
Definition: event.h:281
static void input_SendEventMetaInfo(input_thread_t *p_input)
Definition: event.h:159
static void input_SendEventVbiPage(input_thread_t *p_input, unsigned page)
Definition: event.h:261
static void input_SendEventProgramAdd(input_thread_t *p_input, int i_program, const char *psz_text)
Definition: event.h:184
static void input_SendEventState(input_thread_t *p_input, int i_state, vlc_tick_t state_date)
Definition: event.h:135
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
Definition: input_internal.h:131