VLC 4.0.0-dev
vlc_sout.h
Go to the documentation of this file.
1/*****************************************************************************
2 * vlc_sout.h : stream output module
3 *****************************************************************************
4 * Copyright (C) 2002-2008 VLC authors and VideoLAN
5 *
6 * Authors: Christophe Massiot <massiot@via.ecp.fr>
7 * Laurent Aimar <fenrir@via.ecp.fr>
8 * Eric Petit <titer@videolan.org>
9 * Jean-Paul Saman <jpsaman #_at_# m2x.nl>
10 * RĂ©mi Denis-Courmont
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU Lesser General Public License as published by
14 * the Free Software Foundation; either version 2.1 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this program; if not, write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 *****************************************************************************/
26
27#ifndef VLC_SOUT_H_
28#define VLC_SOUT_H_
29
30#include <sys/types.h>
31#include <vlc_es.h>
32#include <vlc_clock.h>
33#include <vlc_tick.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/**
40 * \defgroup sout Stream output
41 * \ingroup output
42 * @{
43 * \file
44 * Stream output modules interface
45 */
46
47/**
48 * \defgroup sout_access Access output
49 * Raw output byte streams
50 * @{
51 */
52
53/** Stream output access_output */
56 struct vlc_object_t obj;
61 char *psz_path;
62 void *p_sys;
63 int (*pf_seek)( sout_access_out_t *, uint64_t );
64 ssize_t (*pf_read)( sout_access_out_t *, block_t * );
66 int (*pf_control)( sout_access_out_t *, int, va_list );
69};
70
73 ACCESS_OUT_CONTROLS_PACE, /* arg1=bool *, can fail (assume true) */
74 ACCESS_OUT_CAN_SEEK, /* arg1=bool *, can fail (assume false) */
75};
76
77VLC_API sout_access_out_t * sout_AccessOutNew( vlc_object_t *, const char *psz_access, const char *psz_name ) VLC_USED;
78#define sout_AccessOutNew( obj, access, name ) \
79 sout_AccessOutNew( VLC_OBJECT(obj), access, name )
85
86static inline bool sout_AccessOutCanControlPace( sout_access_out_t *p_ao )
88 bool b;
90 return true;
91 return b;
92}
93
94/**
95 * @}
96 * \defgroup sout_mux Multiplexer
97 * Multiplexers (file formatters)
98 * @{
99 */
100
101/** Muxer structure */
102struct sout_mux_t
104 struct vlc_object_t obj;
107 char *psz_mux;
112 int (*pf_addstream)( sout_mux_t *, sout_input_t * );
114 int (*pf_mux) ( sout_mux_t * );
115 int (*pf_control) ( sout_mux_t *, int, va_list );
117 /* here are all inputs accepted by muxer */
118 int i_nb_inputs;
121 /* mux private */
122 void *p_sys;
124 /* XXX private to stream_output.c */
125 /* if muxer doesn't support adding stream at any time then we first wait
126 * for stream then we refuse all stream and start muxing */
129 /* we wait 1.5 second after first stream added */
132
135 /* capabilities */
136 MUX_CAN_ADD_STREAM_WHILE_MUXING, /* arg1= bool *, res=cannot fail */
137 /* properties */
138 MUX_GET_MIME, /* arg1= char ** res=can fail */
140
141struct sout_input_t
143 const es_format_t *p_fmt;
145 void *p_sys;
148
149
157
158static inline int sout_MuxControl( sout_mux_t *p_mux, int i_query, ... )
160 va_list args;
161 int i_result;
162
163 va_start( args, i_query );
164 i_result = p_mux->pf_control( p_mux, i_query, args );
165 va_end( args );
166 return i_result;
167}
168
169/** @} */
170
172 SOUT_STREAM_WANTS_SUBSTREAMS, /* arg1=bool *, res=can fail (assume false) */
173 SOUT_STREAM_ID_SPU_HIGHLIGHT, /* arg1=void *, arg2=const vlc_spu_highlight_t *, res=can fail */
174 SOUT_STREAM_IS_SYNCHRONOUS, /* arg1=bool *, can fail (assume false) */
176
178 void *(*add)(sout_stream_t *, const es_format_t *);
179 void (*del)(sout_stream_t *, void *);
180 int (*send)(sout_stream_t *, void *, block_t *);
181 int (*control)( sout_stream_t *, int, va_list );
182 void (*flush)( sout_stream_t *, void *);
185
186struct sout_stream_t
188 struct vlc_object_t obj;
190 char *psz_name;
194 const struct sout_stream_operations *ops;
195 void *p_sys;
197
200 const char *psz_chain, sout_stream_t *p_next) VLC_USED;
201
203VLC_API void sout_StreamIdDel(sout_stream_t *s, void *id);
204VLC_API int sout_StreamIdSend( sout_stream_t *s, void *id, block_t *b);
205VLC_API void sout_StreamFlush(sout_stream_t *s, void *id);
207VLC_API int sout_StreamControlVa(sout_stream_t *s, int i_query, va_list args);
208
214
215static inline int sout_StreamControl( sout_stream_t *s, int i_query, ... )
217 va_list args;
218 int i_result;
219
220 va_start( args, i_query );
221 i_result = sout_StreamControlVa( s, i_query, args );
222 va_end( args );
223 return i_result;
224}
225
226static inline bool sout_StreamIsSynchronous(sout_stream_t *s)
228 bool b;
229
231 b = false;
232
233 return b;
234}
235
236/****************************************************************************
237 * Encoder
238 ****************************************************************************/
239
241#define sout_EncoderCreate(o,s) sout_EncoderCreate(VLC_OBJECT(o),s)
243/****************************************************************************
244 * Announce handler
245 ****************************************************************************/
248#define sout_AnnounceRegisterSDP(o, sdp, addr) \
249 sout_AnnounceRegisterSDP(VLC_OBJECT (o), sdp, addr)
250#define sout_AnnounceUnRegister(o, a) \
251 sout_AnnounceUnRegister(VLC_OBJECT (o), a)
252
253/** @} */
254
255#ifdef __cplusplus
256}
257#endif
258
259#endif
#define VLC_USED
Definition: fourcc_gen.c:32
#define VLC_API
Definition: fourcc_gen.c:31
int sout_AccessOutSeek(sout_access_out_t *, uint64_t)
Definition: missing.c:70
static bool sout_AccessOutCanControlPace(sout_access_out_t *p_ao)
Definition: vlc_sout.h:87
access_out_query_e
Definition: vlc_sout.h:73
ssize_t sout_AccessOutWrite(sout_access_out_t *, block_t *)
Definition: missing.c:76
int sout_AccessOutControl(sout_access_out_t *, int,...)
sout_AccessOutControl
Definition: missing.c:43
#define sout_AccessOutNew(obj, access, name)
Definition: vlc_sout.h:79
void sout_AccessOutDelete(sout_access_out_t *)
Definition: missing.c:49
ssize_t sout_AccessOutRead(sout_access_out_t *, block_t *)
Definition: missing.c:64
@ ACCESS_OUT_CAN_SEEK
Definition: vlc_sout.h:75
@ ACCESS_OUT_CONTROLS_PACE
Definition: vlc_sout.h:74
void sout_MuxDelete(sout_mux_t *)
Definition: missing.c:115
sout_input_t * sout_MuxAddStream(sout_mux_t *, const es_format_t *)
Definition: missing.c:108
sout_mux_t * sout_MuxNew(sout_access_out_t *, const char *)
Definition: missing.c:133
static int sout_MuxControl(sout_mux_t *p_mux, int i_query,...)
Definition: vlc_sout.h:159
int sout_MuxGetStream(sout_mux_t *, unsigned, vlc_tick_t *)
Definition: missing.c:127
void sout_MuxFlush(sout_mux_t *, sout_input_t *)
Definition: missing.c:146
void sout_MuxDeleteStream(sout_mux_t *, sout_input_t *)
Definition: missing.c:121
int sout_MuxSendBuffer(sout_mux_t *, sout_input_t *, block_t *)
Definition: missing.c:139
sout_mux_query_e
Definition: vlc_sout.h:135
@ MUX_GET_MIME
Definition: vlc_sout.h:139
@ MUX_CAN_ADD_STREAM_WHILE_MUXING
Definition: vlc_sout.h:137
vlc_clock_main_t * sout_ClockMainCreate(sout_stream_t *)
Definition: stream_output.c:778
static bool sout_StreamIsSynchronous(sout_stream_t *s)
Definition: vlc_sout.h:227
void sout_StreamIdDel(sout_stream_t *s, void *id)
Definition: stream_output.c:708
static int sout_StreamControl(sout_stream_t *s, int i_query,...)
Definition: vlc_sout.h:216
void sout_StreamChainDelete(sout_stream_t *first, sout_stream_t *end)
Definition: missing.c:152
void sout_ClockMainDelete(vlc_clock_main_t *)
Definition: stream_output.c:784
int sout_StreamIdSend(sout_stream_t *s, void *id, block_t *b)
Definition: stream_output.c:715
vlc_clock_t * sout_ClockCreate(vlc_clock_main_t *, const es_format_t *)
Definition: stream_output.c:795
void sout_StreamFlush(sout_stream_t *s, void *id)
Definition: stream_output.c:725
#define sout_AnnounceRegisterSDP(o, sdp, addr)
Definition: vlc_sout.h:249
void sout_ClockMainSetFirstPcr(vlc_clock_main_t *, vlc_tick_t pcr)
Definition: stream_output.c:789
void sout_StreamSetPCR(sout_stream_t *s, vlc_tick_t pcr)
Definition: stream_output.c:735
#define sout_AnnounceUnRegister(o, a)
Definition: vlc_sout.h:251
void sout_ClockDelete(vlc_clock_t *)
Definition: stream_output.c:802
#define sout_EncoderCreate(o, s)
Definition: vlc_sout.h:242
void * sout_StreamIdAdd(sout_stream_t *s, const es_format_t *fmt)
Definition: stream_output.c:698
int sout_StreamControlVa(sout_stream_t *s, int i_query, va_list args)
Definition: stream_output.c:745
sout_stream_query_e
Definition: vlc_sout.h:172
sout_stream_t * sout_StreamChainNew(vlc_object_t *parent, const char *psz_chain, sout_stream_t *p_next)
Definition: missing.c:159
@ SOUT_STREAM_ID_SPU_HIGHLIGHT
Definition: vlc_sout.h:174
@ SOUT_STREAM_WANTS_SUBSTREAMS
Definition: vlc_sout.h:173
@ SOUT_STREAM_IS_SYNCHRONOUS
Definition: vlc_sout.h:175
Definition: vlc_configuration.h:319
Definition: vlc_codec.h:255
Definition: vlc_es.h:630
Internal module descriptor.
Definition: modules.h:76
Definition: sap.c:49
Stream output access_output.
Definition: vlc_sout.h:56
config_chain_t * p_cfg
Definition: vlc_sout.h:69
char * psz_path
Definition: vlc_sout.h:62
module_t * p_module
Definition: vlc_sout.h:59
int(* pf_control)(sout_access_out_t *, int, va_list)
Definition: vlc_sout.h:67
int(* pf_seek)(sout_access_out_t *, uint64_t)
Definition: vlc_sout.h:64
struct vlc_object_t obj
Definition: vlc_sout.h:57
ssize_t(* pf_write)(sout_access_out_t *, block_t *)
Definition: vlc_sout.h:66
char * psz_access
Definition: vlc_sout.h:60
ssize_t(* pf_read)(sout_access_out_t *, block_t *)
Definition: vlc_sout.h:65
void * p_sys
Definition: vlc_sout.h:63
Definition: vlc_sout.h:143
block_fifo_t * p_fifo
Definition: vlc_sout.h:145
es_format_t fmt
Definition: vlc_sout.h:147
void * p_sys
Definition: vlc_sout.h:146
const es_format_t * p_fmt
Definition: vlc_sout.h:144
Muxer structure.
Definition: vlc_sout.h:104
module_t * p_module
Definition: vlc_sout.h:106
void * p_sys
Definition: vlc_sout.h:123
int i_nb_inputs
Definition: vlc_sout.h:119
bool b_add_stream_any_time
Definition: vlc_sout.h:128
int(* pf_mux)(sout_mux_t *)
Definition: vlc_sout.h:115
int(* pf_control)(sout_mux_t *, int, va_list)
Definition: vlc_sout.h:116
struct vlc_object_t obj
Definition: vlc_sout.h:105
void(* pf_delstream)(sout_mux_t *, sout_input_t *)
Definition: vlc_sout.h:114
sout_input_t ** pp_inputs
Definition: vlc_sout.h:120
vlc_tick_t i_add_stream_start
Definition: vlc_sout.h:131
sout_access_out_t * p_access
Definition: vlc_sout.h:111
char * psz_mux
Definition: vlc_sout.h:108
bool b_waiting_stream
Definition: vlc_sout.h:129
int(* pf_addstream)(sout_mux_t *, sout_input_t *)
Definition: vlc_sout.h:113
config_chain_t * p_cfg
Definition: vlc_sout.h:109
Definition: vlc_sout.h:178
void(* set_pcr)(sout_stream_t *, vlc_tick_t)
Definition: vlc_sout.h:184
int(* control)(sout_stream_t *, int, va_list)
Definition: vlc_sout.h:182
int(* send)(sout_stream_t *, void *, block_t *)
Definition: vlc_sout.h:181
void(* del)(sout_stream_t *, void *)
Definition: vlc_sout.h:180
void(* flush)(sout_stream_t *, void *)
Definition: vlc_sout.h:183
Definition: vlc_sout.h:188
const struct sout_stream_operations * ops
Definition: vlc_sout.h:195
char * psz_name
Definition: vlc_sout.h:191
struct vlc_object_t obj
Definition: vlc_sout.h:189
config_chain_t * p_cfg
Definition: vlc_sout.h:192
void * p_sys
Definition: vlc_sout.h:196
sout_stream_t * p_next
Definition: vlc_sout.h:193
Definition: clock.c:35
Definition: clock.c:67
Internal state for block queues.
Definition: fifo.c:39
Definition: vlc_frame.h:123
VLC object common members.
Definition: vlc_objects.h:45
const char * psz_name
Definition: text_style.c:33
This file is a collection of common definitions and types.
This file defines the elementary streams format types.
int64_t vlc_tick_t
High precision date or time interval.
Definition: vlc_tick.h:45