[vlc-devel] [RFC/WIP PATCH 2/3] decoder: move extra packetizer creation
Thomas Guillem
thomas at gllm.fr
Fri Jul 1 12:18:31 CEST 2016
---
src/input/decoder.c | 40 +++++++++++++++++++++++++---------------
1 file changed, 25 insertions(+), 15 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 8819018..6987fed 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -189,6 +189,29 @@ static void UnloadDecoder( decoder_t *p_dec )
p_dec->b_error = false;
}
+static int CreateExtraPacketizer( decoder_t *p_dec, const es_format_t *fmt,
+ const char *psz_name )
+{
+ decoder_owner_sys_t *p_owner = p_dec->p_owner;
+
+ p_owner->p_packetizer =
+ vlc_custom_create( p_dec, sizeof( decoder_t ), "packetizer" );
+ if( !p_owner->p_packetizer )
+ return VLC_ENOMEM;
+
+ if( LoadDecoder( p_owner->p_packetizer, "packetizer", psz_name, fmt ) )
+ {
+ vlc_object_release( p_owner->p_packetizer );
+ p_owner->p_packetizer = NULL;
+ return VLC_EGENERIC;
+ }
+ else
+ {
+ p_owner->p_packetizer->fmt_out.b_packetized = true;
+ return VLC_SUCCESS;
+ }
+}
+
static void DecoderUpdateFormatLocked( decoder_t *p_dec )
{
decoder_owner_sys_t *p_owner = p_dec->p_owner;
@@ -1600,21 +1623,8 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
/* Load a packetizer module if the input is not already packetized */
if( p_sout == NULL && !fmt->b_packetized )
{
- p_owner->p_packetizer =
- vlc_custom_create( p_parent, sizeof( decoder_t ), "packetizer" );
- if( p_owner->p_packetizer )
- {
- if( LoadDecoder( p_owner->p_packetizer, "packetizer", NULL, fmt ) )
- {
- vlc_object_release( p_owner->p_packetizer );
- p_owner->p_packetizer = NULL;
- }
- else
- {
- p_owner->p_packetizer->fmt_out.b_packetized = true;
- fmt = &p_owner->p_packetizer->fmt_out;
- }
- }
+ if( CreateExtraPacketizer( p_dec, fmt, NULL ) == VLC_SUCCESS )
+ fmt = &p_owner->p_packetizer->fmt_out;
}
/* Find a suitable decoder/packetizer module */
--
2.8.1
More information about the vlc-devel
mailing list