Commit ee0b4010 authored by Yoann Peronneau's avatar Yoann Peronneau

* src/video_output/vout_subpictures.c: added a b_fade parameter for enabling...

* src/video_output/vout_subpictures.c: added a b_fade parameter for enabling fading when rendering subpictures
parent 2ec88591
......@@ -244,6 +244,7 @@ struct subpicture_t
vlc_bool_t b_ephemer; /**< If this flag is set to true
the subtitle will be displayed
untill the next one appear */
vlc_bool_t b_fade; /**< enable fading */
/**@}*/
subpicture_region_t *p_region; /**< region list composing this subtitle */
......
......@@ -220,6 +220,7 @@ subpicture_t *vout_CreateWidget( vout_thread_t *p_vout, int i_channel )
p_subpic->i_start = i_now;
p_subpic->i_stop = i_now + 1200000;
p_subpic->b_ephemer = VLC_TRUE;
p_subpic->b_fade = VLC_TRUE;
p_widget = malloc( sizeof(subpicture_sys_t) );
if( p_widget == NULL )
......
......@@ -372,6 +372,7 @@ subpicture_t *spu_CreateSubpicture( spu_t *p_spu )
memset( p_subpic, 0, sizeof(subpicture_t) );
p_subpic->i_status = RESERVED_SUBPICTURE;
p_subpic->b_absolute = VLC_TRUE;
p_subpic->b_fade = VLC_FALSE;
p_subpic->pf_render = 0;
p_subpic->pf_destroy = 0;
p_subpic->p_sys = 0;
......@@ -529,6 +530,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
else while( p_region && p_spu->p_blend &&
p_spu->p_blend->pf_video_blend )
{
int i_fade_alpha = 255;
int i_x_offset = p_region->i_x + p_subpic->i_x;
int i_y_offset = p_region->i_y + p_subpic->i_y;
......@@ -724,8 +726,21 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
p_spu->p_blend->fmt_out.video.i_visible_height =
p_fmt->i_height;
p_spu->p_blend->pf_video_blend( p_spu->p_blend, p_pic_dst,
p_pic_src, &p_region->picture, i_x_offset, i_y_offset, 255 );
if( p_subpic->b_fade )
{
mtime_t i_fade_start = ( p_subpic->i_stop +
p_subpic->i_start ) / 2;
mtime_t i_now = mdate();
if( i_now >= i_fade_start && p_subpic->i_stop > i_fade_start )
{
i_fade_alpha = 255 * ( p_subpic->i_stop - i_now ) /
( p_subpic->i_stop - i_fade_start );
}
}
p_spu->p_blend->pf_video_blend( p_spu->p_blend, p_pic_dst,
p_pic_src, &p_region->picture, i_x_offset, i_y_offset,
i_fade_alpha );
p_region = p_region->p_next;
}
......
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