sys/v4l2/gstv4l2src.c: Use define here.

Original commit message from CVS:
Patch by: Alexander Eichner <alexeichi@yahoo.de>
* 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
This commit is contained in:
Alexander Eichner 2007-07-18 11:42:33 +00:00 committed by Stefan Kost
parent 0dd484d900
commit e547bc5595
5 changed files with 41 additions and 16 deletions

View file

@ -1,3 +1,20 @@
2007-07-18 Stefan Kost <ensonic@users.sf.net>
Patch by: Alexander Eichner <alexeichi@yahoo.de>
* 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 <ensonic@users.sf.net>
* tests/check/elements/videocrop.c: (GST_START_TEST):

View file

@ -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;

View file

@ -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
}
}

View file

@ -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",

View file

@ -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);