[vlc-commits] commit: Added picture_BlendSubpicture helper. (Laurent Aimar )

git at videolan.org git at videolan.org
Sun Jan 9 22:44:18 CET 2011


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Dec 11 18:32:42 2010 +0100| [81f8f88d654bc5b47595b044ba5833e11f12d2d6] | committer: Laurent Aimar 

Added picture_BlendSubpicture helper.

It blends a subpicture onto a picture.

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

 include/vlc_picture.h |   13 +++++++++++++
 src/libvlccore.sym    |    1 +
 src/misc/picture.c    |   19 +++++++++++++++++++
 3 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index b0fe6e4..156b9c2 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -279,6 +279,19 @@ VLC_EXPORT( int, picture_Export, ( vlc_object_t *p_obj, block_t **pp_image, vide
  */
 VLC_EXPORT( int, picture_Setup, ( picture_t *, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den ) );
 
+
+/**
+ * This function will blend a given subpicture onto a picture.
+ *
+ * The subpicture and all its region must:
+ *  - be absolute.
+ *  - not be ephemere.
+ *  - not have the fade flag.
+ *  - contains only picture (no text rendering).
+ */
+VLC_EXPORT( void, picture_BlendSubpicture, ( picture_t *, filter_t *p_blend, subpicture_t * ) );
+
+
 /*****************************************************************************
  * Flags used to describe the status of a picture
  *****************************************************************************/
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 309f88d..9f7249c 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -309,6 +309,7 @@ osd_ShowTextAbsolute
 osd_ShowTextRelative
 osd_Volume
 path_sanitize
+picture_BlendSubpicture
 picture_CopyPixels
 picture_Delete
 picture_Export
diff --git a/src/misc/picture.c b/src/misc/picture.c
index b738446..ae3efc9 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -389,3 +389,22 @@ int picture_Export( vlc_object_t *p_obj,
     return VLC_SUCCESS;
 }
 
+void picture_BlendSubpicture(picture_t *dst,
+                             filter_t *blend, subpicture_t *src)
+{
+    assert(blend && dst && blend->fmt_out.video.i_chroma == dst->format.i_chroma);
+    assert(src && !src->b_fade && src->b_absolute);
+
+    for (subpicture_region_t *r = src->p_region; r != NULL; r = r->p_next) {
+        assert(r->p_picture && r->i_align == 0);
+        if (filter_ConfigureBlend(blend, dst->format.i_width, dst->format.i_height,
+                                  &r->fmt) ||
+            filter_Blend(blend, dst,
+                         r->i_x, r->i_y, r->p_picture,
+                         src->i_alpha * r->i_alpha / 255)) {
+            msg_Err(blend, "blending %4.4s to %4.4s failed",
+                    (char *)&blend->fmt_in.video.i_chroma,
+                    (char *)&blend->fmt_out.video.i_chroma );
+        }
+    }
+}



More information about the vlc-commits mailing list