From a3a051705ad5963a61f667bf561947211adb6c97 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 10 May 2003 14:36:34 +0000 Subject: This implements filtered-caps negotiation for all the v4l*src elements, and removes the accompanying properties since... Original commit message from CVS: This implements filtered-caps negotiation for all the v4l*src elements, and removes the accompanying properties since they're no longer needed --- sys/v4l2/v4l2src_calls.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'sys/v4l2/v4l2src_calls.c') diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c index 685b37b4..1f8be1cb 100644 --- a/sys/v4l2/v4l2src_calls.c +++ b/sys/v4l2/v4l2src_calls.c @@ -413,3 +413,48 @@ gst_v4l2src_capture_deinit (GstV4l2Src *v4l2src) return TRUE; } + + +/* + + */ + +gboolean +gst_v4l2src_get_size_limits (GstV4l2Src *v4l2src, + struct v4l2_fmtdesc *format, + gint *min_w, gint *max_w, + gint *min_h, gint *max_h) +{ + struct v4l2_format fmt; + + /* get size delimiters */ + memset(&fmt, 0, sizeof(fmt)); + fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + fmt.fmt.pix.width = 0; + fmt.fmt.pix.height = 0; + fmt.fmt.pix.pixelformat = format->pixelformat; + fmt.fmt.pix.field = V4L2_FIELD_ANY; + if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, + VIDIOC_TRY_FMT, &fmt) < 0) { + return FALSE; + } + + if (min_w) + *min_w = fmt.fmt.pix.width; + if (min_h) + *min_h = fmt.fmt.pix.height; + + fmt.fmt.pix.width = G_MAXINT; + fmt.fmt.pix.height = G_MAXINT; + if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, + VIDIOC_TRY_FMT, &fmt) < 0) { + return FALSE; + } + + if (max_w) + *max_w = fmt.fmt.pix.width; + if (max_h) + *max_h = fmt.fmt.pix.height; + + return TRUE; +} -- cgit