From b18031cf4b5c3089c87831db9f43350bda9ffa18 Mon Sep 17 00:00:00 2001 From: Andreas Naumann Date: Wed, 27 Jan 2016 09:57:38 +0100 Subject: [PATCH] v4l2sink: Use V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY if driver advertises it. On modern kernels, the G/S_FMT ioctls will always fail using V4L2_BUF_TYPE_VIDEO_OVERLAY with VFL_DIR_TX (e.g. real overlay out drivers) since this is not the intented use (rather rx, according to v4l2 API doc). Probably this is why the Video Output Overlay interface was created, so if the driver advertises it we might as well use. For old kernels (pre 2012) the old way might still work so keeping this for compatibility. https://bugzilla.gnome.org/show_bug.cgi?id=761165 --- sys/v4l2/gstv4l2sink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c index 5ea374bd4b..7587aa9bde 100644 --- a/sys/v4l2/gstv4l2sink.c +++ b/sys/v4l2/gstv4l2sink.c @@ -250,7 +250,10 @@ gst_v4l2sink_sync_overlay_fields (GstV4l2Sink * v4l2sink) struct v4l2_format format; memset (&format, 0x00, sizeof (struct v4l2_format)); - format.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; + if ( v4l2sink->v4l2object->vcap.capabilities & V4L2_CAP_VIDEO_OUTPUT_OVERLAY ) + format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY; + else + format.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; if (v4l2_ioctl (fd, VIDIOC_G_FMT, &format) < 0) { GST_WARNING_OBJECT (v4l2sink, "VIDIOC_G_FMT failed");