[vlc-commits] fps: implement Flush callback

Steve Lhomme git at videolan.org
Wed Oct 14 14:27:13 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Oct 13 09:30:47 2020 +0200| [cb342c8172816a1d4b921506747ebc485f54425b] | committer: Steve Lhomme

fps: implement Flush callback

A Flush is normally done before seeking. We should not keep the date of the
previous pictures in this case and restart from scratch.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cb342c8172816a1d4b921506747ebc485f54425b
---

 modules/video_filter/fps.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/modules/video_filter/fps.c b/modules/video_filter/fps.c
index d244d65bb1..369a020df3 100644
--- a/modules/video_filter/fps.c
+++ b/modules/video_filter/fps.c
@@ -130,11 +130,21 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_picture)
     return last_pic;
 }
 
-static void Close( filter_t *p_filter )
+static void Flush( filter_t *p_filter )
 {
     filter_sys_t *p_sys = p_filter->p_sys;
+    date_Init( &p_sys->next_output_pts,
+               p_filter->fmt_out.video.i_frame_rate, p_filter->fmt_out.video.i_frame_rate_base );
     if( p_sys->p_previous_pic )
+    {
         picture_Release( p_sys->p_previous_pic );
+        p_sys->p_previous_pic = NULL;
+    }
+}
+
+static void Close( filter_t *p_filter )
+{
+    Flush( p_filter );
     if( p_filter->vctx_out )
         vlc_video_context_Release( p_filter->vctx_out );
 }
@@ -142,6 +152,7 @@ static void Close( filter_t *p_filter )
 static const struct vlc_filter_operations filter_ops =
 {
     .filter_video = Filter, .close = Close,
+    .flush = Flush,
 };
 
 static int Open( filter_t *p_filter )



More information about the vlc-commits mailing list