[vlc-commits] picture_BlendSubpicture: return the number of blent regions

Rémi Denis-Courmont git at videolan.org
Sun Jul 7 20:13:39 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun 22 21:10:00 2013 +0300| [c47e7e826fa92b93f0106b94c89913deeb13d8b3] | committer: Rémi Denis-Courmont

picture_BlendSubpicture: return the number of blent regions

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

 include/vlc_picture.h |    3 ++-
 src/misc/picture.c    |   19 +++++++++++--------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index 0b3f948..30a8b03 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -245,8 +245,9 @@ VLC_API int picture_Setup( picture_t *, vlc_fourcc_t i_chroma, int i_width, int
  *  - not be ephemere.
  *  - not have the fade flag.
  *  - contains only picture (no text rendering).
+ * \return the number of region(s) succesfully blent
  */
-VLC_API void picture_BlendSubpicture( picture_t *, filter_t *p_blend, subpicture_t * );
+VLC_API unsigned picture_BlendSubpicture( picture_t *, filter_t *p_blend, subpicture_t * );
 
 
 /*****************************************************************************
diff --git a/src/misc/picture.c b/src/misc/picture.c
index ac4caba..983569f 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -435,21 +435,24 @@ int picture_Export( vlc_object_t *p_obj,
     return VLC_SUCCESS;
 }
 
-void picture_BlendSubpicture(picture_t *dst,
-                             filter_t *blend, subpicture_t *src)
+unsigned picture_BlendSubpicture(picture_t *dst,
+                                 filter_t *blend, subpicture_t *src)
 {
+    unsigned done = 0;
+
     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)) {
+        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 );
-        }
+        else
+            done++;
     }
+    return done;
 }



More information about the vlc-commits mailing list