Commit 3887b077 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* changed default value of sub-margin to 0

* sub elements can be moved up (positive values) and down (negative)
* force_crop'ed elements cannot be moves (usually only dvd menu's)
* works for spudec and subsdec
* if the margin / offset correction forces the picture out of the main picture, the offset is cropped so that the subpicture is still 100% visible.
parent e576f470
......@@ -1076,7 +1076,7 @@ vlc_module_begin();
#endif
add_string( "sub-autodetect-path", SUB_PATH, NULL,
SUB_PATH_TEXT, SUB_PATH_LONGTEXT, VLC_TRUE );
add_integer( "sub-margin", -1, NULL, SUB_MARGIN_TEXT,
add_integer( "sub-margin", 0, NULL, SUB_MARGIN_TEXT,
SUB_MARGIN_LONGTEXT, VLC_TRUE );
add_deprecated( "spu-margin", VLC_FALSE ); /*Deprecated since 0.8.2 */
set_section( N_( "Overlays" ) , NULL );
......
......@@ -694,15 +694,18 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
i_y_offset = p_region->i_y +
p_subpic->i_y * i_scale_height / 1000;
if( p_spu->i_margin >= 0 )
{
if( p_subpic->i_height + (unsigned int)p_spu->i_margin <=
p_fmt->i_height )
{
i_y_offset = p_fmt->i_height -
p_spu->i_margin - p_subpic->i_height;
}
}
}
if( p_spu->i_margin != 0 && p_spu->b_force_crop == VLC_FALSE )
{
int i_diff = 0;
int i_low = i_y_offset - p_spu->i_margin;
int i_high = i_y_offset + p_region->fmt.i_height - p_spu->i_margin;
/* crop extra margin to keep within bounds */
if( i_low < 0 ) i_diff = i_low;
if( i_high > (int)p_fmt->i_height ) i_diff = i_high - p_fmt->i_height;
i_y_offset -= ( p_spu->i_margin + i_diff );
}
p_spu->p_blend->fmt_in.video = p_region->fmt;
......
Markdown is supported
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