[vlc-devel] [RFC PATCH 2/3] transform: add opaque support via pic->display_orientation

Thomas Guillem thomas at gllm.fr
Thu Dec 21 18:08:54 CET 2017


---
 modules/video_filter/transform.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/modules/video_filter/transform.c b/modules/video_filter/transform.c
index 7c88f234ef..827f5f5778 100644
--- a/modules/video_filter/transform.c
+++ b/modules/video_filter/transform.c
@@ -265,6 +265,7 @@ struct filter_sys_t {
     const vlc_chroma_description_t *chroma;
     void (*plane[PICTURE_PLANE_MAX])(plane_t *, const plane_t *);
     convert_t convert;
+    video_orientation_t display_orientation;
 };
 
 static picture_t *Filter(filter_t *filter, picture_t *src)
@@ -286,6 +287,21 @@ static picture_t *Filter(filter_t *filter, picture_t *src)
     return dst;
 }
 
+static picture_t *FilterOpaque(filter_t *filter, picture_t *src)
+{
+    filter_sys_t *sys = filter->p_sys;
+
+    picture_t *dst = picture_Clone(src);
+    if (dst)
+    {
+        picture_CopyProperties(dst, src);
+        dst->display_orientation = sys->display_orientation;
+    }
+    picture_Release(src);
+
+    return dst;
+}
+
 static int Mouse(filter_t *filter, vlc_mouse_t *mouse,
                  const vlc_mouse_t *mold, const vlc_mouse_t *mnew)
 {
@@ -340,6 +356,8 @@ static int Open(vlc_object_t *object)
 
     free(type_name);
 
+    sys->convert = dsc->convert;
+
     switch (chroma->pixel_size) {
         case 1:
             sys->plane[0] = dsc->plane8;
@@ -350,6 +368,13 @@ static int Open(vlc_object_t *object)
         case 4:
             sys->plane[0] = dsc->plane32;
             break;
+        case 0:
+            sys->display_orientation =
+                video_format_GetTransform(dst->orientation, dsc->operation);
+            filter->p_sys           = sys;
+            filter->pf_video_filter = FilterOpaque;
+            filter->pf_video_mouse  = Mouse;
+            return VLC_SUCCESS;
         default:
             msg_Err(filter, "Unsupported pixel size %u (chroma %4.4s)",
                     chroma->pixel_size, (char *)&src->i_chroma);
@@ -358,7 +383,6 @@ static int Open(vlc_object_t *object)
 
     for (unsigned i = 1; i < PICTURE_PLANE_MAX; i++)
         sys->plane[i] = sys->plane[0];
-    sys->convert = dsc->convert;
 
     if (dsc_is_rotated(dsc)) {
         switch (src->i_chroma) {
-- 
2.11.0



More information about the vlc-devel mailing list