[vlc-devel] commit: Patch by Soren Bog <avacore at videolan.org> from GSoC: Overlay - Add alpha component to subpicture regions. (Jean-Paul Saman )

git version control git at videolan.org
Wed Apr 9 12:44:47 CEST 2008


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Thu Feb 28 11:31:45 2008 +0100| [4b36edd1d545c74ce66ad959e6d08ad1ba947023]

Patch by Soren Bog <avacore at videolan.org> from GSoC: Overlay - Add alpha component to subpicture regions.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4b36edd1d545c74ce66ad959e6d08ad1ba947023
---

 include/vlc_vout.h                  |    1 +
 src/video_output/vout_subpictures.c |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index 30baf25..4548c50 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -211,6 +211,7 @@ struct subpicture_region_t
     int             i_x;                             /**< position of region */
     int             i_y;                             /**< position of region */
     int             i_align;                  /**< alignment within a region */
+    int             i_alpha;                               /**< transparency */
 
     char            *psz_text;       /**< text string comprising this region */
     char            *psz_html;       /**< HTML version of subtitle (NULL = use psz_text) */
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 9dccc53..c814964 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -291,6 +291,7 @@ subpicture_region_t *__spu_CreateRegion( vlc_object_t *p_this,
     if( !p_region ) return NULL;
 
     memset( p_region, 0, sizeof(subpicture_region_t) );
+    p_region->i_alpha = 0xff
     p_region->p_next = NULL;
     p_region->p_cache = NULL;
     p_region->fmt = *p_fmt;
@@ -336,6 +337,7 @@ subpicture_region_t *__spu_MakeRegion( vlc_object_t *p_this,
     (void)p_this;
     if( !p_region ) return NULL;
     memset( p_region, 0, sizeof(subpicture_region_t) );
+    p_region->i_alpha = 0xff;
     p_region->p_next = 0;
     p_region->p_cache = 0;
     p_region->fmt = *p_fmt;
@@ -901,6 +903,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
                 p_region->p_cache->i_x = p_region->i_x * pi_scale_width[ i_scale_idx ] / 1000;
                 p_region->p_cache->i_y = p_region->i_y * pi_scale_height[ i_scale_idx ] / 1000;
                 p_region->p_cache->i_align = p_region->i_align;
+                p_region->p_cache->i_alpha = p_region->i_alpha;
 
                 p_pic = p_spu->p_scale->pf_video_filter(
                                  p_spu->p_scale, &p_region->p_cache->picture );
@@ -1060,7 +1063,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
                 {
                     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_subpic->i_alpha / 255 );
+                        i_fade_alpha * p_subpic->i_alpha * p_region->i_alpha / 65025 );
                 }
                 else
                 {




More information about the vlc-devel mailing list