X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fstream_out%2Fes.c;h=1a20113ee2f9c5e9fa98ff090264ae487074f7a4;hb=f3ad50e8a846bd4de3c36a31bae26c1042b52c7c;hp=a8d1568d6bd6932d897248ccc6672f8292a44cbc;hpb=af5aece7d5356daadacec2e260df961be78d3b6c;p=vlc diff --git a/modules/stream_out/es.c b/modules/stream_out/es.c index a8d1568d6b..1a20113ee2 100644 --- a/modules/stream_out/es.c +++ b/modules/stream_out/es.c @@ -29,11 +29,11 @@ # include "config.h" #endif -#include +#include #include #include #include -#include +#include /***************************************************************************** * Module descriptor @@ -74,40 +74,40 @@ static void Close ( vlc_object_t * ); #define SOUT_CFG_PREFIX "sout-es-" -vlc_module_begin(); - set_shortname( "ES" ); - set_description( N_("Elementary stream output") ); - set_capability( "sout stream", 50 ); - add_shortcut( "es" ); - set_category( CAT_SOUT ); - set_subcategory( SUBCAT_SOUT_STREAM ); +vlc_module_begin () + set_shortname( "ES" ) + set_description( N_("Elementary stream output") ) + set_capability( "sout stream", 50 ) + add_shortcut( "es" ) + set_category( CAT_SOUT ) + set_subcategory( SUBCAT_SOUT_STREAM ) + set_section( N_("Generic"), NULL ) add_string( SOUT_CFG_PREFIX "access", "", NULL, ACCESS_TEXT, - ACCESS_LONGTEXT, true ); - add_string( SOUT_CFG_PREFIX "access-audio", "", NULL, ACCESSA_TEXT, - ACCESSA_LONGTEXT, true ); - add_string( SOUT_CFG_PREFIX "access-video", "", NULL, ACCESSV_TEXT, - ACCESSV_LONGTEXT, true ); - + ACCESS_LONGTEXT, true ) add_string( SOUT_CFG_PREFIX "mux", "", NULL, MUX_TEXT, - MUX_LONGTEXT, true ); - add_string( SOUT_CFG_PREFIX "mux-audio", "", NULL, MUXA_TEXT, - MUXA_LONGTEXT, true ); - add_string( SOUT_CFG_PREFIX "mux-video", "", NULL, MUXV_TEXT, - MUXV_LONGTEXT, true ); - + MUX_LONGTEXT, true ) add_string( SOUT_CFG_PREFIX "dst", "", NULL, DEST_TEXT, - DEST_LONGTEXT, true ); - change_unsafe(); + DEST_LONGTEXT, true ) + + set_section( N_("Audio"), NULL ) + add_string( SOUT_CFG_PREFIX "access-audio", "", NULL, ACCESSA_TEXT, + ACCESSA_LONGTEXT, true ) + add_string( SOUT_CFG_PREFIX "mux-audio", "", NULL, MUXA_TEXT, + MUXA_LONGTEXT, true ) add_string( SOUT_CFG_PREFIX "dst-audio", "", NULL, DESTA_TEXT, - DESTA_LONGTEXT, true ); - change_unsafe(); + DESTA_LONGTEXT, true ) + + set_section( N_("Video"), NULL ) + add_string( SOUT_CFG_PREFIX "access-video", "", NULL, ACCESSV_TEXT, + ACCESSV_LONGTEXT, true ) + add_string( SOUT_CFG_PREFIX "mux-video", "", NULL, MUXV_TEXT, + MUXV_LONGTEXT, true ) add_string( SOUT_CFG_PREFIX "dst-video", "", NULL, DESTV_TEXT, - DESTV_LONGTEXT, true ); - change_unsafe(); + DESTV_LONGTEXT, true ) - set_callbacks( Open, Close ); -vlc_module_end(); + set_callbacks( Open, Close ) +vlc_module_end () /***************************************************************************** * Exported prototypes @@ -149,7 +149,6 @@ static int Open( vlc_object_t *p_this ) { sout_stream_t *p_stream = (sout_stream_t*)p_this; sout_stream_sys_t *p_sys; - vlc_value_t val; config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg ); p_sys = malloc( sizeof( sout_stream_sys_t ) ); @@ -158,26 +157,17 @@ static int Open( vlc_object_t *p_this ) p_sys->i_count_audio = 0; p_sys->i_count_video = 0; - var_Get( p_stream, SOUT_CFG_PREFIX "access", &val ); - p_sys->psz_access = val.psz_string; - var_Get( p_stream, SOUT_CFG_PREFIX "access-audio", &val ); - p_sys->psz_access_audio = val.psz_string; - var_Get( p_stream, SOUT_CFG_PREFIX "access-video", &val ); - p_sys->psz_access_video = val.psz_string; - - var_Get( p_stream, SOUT_CFG_PREFIX "mux", &val ); - p_sys->psz_mux = val.psz_string; - var_Get( p_stream, SOUT_CFG_PREFIX "mux-audio", &val ); - p_sys->psz_mux_audio = val.psz_string; - var_Get( p_stream, SOUT_CFG_PREFIX "mux-video", &val ); - p_sys->psz_mux_video = val.psz_string; - - var_Get( p_stream, SOUT_CFG_PREFIX "dst", &val ); - p_sys->psz_dst = val.psz_string; - var_Get( p_stream, SOUT_CFG_PREFIX "dst-audio", &val ); - p_sys->psz_dst_audio = val.psz_string; - var_Get( p_stream, SOUT_CFG_PREFIX "dst-video", &val ); - p_sys->psz_dst_video = val.psz_string; + p_sys->psz_access = var_GetString( p_stream, SOUT_CFG_PREFIX "access" ); + p_sys->psz_access_audio = var_GetString( p_stream, SOUT_CFG_PREFIX "access-audio" ); + p_sys->psz_access_video = var_GetString( p_stream, SOUT_CFG_PREFIX "access-video" ); + + p_sys->psz_mux = var_GetString( p_stream, SOUT_CFG_PREFIX "mux" ); + p_sys->psz_mux_audio = var_GetString( p_stream, SOUT_CFG_PREFIX "mux-audio" ); + p_sys->psz_mux_video = var_GetString( p_stream, SOUT_CFG_PREFIX "mux-video" ); + + p_sys->psz_dst = var_GetString( p_stream, SOUT_CFG_PREFIX "dst" ); + p_sys->psz_dst_audio = var_GetString( p_stream, SOUT_CFG_PREFIX "dst-audio" ); + p_sys->psz_dst_video = var_GetString( p_stream, SOUT_CFG_PREFIX "dst-video" ); p_stream->pf_add = Add; p_stream->pf_del = Del; @@ -218,17 +208,19 @@ struct sout_stream_id_t sout_mux_t *p_mux; }; -static char * es_print_url( char *psz_fmt, vlc_fourcc_t i_fourcc, int i_count, - char *psz_access, char *psz_mux ) +static char * es_print_url( const char *psz_fmt, vlc_fourcc_t i_fourcc, int i_count, + const char *psz_access, const char *psz_mux ) { char *psz_dst, *p; if( psz_fmt == NULL || !*psz_fmt ) { - psz_fmt = "stream-%n-%c.%m"; + psz_fmt = (char*)"stream-%n-%c.%m"; } p = psz_dst = malloc( 4096 ); + if( !psz_dst ) + return NULL; memset( p, 0, 4096 ); for( ;; ) { @@ -283,8 +275,8 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) sout_instance_t *p_sout = p_stream->p_sout; sout_stream_id_t *id; - char *psz_access; - char *psz_mux; + const char *psz_access; + const char *psz_mux; char *psz_dst; sout_access_out_t *p_access; @@ -367,11 +359,12 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) { msg_Err( p_stream, "no suitable sout access module for `%s/%s://%s'", psz_access, psz_mux, psz_dst ); - intf_UserFatal( p_stream, false, + dialog_Fatal( p_stream, _("Streaming / Transcoding failed"), _("There is no suitable stream-output access module for \"%s/%s://%s\"."), psz_access, psz_mux, psz_dst ); + free( psz_dst ); return( NULL ); } @@ -381,16 +374,24 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) { msg_Err( p_stream, "no suitable sout mux module for `%s/%s://%s'", psz_access, psz_mux, psz_dst ); - intf_UserFatal( p_stream, false, + dialog_Fatal( p_stream, _("Streaming / Transcoding failed"), _("There is no suitable stream-output access module "\ "for \"%s/%s://%s\"."), psz_access, psz_mux, psz_dst ); sout_AccessOutDelete( p_access ); + free( psz_dst ); return( NULL ); } + free( psz_dst ); id = malloc( sizeof( sout_stream_id_t ) ); + if( !id ) + { + sout_MuxDelete( p_mux ); + sout_AccessOutDelete( p_access ); + return NULL; + } id->p_mux = p_mux; id->p_input = sout_MuxAddStream( p_mux, p_fmt ); @@ -402,6 +403,9 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) return NULL; } + if( !sout_AccessOutCanControlPace( p_access ) ) + p_sout->i_out_pace_nocontrol++; + return id; } @@ -409,8 +413,11 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id ) { VLC_UNUSED(p_stream); sout_access_out_t *p_access = id->p_mux->p_access; - sout_MuxDelete( id->p_mux ); + sout_MuxDeleteStream( id->p_mux, id->p_input ); + sout_MuxDelete( id->p_mux ); + if( !sout_AccessOutCanControlPace( p_access ) ) + p_stream->p_sout->i_out_pace_nocontrol--; sout_AccessOutDelete( p_access ); free( id );