[vlc-devel] [RFC PATCH 3/9] decoder: change LoadDecoder arguments
Thomas Guillem
thomas at gllm.fr
Sat Jul 9 12:20:11 CEST 2016
The module type and name can now be specified with LoadDecoder arguments.
---
src/input/decoder.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index cbc68e9..066aba8 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -137,8 +137,8 @@ struct decoder_owner_sys_t
/**
* Load a decoder module
*/
-static int LoadDecoder( decoder_t *p_dec, bool b_packetizer,
- const es_format_t *restrict p_fmt )
+static int LoadDecoder( decoder_t *p_dec, const char *psz_type,
+ const char *psz_name, const es_format_t *restrict p_fmt )
{
p_dec->b_frame_drop_allowed = true;
p_dec->i_extra_picture_buffers = 0;
@@ -154,10 +154,9 @@ static int LoadDecoder( decoder_t *p_dec, bool b_packetizer,
es_format_Init( &p_dec->fmt_out, UNKNOWN_ES, 0 );
/* Find a suitable decoder/packetizer module */
- if( !b_packetizer )
- p_dec->p_module = module_need( p_dec, "decoder", "$codec", false );
- else
- p_dec->p_module = module_need( p_dec, "packetizer", "$packetizer", false );
+ p_dec->p_module = module_need( p_dec, psz_type,
+ psz_name == NULL ? "$codec" : psz_name,
+ false );
if( !p_dec->p_module )
{
@@ -1008,7 +1007,7 @@ static void DecoderProcessVideo( decoder_t *p_dec, block_t *p_block )
DecoderDecodeVideo( p_dec, NULL );
/* Restart the decoder module */
UnloadDecoder( p_dec );
- if( LoadDecoder( p_dec, false, &p_packetizer->fmt_out ) )
+ if( LoadDecoder( p_dec, "decoder", NULL, &p_packetizer->fmt_out ) )
{
p_dec->b_error = true;
block_ChainRelease( p_packetized_block );
@@ -1191,7 +1190,7 @@ static void DecoderProcessAudio( decoder_t *p_dec, block_t *p_block )
DecoderDecodeAudio( p_dec, NULL );
/* Restart the decoder module */
UnloadDecoder( p_dec );
- if( LoadDecoder( p_dec, false, &p_packetizer->fmt_out ) )
+ if( LoadDecoder( p_dec, "decoder", NULL, &p_packetizer->fmt_out ) )
{
p_dec->b_error = true;
block_ChainRelease( p_packetized_block );
@@ -1614,7 +1613,7 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
vlc_custom_create( p_parent, sizeof( decoder_t ), "packetizer" );
if( p_owner->p_packetizer )
{
- if( LoadDecoder( p_owner->p_packetizer, true, fmt ) )
+ if( LoadDecoder( p_owner->p_packetizer, "packetizer", NULL, fmt ) )
{
vlc_object_release( p_owner->p_packetizer );
p_owner->p_packetizer = NULL;
@@ -1628,7 +1627,7 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
}
/* Find a suitable decoder/packetizer module */
- if( LoadDecoder( p_dec, p_sout != NULL, fmt ) )
+ if( LoadDecoder( p_dec, p_sout == NULL ? "decoder" : "packetizer", NULL, fmt ) )
return p_dec;
/* Copy ourself the input replay gain */
--
2.8.1
More information about the vlc-devel
mailing list