vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sat Nov 1 18:30:39 2014 +0200| [c1111ae38b03d71900bebcc98ca0410550e6beb8] | committer: Rémi Denis-Courmont
decoder: remove decoder_DeleteSubpicture() and fix a leak > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c1111ae38b03d71900bebcc98ca0410550e6beb8 --- include/vlc_codec.h | 10 ++-------- modules/codec/cvdsub.c | 2 +- modules/codec/kate.c | 4 ++-- modules/codec/libass.c | 2 +- modules/codec/spudec/parse.c | 4 ++-- modules/codec/svcdsub.c | 2 +- modules/codec/telx.c | 2 +- modules/codec/zvbi.c | 2 +- modules/stream_out/transcode/spu.c | 8 +------- src/input/decoder.c | 26 -------------------------- src/libvlccore.sym | 1 - 11 files changed, 12 insertions(+), 51 deletions(-) diff --git a/include/vlc_codec.h b/include/vlc_codec.h index 7c43992..8f33165 100644 --- a/include/vlc_codec.h +++ b/include/vlc_codec.h @@ -109,9 +109,8 @@ struct decoder_t int (*pf_aout_format_update)( decoder_t * ); /* SPU output callbacks - * XXX use decoder_NewSubpicture and decoder_DeleteSubpicture */ + * XXX use decoder_NewSubpicture */ subpicture_t *(*pf_spu_buffer_new)( decoder_t *, const subpicture_updater_t * ); - void (*pf_spu_buffer_del)( decoder_t *, subpicture_t * ); /* Input attachments * XXX use decoder_GetInputAttachments */ @@ -218,17 +217,12 @@ VLC_API block_t * decoder_NewAudioBuffer( decoder_t *, int i_size ) VLC_USED; /** * This function will return a new subpicture usable by a decoder as an output - * buffer. You have to release it using decoder_DeleteSubpicture or by returning + * buffer. You have to release it using subpicture_Delete() or by returning * it to the caller as a pf_decode_sub return value. */ VLC_API subpicture_t * decoder_NewSubpicture( decoder_t *, const subpicture_updater_t * ) VLC_USED; /** - * This function will release a subpicture created by decoder_NewSubicture. - */ -VLC_API void decoder_DeleteSubpicture( decoder_t *, subpicture_t *p_subpicture ); - -/** * This function gives all input attachments at once. * * You MUST release the returned values diff --git a/modules/codec/cvdsub.c b/modules/codec/cvdsub.c index aaaa203..21098b1 100644 --- a/modules/codec/cvdsub.c +++ b/modules/codec/cvdsub.c @@ -526,7 +526,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data ) if( !p_region ) { msg_Err( p_dec, "cannot allocate SPU region" ); - decoder_DeleteSubpicture( p_dec, p_spu ); + subpicture_Delete( p_spu ); return NULL; } diff --git a/modules/codec/kate.c b/modules/codec/kate.c index 93cbb3d..b006ddc 100644 --- a/modules/codec/kate.c +++ b/modules/codec/kate.c @@ -1261,7 +1261,7 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu, if( !p_bitmap_region ) { msg_Err( p_dec, "cannot allocate SPU region" ); - decoder_DeleteSubpicture( p_dec, p_spu ); + subpicture_Delete( p_dec, p_spu ); return NULL; } @@ -1283,7 +1283,7 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu, msg_Err( p_dec, "cannot allocate SPU region" ); if( p_bitmap_region ) subpicture_region_Delete( p_bitmap_region ); - decoder_DeleteSubpicture( p_dec, p_spu ); + subpicture_Delete( p_spu ); return NULL; } diff --git a/modules/codec/libass.c b/modules/codec/libass.c index 5590df1..9ea4f38 100644 --- a/modules/codec/libass.c +++ b/modules/codec/libass.c @@ -350,7 +350,7 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) p_spu_sys->i_pts = p_block->i_pts; if( !p_spu_sys->p_subs_data ) { - decoder_DeleteSubpicture( p_dec, p_spu ); + subpicture_Delete( p_spu ); block_Release( p_block ); return NULL; } diff --git a/modules/codec/spudec/parse.c b/modules/codec/spudec/parse.c index ccc8cb6..60ed0dd 100644 --- a/modules/codec/spudec/parse.c +++ b/modules/codec/spudec/parse.c @@ -113,7 +113,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec ) if( ParseControlSeq( p_dec, p_spu, &spu_data, &spu_properties, p_sys->i_pts ) ) { /* There was a parse error, delete the subpicture */ - decoder_DeleteSubpicture( p_dec, p_spu ); + subpicture_Delete( p_spu ); return NULL; } @@ -131,7 +131,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec ) if( ParseRLE( p_dec, &spu_data, &spu_properties ) ) { /* There was a parse error, delete the subpicture */ - decoder_DeleteSubpicture( p_dec, p_spu ); + subpicture_Delete( p_spu ); free( spu_data.p_data ); return NULL; } diff --git a/modules/codec/svcdsub.c b/modules/codec/svcdsub.c index 953070b..574e2d4 100644 --- a/modules/codec/svcdsub.c +++ b/modules/codec/svcdsub.c @@ -465,7 +465,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data ) if( !p_region ) { msg_Err( p_dec, "cannot allocate SVCD subtitle region" ); - decoder_DeleteSubpicture( p_dec, p_spu ); + subpicture_Delete( p_spu ); return NULL; } diff --git a/modules/codec/telx.c b/modules/codec/telx.c index 95fa9da..9e4228b 100644 --- a/modules/codec/telx.c +++ b/modules/codec/telx.c @@ -722,7 +722,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block ) error: if ( p_spu != NULL ) { - decoder_DeleteSubpicture( p_dec, p_spu ); + subpicture_Delete( p_spu ); p_spu = NULL; } diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c index 29db306..2d2d32f 100644 --- a/modules/codec/zvbi.c +++ b/modules/codec/zvbi.c @@ -523,7 +523,7 @@ static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt, if( p_spu->p_region == NULL ) { msg_Err( p_dec, "cannot allocate SPU region" ); - decoder_DeleteSubpicture( p_dec, p_spu ); + subpicture_Delete( p_spu ); return NULL; } diff --git a/modules/stream_out/transcode/spu.c b/modules/stream_out/transcode/spu.c index 50d9e2d..1250dcc 100644 --- a/modules/stream_out/transcode/spu.c +++ b/modules/stream_out/transcode/spu.c @@ -45,11 +45,6 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec, return p_subpicture; } -static void spu_del_buffer( decoder_t *p_dec, subpicture_t *p_subpic ) -{ - VLC_UNUSED( p_dec ); - subpicture_Delete( p_subpic ); -} int transcode_spu_new( sout_stream_t *p_stream, sout_stream_id_sys_t *id ) { sout_stream_sys_t *p_sys = p_stream->p_sys; @@ -61,7 +56,6 @@ int transcode_spu_new( sout_stream_t *p_stream, sout_stream_id_sys_t *id ) /* Initialization of decoder structures */ id->p_decoder->pf_decode_sub = NULL; id->p_decoder->pf_spu_buffer_new = spu_new_buffer; - id->p_decoder->pf_spu_buffer_del = spu_del_buffer; id->p_decoder->p_owner = (decoder_owner_sys_t *)p_stream; /* id->p_decoder->p_cfg = p_sys->p_spu_cfg; */ @@ -151,7 +145,7 @@ int transcode_spu_process( sout_stream_t *p_stream, block_t *p_block; p_block = id->p_encoder->pf_encode_sub( id->p_encoder, p_subpic ); - spu_del_buffer( id->p_decoder, p_subpic ); + subpicture_Delete( p_subpic ); if( p_block ) { block_ChainAppend( out, p_block ); diff --git a/src/input/decoder.c b/src/input/decoder.c index 7c0c785..fd615d7 100644 --- a/src/input/decoder.c +++ b/src/input/decoder.c @@ -70,7 +70,6 @@ static int vout_update_format( decoder_t * ); static picture_t *vout_new_buffer( decoder_t * ); static int aout_update_format( decoder_t * ); static subpicture_t *spu_new_buffer( decoder_t *, const subpicture_updater_t * ); -static void spu_del_buffer( decoder_t *, subpicture_t * ); struct decoder_owner_sys_t { @@ -192,11 +191,6 @@ subpicture_t *decoder_NewSubpicture( decoder_t *p_decoder, return p_subpicture; } -void decoder_DeleteSubpicture( decoder_t *p_decoder, subpicture_t *p_subpicture ) -{ - p_decoder->pf_spu_buffer_del( p_decoder, p_subpicture ); -} - /* decoder_GetInputAttachments: */ int decoder_GetInputAttachments( decoder_t *p_dec, @@ -770,7 +764,6 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent, p_dec->pf_vout_format_update = vout_update_format; p_dec->pf_vout_buffer_new = vout_new_buffer; p_dec->pf_spu_buffer_new = spu_new_buffer; - p_dec->pf_spu_buffer_del = spu_del_buffer; /* */ p_dec->pf_get_attachments = DecoderGetInputAttachments; p_dec->pf_get_display_date = DecoderGetDisplayDate; @@ -2218,22 +2211,3 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec, return p_subpic; } - -static void spu_del_buffer( decoder_t *p_dec, subpicture_t *p_subpic ) -{ - decoder_owner_sys_t *p_owner = p_dec->p_owner; - vout_thread_t *p_vout = NULL; - - p_vout = input_resource_HoldVout( p_owner->p_resource ); - if( !p_vout || p_owner->p_spu_vout != p_vout ) - { - if( p_vout ) - vlc_object_release( p_vout ); - msg_Warn( p_dec, "no vout found, leaking subpicture" ); - return; - } - - subpicture_Delete( p_subpic ); - - vlc_object_release( p_vout ); -} diff --git a/src/libvlccore.sym b/src/libvlccore.sym index dcf591d..b53ad9d 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -72,7 +72,6 @@ date_Increment date_Init date_Move date_Set -decoder_DeleteSubpicture decoder_GetDisplayDate decoder_GetDisplayRate decoder_GetInputAttachments _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
