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

filter: remove filter_DeletePicture()

All variants of the filter_t.video.buffer_del callback invoke
picture_Release() - possibly through recursion.

Most filters used picture_Release() directly already.
parent 73c7b4a1
......@@ -46,7 +46,6 @@ typedef struct filter_owner_t
struct
{
picture_t * (*buffer_new)( filter_t * );
void (*buffer_del)( filter_t *, picture_t * );
} video;
struct
{
......@@ -156,7 +155,7 @@ struct filter_t
/**
* This function will return a new picture usable by p_filter as an output
* buffer. You have to release it using filter_DeletePicture or by returning
* buffer. You have to release it using picture_Release or by returning
* it to the caller as a pf_video_filter return value.
* Provided for convenience.
*
......@@ -171,18 +170,6 @@ static inline picture_t *filter_NewPicture( filter_t *p_filter )
return pic;
}
/**
* This function will release a picture create by filter_NewPicture.
* Provided for convenience.
*
* \param p_filter filter_t object
* \param p_picture picture to be deleted
*/
static inline void filter_DeletePicture( filter_t *p_filter, picture_t *pic )
{
p_filter->owner.video.buffer_del( p_filter, pic );
}
/**
* This function will flush the state of a video filter.
*/
......
......@@ -78,7 +78,6 @@ static int Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *, block_t * );
inline static void video_del_buffer_decoder( decoder_t *, picture_t * );
inline static void video_del_buffer_filter( filter_t *, picture_t * );
inline static int video_update_format_decoder( decoder_t *p_dec );
inline static picture_t *video_new_buffer_decoder( decoder_t * );
......@@ -398,7 +397,6 @@ static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
.sys = p_sys->p_decoder->p_owner,
.video = {
.buffer_new = video_new_buffer_filter,
.buffer_del = video_del_buffer_filter,
},
};
......@@ -666,13 +664,6 @@ inline static void video_del_buffer_decoder( decoder_t *p_this,
picture_Release( p_pic );
}
inline static void video_del_buffer_filter( filter_t *p_this,
picture_t *p_pic )
{
VLC_UNUSED(p_this);
picture_Release( p_pic );
}
static void video_link_picture_decoder( decoder_t *p_dec, picture_t *p_pic )
{
VLC_UNUSED(p_dec);
......
......@@ -84,12 +84,6 @@ static picture_t *transcode_video_filter_buffer_new( filter_t *p_filter )
return picture_NewFromFormat( &p_filter->fmt_out.video );
}
static void transcode_video_filter_buffer_del( filter_t *p_filter, picture_t *p_pic )
{
VLC_UNUSED(p_filter);
picture_Release( p_pic );
}
static void* EncoderThread( void *obj )
{
sout_stream_sys_t *p_sys = (sout_stream_sys_t*)obj;
......@@ -296,7 +290,6 @@ static void transcode_video_filter_init( sout_stream_t *p_stream,
.sys = p_stream->p_sys,
.video = {
.buffer_new = transcode_video_filter_buffer_new,
.buffer_del = transcode_video_filter_buffer_del,
},
};
es_format_t *p_fmt_out = &id->p_decoder->fmt_out;
......
......@@ -83,13 +83,6 @@ static picture_t *BufferNew( filter_t *p_filter )
return filter_NewPicture( p_parent );
}
static void BufferDel( filter_t *p_filter, picture_t *p_pic )
{
filter_t *p_parent = p_filter->owner.sys;
filter_DeletePicture( p_parent, p_pic );
}
#define CHAIN_LEVEL_MAX 1
/*****************************************************************************
......@@ -119,7 +112,6 @@ static int Activate( vlc_object_t *p_this )
.sys = p_filter,
.video = {
.buffer_new = BufferNew,
.buffer_del = BufferDel,
},
};
......
......@@ -136,11 +136,6 @@ static picture_t *video_new( filter_t *p_filter )
return filter_NewPicture( p_filter->owner.sys );
}
static void video_del( filter_t *p_filter, picture_t *p_pic )
{
return filter_DeletePicture( p_filter->owner.sys, p_pic );
}
/*****************************************************************************
*
*****************************************************************************/
......@@ -239,7 +234,6 @@ static int Activate( vlc_object_t *p_this )
.sys = p_filter,
.video = {
.buffer_new = video_new,
.buffer_del = video_del,
},
};
......
......@@ -65,7 +65,7 @@ struct filter_chain_t
/**
* Local prototypes
*/
static void FilterDeletePictures( filter_t *, picture_t * );
static void FilterDeletePictures( picture_t * );
static filter_chain_t *filter_chain_NewInner( const filter_owner_t *callbacks,
const char *cap, bool fmt_out_change, const filter_owner_t *owner )
......@@ -127,18 +127,6 @@ static picture_t *filter_chain_VideoBufferNew( filter_t *filter )
}
}
static void filter_chain_VideoBufferDelete( filter_t *filter, picture_t *pic )
{
if( chained(filter)->next != NULL )
picture_Release( pic );
else
{
filter_chain_t *chain = filter->owner.sys;
chain->owner.video.buffer_del( filter, pic );
}
}
#undef filter_chain_NewVideo
filter_chain_t *filter_chain_NewVideo( vlc_object_t *obj, bool allow_change,
const filter_owner_t *restrict owner )
......@@ -147,7 +135,6 @@ filter_chain_t *filter_chain_NewVideo( vlc_object_t *obj, bool allow_change,
.sys = obj,
.video = {
.buffer_new = filter_chain_VideoBufferNew,
.buffer_del = filter_chain_VideoBufferDelete,
},
};
......@@ -295,7 +282,7 @@ void filter_chain_DeleteFilter( filter_chain_t *chain, filter_t *filter )
module_unneed( filter, filter->p_module );
msg_Dbg( obj, "Filter %p removed from chain", filter );
FilterDeletePictures( &chained->filter, chained->pending );
FilterDeletePictures( chained->pending );
free( chained->mouse );
es_format_Clean( &filter->fmt_out );
......@@ -390,7 +377,7 @@ static picture_t *FilterChainVideoFilter( chained_filter_t *f, picture_t *p_pic
if( f->pending )
{
msg_Warn( p_filter, "dropping pictures" );
FilterDeletePictures( p_filter, f->pending );
FilterDeletePictures( f->pending );
}
f->pending = p_pic->p_next;
p_pic->p_next = NULL;
......@@ -427,7 +414,7 @@ void filter_chain_VideoFlush( filter_chain_t *p_chain )
{
filter_t *p_filter = &f->filter;
FilterDeletePictures( p_filter, f->pending );
FilterDeletePictures( f->pending );
f->pending = NULL;
filter_FlushPictures( p_filter );
......@@ -520,12 +507,12 @@ int filter_chain_MouseEvent( filter_chain_t *p_chain,
}
/* Helpers */
static void FilterDeletePictures( filter_t *filter, picture_t *picture )
static void FilterDeletePictures( picture_t *picture )
{
while( picture )
{
picture_t *next = picture->p_next;
filter_DeletePicture( filter, picture );
picture_Release( picture );
picture = next;
}
}
......@@ -346,7 +346,7 @@ static block_t *ImageWrite( image_handler_t *p_image, picture_t *p_pic,
{
p_block = p_image->p_enc->pf_encode_video( p_image->p_enc,
p_tmp_pic );
filter_DeletePicture(p_image->p_filter, p_tmp_pic );
picture_Release( p_tmp_pic );
}
else
p_block = NULL;
......@@ -752,8 +752,6 @@ static filter_t *CreateFilter( vlc_object_t *p_this, es_format_t *p_fmt_in,
p_filter = vlc_custom_create( p_this, sizeof(filter_t), "filter" );
p_filter->owner.video.buffer_new =
(picture_t *(*)(filter_t *))video_new_buffer;
p_filter->owner.video.buffer_del =
(void (*)(filter_t *, picture_t *))video_del_buffer;
p_filter->fmt_in = *p_fmt_in;
p_filter->fmt_out = *p_fmt_in;
......
......@@ -63,12 +63,6 @@ static picture_t *VideoBufferNew(filter_t *filter)
return picture_pool_Get(pool);
}
static void VideoBufferDelete(filter_t *filter, picture_t *picture)
{
VLC_UNUSED(filter);
picture_Release(picture);
}
/*****************************************************************************
*
*****************************************************************************/
......@@ -447,7 +441,6 @@ static void VoutDisplayCreateRender(vout_display_t *vd)
.sys = vd,
.video = {
.buffer_new = VideoBufferNew,
.buffer_del = VideoBufferDelete,
},
};
......
......@@ -696,12 +696,6 @@ static picture_t *VoutVideoFilterStaticNewPicture(filter_t *filter)
return picture_NewFromFormat(&filter->fmt_out.video);
}
static void VoutVideoFilterDelPicture(filter_t *filter, picture_t *picture)
{
VLC_UNUSED(filter);
picture_Release(picture);
}
static void ThreadFilterFlush(vout_thread_t *vout, bool is_locked)
{
if (vout->p->displayed.current)
......@@ -1345,7 +1339,6 @@ static int ThreadStart(vout_thread_t *vout, const vout_display_state_t *state)
.sys = vout,
.video = {
.buffer_new = VoutVideoFilterStaticNewPicture,
.buffer_del = VoutVideoFilterDelPicture,
},
};
vout->p->filter.chain_static =
......
......@@ -170,12 +170,6 @@ static picture_t *spu_new_video_buffer(filter_t *filter)
return picture_NewFromFormat(fmt);
}
static void spu_del_video_buffer(filter_t *filter, picture_t *picture)
{
VLC_UNUSED(filter);
picture_Release(picture);
}
static int spu_get_attachments(filter_t *filter,
input_attachment_t ***attachment_ptr,
int *attachment_count)
......@@ -241,7 +235,6 @@ static filter_t *SpuRenderCreateAndLoadScale(vlc_object_t *object,
scale->fmt_out.video.i_visible_height = require_resize ? 16 : 32;
scale->owner.video.buffer_new = spu_new_video_buffer;
scale->owner.video.buffer_del = spu_del_video_buffer;
scale->p_module = module_need(scale, "video filter2", NULL, false);
......
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