Commit 204064ae authored by Steve Lhomme's avatar Steve Lhomme
Browse files

epileptic: implement draining of the inverted picture

parent 6c1973f1
......@@ -42,6 +42,7 @@ vlc_module_end ()
typedef struct {
filter_t *inverter;
picture_t *src_pic;
} filter_sys_t;
static filter_t *CreateInverter(vlc_object_t *object, const video_format_t *fmt)
......@@ -66,27 +67,50 @@ static filter_t *CreateInverter(vlc_object_t *object, const video_format_t *fmt)
static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
{
filter_sys_t *p_sys = p_filter->p_sys;
picture_Hold( p_pic ); // the inverter will release the source
picture_t *inverted = p_sys->inverter->ops->filter_video( p_sys->inverter, p_pic );
assert(p_sys->src_pic == NULL); // missing drain ?
p_sys->src_pic = picture_Hold( p_pic );
return p_pic;
}
static picture_t *Drain(filter_t *p_filter)
{
filter_sys_t *p_sys = p_filter->p_sys;
if ( p_sys->src_pic == NULL )
return NULL;
picture_t *inverted = p_sys->inverter->ops->filter_video( p_sys->inverter, p_sys->src_pic );
p_sys->src_pic = NULL; // the invert filter has released it
if ( inverted )
{
inverted->date += vlc_tick_from_samples( p_filter->fmt_out.video.i_frame_rate_base,
p_filter->fmt_out.video.i_frame_rate );
vlc_picture_chain_AppendChain( p_pic, inverted );
}
return p_pic;
return inverted;
}
static void Flush(filter_t *p_filter)
{
filter_sys_t *p_sys = p_filter->p_sys;
if ( p_sys->src_pic )
{
picture_Release( p_sys->src_pic );
p_sys->src_pic = NULL;
}
}
static void Close(filter_t *p_filter)
{
filter_sys_t *p_sys = p_filter->p_sys;
Flush( p_filter );
filter_Close( p_sys->inverter );
module_unneed( p_sys->inverter, p_sys->inverter->p_module );
vlc_object_delete( p_sys->inverter );
}
static struct vlc_filter_operations filter_ops = {
.filter_video = Filter, .close = Close,
.filter_video = Filter, .drain_video = Drain, .close = Close,
.flush = Flush,
};
static int Create(filter_t *p_filter)
......@@ -109,6 +133,7 @@ static int Create(filter_t *p_filter)
vlc_obj_free(VLC_OBJECT(p_filter), p_sys);
return VLC_ENOMOD;
}
p_sys->src_pic = NULL;
p_filter->fmt_out.video.i_frame_rate *= 2;
......
Supports Markdown
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