From b37845dac0ebb71ddfa17a2d1e55ef9cb12c67fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Sat, 9 Oct 2010 14:14:27 +0200 Subject: [PATCH] v4l2sink: Only get/set overlay params if needed it's perfectly ok for a video output device to not have overlay capabilities. this patch removes the need to get/set the overlay parameters if the user does not explicitely request one of the overlay properties --- sys/v4l2/gstv4l2sink.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c index 7dc1382933..1fde82c292 100644 --- a/sys/v4l2/gstv4l2sink.c +++ b/sys/v4l2/gstv4l2sink.c @@ -329,6 +329,9 @@ enum static void gst_v4l2sink_sync_overlay_fields (GstV4l2Sink * v4l2sink) { + if (!v4l2sink->overlay_fields_set) + return; + if (GST_V4L2_IS_OPEN (v4l2sink->v4l2object)) { gint fd = v4l2sink->v4l2object->video_fd; @@ -339,19 +342,17 @@ gst_v4l2sink_sync_overlay_fields (GstV4l2Sink * v4l2sink) g_return_if_fail (v4l2_ioctl (fd, VIDIOC_G_FMT, &format) >= 0); - if (v4l2sink->overlay_fields_set) { - if (v4l2sink->overlay_fields_set & OVERLAY_TOP_SET) - format.fmt.win.w.top = v4l2sink->overlay.top; - if (v4l2sink->overlay_fields_set & OVERLAY_LEFT_SET) - format.fmt.win.w.left = v4l2sink->overlay.left; - if (v4l2sink->overlay_fields_set & OVERLAY_WIDTH_SET) - format.fmt.win.w.width = v4l2sink->overlay.width; - if (v4l2sink->overlay_fields_set & OVERLAY_HEIGHT_SET) - format.fmt.win.w.height = v4l2sink->overlay.height; + if (v4l2sink->overlay_fields_set & OVERLAY_TOP_SET) + format.fmt.win.w.top = v4l2sink->overlay.top; + if (v4l2sink->overlay_fields_set & OVERLAY_LEFT_SET) + format.fmt.win.w.left = v4l2sink->overlay.left; + if (v4l2sink->overlay_fields_set & OVERLAY_WIDTH_SET) + format.fmt.win.w.width = v4l2sink->overlay.width; + if (v4l2sink->overlay_fields_set & OVERLAY_HEIGHT_SET) + format.fmt.win.w.height = v4l2sink->overlay.height; - g_return_if_fail (v4l2_ioctl (fd, VIDIOC_S_FMT, &format) >= 0); - v4l2sink->overlay_fields_set = 0; - } + g_return_if_fail (v4l2_ioctl (fd, VIDIOC_S_FMT, &format) >= 0); + v4l2sink->overlay_fields_set = 0; v4l2sink->overlay = format.fmt.win.w; }