VLC 4.0.0-dev
vlc_es_out.h
Go to the documentation of this file.
1/*****************************************************************************
2 * vlc_es_out.h: es_out (demuxer output) descriptor, queries and methods
3 *****************************************************************************
4 * Copyright (C) 1999-2004 VLC authors and VideoLAN
5 *
6 * Authors: Laurent Aimar <fenrir@via.ecp.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 VLC_ES_OUT_H
24#define VLC_ES_OUT_H 1
25
26#include <assert.h>
27
28#include <vlc_es.h>
29
30#include <vlc_tick.h>
31
32/**
33 * \defgroup es_out ES output
34 * \ingroup input
35 * Elementary streams output
36 * @{
37 * \file
38 * Elementary streams output interface
39 */
40
43 /* set or change the selected ES in its category (audio/video/spu) */
44 ES_OUT_SET_ES, /* arg1= es_out_id_t* */
45 ES_OUT_UNSET_ES, /* arg1= es_out_id_t* res=can fail */
46 ES_OUT_RESTART_ES, /* arg1= es_out_id_t* */
48 /* set 'default' tag on ES (copied across from container) */
49 ES_OUT_SET_ES_DEFAULT, /* arg1= es_out_id_t* */
51 /* force (un)selection of the ES (bypass current mode)
52 XXX: this will not change the state of any other ES ! (see SET_ES) */
53 ES_OUT_SET_ES_STATE,/* arg1= es_out_id_t* arg2=bool */
54 ES_OUT_GET_ES_STATE,/* arg1= es_out_id_t* arg2=bool* */
56 /* sets es selection policy when in auto mode */
57 ES_OUT_SET_ES_CAT_POLICY, /* arg1=es_format_category_e arg2=es_out_policy_e */
59 /* */
60 ES_OUT_SET_GROUP, /* arg1= int */
62 /* PCR handling, DTS/PTS will be automatically computed using those PCR
63 * XXX: SET_PCR(_GROUP) are in charge of the pace control. They will wait
64 * to slow down the demuxer so that it reads at the right speed.
65 * XXX: if you want PREROLL just call ES_OUT_SET_NEXT_DISPLAY_TIME and send
66 * as you would normally do.
67 */
68 ES_OUT_SET_PCR, /* arg1=vlc_tick_t i_pcr(microsecond!) (using default group 0)*/
69 ES_OUT_SET_GROUP_PCR, /* arg1= int i_group, arg2=vlc_tick_t i_pcr(microsecond!)*/
70 ES_OUT_RESET_PCR, /* no arg */
72 /* This will update the fmt, drain and restart the decoder (if any).
73 * The new fmt must have the same i_cat and i_id. */
74 ES_OUT_SET_ES_FMT, /* arg1= es_out_id_t* arg2=es_format_t* res=can fail */
76 /* Allow preroll of data (data with dts/pts < i_pts for all ES will be decoded but not displayed */
77 ES_OUT_SET_NEXT_DISPLAY_TIME, /* arg1=int64_t i_pts(microsecond) */
78 /* Set meta data for group (dynamic) (The vlc_meta_t is not modified nor released) */
79 ES_OUT_SET_GROUP_META, /* arg1=int i_group arg2=const vlc_meta_t */
80 /* Set epg for group (dynamic) (The vlc_epg_t is not modified nor released) */
81 ES_OUT_SET_GROUP_EPG, /* arg1=int i_group arg2=const vlc_epg_t * */
82 ES_OUT_SET_GROUP_EPG_EVENT, /* arg1=int i_group arg2=const vlc_epg_event_t * */
83 ES_OUT_SET_EPG_TIME, /* arg1=int int64_t */
85 /* */
86 ES_OUT_DEL_GROUP, /* arg1=int i_group */
88 /* Set scrambled state for one es */
89 ES_OUT_SET_ES_SCRAMBLED_STATE, /* arg1=int i_group arg2=es_out_id_t* */
91 /* Stop any buffering being done, and ask if es_out has no more data to
92 * play.
93 * It will not block and so MUST be used carrefully. The only good reason
94 * is for interactive playback (like for DVD menu).
95 * XXX You SHALL call ES_OUT_RESET_PCR before any other es_out_Control/Send calls. */
96 ES_OUT_GET_EMPTY, /* arg1=bool* res=cannot fail */
98 /* Set global meta data (The vlc_meta_t is not modified nor released) */
99 ES_OUT_SET_META, /* arg1=const vlc_meta_t * */
101 /* PCR system clock manipulation for external clock synchronization */
102 ES_OUT_GET_PCR_SYSTEM, /* arg1=vlc_tick_t *, arg2=vlc_tick_t * res=can fail */
103 ES_OUT_MODIFY_PCR_SYSTEM, /* arg1=int is_absolute, arg2=vlc_tick_t, res=can fail */
105 ES_OUT_POST_SUBNODE, /* arg1=input_item_node_t *, res=can fail */
107 ES_OUT_VOUT_SET_MOUSE_EVENT, /* arg1= es_out_id_t* (video es),
108 arg2=vlc_mouse_event, arg3=void *(user_data),
109 res=can fail */
110
111 ES_OUT_VOUT_ADD_OVERLAY, /* arg1= es_out_id_t* (video es),
112 * arg2= subpicture_t *,
113 * arg3= size_t * (channel id), res= can fail */
114 ES_OUT_VOUT_DEL_OVERLAY, /* arg1= es_out_id_t* (video es),
115 * arg2= size_t (channel id), res= can fail */
116
117 ES_OUT_SPU_SET_HIGHLIGHT, /* arg1= es_out_id_t* (spu es),
118 arg2= const vlc_spu_highlight_t *, res=can fail */
119
120 /* First value usable for private control */
121 ES_OUT_PRIVATE_START = 0x10000,
123
126 ES_OUT_ES_POLICY_EXCLUSIVE = 0,/* Enforces single ES selection only */
127 ES_OUT_ES_POLICY_SIMULTANEOUS, /* Allows multiple ES per cat */
128 /* Exclusive by default, and simultaneous if specifically requested more
129 * than one track at once */
132
133struct es_out_callbacks
135 es_out_id_t *(*add)(es_out_t *, input_source_t *in, const es_format_t *);
137 void (*del)(es_out_t *, es_out_id_t *);
138 int (*control)(es_out_t *, input_source_t *in, int query, va_list);
139 void (*destroy)(es_out_t *);
140 /**
141 * Private control callback, must be NULL for es_out created from modules.
142 */
143 int (*priv_control)(es_out_t *, int query, va_list);
145
146struct es_out_t
148 const struct es_out_callbacks *cbs;
150
152static inline es_out_id_t * es_out_Add( es_out_t *out, const es_format_t *fmt )
154 return out->cbs->add( out, NULL, fmt );
155}
156
157static inline void es_out_Del( es_out_t *out, es_out_id_t *id )
159 out->cbs->del( out, id );
160}
161
162static inline int es_out_Send( es_out_t *out, es_out_id_t *id,
163 block_t *p_block )
164{
165 return out->cbs->send( out, id, p_block );
166}
167
168static inline int es_out_vaControl( es_out_t *out, int i_query, va_list args )
170 return out->cbs->control( out, NULL, i_query, args );
171}
172
173static inline int es_out_Control( es_out_t *out, int i_query, ... )
175 va_list args;
176 int i_result;
177
178 va_start( args, i_query );
179 i_result = es_out_vaControl( out, i_query, args );
180 va_end( args );
181 return i_result;
182}
183
184static inline void es_out_Delete( es_out_t *p_out )
186 p_out->cbs->destroy( p_out );
187}
188
189/* PCR handling, DTS/PTS will be automatically computed using those PCR
190 * XXX: SET_PCR(_GROUP) are in charge of the pace control. They will wait
191 * to slow down the demuxer so that it reads at the right speed.
192 * XXX: if you want PREROLL just call ES_OUT_SET_NEXT_DISPLAY_TIME and send
193 * as you would normally do.
194 */
195static inline int es_out_SetPCR( es_out_t *out, vlc_tick_t pcr )
197 return es_out_Control( out, ES_OUT_SET_PCR, pcr );
198}
199
200/* Reset the PCR */
201VLC_USED static inline int es_out_ResetPCR( es_out_t *out )
203 return es_out_Control( out, ES_OUT_RESET_PCR );
204}
205
206/* Set or change the selected ES in its category (audio/video/spu) */
207VLC_USED static inline int es_out_SetES( es_out_t *out, es_out_id_t *id )
209 return es_out_Control( out, ES_OUT_SET_ES, id );
210}
211
212/* Unset selected ES */
213VLC_USED static inline int es_out_UnsetES( es_out_t *out, es_out_id_t *id )
215 return es_out_Control( out, ES_OUT_UNSET_ES, id );
216}
217
218/* Restart the selected ES */
219VLC_USED static inline int es_out_RestartES( es_out_t *out, es_out_id_t *id )
221 return es_out_Control( out, ES_OUT_RESTART_ES, id );
222}
223
224/* Set or change the default ES */
225VLC_USED static inline int es_out_SetESDefault( es_out_t *out, es_out_id_t *id )
227 return es_out_Control( out, ES_OUT_SET_ES_DEFAULT, id );
228}
229
230/* Force (un)selection of the ES (bypass current mode) */
231VLC_USED static inline int es_out_SetESState( es_out_t *out, es_out_id_t *id, bool state )
233 return es_out_Control( out, ES_OUT_SET_ES_STATE, id, state );
234}
235
236/* This will update the fmt, drain and restart the decoder (if any).
237 * The new fmt must have the same i_cat and i_id. */
238VLC_USED static inline int es_out_SetESFmt( es_out_t *out, es_format_t *fmt )
240 return es_out_Control( out, ES_OUT_SET_ES_FMT, fmt );
241}
242
243/* Sets ES selection policy when in auto mode */
244VLC_USED static inline int es_out_SetESCatPolicy( es_out_t *out, enum es_format_category_e cat, enum es_out_policy_e policy )
246 return es_out_Control( out, ES_OUT_SET_ES_CAT_POLICY, cat, policy );
247}
248
249/* Get the selected state of the ES */
250VLC_USED static inline bool es_out_GetESState( es_out_t *out, es_out_id_t *id)
252 bool state = false;
253
255 return state;
256}
257
258/* Allow preroll of data (data with dts/pts < i_pts for all ES will be decoded but not displayed) */
259VLC_USED static inline int es_out_SetNextDisplayTime( es_out_t *out, vlc_tick_t ndt )
262}
263
264/* Set global meta data (The vlc_meta_t is not modified nor released) */
265VLC_USED static inline int es_out_SetMeta( es_out_t *out, const vlc_meta_t *meta )
267 return es_out_Control( out, ES_OUT_SET_META, meta );
268}
269#define es_out_ControlSetMeta es_out_SetMeta
271/* Get the PCR system clock manipulation for external clock synchronization */
272VLC_USED static inline int es_out_GetPcrSystem( es_out_t *out, vlc_tick_t *pi_system, vlc_tick_t *pi_delay )
274 return es_out_Control( out, ES_OUT_GET_PCR_SYSTEM, pi_system, pi_delay );
275}
276#define es_out_ControlGetPcrSystem es_out_GetPcrSystem
278/* Modify the PCR system clock manipulation for external clock synchronization */
279VLC_USED static inline int es_out_ModifyPcrSystem( es_out_t *out, bool b_absolute, vlc_tick_t i_system )
281 return es_out_Control( out, ES_OUT_MODIFY_PCR_SYSTEM, b_absolute, i_system );
282}
283#define es_out_ControlModifyPcrSystem es_out_ModifyPcrSystem
285/**
286 * @}
287 */
288
289#endif
#define VLC_USED
Definition: fourcc_gen.c:32
static int es_out_SetMeta(es_out_t *out, const vlc_meta_t *meta)
Definition: vlc_es_out.h:266
static int es_out_SetESCatPolicy(es_out_t *out, enum es_format_category_e cat, enum es_out_policy_e policy)
Definition: vlc_es_out.h:245
static int es_out_SetESDefault(es_out_t *out, es_out_id_t *id)
Definition: vlc_es_out.h:226
static es_out_id_t * es_out_Add(es_out_t *out, const es_format_t *fmt)
Definition: vlc_es_out.h:153
static int es_out_RestartES(es_out_t *out, es_out_id_t *id)
Definition: vlc_es_out.h:220
static int es_out_GetPcrSystem(es_out_t *out, vlc_tick_t *pi_system, vlc_tick_t *pi_delay)
Definition: vlc_es_out.h:273
static int es_out_Send(es_out_t *out, es_out_id_t *id, block_t *p_block)
Definition: vlc_es_out.h:163
es_out_policy_e
Definition: vlc_es_out.h:126
static int es_out_SetPCR(es_out_t *out, vlc_tick_t pcr)
Definition: vlc_es_out.h:196
static int es_out_ResetPCR(es_out_t *out)
Definition: vlc_es_out.h:202
static int es_out_ModifyPcrSystem(es_out_t *out, bool b_absolute, vlc_tick_t i_system)
Definition: vlc_es_out.h:280
static int es_out_SetESState(es_out_t *out, es_out_id_t *id, bool state)
Definition: vlc_es_out.h:232
static int es_out_SetNextDisplayTime(es_out_t *out, vlc_tick_t ndt)
Definition: vlc_es_out.h:260
static int es_out_SetESFmt(es_out_t *out, es_format_t *fmt)
Definition: vlc_es_out.h:239
static int es_out_Control(es_out_t *out, int i_query,...)
Definition: vlc_es_out.h:174
static bool es_out_GetESState(es_out_t *out, es_out_id_t *id)
Definition: vlc_es_out.h:251
static void es_out_Del(es_out_t *out, es_out_id_t *id)
Definition: vlc_es_out.h:158
es_out_query_e
Definition: vlc_es_out.h:43
static int es_out_UnsetES(es_out_t *out, es_out_id_t *id)
Definition: vlc_es_out.h:214
static void es_out_Delete(es_out_t *p_out)
Definition: vlc_es_out.h:185
static int es_out_SetES(es_out_t *out, es_out_id_t *id)
Definition: vlc_es_out.h:208
static int es_out_vaControl(es_out_t *out, int i_query, va_list args)
Definition: vlc_es_out.h:169
@ ES_OUT_ES_POLICY_EXCLUSIVE
Definition: vlc_es_out.h:127
@ ES_OUT_ES_POLICY_AUTO
Definition: vlc_es_out.h:131
@ ES_OUT_ES_POLICY_SIMULTANEOUS
Definition: vlc_es_out.h:128
@ ES_OUT_SET_GROUP_EPG_EVENT
Definition: vlc_es_out.h:83
@ ES_OUT_SET_GROUP
Definition: vlc_es_out.h:61
@ ES_OUT_SET_GROUP_PCR
Definition: vlc_es_out.h:70
@ ES_OUT_SET_EPG_TIME
Definition: vlc_es_out.h:84
@ ES_OUT_SET_ES_CAT_POLICY
Definition: vlc_es_out.h:58
@ ES_OUT_UNSET_ES
Definition: vlc_es_out.h:46
@ ES_OUT_VOUT_DEL_OVERLAY
Definition: vlc_es_out.h:115
@ ES_OUT_RESTART_ES
Definition: vlc_es_out.h:47
@ ES_OUT_VOUT_ADD_OVERLAY
Definition: vlc_es_out.h:112
@ ES_OUT_SET_GROUP_EPG
Definition: vlc_es_out.h:82
@ ES_OUT_POST_SUBNODE
Definition: vlc_es_out.h:106
@ ES_OUT_RESET_PCR
Definition: vlc_es_out.h:71
@ ES_OUT_SPU_SET_HIGHLIGHT
Definition: vlc_es_out.h:118
@ ES_OUT_GET_EMPTY
Definition: vlc_es_out.h:97
@ ES_OUT_SET_ES_DEFAULT
Definition: vlc_es_out.h:50
@ ES_OUT_SET_NEXT_DISPLAY_TIME
Definition: vlc_es_out.h:78
@ ES_OUT_DEL_GROUP
Definition: vlc_es_out.h:87
@ ES_OUT_GET_PCR_SYSTEM
Definition: vlc_es_out.h:103
@ ES_OUT_SET_ES_STATE
Definition: vlc_es_out.h:54
@ ES_OUT_SET_ES_FMT
Definition: vlc_es_out.h:75
@ ES_OUT_VOUT_SET_MOUSE_EVENT
Definition: vlc_es_out.h:108
@ ES_OUT_GET_ES_STATE
Definition: vlc_es_out.h:55
@ ES_OUT_SET_GROUP_META
Definition: vlc_es_out.h:80
@ ES_OUT_MODIFY_PCR_SYSTEM
Definition: vlc_es_out.h:104
@ ES_OUT_PRIVATE_START
Definition: vlc_es_out.h:122
@ ES_OUT_SET_META
Definition: vlc_es_out.h:100
@ ES_OUT_SET_ES_SCRAMBLED_STATE
Definition: vlc_es_out.h:90
@ ES_OUT_SET_ES
Definition: vlc_es_out.h:45
@ ES_OUT_SET_PCR
Definition: vlc_es_out.h:69
static thread_local struct @81 state
Definition: vlc_es.h:630
Definition: vlc_es_out.h:135
int(* control)(es_out_t *, input_source_t *in, int query, va_list)
Definition: vlc_es_out.h:139
int(* priv_control)(es_out_t *, int query, va_list)
Private control callback, must be NULL for es_out created from modules.
Definition: vlc_es_out.h:144
es_out_id_t *(* add)(es_out_t *, input_source_t *in, const es_format_t *)
Definition: vlc_es_out.h:136
int(* send)(es_out_t *, es_out_id_t *, block_t *)
Definition: vlc_es_out.h:137
void(* del)(es_out_t *, es_out_id_t *)
Definition: vlc_es_out.h:138
void(* destroy)(es_out_t *)
Definition: vlc_es_out.h:140
Definition: es_out.c:109
Definition: vlc_es_out.h:148
const struct es_out_callbacks * cbs
Definition: vlc_es_out.h:149
Definition: input_internal.h:358
Definition: vlc_frame.h:123
Definition: meta.c:40
This file is a collection of common definitions and types.
This file defines the elementary streams format types.
es_format_category_e
ES Categories.
Definition: vlc_es.h:613
int64_t vlc_tick_t
High precision date or time interval.
Definition: vlc_tick.h:45