From 179f1381ce3b2c90d34485c0d186c1ed6cfec2d5 Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Sat, 10 Jul 2004 17:20:11 +0000 Subject: [PATCH] * all: cosmetics + MUX_GET_MIME. --- modules/mux/asf.c | 44 ++++++++++++++++++++++++++++++------------- modules/mux/avi.c | 36 ++++++++++++++++++++++++----------- modules/mux/dummy.c | 31 +++++++++++++++++++----------- modules/mux/mp4.c | 30 ++++++++++++++++------------- modules/mux/mpeg/ps.c | 32 ++++++++++++++++++++++--------- modules/mux/mpeg/ts.c | 40 ++++++++++++++++++++++++++------------- modules/mux/ogg.c | 37 ++++++++++++++++++++++++------------ 7 files changed, 168 insertions(+), 82 deletions(-) diff --git a/modules/mux/asf.c b/modules/mux/asf.c index bbb2e73bca..eda83ccc0d 100644 --- a/modules/mux/asf.c +++ b/modules/mux/asf.c @@ -80,12 +80,12 @@ vlc_module_end(); *****************************************************************************/ static const char *ppsz_sout_options[] = { "title", "author", "copyright", "comment", "rating", NULL -};; +}; -static int Capability(sout_mux_t *, int, void *, void * ); -static int AddStream( sout_mux_t *, sout_input_t * ); -static int DelStream( sout_mux_t *, sout_input_t * ); -static int Mux ( sout_mux_t * ); +static int Control ( sout_mux_t *, int, va_list ); +static int AddStream( sout_mux_t *, sout_input_t * ); +static int DelStream( sout_mux_t *, sout_input_t * ); +static int Mux ( sout_mux_t * ); typedef struct { @@ -175,9 +175,9 @@ static int Open( vlc_object_t *p_this ) int i; msg_Dbg( p_mux, "Asf muxer opened" ); - sout_ParseCfg( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg ); + sout_CfgParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg ); - p_mux->pf_capacity = Capability; + p_mux->pf_control = Control; p_mux->pf_addstream = AddStream; p_mux->pf_delstream = DelStream; p_mux->pf_mux = Mux; @@ -267,16 +267,34 @@ static void Close( vlc_object_t * p_this ) /***************************************************************************** * Capability: *****************************************************************************/ -static int Capability( sout_mux_t *p_mux, int i_query, - void *p_args, void *p_answer ) +static int Control( sout_mux_t *p_mux, int i_query, va_list args ) { + sout_mux_sys_t *p_sys = p_mux->p_sys; + vlc_bool_t *pb_bool; + char **ppsz; + switch( i_query ) { - case SOUT_MUX_CAP_GET_ADD_STREAM_ANY_TIME: - *(vlc_bool_t*)p_answer = VLC_FALSE; - return( SOUT_MUX_CAP_ERR_OK ); + case MUX_CAN_ADD_STREAM_WHILE_MUXING: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_TRUE; + return VLC_SUCCESS; + + case MUX_GET_ADD_STREAM_WAIT: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_FALSE; + return VLC_SUCCESS; + + case MUX_GET_MIME: + ppsz = (char**)va_arg( args, char ** ); + if( p_sys->b_asf_http ) + *ppsz = strdup( "video/x-ms-asf-stream" ); + else + *ppsz = strdup( "video/x-ms-asf" ); + return VLC_SUCCESS; + default: - return( SOUT_MUX_CAP_ERR_UNIMPLEMENTED ); + return VLC_EGENERIC; } } diff --git a/modules/mux/avi.c b/modules/mux/avi.c index cc264d42d0..1011921df6 100644 --- a/modules/mux/avi.c +++ b/modules/mux/avi.c @@ -51,10 +51,10 @@ vlc_module_end(); /***************************************************************************** * Local prototypes *****************************************************************************/ -static int Capability(sout_mux_t *, int , void *, void * ); -static int AddStream( sout_mux_t *, sout_input_t * ); -static int DelStream( sout_mux_t *, sout_input_t * ); -static int Mux ( sout_mux_t * ); +static int Control( sout_mux_t *, int, va_list ); +static int AddStream( sout_mux_t *, sout_input_t * ); +static int DelStream( sout_mux_t *, sout_input_t * ); +static int Mux ( sout_mux_t * ); typedef struct avi_stream_s { @@ -149,7 +149,7 @@ static int Open( vlc_object_t *p_this ) p_sys->b_write_header = VLC_TRUE; - p_mux->pf_capacity = Capability; + p_mux->pf_control = Control; p_mux->pf_addstream = AddStream; p_mux->pf_delstream = DelStream; p_mux->pf_mux = Mux; @@ -212,16 +212,30 @@ static void Close( vlc_object_t * p_this ) sout_AccessOutWrite( p_mux->p_access, p_hdr ); } -static int Capability( sout_mux_t *p_mux, int i_query, - void *p_args, void *p_answer ) +static int Control( sout_mux_t *p_mux, int i_query, va_list args ) { + vlc_bool_t *pb_bool; + char **ppsz; + switch( i_query ) { - case SOUT_MUX_CAP_GET_ADD_STREAM_ANY_TIME: - *(vlc_bool_t*)p_answer = VLC_FALSE; - return( SOUT_MUX_CAP_ERR_OK ); + case MUX_CAN_ADD_STREAM_WHILE_MUXING: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_FALSE; + return VLC_SUCCESS; + + case MUX_GET_ADD_STREAM_WAIT: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_TRUE; + return VLC_SUCCESS; + + case MUX_GET_MIME: + ppsz = (char**)va_arg( args, char ** ); + *ppsz = strdup( "video/avi" ); + return VLC_SUCCESS; + default: - return( SOUT_MUX_CAP_ERR_UNIMPLEMENTED ); + return VLC_EGENERIC; } } diff --git a/modules/mux/dummy.c b/modules/mux/dummy.c index fc0de1c8cd..c5b6cc4fdd 100644 --- a/modules/mux/dummy.c +++ b/modules/mux/dummy.c @@ -49,10 +49,10 @@ vlc_module_end(); /***************************************************************************** * Exported prototypes *****************************************************************************/ -static int Capability(sout_mux_t *, int, void *, void * ); -static int AddStream( sout_mux_t *, sout_input_t * ); -static int DelStream( sout_mux_t *, sout_input_t * ); -static int Mux ( sout_mux_t * ); +static int Control( sout_mux_t *, int, va_list ); +static int AddStream( sout_mux_t *, sout_input_t * ); +static int DelStream( sout_mux_t *, sout_input_t * ); +static int Mux ( sout_mux_t * ); struct sout_mux_sys_t { @@ -72,7 +72,7 @@ static int Open( vlc_object_t *p_this ) msg_Dbg( p_mux, "Dummy/Raw muxer opened" ); msg_Info( p_mux, "Open" ); - p_mux->pf_capacity = Capability; + p_mux->pf_control = Control; p_mux->pf_addstream = AddStream; p_mux->pf_delstream = DelStream; p_mux->pf_mux = Mux; @@ -96,16 +96,25 @@ static void Close( vlc_object_t * p_this ) free( p_sys ); } -static int Capability( sout_mux_t *p_mux, int i_query, - void *p_args, void *p_answer ) +static int Control( sout_mux_t *p_mux, int i_query, va_list args ) { + vlc_bool_t *pb_bool; + switch( i_query ) { - case SOUT_MUX_CAP_GET_ADD_STREAM_ANY_TIME: - *(vlc_bool_t*)p_answer = VLC_TRUE; - return( SOUT_MUX_CAP_ERR_OK ); + case MUX_CAN_ADD_STREAM_WHILE_MUXING: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_TRUE; + return VLC_SUCCESS; + + case MUX_GET_ADD_STREAM_WAIT: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_FALSE; + return VLC_SUCCESS; + + case MUX_GET_MIME: /* Unknown */ default: - return( SOUT_MUX_CAP_ERR_UNIMPLEMENTED ); + return VLC_EGENERIC; } } diff --git a/modules/mux/mp4.c b/modules/mux/mp4.c index f468d41954..4fd0264aa1 100644 --- a/modules/mux/mp4.c +++ b/modules/mux/mp4.c @@ -70,7 +70,7 @@ static const char *ppsz_sout_options[] = { "faststart", NULL }; -static int Capability(sout_mux_t *, int, void *, void * ); +static int Control( sout_mux_t *, int, va_list ); static int AddStream( sout_mux_t *, sout_input_t * ); static int DelStream( sout_mux_t *, sout_input_t * ); static int Mux ( sout_mux_t * ); @@ -188,9 +188,9 @@ static int Open( vlc_object_t *p_this ) bo_t *box; msg_Dbg( p_mux, "Mp4 muxer opend" ); - sout_ParseCfg( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg ); + sout_CfgParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg ); - p_mux->pf_capacity = Capability; + p_mux->pf_control = Control; p_mux->pf_addstream = AddStream; p_mux->pf_delstream = DelStream; p_mux->pf_mux = Mux; @@ -363,23 +363,27 @@ static void Close( vlc_object_t * p_this ) } /***************************************************************************** - * Capability: + * Control: *****************************************************************************/ -static int Capability( sout_mux_t *p_mux, int i_query, void *p_args, - void *p_answer ) +static int Control( sout_mux_t *p_mux, int i_query, va_list args ) { + vlc_bool_t *pb_bool; + switch( i_query ) { - case SOUT_MUX_CAP_GET_ADD_STREAM_ANY_TIME: - *(vlc_bool_t*)p_answer = VLC_TRUE; - return SOUT_MUX_CAP_ERR_OK; + case MUX_CAN_ADD_STREAM_WHILE_MUXING: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_FALSE; + return VLC_SUCCESS; - case SOUT_MUX_CAP_GET_ADD_STREAM_WAIT: - *(vlc_bool_t*)p_answer = VLC_TRUE; - return( SOUT_MUX_CAP_ERR_OK ); + case MUX_GET_ADD_STREAM_WAIT: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_TRUE; + return VLC_SUCCESS; + case MUX_GET_MIME: /* Not needed, as not streamable */ default: - return SOUT_MUX_CAP_ERR_UNIMPLEMENTED; + return VLC_EGENERIC; } } diff --git a/modules/mux/mpeg/ps.c b/modules/mux/mpeg/ps.c index 0ce0d92b48..ee4b3af796 100644 --- a/modules/mux/mpeg/ps.c +++ b/modules/mux/mpeg/ps.c @@ -61,7 +61,7 @@ vlc_module_end(); /***************************************************************************** * Exported prototypes *****************************************************************************/ -static int Capability(sout_mux_t *, int, void *, void * ); +static int Control ( sout_mux_t *, int, va_list ); static int AddStream( sout_mux_t *, sout_input_t * ); static int DelStream( sout_mux_t *, sout_input_t * ); static int Mux ( sout_mux_t * ); @@ -116,7 +116,7 @@ static int Open( vlc_object_t *p_this ) msg_Info( p_mux, "Open" ); - p_mux->pf_capacity = Capability; + p_mux->pf_control = Control; p_mux->pf_addstream = AddStream; p_mux->pf_delstream = DelStream; p_mux->pf_mux = Mux; @@ -164,18 +164,32 @@ static void Close( vlc_object_t * p_this ) } /***************************************************************************** - * Capability: + * Control: *****************************************************************************/ -static int Capability( sout_mux_t *p_mux, int i_query, void *p_args, - void *p_answer ) +static int Control( sout_mux_t *p_mux, int i_query, va_list args ) { + vlc_bool_t *pb_bool; + char **ppsz; + switch( i_query ) { - case SOUT_MUX_CAP_GET_ADD_STREAM_ANY_TIME: - *(vlc_bool_t*)p_answer = VLC_TRUE; - return( SOUT_MUX_CAP_ERR_OK ); + case MUX_CAN_ADD_STREAM_WHILE_MUXING: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_TRUE; + return VLC_SUCCESS; + + case MUX_GET_ADD_STREAM_WAIT: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_FALSE; + return VLC_SUCCESS; + + case MUX_GET_MIME: + ppsz = (char**)va_arg( args, char ** ); + *ppsz = strdup( "video/mpeg" ); + return VLC_SUCCESS; + default: - return( SOUT_MUX_CAP_ERR_UNIMPLEMENTED ); + return VLC_EGENERIC; } } diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c index 4b4ac5a9f6..5460769091 100644 --- a/modules/mux/mpeg/ts.c +++ b/modules/mux/mpeg/ts.c @@ -307,10 +307,10 @@ static int AllocatePID( sout_mux_sys_t *p_sys, int i_cat ) /***************************************************************************** * Local prototypes *****************************************************************************/ -static int Capability(sout_mux_t *, int, void *, void * ); -static int AddStream( sout_mux_t *, sout_input_t * ); -static int DelStream( sout_mux_t *, sout_input_t * ); -static int Mux ( sout_mux_t * ); +static int Control ( sout_mux_t *, int, va_list ); +static int AddStream( sout_mux_t *, sout_input_t * ); +static int DelStream( sout_mux_t *, sout_input_t * ); +static int Mux ( sout_mux_t * ); static void TSSchedule ( sout_mux_t *p_mux, sout_buffer_chain_t *p_chain_ts, mtime_t i_pcr_length, mtime_t i_pcr_dts ); @@ -334,11 +334,11 @@ static int Open( vlc_object_t *p_this ) vlc_value_t val; msg_Dbg( p_mux, "Open" ); - sout_ParseCfg( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg ); + sout_CfgParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg ); p_sys = malloc( sizeof( sout_mux_sys_t ) ); - p_mux->pf_capacity = Capability; + p_mux->pf_control = Control; p_mux->pf_addstream = AddStream; p_mux->pf_delstream = DelStream; p_mux->pf_mux = Mux; @@ -493,18 +493,32 @@ static void Close( vlc_object_t * p_this ) } /***************************************************************************** - * Capability: + * Control: *****************************************************************************/ -static int Capability( sout_mux_t *p_mux, int i_query, void *p_args, - void *p_answer ) +static int Control( sout_mux_t *p_mux, int i_query, va_list args ) { + vlc_bool_t *pb_bool; + char **ppsz; + switch( i_query ) { - case SOUT_MUX_CAP_GET_ADD_STREAM_ANY_TIME: - *(vlc_bool_t*)p_answer = VLC_TRUE; - return( SOUT_MUX_CAP_ERR_OK ); + case MUX_CAN_ADD_STREAM_WHILE_MUXING: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_TRUE; + return VLC_SUCCESS; + + case MUX_GET_ADD_STREAM_WAIT: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_FALSE; + return VLC_SUCCESS; + + case MUX_GET_MIME: + ppsz = (char**)va_arg( args, char ** ); + *ppsz = strdup( "video/mpeg" ); /* FIXME not sure */ + return VLC_SUCCESS; + default: - return( SOUT_MUX_CAP_ERR_UNIMPLEMENTED ); + return VLC_EGENERIC; } } diff --git a/modules/mux/ogg.c b/modules/mux/ogg.c index 0ad04d2481..b8a73d714a 100644 --- a/modules/mux/ogg.c +++ b/modules/mux/ogg.c @@ -58,7 +58,7 @@ vlc_module_end(); /***************************************************************************** * Exported prototypes *****************************************************************************/ -static int Capability(sout_mux_t *, int, void *, void * ); +static int Control ( sout_mux_t *, int, va_list ); static int AddStream( sout_mux_t *, sout_input_t * ); static int DelStream( sout_mux_t *, sout_input_t * ); static int Mux ( sout_mux_t * ); @@ -236,7 +236,7 @@ static int Open( vlc_object_t *p_this ) p_sys->pp_del_streams = 0; p_mux->p_sys = p_sys; - p_mux->pf_capacity = Capability; + p_mux->pf_control = Control; p_mux->pf_addstream = AddStream; p_mux->pf_delstream = DelStream; p_mux->pf_mux = Mux; @@ -288,22 +288,35 @@ static void Close( vlc_object_t * p_this ) free( p_sys ); } -static int Capability( sout_mux_t *p_mux, int i_query, void *p_args, - void *p_answer ) +/***************************************************************************** + * Control: + *****************************************************************************/ +static int Control( sout_mux_t *p_mux, int i_query, va_list args ) { + vlc_bool_t *pb_bool; + char **ppsz; + switch( i_query ) { - case SOUT_MUX_CAP_GET_ADD_STREAM_ANY_TIME: - *(vlc_bool_t*)p_answer = VLC_TRUE; - return( SOUT_MUX_CAP_ERR_OK ); - case SOUT_MUX_CAP_GET_ADD_STREAM_WAIT: - *(vlc_bool_t*)p_answer = VLC_TRUE; - return( SOUT_MUX_CAP_ERR_OK ); + case MUX_CAN_ADD_STREAM_WHILE_MUXING: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_TRUE; + return VLC_SUCCESS; + + case MUX_GET_ADD_STREAM_WAIT: + pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t * ); + *pb_bool = VLC_TRUE; + return VLC_SUCCESS; + + case MUX_GET_MIME: + ppsz = (char**)va_arg( args, char ** ); + *ppsz = strdup( "application/ogg" ); + return VLC_SUCCESS; + default: - return( SOUT_MUX_CAP_ERR_UNIMPLEMENTED ); + return VLC_EGENERIC; } } - /***************************************************************************** * AddStream: Add an elementary stream to the muxed stream *****************************************************************************/ -- 2.39.2