[vlc-commits] wall: remove aspect ratio parameter

Rémi Denis-Courmont git at videolan.org
Mon Apr 1 19:46:10 CEST 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Apr  1 20:40:49 2019 +0300| [b75bde9e40dd0f7726a381c0dd2af571144b68ab] | committer: Rémi Denis-Courmont

wall: remove aspect ratio parameter

The aspect ratio of window is fully determined by the aspect ratio of
the source video and the quotient of colums by rows. Adding an extra
parameter makes no sense, and does not work properly.

This fixes #17433, #213.

To select a custom ratio, the source video must be filtered with
cropadd. (In the future, we could also support crop in the splitter
display plugin.)

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

 modules/video_splitter/wall.c | 127 +++---------------------------------------
 1 file changed, 7 insertions(+), 120 deletions(-)

diff --git a/modules/video_splitter/wall.c b/modules/video_splitter/wall.c
index 6a7b430287..7248e21f03 100644
--- a/modules/video_splitter/wall.c
+++ b/modules/video_splitter/wall.c
@@ -52,10 +52,6 @@
 #define ACTIVE_LONGTEXT N_("Comma-separated list of active windows, " \
     "defaults to all")
 
-#define ASPECT_TEXT N_("Element aspect ratio")
-#define ASPECT_LONGTEXT N_("Aspect ratio of the individual displays " \
-   "building the wall.")
-
 #define CFG_PREFIX "wall-"
 
 static int  Open ( vlc_object_t * );
@@ -74,7 +70,7 @@ vlc_module_begin()
     change_integer_range( 1, ROW_MAX )
     add_string( CFG_PREFIX "active", NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT,
                  true )
-    add_string( CFG_PREFIX "element-aspect", "16:9", ASPECT_TEXT, ASPECT_LONGTEXT, false )
+    add_obsolete_string( CFG_PREFIX "element-aspect" ) /* since 4.0.0 */
 
     add_shortcut( "wall" )
     set_callbacks( Open, Close )
@@ -84,7 +80,7 @@ vlc_module_end()
  * Local prototypes
  *****************************************************************************/
 static const char *const ppsz_filter_options[] = {
-    "cols", "rows", "active", "element-aspect", NULL
+    "cols", "rows", "active", NULL
 };
 
 /* */
@@ -163,130 +159,21 @@ static int Open( vlc_object_t *p_this )
     }
     free( psz_state );
 
-    /* Parse aspect ratio if provided */
-    int i_aspect = 0;
-    char *psz_aspect = var_CreateGetNonEmptyString( p_splitter,
-                                                    CFG_PREFIX "element-aspect" );
-    if( psz_aspect )
-    {
-        int i_ar_num, i_ar_den;
-        if( sscanf( psz_aspect, "%d:%d", &i_ar_num, &i_ar_den ) == 2 &&
-            i_ar_num > 0 && i_ar_den > 0 )
-        {
-            i_aspect = i_ar_num * VOUT_ASPECT_FACTOR / i_ar_den;
-        }
-        else
-        {
-            msg_Warn( p_splitter, "invalid aspect ratio specification" );
-        }
-        free( psz_aspect );
-    }
-    if( i_aspect <= 0 )
-        i_aspect = 4 * VOUT_ASPECT_FACTOR / 3;
-
     /* Compute placements/size of the windows */
-    const unsigned w1 = ( p_splitter->fmt.i_visible_width / p_sys->i_col ) & ~1;
-    const unsigned h1 = ( w1 * VOUT_ASPECT_FACTOR / i_aspect ) & ~1;
-
-    const unsigned h2 = ( p_splitter->fmt.i_visible_height / p_sys->i_row ) & ~1;
-    const unsigned w2 = ( h2 * i_aspect / VOUT_ASPECT_FACTOR ) & ~1;
-
-    unsigned i_target_width;
-    unsigned i_target_height;
-    unsigned i_hstart, i_hend;
-    unsigned i_vstart, i_vend;
-    bool b_vstart_rounded;
-    bool b_hstart_rounded;
-
-    if( h1 * p_sys->i_row < p_splitter->fmt.i_visible_height )
-    {
-        i_target_width = w2;
-        i_target_height = h2;
-
-        i_vstart = 0;
-        b_vstart_rounded = false;
-        i_vend = p_splitter->fmt.i_visible_height;
-
-        unsigned i_tmp = i_target_width * p_sys->i_col;
-        while( i_tmp < p_splitter->fmt.i_width )
-            i_tmp += p_sys->i_col;
-
-        i_hstart = (( i_tmp - p_splitter->fmt.i_visible_width ) / 2)&~1;
-        b_hstart_rounded  = ( ( i_tmp - p_splitter->fmt.i_visible_width ) % 2 ) ||
-            ( ( ( i_tmp - p_splitter->fmt.i_visible_width ) / 2 ) & 1 );
-        i_hend = i_hstart + p_splitter->fmt.i_visible_width;
-    }
-    else
-    {
-        i_target_height = h1;
-        i_target_width = w1;
-
-        i_hstart = 0;
-        b_hstart_rounded = false;
-        i_hend = p_splitter->fmt.i_visible_width;
-
-        unsigned i_tmp = i_target_height * p_sys->i_row;
-        while( i_tmp < p_splitter->fmt.i_visible_height )
-            i_tmp += p_sys->i_row;
-
-        i_vstart = ( ( i_tmp - p_splitter->fmt.i_visible_height ) / 2 ) & ~1;
-        b_vstart_rounded  = ( ( i_tmp - p_splitter->fmt.i_visible_height ) % 2 ) ||
-            ( ( ( i_tmp - p_splitter->fmt.i_visible_height ) / 2 ) & 1 );
-        i_vend = i_vstart + p_splitter->fmt.i_visible_height;
-    }
-    msg_Dbg( p_splitter, "target resolution %dx%d", i_target_width, i_target_height );
-    msg_Dbg( p_splitter, "target window (%d,%d)-(%d,%d)", i_hstart,i_vstart,i_hend,i_vend );
-
     int i_active = 0;
     for( int y = 0, i_top = 0; y < p_sys->i_row; y++ )
     {
-        /* */
-        int i_height = 0;
-        if( y * i_target_height >= i_vstart &&
-            ( y + 1 ) * i_target_height <= i_vend )
-        {
-            i_height = i_target_height;
-        }
-        else if( ( y + 1 ) * i_target_height <= i_vstart ||
-                 ( y * i_target_height ) >= i_vend )
-        {
-            i_height = 0;
-        }
-        else
-        {
-            i_height = ( i_target_height -
-                         i_vstart%i_target_height );
-            if(  y >= ( p_sys->i_row / 2 ) )
-                i_height -= b_vstart_rounded ? 2: 0;
-        }
+        unsigned i_height = ((p_splitter->fmt.i_visible_height - i_top)
+                             / (p_sys->i_row - y)) & ~1;
 
-        /* */
         for( int x = 0, i_left = 0; x < p_sys->i_col; x++ )
         {
             wall_output_t *p_output = &p_sys->pp_output[x][y];
+            unsigned i_width = ((p_splitter->fmt.i_visible_width - i_left)
+                                / (p_sys->i_col - x)) & ~1;
 
             /* */
-            int i_width;
-            if( x*i_target_width >= i_hstart &&
-                (x+1)*i_target_width <= i_hend )
-            {
-                i_width = i_target_width;
-            }
-            else if( ( x + 1 ) * i_target_width <= i_hstart ||
-                     ( x * i_target_width ) >= i_hend )
-            {
-                i_width = 0;
-            }
-            else
-            {
-                i_width = ( i_target_width - i_hstart % i_target_width );
-                if( x >= ( p_sys->i_col / 2 ) )
-                    i_width -= b_hstart_rounded ? 2: 0;
-            }
-
-            /* */
-            p_output->b_active = pb_active[y * p_sys->i_col + x] &&
-                                 i_height > 0 && i_width > 0;
+            p_output->b_active = pb_active[y * p_sys->i_col + x];
             p_output->i_output = -1;
             p_output->i_width = i_width;
             p_output->i_height = i_height;



More information about the vlc-commits mailing list