]> git.sesse.net Git - vlc/commitdiff
* src/video_output/vout_subpictures.c: added a b_fade parameter for enabling fading...
authorYoann Peronneau <yoann@videolan.org>
Sat, 6 Nov 2004 18:25:01 +0000 (18:25 +0000)
committerYoann Peronneau <yoann@videolan.org>
Sat, 6 Nov 2004 18:25:01 +0000 (18:25 +0000)
include/vlc_video.h
src/video_output/video_widgets.c
src/video_output/vout_subpictures.c

index 10a6644d399ace673b6d7c9c78471804b24cee03..14c497dc4417dc679d676f9f0b07d6a8405d3905 100644 (file)
@@ -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 */
index 66d9d52a98db3e4770f362264b5350c24d92378c..1543a18840d850791e5932d0254132221245bf39 100644 (file)
@@ -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 )
index 202349517c251a6672bd97789c6bfc2271e09a27..bf1aca46839bc23251bc35102a16b04f281129e4 100644 (file)
@@ -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;
         }