[vlc-devel] [PATCH] bugfix: mosaic-[hv]border reversed
Thomas Parmelan
tom+vlc at ankh.fr.EU.org
Tue Oct 3 14:15:21 CEST 2006
Hello,
I think I found 2 bugs related to mosaic-hborder and mosaic-vborder.
1. The help says hborder means horizontal border and vborder means
vertical border, whereas the code uses hborder as border height and
vborder as border width!
2. (minor) In a debug message of the MosaicCallback() function,
p_sys->i_vborder is used instead of p_sys->i_hborder when parsing the
mosaic-hborder option.
The attached patch (against trunk) fixes the code to match the help
text, but I can propose a patch the other way around if people think it
is better (but I would suggest renaming hborder to borderh and vborder
to borderw (NOT borderv) in this case!).
NB: the patch also applies cleanly to the 0.8.6 branch.
--
Thomas Parmelan
-------------- next part --------------
Index: modules/video_filter/mosaic.c
===================================================================
--- modules/video_filter/mosaic.c (revision 16930)
+++ modules/video_filter/mosaic.c (working copy)
@@ -73,7 +73,7 @@
int i_cols, i_rows; /* mosaic rows and cols */
int i_align; /* mosaic alignment in background video */
int i_xoffset, i_yoffset; /* top left corner offset */
- int i_vborder, i_hborder; /* border width/height between miniatures */
+ int i_hborder, i_vborder; /* horizontal/vertical border between miniatures */
int i_alpha; /* subfilter alpha blending */
vlc_bool_t b_bs; /* Bluescreen vars */
@@ -559,9 +559,9 @@
}
col_inner_width = ( ( p_sys->i_width - ( p_sys->i_cols - 1 )
- * p_sys->i_vborder ) / p_sys->i_cols );
+ * p_sys->i_hborder ) / p_sys->i_cols );
row_inner_height = ( ( p_sys->i_height - ( p_sys->i_rows - 1 )
- * p_sys->i_hborder ) / p_sys->i_rows );
+ * p_sys->i_vborder ) / p_sys->i_rows );
i_real_index = 0;
@@ -791,14 +791,14 @@
whole rectangle area or it's larger than the rectangle */
p_region->i_x = p_sys->i_xoffset
+ i_col * ( p_sys->i_width / p_sys->i_cols )
- + ( i_col * p_sys->i_vborder ) / p_sys->i_cols;
+ + ( i_col * p_sys->i_hborder ) / p_sys->i_cols;
}
else
{
/* center the video in the dedicated rectangle */
p_region->i_x = p_sys->i_xoffset
+ i_col * ( p_sys->i_width / p_sys->i_cols )
- + ( i_col * p_sys->i_vborder ) / p_sys->i_cols
+ + ( i_col * p_sys->i_hborder ) / p_sys->i_cols
+ ( col_inner_width - fmt_out.i_width ) / 2;
}
@@ -813,14 +813,14 @@
whole rectangle area or it's taller than the rectangle */
p_region->i_y = p_sys->i_yoffset
+ i_row * ( p_sys->i_height / p_sys->i_rows )
- + ( i_row * p_sys->i_hborder ) / p_sys->i_rows;
+ + ( i_row * p_sys->i_vborder ) / p_sys->i_rows;
}
else
{
/* center the video in the dedicated rectangle */
p_region->i_y = p_sys->i_yoffset
+ i_row * ( p_sys->i_height / p_sys->i_rows )
- + ( i_row * p_sys->i_hborder ) / p_sys->i_rows
+ + ( i_row * p_sys->i_vborder ) / p_sys->i_rows
+ ( row_inner_height - fmt_out.i_height ) / 2;
}
@@ -917,7 +917,7 @@
{
vlc_mutex_lock( &p_sys->lock );
msg_Dbg( p_this, "changing horizontal border from %dpx to %dpx",
- p_sys->i_vborder, newval.i_int );
+ p_sys->i_hborder, newval.i_int );
p_sys->i_hborder = __MAX( newval.i_int, 0 );
vlc_mutex_unlock( &p_sys->lock );
}
More information about the vlc-devel
mailing list