Commit c1111ae3 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

decoder: remove decoder_DeleteSubpicture() and fix a leak

parent 572925b6
...@@ -109,9 +109,8 @@ struct decoder_t ...@@ -109,9 +109,8 @@ struct decoder_t
int (*pf_aout_format_update)( decoder_t * ); int (*pf_aout_format_update)( decoder_t * );
/* SPU output callbacks /* 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 * ); subpicture_t *(*pf_spu_buffer_new)( decoder_t *, const subpicture_updater_t * );
void (*pf_spu_buffer_del)( decoder_t *, subpicture_t * );
/* Input attachments /* Input attachments
* XXX use decoder_GetInputAttachments */ * XXX use decoder_GetInputAttachments */
...@@ -218,16 +217,11 @@ VLC_API block_t * decoder_NewAudioBuffer( decoder_t *, int i_size ) VLC_USED; ...@@ -218,16 +217,11 @@ 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 * 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. * 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; 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. * This function gives all input attachments at once.
* *
......
...@@ -526,7 +526,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data ) ...@@ -526,7 +526,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
if( !p_region ) if( !p_region )
{ {
msg_Err( p_dec, "cannot allocate SPU region" ); msg_Err( p_dec, "cannot allocate SPU region" );
decoder_DeleteSubpicture( p_dec, p_spu ); subpicture_Delete( p_spu );
return NULL; return NULL;
} }
......
...@@ -1261,7 +1261,7 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu, ...@@ -1261,7 +1261,7 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu,
if( !p_bitmap_region ) if( !p_bitmap_region )
{ {
msg_Err( p_dec, "cannot allocate SPU region" ); msg_Err( p_dec, "cannot allocate SPU region" );
decoder_DeleteSubpicture( p_dec, p_spu ); subpicture_Delete( p_dec, p_spu );
return NULL; return NULL;
} }
...@@ -1283,7 +1283,7 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu, ...@@ -1283,7 +1283,7 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu,
msg_Err( p_dec, "cannot allocate SPU region" ); msg_Err( p_dec, "cannot allocate SPU region" );
if( p_bitmap_region ) if( p_bitmap_region )
subpicture_region_Delete( p_bitmap_region ); subpicture_region_Delete( p_bitmap_region );
decoder_DeleteSubpicture( p_dec, p_spu ); subpicture_Delete( p_spu );
return NULL; return NULL;
} }
......
...@@ -350,7 +350,7 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -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; p_spu_sys->i_pts = p_block->i_pts;
if( !p_spu_sys->p_subs_data ) if( !p_spu_sys->p_subs_data )
{ {
decoder_DeleteSubpicture( p_dec, p_spu ); subpicture_Delete( p_spu );
block_Release( p_block ); block_Release( p_block );
return NULL; return NULL;
} }
......
...@@ -113,7 +113,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec ) ...@@ -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 ) ) if( ParseControlSeq( p_dec, p_spu, &spu_data, &spu_properties, p_sys->i_pts ) )
{ {
/* There was a parse error, delete the subpicture */ /* There was a parse error, delete the subpicture */
decoder_DeleteSubpicture( p_dec, p_spu ); subpicture_Delete( p_spu );
return NULL; return NULL;
} }
...@@ -131,7 +131,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec ) ...@@ -131,7 +131,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec )
if( ParseRLE( p_dec, &spu_data, &spu_properties ) ) if( ParseRLE( p_dec, &spu_data, &spu_properties ) )
{ {
/* There was a parse error, delete the subpicture */ /* There was a parse error, delete the subpicture */
decoder_DeleteSubpicture( p_dec, p_spu ); subpicture_Delete( p_spu );
free( spu_data.p_data ); free( spu_data.p_data );
return NULL; return NULL;
} }
......
...@@ -465,7 +465,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data ) ...@@ -465,7 +465,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
if( !p_region ) if( !p_region )
{ {
msg_Err( p_dec, "cannot allocate SVCD subtitle region" ); msg_Err( p_dec, "cannot allocate SVCD subtitle region" );
decoder_DeleteSubpicture( p_dec, p_spu ); subpicture_Delete( p_spu );
return NULL; return NULL;
} }
......
...@@ -722,7 +722,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block ) ...@@ -722,7 +722,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
error: error:
if ( p_spu != NULL ) if ( p_spu != NULL )
{ {
decoder_DeleteSubpicture( p_dec, p_spu ); subpicture_Delete( p_spu );
p_spu = NULL; p_spu = NULL;
} }
......
...@@ -523,7 +523,7 @@ static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt, ...@@ -523,7 +523,7 @@ static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt,
if( p_spu->p_region == NULL ) if( p_spu->p_region == NULL )
{ {
msg_Err( p_dec, "cannot allocate SPU region" ); msg_Err( p_dec, "cannot allocate SPU region" );
decoder_DeleteSubpicture( p_dec, p_spu ); subpicture_Delete( p_spu );
return NULL; return NULL;
} }
......
...@@ -45,11 +45,6 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec, ...@@ -45,11 +45,6 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec,
return p_subpicture; 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 ) 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; 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 ) ...@@ -61,7 +56,6 @@ int transcode_spu_new( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
/* Initialization of decoder structures */ /* Initialization of decoder structures */
id->p_decoder->pf_decode_sub = NULL; id->p_decoder->pf_decode_sub = NULL;
id->p_decoder->pf_spu_buffer_new = spu_new_buffer; 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_owner = (decoder_owner_sys_t *)p_stream;
/* id->p_decoder->p_cfg = p_sys->p_spu_cfg; */ /* id->p_decoder->p_cfg = p_sys->p_spu_cfg; */
...@@ -151,7 +145,7 @@ int transcode_spu_process( sout_stream_t *p_stream, ...@@ -151,7 +145,7 @@ int transcode_spu_process( sout_stream_t *p_stream,
block_t *p_block; block_t *p_block;
p_block = id->p_encoder->pf_encode_sub( id->p_encoder, p_subpic ); 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 ) if( p_block )
{ {
block_ChainAppend( out, p_block ); block_ChainAppend( out, p_block );
......
...@@ -70,7 +70,6 @@ static int vout_update_format( decoder_t * ); ...@@ -70,7 +70,6 @@ static int vout_update_format( decoder_t * );
static picture_t *vout_new_buffer( decoder_t * ); static picture_t *vout_new_buffer( decoder_t * );
static int aout_update_format( decoder_t * ); static int aout_update_format( decoder_t * );
static subpicture_t *spu_new_buffer( decoder_t *, const subpicture_updater_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 struct decoder_owner_sys_t
{ {
...@@ -192,11 +191,6 @@ subpicture_t *decoder_NewSubpicture( decoder_t *p_decoder, ...@@ -192,11 +191,6 @@ subpicture_t *decoder_NewSubpicture( decoder_t *p_decoder,
return p_subpicture; 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: /* decoder_GetInputAttachments:
*/ */
int decoder_GetInputAttachments( decoder_t *p_dec, int decoder_GetInputAttachments( decoder_t *p_dec,
...@@ -770,7 +764,6 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent, ...@@ -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_format_update = vout_update_format;
p_dec->pf_vout_buffer_new = vout_new_buffer; p_dec->pf_vout_buffer_new = vout_new_buffer;
p_dec->pf_spu_buffer_new = spu_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_attachments = DecoderGetInputAttachments;
p_dec->pf_get_display_date = DecoderGetDisplayDate; p_dec->pf_get_display_date = DecoderGetDisplayDate;
...@@ -2218,22 +2211,3 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec, ...@@ -2218,22 +2211,3 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec,
return p_subpic; 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 );
}
...@@ -72,7 +72,6 @@ date_Increment ...@@ -72,7 +72,6 @@ date_Increment
date_Init date_Init
date_Move date_Move
date_Set date_Set
decoder_DeleteSubpicture
decoder_GetDisplayDate decoder_GetDisplayDate
decoder_GetDisplayRate decoder_GetDisplayRate
decoder_GetInputAttachments decoder_GetInputAttachments
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment