From 132b8e6f80921f117f0045b804d692fdcec3c602 Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Fri, 5 Dec 2008 10:47:31 +0100 Subject: [PATCH] Allow decoder/packetizer to output meta data. They are ignored for now. --- include/vlc_codec.h | 10 ++++++++-- modules/stream_out/mosaic_bridge.c | 4 ++++ modules/stream_out/transcode.c | 9 +++++++++ src/input/decoder.c | 11 ++++++++--- src/input/demux.c | 3 +++ src/misc/image.c | 4 ++++ 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/include/vlc_codec.h b/include/vlc_codec.h index 5003e63f8a..291581c473 100644 --- a/include/vlc_codec.h +++ b/include/vlc_codec.h @@ -62,10 +62,10 @@ struct decoder_t es_format_t fmt_out; /* Some decoders only accept packetized data (ie. not truncated) */ - bool b_need_packetized; + bool b_need_packetized; /* Tell the decoder if it is allowed to drop frames */ - bool b_pace_control; + bool b_pace_control; /* */ picture_t * ( * pf_decode_video )( decoder_t *, block_t ** ); @@ -81,6 +81,12 @@ struct decoder_t * globaly, not necessary for the current packet */ block_t * ( * pf_get_cc ) ( decoder_t *, bool pb_present[4] ); + /* Meta data at codec level + * The decoder owner set it back to NULL once it has retreived what it needs. + * The decoder owner is responsible of its release except when you overwrite it. + */ + vlc_meta_t *p_description; + /* * Owner fields * XXX You MUST not use them directly. diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c index daec5cdb93..6d18e07d2e 100644 --- a/modules/stream_out/mosaic_bridge.c +++ b/modules/stream_out/mosaic_bridge.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -473,6 +474,9 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id ) if( p_sys->p_decoder->p_module ) module_unneed( p_sys->p_decoder, p_sys->p_decoder->p_module ); + if( p_sys->p_decoder->p_description ) + vlc_meta_Delete( p_sys->p_decoder->p_description ); + vlc_object_detach( p_sys->p_decoder ); vlc_object_release( p_sys->p_decoder ); diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c index e081a0caa1..4a7680e902 100644 --- a/modules/stream_out/transcode.c +++ b/modules/stream_out/transcode.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -1275,6 +1276,10 @@ static void transcode_audio_close( sout_stream_id_t *id ) module_unneed( id->p_decoder, id->p_decoder->p_module ); id->p_decoder->p_module = NULL; + if( id->p_decoder->p_description ) + vlc_meta_Delete( id->p_decoder->p_description ); + id->p_decoder->p_description = NULL; + /* Close encoder */ if( id->p_encoder->p_module ) module_unneed( id->p_encoder, id->p_encoder->p_module ); @@ -1770,6 +1775,8 @@ static void transcode_video_close( sout_stream_t *p_stream, /* Close decoder */ if( id->p_decoder->p_module ) module_unneed( id->p_decoder, id->p_decoder->p_module ); + if( id->p_decoder->p_description ) + vlc_meta_Delete( id->p_decoder->p_description ); if( id->p_decoder->p_owner ) { @@ -2315,6 +2322,8 @@ static void transcode_spu_close( sout_stream_id_t *id) /* Close decoder */ if( id->p_decoder->p_module ) module_unneed( id->p_decoder, id->p_decoder->p_module ); + if( id->p_decoder->p_description ) + vlc_meta_Delete( id->p_decoder->p_description ); /* Close encoder */ if( id->p_encoder->p_module ) diff --git a/src/input/decoder.c b/src/input/decoder.c index 615a7307c6..12e6dd735e 100644 --- a/src/input/decoder.c +++ b/src/input/decoder.c @@ -687,13 +687,15 @@ static decoder_t * CreateDecoder( input_thread_t *p_input, p_dec->pf_get_cc = NULL; p_dec->pf_packetize = NULL; - /* Initialize the decoder fifo */ + /* Initialize the decoder */ p_dec->p_module = NULL; memset( &null_es_format, 0, sizeof(es_format_t) ); es_format_Copy( &p_dec->fmt_in, fmt ); es_format_Copy( &p_dec->fmt_out, &null_es_format ); + p_dec->p_description = NULL; + /* Allocate our private structure for the decoder */ p_dec->p_owner = p_owner = malloc( sizeof( decoder_owner_sys_t ) ); if( p_dec->p_owner == NULL ) @@ -2053,6 +2055,9 @@ static void DeleteDecoder( decoder_t * p_dec ) es_format_Clean( &p_dec->fmt_in ); es_format_Clean( &p_dec->fmt_out ); + if( p_dec->p_description ) + vlc_meta_Delete( p_dec->p_description ); + es_format_Clean( &p_owner->fmt_description ); if( p_owner->p_packetizer ) { @@ -2060,12 +2065,12 @@ static void DeleteDecoder( decoder_t * p_dec ) p_owner->p_packetizer->p_module ); es_format_Clean( &p_owner->p_packetizer->fmt_in ); es_format_Clean( &p_owner->p_packetizer->fmt_out ); + if( p_owner->p_packetizer->p_description ) + vlc_meta_Delete( p_owner->p_packetizer->p_description ); vlc_object_detach( p_owner->p_packetizer ); vlc_object_release( p_owner->p_packetizer ); } - es_format_Clean( &p_owner->fmt_description ); - vlc_cond_destroy( &p_owner->wait ); vlc_mutex_destroy( &p_owner->lock ); diff --git a/src/input/demux.c b/src/input/demux.c index 49fdf28f70..9ed4eeca66 100644 --- a/src/input/demux.c +++ b/src/input/demux.c @@ -28,6 +28,7 @@ #include "demux.h" #include #include +#include static bool SkipID3Tag( demux_t * ); static bool SkipAPETag( demux_t *p_demux ); @@ -602,6 +603,8 @@ void demux_PacketizerDestroy( decoder_t *p_packetizer ) if( p_packetizer->p_module ) module_unneed( p_packetizer, p_packetizer->p_module ); es_format_Clean( &p_packetizer->fmt_in ); + if( p_packetizer->p_description ) + vlc_meta_Delete( p_packetizer->p_description ); vlc_object_release( p_packetizer ); } diff --git a/src/misc/image.c b/src/misc/image.c index d4746f92fa..a28b119f91 100644 --- a/src/misc/image.c +++ b/src/misc/image.c @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -642,6 +643,9 @@ static void DeleteDecoder( decoder_t * p_dec ) es_format_Clean( &p_dec->fmt_in ); es_format_Clean( &p_dec->fmt_out ); + if( p_dec->p_description ) + vlc_meta_Delete( p_dec->p_description ); + vlc_object_release( p_dec ); p_dec = NULL; } -- 2.39.2