[vlc-devel] [PATCH] fps: implement Flush callback

Steve Lhomme robux4 at ycbcr.xyz
Tue Oct 13 10:37:47 CEST 2020


A Flush is normally done before seeking. We should not keep the date of the
previous pictures in this case and restart from scratch.
---
 modules/video_filter/fps.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/modules/video_filter/fps.c b/modules/video_filter/fps.c
index d244d65bb1f..64dd1c1fdc4 100644
--- a/modules/video_filter/fps.c
+++ b/modules/video_filter/fps.c
@@ -139,9 +139,22 @@ static void Close( filter_t *p_filter )
         vlc_video_context_Release( p_filter->vctx_out );
 }
 
+static void Flush( filter_t *p_filter )
+{
+    filter_sys_t *p_sys = p_filter->p_sys;
+    if( p_sys->p_previous_pic )
+    {
+        picture_Release( p_sys->p_previous_pic );
+        p_sys->p_previous_pic = NULL;
+    }
+    date_Init( &p_sys->next_output_pts,
+               p_filter->fmt_out.video.i_frame_rate, p_filter->fmt_out.video.i_frame_rate_base );
+}
+
 static const struct vlc_filter_operations filter_ops =
 {
     .filter_video = Filter, .close = Close,
+    .flush = Flush,
 };
 
 static int Open( filter_t *p_filter )
-- 
2.26.2



More information about the vlc-devel mailing list