From e547bc5595c06733b7e95f5e404b247590b7925d Mon Sep 17 00:00:00 2001 From: Alexander Eichner Date: Wed, 18 Jul 2007 11:42:33 +0000 Subject: [PATCH] sys/v4l2/gstv4l2src.c: Use define here. Original commit message from CVS: Patch by: Alexander Eichner * sys/v4l2/gstv4l2src.c: (gst_v4l2src_init): Use define here. * sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_set_frequency_and_notify): Don't touch the property - its still disabled. * sys/v4l2/v4l2src_calls.c: (gst_v4l2src_probe_caps_for_format), (gst_v4l2src_grab_frame), (gst_v4l2src_get_size_limits): * sys/v4l2/v4l2src_calls.h: Improve fallback format negotionation. Fixes #451388 --- ChangeLog | 17 +++++++++++++++++ sys/v4l2/gstv4l2src.c | 2 +- sys/v4l2/gstv4l2tuner.c | 2 ++ sys/v4l2/v4l2src_calls.c | 34 ++++++++++++++++++++-------------- sys/v4l2/v4l2src_calls.h | 2 +- 5 files changed, 41 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ffffe46a..0b5d6e9b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2007-07-18 Stefan Kost + + Patch by: Alexander Eichner + + * sys/v4l2/gstv4l2src.c: (gst_v4l2src_init): + Use define here. + + * sys/v4l2/gstv4l2tuner.c: + (gst_v4l2_tuner_set_frequency_and_notify): + Don't touch the property - its still disabled. + + * sys/v4l2/v4l2src_calls.c: (gst_v4l2src_probe_caps_for_format), + (gst_v4l2src_grab_frame), (gst_v4l2src_get_size_limits): + * sys/v4l2/v4l2src_calls.h: + Improve fallback format negotionation. Fixes #451388 + + 2007-07-18 Stefan Kost * tests/check/elements/videocrop.c: (GST_START_TEST): diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index a974791c9..9291a9ed6 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -298,7 +298,7 @@ gst_v4l2src_init (GstV4l2Src * v4l2src, GstV4l2SrcClass * klass) gst_v4l2_get_input, gst_v4l2_set_input, NULL); /* number of buffers requested */ - v4l2src->num_buffers = 2; + v4l2src->num_buffers = GST_V4L2_MIN_BUFFERS; v4l2src->formats = NULL; diff --git a/sys/v4l2/gstv4l2tuner.c b/sys/v4l2/gstv4l2tuner.c index 1dc893ab5..94bf90857 100644 --- a/sys/v4l2/gstv4l2tuner.c +++ b/sys/v4l2/gstv4l2tuner.c @@ -256,7 +256,9 @@ gst_v4l2_tuner_set_frequency_and_notify (GstV4l2Object * v4l2object, GstTunerChannel * channel, gulong frequency) { if (gst_v4l2_tuner_set_frequency (v4l2object, channel, frequency)) { +#if 0 g_object_notify (G_OBJECT (v4l2object->element), "frequency"); +#endif } } diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c index f90167e78..87f2234f9 100644 --- a/sys/v4l2/v4l2src_calls.c +++ b/sys/v4l2/v4l2src_calls.c @@ -642,17 +642,24 @@ unknown_type: } default_frame_sizes: #endif /* defined VIDIOC_ENUM_FRAMESIZES */ + { + gint min_w, max_w, min_h, max_h; - /* This code is for Linux < 2.6.19 */ - - ret = gst_caps_new_empty (); - tmp = gst_structure_copy (template); - gst_structure_set (tmp, "width", GST_TYPE_INT_RANGE, (gint) 1, - (gint) GST_V4L2_MAX_SIZE, "height", GST_TYPE_INT_RANGE, - (gint) 1, (gint) GST_V4L2_MAX_SIZE, - "framerate", GST_TYPE_FRACTION_RANGE, (gint) 0, - (gint) 1, (gint) 100, (gint) 1, NULL); - gst_caps_append_structure (ret, tmp); + /* This code is for Linux < 2.6.19 */ + if (!gst_v4l2src_get_size_limits (v4l2src, pixelformat, &min_w, &max_w, + &min_h, &max_h)) { + min_w = min_h = 1; + max_w = max_h = GST_V4L2_MAX_SIZE; + } + ret = gst_caps_new_empty (); + tmp = gst_structure_copy (template); + gst_structure_set (tmp, + "width", GST_TYPE_INT_RANGE, min_w, max_w, + "height", GST_TYPE_INT_RANGE, min_h, max_h, + "framerate", GST_TYPE_FRACTION_RANGE, (gint) 0, (gint) 1, (gint) 100, + (gint) 1, NULL); + gst_caps_append_structure (ret, tmp); + } return ret; } @@ -1181,22 +1188,21 @@ gst_v4l2src_capture_deinit (GstV4l2Src * v4l2src) */ gboolean gst_v4l2src_get_size_limits (GstV4l2Src * v4l2src, - struct v4l2_fmtdesc * format, - gint * min_w, gint * max_w, gint * min_h, gint * max_h) + guint32 pixelformat, gint * min_w, gint * max_w, gint * min_h, gint * max_h) { struct v4l2_format fmt; GST_LOG_OBJECT (v4l2src, "getting size limits with format %" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (format->pixelformat)); + GST_FOURCC_ARGS (pixelformat)); /* 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.pixelformat = pixelformat; fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; if (ioctl (v4l2src->v4l2object->video_fd, VIDIOC_TRY_FMT, &fmt) < 0) { GST_DEBUG_OBJECT (v4l2src, "failed to get min size: %s", diff --git a/sys/v4l2/v4l2src_calls.h b/sys/v4l2/v4l2src_calls.h index 450ea1af2..139d1f038 100644 --- a/sys/v4l2/v4l2src_calls.h +++ b/sys/v4l2/v4l2src_calls.h @@ -48,7 +48,7 @@ GstCaps* gst_v4l2src_probe_caps_for_format (GstV4l2Src * v4l2src, guint32 pixe const GstStructure *template); gboolean gst_v4l2src_get_size_limits (GstV4l2Src * v4l2src, - struct v4l2_fmtdesc *fmt, + guint32 pixelformat, gint * min_w, gint * max_w, gint * min_h, gint * max_h); -- 2.34.1