diff options
author | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2003-05-10 14:36:34 +0000 |
---|---|---|
committer | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2003-05-10 14:36:34 +0000 |
commit | ed779eaf85198383139c2cf354c93e9a661239eb (patch) | |
tree | 312486b4363e66156457f4a25a8e602a2069638e /sys/v4l2/v4l2src_calls.c | |
parent | 1bdef6b2a03c7210ff27f66aa330758d3d65fc8f (diff) | |
download | gst-plugins-bad-ed779eaf85198383139c2cf354c93e9a661239eb.tar.gz gst-plugins-bad-ed779eaf85198383139c2cf354c93e9a661239eb.tar.bz2 gst-plugins-bad-ed779eaf85198383139c2cf354c93e9a661239eb.zip |
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
Diffstat (limited to 'sys/v4l2/v4l2src_calls.c')
-rw-r--r-- | sys/v4l2/v4l2src_calls.c | 45 |
1 files changed, 45 insertions, 0 deletions
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; +} |