[vlc-commits] decoder: factor some common code into DecoderUpdateFormatLocked()
Rémi Denis-Courmont
git at videolan.org
Sat Mar 21 18:01:24 CET 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Mar 21 19:00:57 2015 +0200| [f1c6b2db25d12260771e8cd73412a61b92bc2d01] | committer: Rémi Denis-Courmont
decoder: factor some common code into DecoderUpdateFormatLocked()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f1c6b2db25d12260771e8cd73412a61b92bc2d01
---
src/input/decoder.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 5943843..703ddd0 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -138,13 +138,19 @@ static void DecoderUpdateFormatLocked( decoder_t *p_dec )
vlc_assert_locked( &p_owner->lock );
- p_owner->b_fmt_description = true;
+ es_format_Clean( &p_owner->fmt );
+ es_format_Copy( &p_owner->fmt, &p_dec->fmt_out );
/* Move p_description */
- if( p_owner->p_description && p_dec->p_description )
- vlc_meta_Delete( p_owner->p_description );
- p_owner->p_description = p_dec->p_description;
- p_dec->p_description = NULL;
+ if( p_dec->p_description != NULL )
+ {
+ if( p_owner->p_description != NULL )
+ vlc_meta_Delete( p_owner->p_description );
+ p_owner->p_description = p_dec->p_description;
+ p_dec->p_description = NULL;
+ }
+
+ p_owner->b_fmt_description = true;
}
static bool DecoderIsFlushing( decoder_t *p_dec )
@@ -273,11 +279,8 @@ static int aout_update_format( decoder_t *p_dec )
p_owner->p_aout = p_aout;
- es_format_Clean( &p_owner->fmt );
- es_format_Copy( &p_owner->fmt, &p_dec->fmt_out );
- aout_FormatPrepare( &p_owner->fmt.audio );
-
DecoderUpdateFormatLocked( p_dec );
+ aout_FormatPrepare( &p_owner->fmt.audio );
if( unlikely(p_owner->b_paused) && p_aout != NULL )
/* fake pause if needed */
@@ -415,12 +418,8 @@ static int vout_update_format( decoder_t *p_dec )
vlc_mutex_lock( &p_owner->lock );
p_owner->p_vout = p_vout;
- es_format_Clean( &p_owner->fmt );
- es_format_Copy( &p_owner->fmt, &p_dec->fmt_out );
- p_owner->fmt.video.i_chroma = p_dec->fmt_out.i_codec;
-
DecoderUpdateFormatLocked( p_dec );
-
+ p_owner->fmt.video.i_chroma = p_dec->fmt_out.i_codec;
vlc_mutex_unlock( &p_owner->lock );
if( p_owner->p_input != NULL )
@@ -779,8 +778,6 @@ static void DecoderProcessSout( decoder_t *p_dec, block_t *p_block )
if( p_owner->p_sout_input == NULL )
{
vlc_mutex_lock( &p_owner->lock );
- es_format_Clean( &p_owner->fmt );
- es_format_Copy( &p_owner->fmt, &p_dec->fmt_out );
DecoderUpdateFormatLocked( p_dec );
vlc_mutex_unlock( &p_owner->lock );
More information about the vlc-commits
mailing list