00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "vlc_es.h"
00032
00033
00034
00035
00036 struct sout_instance_t
00037 {
00038 VLC_COMMON_MEMBERS
00039
00040 char *psz_sout;
00041 char *psz_chain;
00042
00043
00044 vlc_meta_t *p_meta;
00045
00046 int i_out_pace_nocontrol;
00047
00048 vlc_mutex_t lock;
00049 sout_stream_t *p_stream;
00050
00051
00052 sout_instance_sys_t *p_sys;
00053 };
00054
00055
00056
00057
00058 struct sout_cfg_t
00059 {
00060 sout_cfg_t *p_next;
00061
00062 char *psz_name;
00063 char *psz_value;
00064 };
00065
00066 #define sout_CfgParse( a, b, c, d ) __sout_CfgParse( VLC_OBJECT(a), b, c, d )
00067 VLC_EXPORT( void, __sout_CfgParse, ( vlc_object_t *, char *psz_prefix, const char **ppsz_options, sout_cfg_t * ) );
00068 VLC_EXPORT( char *, sout_CfgCreate, ( char **, sout_cfg_t **, char * ) );
00069
00070
00071
00072
00073 typedef struct sout_stream_id_t sout_stream_id_t;
00074
00075
00076
00077
00078 struct sout_packetizer_input_t
00079 {
00080 sout_instance_t *p_sout;
00081
00082 es_format_t *p_fmt;
00083
00084 sout_stream_id_t *id;
00085 };
00086
00087 #define sout_NewInstance(a,b) __sout_NewInstance(VLC_OBJECT(a),b)
00088 VLC_EXPORT( sout_instance_t *, __sout_NewInstance, ( vlc_object_t *, char * ) );
00089 VLC_EXPORT( void, sout_DeleteInstance, ( sout_instance_t * ) );
00090
00091 VLC_EXPORT( sout_packetizer_input_t *, sout_InputNew,( sout_instance_t *, es_format_t * ) );
00092 VLC_EXPORT( int, sout_InputDelete, ( sout_packetizer_input_t * ) );
00093 VLC_EXPORT( int, sout_InputSendBuffer, ( sout_packetizer_input_t *, block_t* ) );
00094
00095
00096
00097
00098 struct sout_access_out_t
00099 {
00100 VLC_COMMON_MEMBERS
00101
00102 module_t *p_module;
00103
00104 sout_instance_t *p_sout;
00105
00106 char *psz_access;
00107 sout_cfg_t *p_cfg;
00108
00109 char *psz_name;
00110 sout_access_out_sys_t *p_sys;
00111 int (*pf_seek)( sout_access_out_t *, off_t );
00112 int (*pf_read)( sout_access_out_t *, block_t * );
00113 int (*pf_write)( sout_access_out_t *, block_t * );
00114 };
00115
00116 VLC_EXPORT( sout_access_out_t *,sout_AccessOutNew, ( sout_instance_t *, char *psz_access, char *psz_name ) );
00117 VLC_EXPORT( void, sout_AccessOutDelete, ( sout_access_out_t * ) );
00118 VLC_EXPORT( int, sout_AccessOutSeek, ( sout_access_out_t *, off_t ) );
00119 VLC_EXPORT( int, sout_AccessOutRead, ( sout_access_out_t *, block_t * ) );
00120 VLC_EXPORT( int, sout_AccessOutWrite, ( sout_access_out_t *, block_t * ) );
00121
00122
00123
00124
00125 struct sout_mux_t
00126 {
00127 VLC_COMMON_MEMBERS
00128 module_t *p_module;
00129
00130 sout_instance_t *p_sout;
00131
00132 char *psz_mux;
00133 sout_cfg_t *p_cfg;
00134
00135 sout_access_out_t *p_access;
00136
00137 int (*pf_addstream)( sout_mux_t *, sout_input_t * );
00138 int (*pf_delstream)( sout_mux_t *, sout_input_t * );
00139 int (*pf_mux) ( sout_mux_t * );
00140 int (*pf_control) ( sout_mux_t *, int, va_list );
00141
00142
00143 int i_nb_inputs;
00144 sout_input_t **pp_inputs;
00145
00146
00147
00148 sout_mux_sys_t *p_sys;
00149
00150
00151
00152
00153 vlc_bool_t b_add_stream_any_time;
00154 vlc_bool_t b_waiting_stream;
00155
00156 mtime_t i_add_stream_start;
00157 };
00158
00159 enum sout_mux_query_e
00160 {
00161
00162 MUX_CAN_ADD_STREAM_WHILE_MUXING,
00163
00164 MUX_GET_ADD_STREAM_WAIT,
00165 MUX_GET_MIME,
00166 };
00167
00168 struct sout_input_t
00169 {
00170 sout_instance_t *p_sout;
00171
00172 es_format_t *p_fmt;
00173 block_fifo_t *p_fifo;
00174
00175 void *p_sys;
00176 };
00177
00178
00179 VLC_EXPORT( sout_mux_t *, sout_MuxNew, ( sout_instance_t*, char *, sout_access_out_t * ) );
00180 VLC_EXPORT( sout_input_t *, sout_MuxAddStream, ( sout_mux_t *, es_format_t * ) );
00181 VLC_EXPORT( void, sout_MuxDeleteStream, ( sout_mux_t *, sout_input_t * ) );
00182 VLC_EXPORT( void, sout_MuxDelete, ( sout_mux_t * ) );
00183 VLC_EXPORT( void, sout_MuxSendBuffer, ( sout_mux_t *, sout_input_t *, block_t * ) );
00184
00185 static inline int sout_MuxControl( sout_mux_t *p_mux, int i_query, ... )
00186 {
00187 va_list args;
00188 int i_result;
00189
00190 va_start( args, i_query );
00191 i_result = p_mux->pf_control( p_mux, i_query, args );
00192 va_end( args );
00193 return i_result;
00194 }
00195
00196
00197
00198
00199 struct sout_stream_t
00200 {
00201 VLC_COMMON_MEMBERS
00202
00203 module_t *p_module;
00204 sout_instance_t *p_sout;
00205
00206 char *psz_name;
00207 sout_cfg_t *p_cfg;
00208 char *psz_next;
00209
00210
00211 spu_t *p_spu;
00212
00213
00214 sout_stream_id_t *(*pf_add)( sout_stream_t *, es_format_t * );
00215 int (*pf_del)( sout_stream_t *, sout_stream_id_t * );
00216
00217 int (*pf_send)( sout_stream_t *, sout_stream_id_t *, block_t* );
00218
00219
00220 sout_stream_sys_t *p_sys;
00221 };
00222
00223 VLC_EXPORT( sout_stream_t *, sout_StreamNew, ( sout_instance_t *, char *psz_chain ) );
00224 VLC_EXPORT( void, sout_StreamDelete, ( sout_stream_t * ) );
00225
00226 static inline sout_stream_id_t *sout_StreamIdAdd( sout_stream_t *s, es_format_t *fmt )
00227 {
00228 return s->pf_add( s, fmt );
00229 }
00230 static inline int sout_StreamIdDel( sout_stream_t *s, sout_stream_id_t *id )
00231 {
00232 return s->pf_del( s, id );
00233 }
00234 static inline int sout_StreamIdSend( sout_stream_t *s, sout_stream_id_t *id, block_t *b )
00235 {
00236 return s->pf_send( s, id, b );
00237 }
00238
00239
00240
00241
00242 struct sap_session_t;
00243
00244 struct session_descriptor_t
00245 {
00246 char *psz_name;
00247 char *psz_uri;
00248 int i_port;
00249 int i_ttl;
00250 int i_payload;
00251
00252 char *psz_group;
00253
00254 sap_session_t *p_sap;
00255 char *psz_sdp;
00256 vlc_bool_t b_rtp;
00257 };
00258
00259 #define METHOD_TYPE_SAP 1
00260 #define METHOD_TYPE_SLP 2
00261
00262 struct announce_method_t
00263 {
00264 int i_type;
00265 };
00266
00267
00268
00269 struct sap_session_t
00270 {
00271 char *psz_sdp;
00272 uint8_t *psz_data;
00273 unsigned i_length;
00274 sap_address_t *p_address;
00275
00276
00277 mtime_t i_last;
00278 mtime_t i_next;
00279 };
00280
00281
00282 struct sap_handler_t
00283 {
00284 VLC_COMMON_MEMBERS
00285
00286 sap_session_t **pp_sessions;
00287 sap_address_t **pp_addresses;
00288
00289 vlc_bool_t b_control;
00290
00291 int i_sessions;
00292 int i_addresses;
00293
00294 int i_current_session;
00295
00296 int (*pf_add) ( sap_handler_t*, session_descriptor_t *);
00297 int (*pf_del) ( sap_handler_t*, session_descriptor_t *);
00298
00299
00300 };
00301
00302
00303 struct announce_handler_t
00304 {
00305 VLC_COMMON_MEMBERS
00306
00307 sap_handler_t *p_sap;
00308 };
00309
00310
00311
00312
00313 static inline sout_cfg_t *sout_cfg_find( sout_cfg_t *p_cfg, char *psz_name )
00314 {
00315 while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) )
00316 {
00317 p_cfg = p_cfg->p_next;
00318 }
00319
00320 return p_cfg;
00321 }
00322
00323 static inline char *sout_cfg_find_value( sout_cfg_t *p_cfg, char *psz_name )
00324 {
00325 while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) )
00326 {
00327 p_cfg = p_cfg->p_next;
00328 }
00329
00330 if( p_cfg && p_cfg->psz_value )
00331 {
00332 return( p_cfg->psz_value );
00333 }
00334
00335 return NULL;
00336 }
00337
00338
00339 VLC_EXPORT( int, sout_AnnounceRegister, (sout_instance_t *,session_descriptor_t*, announce_method_t* ) );
00340 VLC_EXPORT(session_descriptor_t*,sout_AnnounceRegisterSDP, (sout_instance_t *,const char *, const char *, announce_method_t* ) );
00341 VLC_EXPORT( int, sout_AnnounceUnRegister, (sout_instance_t *,session_descriptor_t* ) );
00342
00343 VLC_EXPORT(session_descriptor_t*,sout_AnnounceSessionCreate, (void) );
00344 VLC_EXPORT(void, sout_AnnounceSessionDestroy, (session_descriptor_t *) );
00345 VLC_EXPORT(announce_method_t*, sout_AnnounceMethodCreate, (int) );
00346
00347 #define announce_HandlerCreate(a) __announce_HandlerCreate(VLC_OBJECT(a))
00348 announce_handler_t* __announce_HandlerCreate( vlc_object_t *);
00349
00350
00351 int announce_HandlerDestroy( announce_handler_t * );
00352 int announce_Register( announce_handler_t *p_announce,
00353 session_descriptor_t *p_session,
00354 announce_method_t *p_method );
00355 int announce_UnRegister( announce_handler_t *p_announce,
00356 session_descriptor_t *p_session );
00357
00358 sap_handler_t *announce_SAPHandlerCreate( announce_handler_t *p_announce );
00359 void announce_SAPHandlerDestroy( sap_handler_t *p_sap );