if( p_sys->i_acodec )
{
- if( (strncmp( (char *)&p_sys->i_acodec, "mp3", 3) == 0) &&
- (p_sys->i_channels > 2) )
+ if( p_sys->i_acodec == VLC_FOURCC('m','p','3',0) &&
+ p_sys->i_channels > 2 )
{
msg_Warn( p_stream, "%d channels invalid for mp3, forcing to 2",
p_sys->i_channels );
p_sys->i_canvas_height = val.i_int;
var_Get( p_stream, SOUT_CFG_PREFIX "canvas-aspect", &val );
- if ( val.psz_string )
+ p_sys->i_canvas_aspect = 0;
+ if( val.psz_string && *val.psz_string )
{
char *psz_parser = strchr( val.psz_string, ':' );
-
if( psz_parser )
{
*psz_parser++ = '\0';
- p_sys->i_canvas_aspect = atoi( val.psz_string ) * VOUT_ASPECT_FACTOR
- / atoi( psz_parser );
- }
- else
- {
- msg_Warn( p_stream, "bad aspect ratio %s", val.psz_string );
- p_sys->i_canvas_aspect = 0;
+ p_sys->i_canvas_aspect = atoi( val.psz_string ) *
+ VOUT_ASPECT_FACTOR / atoi( psz_parser );
}
+ else msg_Warn( p_stream, "bad aspect ratio %s", val.psz_string );
- free( val.psz_string );
- }
- else
- {
- p_sys->i_canvas_aspect = 0;
}
+ if( val.psz_string ) free( val.psz_string );
var_Get( p_stream, SOUT_CFG_PREFIX "threads", &val );
p_sys->i_threads = val.i_int;
{
vlc_object_detach( id->p_decoder );
vlc_object_destroy( id->p_decoder );
+ id->p_decoder = NULL;
}
if( id->p_encoder )
vlc_object_detach( id->p_encoder );
es_format_Clean( &id->p_encoder->fmt_out );
vlc_object_destroy( id->p_encoder );
+ id->p_encoder = NULL;
}
free( id );
{
vlc_object_detach( id->p_decoder );
vlc_object_destroy( id->p_decoder );
+ id->p_decoder = NULL;
}
if( id->p_encoder )
vlc_object_detach( id->p_encoder );
es_format_Clean( &id->p_encoder->fmt_out );
vlc_object_destroy( id->p_encoder );
+ id->p_encoder = NULL;
}
-
free( id );
return VLC_SUCCESS;
id->p_decoder->p_module =
module_Need( id->p_decoder, "decoder", "$codec", 0 );
-
if( !id->p_decoder->p_module )
{
msg_Err( p_stream, "cannot find decoder" );
id->p_encoder->fmt_in.audio.i_format = id->p_decoder->fmt_out.i_codec;
/* Initialization of encoder format structures */
- es_format_Init( &id->p_encoder->fmt_in, AUDIO_ES, AOUT_FMT_S16_NE );
- id->p_encoder->fmt_in.audio.i_format = AOUT_FMT_S16_NE;
+ es_format_Init( &id->p_encoder->fmt_in, AUDIO_ES, VLC_FOURCC('f','l','3','2') );
+ id->p_encoder->fmt_in.audio.i_format = VLC_FOURCC('f','l','3','2');
+
id->p_encoder->fmt_in.audio.i_rate = id->p_encoder->fmt_out.audio.i_rate;
id->p_encoder->fmt_in.audio.i_physical_channels =
id->p_encoder->fmt_out.audio.i_physical_channels;
audio_BitsPerSample( id->p_encoder->fmt_in.i_codec );
id->p_encoder->p_cfg = p_stream->p_sys->p_audio_cfg;
-
id->p_encoder->p_module =
module_Need( id->p_encoder, "encoder", p_sys->psz_aenc, VLC_TRUE );
if( !id->p_encoder->p_module )
{
msg_Err( p_stream, "cannot find encoder (%s)", p_sys->psz_aenc );
module_Unneed( id->p_decoder, id->p_decoder->p_module );
- id->p_decoder->p_module = 0;
+ id->p_decoder->p_module = NULL;
return VLC_EGENERIC;
}
id->p_encoder->fmt_in.audio.i_format = id->p_encoder->fmt_in.i_codec;
if( fmt_last.audio.i_channels != id->p_encoder->fmt_in.audio.i_channels )
{
- msg_Err( p_stream, "no audio filter found for mixing from"
- " %i to %i channels", fmt_last.audio.i_channels,
- id->p_encoder->fmt_in.audio.i_channels );
-#if 0
- /* FIXME : this might work, but only if the encoder is restarted */
+#if 1
+ module_Unneed( id->p_encoder, id->p_encoder->p_module );
+ id->p_encoder->p_module = NULL;
+
+ /* This might work, but only if the encoder is restarted */
id->p_encoder->fmt_in.audio.i_channels = fmt_last.audio.i_channels;
id->p_encoder->fmt_out.audio.i_channels = fmt_last.audio.i_channels;
id->p_encoder->fmt_out.audio.i_physical_channels =
id->p_encoder->fmt_out.audio.i_original_channels =
fmt_last.audio.i_physical_channels;
+
+ msg_Dbg( p_stream, "number of audio channels for mixing changed, "
+ "trying to reopen the encoder for mixing %i to %i channels",
+ fmt_last.audio.i_channels,
+ id->p_encoder->fmt_in.audio.i_channels );
+
+ /* reload encoder */
+ id->p_encoder->p_cfg = p_stream->p_sys->p_audio_cfg;
+ id->p_encoder->p_module =
+ module_Need( id->p_encoder, "encoder", p_sys->psz_aenc, VLC_TRUE );
+ if( !id->p_encoder->p_module )
+ {
+ msg_Err( p_stream, "cannot find encoder (%s)", p_sys->psz_aenc );
+ transcode_audio_close( p_stream, id );
+ return VLC_EGENERIC;
+ }
+ id->p_encoder->fmt_in.audio.i_format = id->p_encoder->fmt_in.i_codec;
+ id->p_encoder->fmt_in.audio.i_bitspersample =
+ audio_BitsPerSample( id->p_encoder->fmt_in.i_codec );
#else
+ msg_Err( p_stream, "no audio filter found for mixing from"
+ " %i to %i channels", fmt_last.audio.i_channels,
+ id->p_encoder->fmt_in.audio.i_channels );
+
transcode_audio_close( p_stream, id );
return VLC_EGENERIC;
#endif
/* Close decoder */
if( id->p_decoder->p_module )
module_Unneed( id->p_decoder, id->p_decoder->p_module );
- id->p_decoder->p_module = 0;
+ id->p_decoder->p_module = NULL;
/* Close encoder */
if( id->p_encoder->p_module )
module_Unneed( id->p_encoder, id->p_encoder->p_module );
- id->p_encoder->p_module = 0;
+ id->p_encoder->p_module = NULL;
/* Close filters */
for( i = 0; i < id->i_filter; i++ )
msg_Dbg( p_stream, "no video filter found" );
vlc_object_detach( id->pp_ufilter[id->i_ufilter] );
vlc_object_destroy( id->pp_ufilter[id->i_ufilter] );
+ id->pp_ufilter[id->i_ufilter] = NULL;
}
}
}
/* Check if we have a subpicture to overlay */
if( p_sys->p_spu )
{
- p_subpic = spu_SortSubpictures( p_sys->p_spu, p_pic->date );
+ p_subpic = spu_SortSubpictures( p_sys->p_spu, p_pic->date,
+ VLC_FALSE /* Fixme: check if stream is paused */ );
/* TODO: get another pic */
}
/* Check if we have a subpicture to send */
if( p_sys->p_spu && in->i_dts > 0)
{
- p_subpic = spu_SortSubpictures( p_sys->p_spu, in->i_dts );
+ p_subpic = spu_SortSubpictures( p_sys->p_spu, in->i_dts, VLC_FALSE );
}
else
{