[vlc-devel] [PATCH] flaschen: implement --flaschen-offset-{x,y,z}
François Revol
revol at free.fr
Wed Jul 27 14:22:12 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 | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/modules/video_output/flaschen.c b/modules/video_output/flaschen.c
index 2eeffab..3a9d0c7 100644
--- a/modules/video_output/flaschen.c
+++ b/modules/video_output/flaschen.c
@@ -51,6 +51,15 @@
#define T_HEIGHT N_("Height")
#define LT_HEIGHT N_("Video height")
+#define T_OFFSET_X N_("Offset x")
+#define LT_OFFSET_X N_("Video x offset")
+
+#define T_OFFSET_Y N_("Offset y")
+#define LT_OFFSET_Y N_("Video y offset")
+
+#define T_OFFSET_Z N_("Offset z")
+#define LT_OFFSET_Z N_("Video z offset (layer)")
+
static int Open( vlc_object_t * );
static void Close( vlc_object_t * );
@@ -66,6 +75,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 +86,7 @@ vlc_module_end ()
*****************************************************************************/
struct vout_display_sys_t {
int fd;
+ int offset_x, offset_y, offset_z;
picture_pool_t *pool;
};
@@ -117,7 +130,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 +201,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