[gst-cvs] gst-plugins-good: v4l2sink: Only get/set overlay params if needed
Sebastian Dröge
slomo at kemper.freedesktop.org
Sun Oct 10 02:23:49 PDT 2010
Module: gst-plugins-good
Branch: master
Commit: b37845dac0ebb71ddfa17a2d1e55ef9cb12c67fd
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=b37845dac0ebb71ddfa17a2d1e55ef9cb12c67fd
Author: IOhannes m zmölnig <zmoelnig at iem.at>
Date: Sat Oct 9 14:14:27 2010 +0200
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 | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c
index 7dc1382..1fde82c 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;
-
- g_return_if_fail (v4l2_ioctl (fd, VIDIOC_S_FMT, &format) >= 0);
- v4l2sink->overlay_fields_set = 0;
- }
+ 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;
v4l2sink->overlay = format.fmt.win.w;
}
More information about the Gstreamer-commits
mailing list