[vlc-commits] filter: fps: forward video context and ensure input

Alexandre Janniaux git at videolan.org
Wed Jun 24 15:46:31 CEST 2020


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Tue Jun  9 18:43:56 2020 +0200| [030183d79045a1747d891572b2fe77d8cd0fd946] | committer: Alexandre Janniaux

filter: fps: forward video context and ensure input

The FPS filter is resampling the input source into the output source but
it only modifies metadata, so input chroma and input video context must
be used for output.

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

 modules/stream_out/transcode/video.c |  2 +-
 modules/video_filter/fps.c           | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index a5ec642175..14282ae864 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -385,7 +385,7 @@ static int transcode_video_filters_init( sout_stream_t *p_stream,
 
     if( b_master_sync )
     {
-        filter_chain_AppendFilter( id->p_f_chain, "fps", NULL, p_dst );
+        filter_chain_AppendFilter( id->p_f_chain, "fps", NULL, p_src );
         p_src = filter_chain_GetFmtOut( id->p_f_chain );
         src_ctx = filter_chain_GetVideoCtxOut( id->p_f_chain );
     }
diff --git a/modules/video_filter/fps.c b/modules/video_filter/fps.c
index 99e13bc009..d2e524154d 100644
--- a/modules/video_filter/fps.c
+++ b/modules/video_filter/fps.c
@@ -138,6 +138,10 @@ static int Open( vlc_object_t *p_this)
     filter_t *p_filter = (filter_t*)p_this;
     filter_sys_t *p_sys;
 
+    /* This filter cannot change the format. */
+    if( p_filter->fmt_out.video.i_chroma != p_filter->fmt_in.video.i_chroma )
+        return VLC_EGENERIC;
+
     p_sys = p_filter->p_sys = malloc( sizeof( *p_sys ) );
 
     if( unlikely( !p_sys ) )
@@ -179,6 +183,11 @@ static int Open( vlc_object_t *p_this)
     p_sys->p_previous_pic = NULL;
 
     p_filter->pf_video_filter = Filter;
+
+    /* We don't change neither the format nor the picture */
+    if ( p_filter->vctx_in )
+        p_filter->vctx_out = vlc_video_context_Hold( p_filter->vctx_in );
+
     return VLC_SUCCESS;
 }
 
@@ -188,5 +197,7 @@ static void Close( vlc_object_t *p_this )
     filter_sys_t *p_sys = p_filter->p_sys;
     if( p_sys->p_previous_pic )
         picture_Release( p_sys->p_previous_pic );
+    if( p_filter->vctx_out )
+        vlc_video_context_Release( p_filter->vctx_out );
     free( p_sys );
 }



More information about the vlc-commits mailing list