Commit 6b3c3d33 authored by Lyndon Brown's avatar Lyndon Brown Committed by Jean-Baptiste Kempf
Browse files

spu(audiobargraph,logo): fix buggy positioning with video filtering

the condition check with the comment "Ignore aligment if a position is
given for video filter" is meant to force absolute mode if positive x/y
values are given (in video filtering mode), causing a separate condition
block to skip calculations for x/y. (it seems x/y offsets from relative
positions are not supported in video filtering mode).

problematically though, the condition check set the position value to
`0` instead of `-1`, and the x/y calculation block condition checked
for a non-zero value, which meant that:
 - center,center relative positioning was not possible (pos=0).
 - if position was set to `-1` (as per default) to signal absolute, and
   x/y were not both positive, the x/y calculation block would set about
   trying to calculate x/y based upon incorrectly reading alignment flags
   from the `-1` position value, thus calculating a bogus position.

this commit fixes these issues by correctly signalling and checking for
absolute mode.
parent c8410c7d
......@@ -439,7 +439,7 @@ static picture_t *FilterVideo(filter_t *p_filter, picture_t *p_src)
const int i_dst_w = p_filter->fmt_out.video.i_visible_width;
const int i_dst_h = p_filter->fmt_out.video.i_visible_height;
if (p_sys->i_pos) {
if (p_sys->i_pos >= 0) {
if (p_sys->i_pos & SUBPICTURE_ALIGN_BOTTOM)
p_sys->i_pos_y = i_dst_h - p_fmt->i_visible_height;
else if (!(p_sys->i_pos & SUBPICTURE_ALIGN_TOP))
......@@ -528,7 +528,7 @@ static int OpenCommon(filter_t *p_filter, bool b_sub)
/* Ignore aligment if a position is given for video filter */
if (!b_sub && p_sys->i_pos_x >= 0 && p_sys->i_pos_y >= 0)
p_sys->i_pos = 0;
p_sys->i_pos = -1;
vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_filter));
......
......@@ -274,7 +274,7 @@ static int OpenCommon( filter_t *p_filter, bool b_sub )
/* Ignore aligment if a position is given for video filter */
if( !b_sub && p_sys->i_pos_x >= 0 && p_sys->i_pos_y >= 0 )
p_sys->i_pos = 0;
p_sys->i_pos = -1;
vlc_mutex_init( &p_sys->lock );
LogoListLoad( VLC_OBJECT(p_filter), p_list, psz_filename );
......@@ -444,7 +444,7 @@ static picture_t *FilterVideo( filter_t *p_filter, picture_t *p_src )
const int i_dst_w = p_filter->fmt_out.video.i_visible_width;
const int i_dst_h = p_filter->fmt_out.video.i_visible_height;
if( p_sys->i_pos )
if( p_sys->i_pos >= 0 )
{
if( p_sys->i_pos & SUBPICTURE_ALIGN_BOTTOM )
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment