Commit a90263be authored by Ilkka Ollakka's avatar Ilkka Ollakka

transcode: store fmt per id/track

This helps to keep filters etc if there is for example 2 different audio
tracks with different channel count etc.
parent 602d02a0
...@@ -83,8 +83,8 @@ static int transcode_audio_initialize_filters( sout_stream_t *p_stream, sout_str ...@@ -83,8 +83,8 @@ static int transcode_audio_initialize_filters( sout_stream_t *p_stream, sout_str
id->p_decoder->p_module = NULL; id->p_decoder->p_module = NULL;
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_sys->fmt_audio.i_rate = fmt_last->i_rate; id->fmt_audio.i_rate = fmt_last->i_rate;
p_sys->fmt_audio.i_physical_channels = fmt_last->i_physical_channels; id->fmt_audio.i_physical_channels = fmt_last->i_physical_channels;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -255,8 +255,8 @@ int transcode_audio_process( sout_stream_t *p_stream, ...@@ -255,8 +255,8 @@ int transcode_audio_process( sout_stream_t *p_stream,
} }
/* Check if audio format has changed, and filters need reinit */ /* Check if audio format has changed, and filters need reinit */
if( unlikely( ( id->p_decoder->fmt_out.audio.i_rate != p_sys->fmt_audio.i_rate ) || if( unlikely( ( id->p_decoder->fmt_out.audio.i_rate != id->fmt_audio.i_rate ) ||
( id->p_decoder->fmt_out.audio.i_physical_channels != p_sys->fmt_audio.i_physical_channels ) ) ) ( id->p_decoder->fmt_out.audio.i_physical_channels != id->fmt_audio.i_physical_channels ) ) )
{ {
msg_Info( p_stream, "Audio changed, trying to reinitialize filters" ); msg_Info( p_stream, "Audio changed, trying to reinitialize filters" );
if( id->p_af_chain != NULL ) if( id->p_af_chain != NULL )
......
...@@ -26,7 +26,6 @@ struct sout_stream_sys_t ...@@ -26,7 +26,6 @@ struct sout_stream_sys_t
/* Audio */ /* Audio */
vlc_fourcc_t i_acodec; /* codec audio (0 if not transcode) */ vlc_fourcc_t i_acodec; /* codec audio (0 if not transcode) */
audio_sample_format_t fmt_audio;
char *psz_aenc; char *psz_aenc;
char *psz_alang; char *psz_alang;
config_chain_t *p_audio_cfg; config_chain_t *p_audio_cfg;
...@@ -38,7 +37,6 @@ struct sout_stream_sys_t ...@@ -38,7 +37,6 @@ struct sout_stream_sys_t
/* Video */ /* Video */
vlc_fourcc_t i_vcodec; /* codec video (0 if not transcode) */ vlc_fourcc_t i_vcodec; /* codec video (0 if not transcode) */
video_format_t fmt_input_video;
char *psz_venc; char *psz_venc;
config_chain_t *p_video_cfg; config_chain_t *p_video_cfg;
int i_vbitrate; int i_vbitrate;
...@@ -93,8 +91,14 @@ struct sout_stream_id_sys_t ...@@ -93,8 +91,14 @@ struct sout_stream_id_sys_t
{ {
filter_chain_t *p_f_chain; /**< Video filters */ filter_chain_t *p_f_chain; /**< Video filters */
filter_chain_t *p_uf_chain; /**< User-specified video filters */ filter_chain_t *p_uf_chain; /**< User-specified video filters */
video_format_t fmt_input_video;
}; };
struct aout_filters *p_af_chain; /**< Audio filters */ struct
{
struct aout_filters *p_af_chain; /**< Audio filters */
audio_format_t fmt_audio;
};
}; };
/* Encoder */ /* Encoder */
......
...@@ -836,13 +836,13 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id, ...@@ -836,13 +836,13 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
if( unlikely ( if( unlikely (
id->p_encoder->p_module && id->p_encoder->p_module &&
!video_format_IsSimilar( &p_sys->fmt_input_video, &id->p_decoder->fmt_out.video ) !video_format_IsSimilar( &id->fmt_input_video, &id->p_decoder->fmt_out.video )
) )
) )
{ {
msg_Info( p_stream, "aspect-ratio changed, reiniting. %i -> %i : %i -> %i.", msg_Info( p_stream, "aspect-ratio changed, reiniting. %i -> %i : %i -> %i.",
p_sys->fmt_input_video.i_sar_num, id->p_decoder->fmt_out.video.i_sar_num, id->fmt_input_video.i_sar_num, id->p_decoder->fmt_out.video.i_sar_num,
p_sys->fmt_input_video.i_sar_den, id->p_decoder->fmt_out.video.i_sar_den id->fmt_input_video.i_sar_den, id->p_decoder->fmt_out.video.i_sar_den
); );
/* Close filters */ /* Close filters */
if( id->p_f_chain ) if( id->p_f_chain )
...@@ -860,7 +860,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id, ...@@ -860,7 +860,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
transcode_video_filter_init( p_stream, id ); transcode_video_filter_init( p_stream, id );
transcode_video_encoder_init( p_stream, id ); transcode_video_encoder_init( p_stream, id );
conversion_video_filter_append( id ); conversion_video_filter_append( id );
memcpy( &p_sys->fmt_input_video, &id->p_decoder->fmt_out.video, sizeof(video_format_t)); memcpy( &id->fmt_input_video, &id->p_decoder->fmt_out.video, sizeof(video_format_t));
} }
...@@ -875,7 +875,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id, ...@@ -875,7 +875,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
transcode_video_filter_init( p_stream, id ); transcode_video_filter_init( p_stream, id );
transcode_video_encoder_init( p_stream, id ); transcode_video_encoder_init( p_stream, id );
conversion_video_filter_append( id ); conversion_video_filter_append( id );
memcpy( &p_sys->fmt_input_video, &id->p_decoder->fmt_out.video, sizeof(video_format_t)); memcpy( &id->fmt_input_video, &id->p_decoder->fmt_out.video, sizeof(video_format_t));
if( transcode_video_encoder_open( p_stream, id ) != VLC_SUCCESS ) if( transcode_video_encoder_open( p_stream, id ) != VLC_SUCCESS )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment