id = malloc( sizeof( sout_stream_id_t ) );
if( !id )
- {
- msg_Err( p_stream, "out of memory" );
goto error;
- }
memset( id, 0, sizeof(sout_stream_id_t) );
id->id = NULL;
/* Create decoder object */
id->p_decoder = vlc_object_create( p_stream, VLC_OBJECT_DECODER );
if( !id->p_decoder )
- {
- msg_Err( p_stream, "out of memory" );
goto error;
- }
vlc_object_attach( id->p_decoder, p_stream );
id->p_decoder->p_module = NULL;
id->p_decoder->fmt_in = *p_fmt;
/* Create encoder object */
id->p_encoder = vlc_object_create( p_stream, VLC_OBJECT_ENCODER );
if( !id->p_encoder )
- {
- msg_Err( p_stream, "out of memory" );
goto error;
- }
vlc_object_attach( id->p_encoder, p_stream );
id->p_encoder->p_module = NULL;
return id;
- error:
- if( id->p_decoder )
+error:
+ if( id )
{
- vlc_object_detach( id->p_decoder );
- vlc_object_release( id->p_decoder );
- id->p_decoder = NULL;
- }
+ if( id->p_decoder )
+ {
+ vlc_object_detach( id->p_decoder );
+ vlc_object_release( 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_release( id->p_encoder );
- id->p_encoder = NULL;
- }
+ if( id->p_encoder )
+ {
+ vlc_object_detach( id->p_encoder );
+ es_format_Clean( &id->p_encoder->fmt_out );
+ vlc_object_release( id->p_encoder );
+ id->p_encoder = NULL;
+ }
- free( id );
+ free( id );
+ }
return NULL;
}
id->p_decoder->fmt_out.i_codec );
id->p_encoder->fmt_in.audio.i_format = id->p_decoder->fmt_out.i_codec;
- if( ( id->p_encoder->fmt_out.i_codec == VLC_FOURCC('s','a','m','r') ) ||
- ( id->p_encoder->fmt_out.i_codec == VLC_FOURCC('s','a','w','b') ) )
- id->p_encoder->fmt_in.audio.i_rate = id->p_encoder->fmt_out.audio.i_rate;
- else
- id->p_encoder->fmt_in.audio.i_rate = fmt_last.audio.i_rate;
+ 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;
id->p_encoder->fmt_in.audio.i_original_channels =
fmt_last.audio.i_rate != id->p_encoder->fmt_in.audio.i_rate )
{
/* We'll have to go through fl32 first */
- es_format_t fmt_out = id->p_encoder->fmt_in;
- fmt_out.i_codec = fmt_out.audio.i_format = VLC_FOURCC('f','l','3','2');
- filter_chain_AppendFilter( id->p_f_chain, NULL, NULL, &fmt_last, &fmt_out );
- fmt_last = fmt_out;
+ fmt_last.i_codec = fmt_last.audio.i_format = VLC_FOURCC('f','l','3','2');
+ fmt_last.audio.i_bitspersample = aout_BitsPerSample( fmt_last.i_codec );
+ filter_chain_AppendFilter( id->p_f_chain, NULL, NULL, NULL, &fmt_last );
+ fmt_last = *filter_chain_GetFmtOut( id->p_f_chain );
}
for( i = 0; i < 4; i++ )
f_aspect = f_aspect * i_dst_width / i_dst_height;
/* Store calculated values */
- id->p_encoder->fmt_out.video.i_width = i_dst_width;
- id->p_encoder->fmt_out.video.i_height = i_dst_height;
+ id->p_encoder->fmt_out.video.i_width =
+ id->p_encoder->fmt_out.video.i_visible_width = i_dst_width;
+ id->p_encoder->fmt_out.video.i_height =
+ id->p_encoder->fmt_out.video.i_visible_height = i_dst_height;
- id->p_encoder->fmt_in.video.i_width = i_dst_width;
- id->p_encoder->fmt_in.video.i_height = i_dst_height;
+ id->p_encoder->fmt_in.video.i_width =
+ id->p_encoder->fmt_in.video.i_visible_width = i_dst_width;
+ id->p_encoder->fmt_in.video.i_height =
+ id->p_encoder->fmt_in.video.i_visible_height = i_dst_height;
msg_Dbg( p_stream, "source %ix%i, destination %ix%i",
i_src_width, i_src_height,
transcode_video_filter_allocation_init,
transcode_video_filter_allocation_clear,
p_stream->p_sys );
- filter_chain_Reset( id->p_uf_chain, &id->p_decoder->fmt_out,
+ filter_chain_Reset( id->p_uf_chain, &id->p_encoder->fmt_in,
&id->p_encoder->fmt_in );
filter_chain_AppendFromString( id->p_uf_chain, p_sys->psz_vf2 );
p_fmt_out = filter_chain_GetFmtOut( id->p_uf_chain );
}
}
- fmt = filter_chain_GetFmtOut( id->p_f_chain )->video;
+ if( filter_chain_GetLength( id->p_f_chain ) > 0 )
+ fmt = filter_chain_GetFmtOut( id->p_f_chain )->video;
+ else
+ fmt = id->p_decoder->fmt_out.video;
/* FIXME (shouldn't have to be done here) */
fmt.i_sar_num = fmt.i_aspect * fmt.i_height / fmt.i_width;
sout_stream_id_t *id = p_sys->id_video;
picture_t *p_pic;
- while( !p_sys->b_die && !p_sys->b_error )
+ while( vlc_object_alive (p_sys) && !p_sys->b_error )
{
block_t *p_block;
while( p_sys->i_last_pic == p_sys->i_first_pic )
{
vlc_cond_wait( &p_sys->cond, &p_sys->lock_out );
- if( p_sys->b_die || p_sys->b_error ) break;
+ if( !vlc_object_alive (p_sys) || p_sys->b_error ) break;
}
- if( p_sys->b_die || p_sys->b_error )
+ if( !vlc_object_alive (p_sys) || p_sys->b_error )
{
vlc_mutex_unlock( &p_sys->lock_out );
break;