[vlc-devel] [PATCH v2] flaschen: implement --flaschen-offset-{x, y, z}

Fran├žois Revol revol at free.fr
Wed Jul 27 14:35:46 CEST 2016


These allow sending several layers to the display at once.

Note though that full black actually becomes transparent.
Let's say it's a feature.
---
 modules/video_output/flaschen.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/flaschen.c b/modules/video_output/flaschen.c
index 2eeffab..c983c34 100644
--- a/modules/video_output/flaschen.c
+++ b/modules/video_output/flaschen.c
@@ -51,6 +51,13 @@
 #define T_HEIGHT N_("Height")
 #define LT_HEIGHT N_("Video height")
 
+#define T_OFFSET_X N_("X offset")
+#define LT_OFFSET_X N_("X offset, from the left screen edge." )
+#define T_OFFSET_Y N_("Y offset")
+#define LT_OFFSET_Y N_("Y offset, down from the top." )
+#define T_OFFSET_Z N_("Z offset")
+#define LT_OFFSET_Z N_("Z offset, video layer.")
+
 static int Open( vlc_object_t * );
 static void Close( vlc_object_t * );
 
@@ -66,6 +73,9 @@ vlc_module_begin ()
     add_string( "flaschen-display", NULL, T_FLDISPLAY, LT_FLDISPLAY, true )
     add_integer("flaschen-width", 25, T_WIDTH, LT_WIDTH, false)
     add_integer("flaschen-height", 20, T_HEIGHT, LT_HEIGHT, false)
+    add_integer("flaschen-offset-x", 0, T_OFFSET_X, LT_OFFSET_X, false)
+    add_integer("flaschen-offset-y", 0, T_OFFSET_Y, LT_OFFSET_Y, false)
+    add_integer("flaschen-offset-z", 0, T_OFFSET_Z, LT_OFFSET_Z, false)
 vlc_module_end ()
 
 
@@ -74,6 +84,7 @@ vlc_module_end ()
  *****************************************************************************/
 struct vout_display_sys_t {
     int             fd;
+    int             offset_x, offset_y, offset_z;
 
     picture_pool_t *pool;
 };
@@ -117,7 +128,14 @@ static int Open(vlc_object_t *object)
         free(sys);
         return VLC_EGENERIC;
     }
-    msg_Dbg(vd, "using display at %s (%dx%d)", display, fmt.i_width, fmt.i_height);
+
+    sys->offset_x = var_InheritInteger(vd, "flaschen-offset-x");
+    sys->offset_y = var_InheritInteger(vd, "flaschen-offset-y");
+    sys->offset_z = var_InheritInteger(vd, "flaschen-offset-z");
+
+    msg_Dbg(vd, "using display at %s (%dx%d)+%d+%d+%d", display,
+            fmt.i_width, fmt.i_height,
+            sys->offset_x, sys->offset_y, sys->offset_z);
 
     fd = net_ConnectDgram( vd, display, port, -1, IPPROTO_UDP );
 
@@ -181,10 +199,11 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
     int result;
     VLC_UNUSED(subpicture);
 
-    char buffer[64];
-    int header_len = snprintf(buffer, sizeof(buffer), "P6\n%d %d\n255\n",
-                              vd->fmt.i_width, vd->fmt.i_height);
-    /* TODO: support offset_{x,y,z}? (#FT:...) */
+    char buffer[128];
+    int header_len = snprintf(buffer, sizeof(buffer),
+                              "P6\n%d %d\n#FT: %d %d %d\n255\n",
+                              vd->fmt.i_width, vd->fmt.i_height,
+                              sys->offset_x, sys->offset_y, sys->offset_z);
     /* Note the protocol doesn't include any picture order field. */
     /* (maybe add as comment?) */
 
-- 
2.8.1



More information about the vlc-devel mailing list