[vlc-commits] chroma/chain: rework level_max for filters

Thomas Guillem git at videolan.org
Fri Mar 2 16:26:53 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar  2 16:18:50 2018 +0100| [05c6ebb1ca01b4d923b3c70d599f11fcffc753cb] | committer: Thomas Guillem

chroma/chain: rework level_max for filters

This reverts commit 6e5e08677d9e279602397fcbc767e6d2a15b4ce5
This reverts commit 2aaca35c09878ba1095b14367fa0a4ae06eac660.

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

 modules/video_chroma/chain.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/modules/video_chroma/chain.c b/modules/video_chroma/chain.c
index b78883e49b..213c3267c6 100644
--- a/modules/video_chroma/chain.c
+++ b/modules/video_chroma/chain.c
@@ -112,7 +112,7 @@ static picture_t *BufferNew( filter_t *p_filter )
  *****************************************************************************
  * This function allocates and initializes a chroma function
  *****************************************************************************/
-static int Activate( filter_t *p_filter, int (*pf_build)(filter_t *) )
+static int Activate( filter_t *p_filter, int (*pf_build)(filter_t *), unsigned level_max )
 {
     filter_sys_t *p_sys;
     int i_ret = VLC_EGENERIC;
@@ -144,7 +144,7 @@ static int Activate( filter_t *p_filter, int (*pf_build)(filter_t *) )
     var_IncInteger( p_filter, "chain-level" );
 
     int level = var_GetInteger( p_filter, "chain-level" );
-    if( level < 0 || level > CHAIN_LEVEL_MAX )
+    if( level < 0 || level > level_max )
         msg_Err( p_filter, "Too high level of recursion (%d)", level );
     else
         i_ret = pf_build( p_filter );
@@ -182,7 +182,8 @@ static int ActivateConverter( vlc_object_t *p_this )
 
     return Activate( p_filter, b_transform ? BuildTransformChain :
                                b_chroma_resize ? BuildChromaResize :
-                               BuildChromaChain );
+                               BuildChromaChain,
+                     CHAIN_LEVEL_MAX );
 }
 
 static int ActivateFilter( vlc_object_t *p_this )
@@ -192,15 +193,9 @@ static int ActivateFilter( vlc_object_t *p_this )
     if( !p_filter->b_allow_fmt_out_change || p_filter->psz_name == NULL )
         return VLC_EGENERIC;
 
-    /* Force only one level of iteration when using the chain converter from a
-     * filter. */
-    if( var_InheritInteger( p_filter, "chain-level" ) > 0 )
-        return VLC_EGENERIC;
-    var_Create( p_filter, "chain-level", VLC_VAR_INTEGER );
-    var_SetInteger( p_filter, "chain-level", CHAIN_LEVEL_MAX - 1 );
-
     /* Try to add a converter before the requested filter */
-    return Activate( p_filter, BuildFilterChain );
+    return Activate( p_filter, BuildFilterChain,
+                     1 /* only one level of iteration for filters */ );
 }
 
 static void Destroy( vlc_object_t *p_this )



More information about the vlc-commits mailing list