diff --git a/ChangeLog b/ChangeLog index 8cc8fa0d5b..b85428ba36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-09-27 Edgard Lima + + * sys/v4l2/gstv4l2colorbalance.c: + * sys/v4l2/gstv4l2object.c: + * sys/v4l2/gstv4l2src.c: + * sys/v4l2/gstv4l2src.h: + * sys/v4l2/gstv4l2tuner.c: + * sys/v4l2/v4l2_calls.c: + * sys/v4l2/v4l2src_calls.c: + * tests/icles/v4l2src-test.c: + Some cleanups and comments. + 2006-09-26 Wim Taymans * docs/plugins/Makefile.am: diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index f16b033753..5d08a6ad07 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -398,11 +398,9 @@ gst_v4l2_object_get_property_helper (GstV4l2Object * v4l2object, flags |= v4l2object->vcap.capabilities & (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT | - V4L2_CAP_VIDEO_OVERLAY | V4L2_CAP_TUNER | V4L2_CAP_AUDIO); - /* FIXME. if there is something with AUDIO we add something with - * video? this needs some explanation.. */ - if (v4l2object->vcap.capabilities & V4L2_CAP_AUDIO) - flags |= V4L2_FBUF_CAP_CHROMAKEY; + V4L2_CAP_VIDEO_OVERLAY | + V4L2_CAP_VBI_CAPTURE | + V4L2_CAP_VBI_OUTPUT | V4L2_CAP_TUNER | V4L2_CAP_AUDIO); } g_value_set_flags (value, flags); break; @@ -438,7 +436,9 @@ gst_v4l2_set_defaults (GstV4l2Object * v4l2object) norm = GST_TUNER_NORM (gst_tuner_get_norm (GST_TUNER (v4l2object->element))); if (norm) { - /* FIXME, free old? */ + if (v4l2object->std) { + g_free (v4l2object->std); + } v4l2object->std = g_strdup (norm->label); gst_tuner_norm_changed (tuner, norm); g_object_notify (G_OBJECT (v4l2object->element), "std"); @@ -453,7 +453,9 @@ gst_v4l2_set_defaults (GstV4l2Object * v4l2object) channel = GST_TUNER_CHANNEL (gst_tuner_get_channel (GST_TUNER (v4l2object-> element))); - /* FIXME, free old? */ + if (v4l2object->input) { + g_free (v4l2object->input); + } v4l2object->input = g_strdup (channel->label); gst_tuner_channel_changed (tuner, channel); g_object_notify (G_OBJECT (v4l2object->element), "input"); diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 6281b188e2..7b943f1714 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -35,7 +35,7 @@ * * * - * gst-launch v4l2src use-fixed-fps=true ! xvimagesink + * gst-launch v4l2src use-undef-fps=true ! xvimagesink * * This example should be used to capture from web-cams * @@ -67,13 +67,13 @@ GST_ELEMENT_DETAILS ("Video (video4linux2/raw) Source", GST_DEBUG_CATEGORY (v4l2src_debug); #define GST_CAT_DEFAULT v4l2src_debug -#define DEFAULT_PROP_USE_FIXED_FPS TRUE +#define DEFAULT_PROP_USE_UNDEF_FPS FALSE enum { PROP_0, V4L2_STD_OBJECT_PROPS, - PROP_USE_FIXED_FPS + PROP_USE_UNDEF_FPS }; static const guint32 gst_v4l2_formats[] = { @@ -284,11 +284,12 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass) gst_v4l2_object_install_properties_helper (gobject_class); g_object_class_install_property - (gobject_class, PROP_USE_FIXED_FPS, - g_param_spec_boolean ("use-fixed-fps", "Use Fixed FPS", - "Drop/Insert frames to reach a certain FPS (TRUE) " - "or adapt FPS to suit the number of frabbed frames", - DEFAULT_PROP_USE_FIXED_FPS, G_PARAM_READWRITE)); + (gobject_class, PROP_USE_UNDEF_FPS, + g_param_spec_boolean ("use-undef-fps", "Use undefined FPS", + "For some devices that can't properly report its fps " + "set this property to TRUE. The 'caps' will have its " + "'framerate' set to '0/1'.", + DEFAULT_PROP_USE_UNDEF_FPS, G_PARAM_READWRITE)); basesrc_class->get_caps = gst_v4l2src_get_caps; basesrc_class->set_caps = gst_v4l2src_set_caps; @@ -311,7 +312,7 @@ gst_v4l2src_init (GstV4l2Src * v4l2src, GstV4l2SrcClass * klass) /* fps */ v4l2src->fps_n = 0; v4l2src->fps_d = 1; - v4l2src->use_fixed_fps = DEFAULT_PROP_USE_FIXED_FPS; + v4l2src->use_undef_fps = DEFAULT_PROP_USE_UNDEF_FPS; v4l2src->is_capturing = FALSE; @@ -348,9 +349,9 @@ gst_v4l2src_set_property (GObject * object, if (!gst_v4l2_object_set_property_helper (v4l2src->v4l2object, prop_id, value, pspec)) { switch (prop_id) { - case PROP_USE_FIXED_FPS: + case PROP_USE_UNDEF_FPS: if (!GST_V4L2_IS_ACTIVE (v4l2src->v4l2object)) { - v4l2src->use_fixed_fps = g_value_get_boolean (value); + v4l2src->use_undef_fps = g_value_get_boolean (value); } break; default: @@ -373,8 +374,8 @@ gst_v4l2src_get_property (GObject * object, if (!gst_v4l2_object_get_property_helper (v4l2src->v4l2object, prop_id, value, pspec)) { switch (prop_id) { - case PROP_USE_FIXED_FPS: - g_value_set_boolean (value, v4l2src->use_fixed_fps); + case PROP_USE_UNDEF_FPS: + g_value_set_boolean (value, v4l2src->use_undef_fps); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -402,8 +403,12 @@ gst_v4l2src_fixate (GstPad * pad, GstCaps * caps) /* FIXME such sizes? we usually fixate to something in the 320x200 * range... */ - gst_structure_fixate_field_nearest_int (structure, "width", 4096); - gst_structure_fixate_field_nearest_int (structure, "height", 4096); + /* We are fixating to greater possble size (limited to GST_V4L2_MAX_SIZE) + and framarate closer to 15/2 that is common in web-cams */ + gst_structure_fixate_field_nearest_int (structure, "width", + GST_V4L2_MAX_SIZE); + gst_structure_fixate_field_nearest_int (structure, "height", + GST_V4L2_MAX_SIZE); gst_structure_fixate_field_nearest_fraction (structure, "framerate", 15, 2); v = gst_structure_get_value (structure, "format"); @@ -697,8 +702,8 @@ gst_v4l2src_get_all_caps (void) structure = gst_v4l2src_v4l2fourcc_to_caps (gst_v4l2_formats[i]); if (structure) { gst_structure_set (structure, - "width", GST_TYPE_INT_RANGE, 1, 4096, - "height", GST_TYPE_INT_RANGE, 1, 4096, + "width", GST_TYPE_INT_RANGE, 1, GST_V4L2_MAX_SIZE, + "height", GST_TYPE_INT_RANGE, 1, GST_V4L2_MAX_SIZE, "framerate", GST_TYPE_FRACTION_RANGE, 1, 1, 100, 1, NULL); gst_caps_append_structure (caps, structure); } @@ -745,11 +750,12 @@ gst_v4l2src_get_caps (GstBaseSrc * src) &min_w, &max_w, &min_h, &max_h)) { continue; } - /* template, FIXME, why limit if the device reported correct results. */ - min_w = CLAMP (min_w, 1, 4096); - min_h = CLAMP (min_h, 1, 4096); - max_w = CLAMP (max_w, min_w, 4096); - max_h = CLAMP (max_h, min_h, 4096); + /* template, FIXME, why limit if the device reported correct results? */ + /* we are doing it right now to avoid unexpected results */ + min_w = CLAMP (min_w, 1, GST_V4L2_MAX_SIZE); + min_h = CLAMP (min_h, 1, GST_V4L2_MAX_SIZE); + max_w = CLAMP (max_w, min_w, GST_V4L2_MAX_SIZE); + max_h = CLAMP (max_h, min_h, GST_V4L2_MAX_SIZE); /* add to list */ structure = gst_v4l2src_v4l2fourcc_to_caps (format->pixelformat); @@ -760,6 +766,13 @@ gst_v4l2src_get_caps (GstBaseSrc * src) "height", GST_TYPE_INT_RANGE, min_h, max_h, NULL); /* FIXME, why random range? */ + /* AFAIK: in v4l2 standard we still don't have a good way to enum + for a range. Currently it is on discussion on v4l2 forum. + Currently, something more smart could be done for tvcard devices. + The maximum value could be determined by 'v4l2_standard.frameperiod' + and minimum also to the same if V4L2_CAP_TIMEPERFRAME is not set. */ + /* another approach for web-cams would be to try to set a very + high(100/1) and low(1/1) FPSs and get the values returned */ gst_structure_set (structure, "framerate", GST_TYPE_FRACTION_RANGE, 1, 1, 100, 1, NULL); @@ -794,7 +807,7 @@ gst_v4l2src_set_caps (GstBaseSrc * src, GstCaps * caps) return FALSE; } - /* it's fixed, one struct */ + /* it's undef, one struct */ structure = gst_caps_get_structure (caps, 0); /* we want our own v4l2 type of fourcc codes */ @@ -991,7 +1004,7 @@ gst_v4l2src_create (GstPushSrc * src, GstBuffer ** buf) GstV4l2Src *v4l2src = GST_V4L2SRC (src); GstFlowReturn ret; - if (v4l2src->use_fixed_fps && v4l2src->fps_n == 0) + if ((!v4l2src->use_undef_fps) && v4l2src->fps_n == 0) goto no_framerate; if (v4l2src->breq.memory == V4L2_MEMORY_MMAP) { @@ -1005,8 +1018,8 @@ gst_v4l2src_create (GstPushSrc * src, GstBuffer ** buf) no_framerate: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, - (_("could not get frame rate for %s, try to set use-fixed-fps " - "property to false"), v4l2src->v4l2object->videodev), (NULL)); + (_("could not get frame rate for %s, try to set use-undef-fps " + "property to true"), v4l2src->v4l2object->videodev), (NULL)); return GST_FLOW_ERROR; } } diff --git a/sys/v4l2/gstv4l2src.h b/sys/v4l2/gstv4l2src.h index e862264661..874fddf78b 100644 --- a/sys/v4l2/gstv4l2src.h +++ b/sys/v4l2/gstv4l2src.h @@ -30,6 +30,7 @@ GST_DEBUG_CATEGORY_EXTERN (v4l2src_debug); #define GST_V4L2_MAX_BUFFERS 16 #define GST_V4L2_MIN_BUFFERS 2 +#define GST_V4L2_MAX_SIZE (1<<15) /* 2^15 == 32768 */ G_BEGIN_DECLS @@ -100,7 +101,7 @@ struct _GstV4l2Src /* how are we going to push buffers? */ guint fps_n, fps_d; - gboolean use_fixed_fps; + gboolean use_undef_fps; }; struct _GstV4l2SrcClass diff --git a/sys/v4l2/gstv4l2tuner.c b/sys/v4l2/gstv4l2tuner.c index 3ec73a23f4..acc0c78b42 100644 --- a/sys/v4l2/gstv4l2tuner.c +++ b/sys/v4l2/gstv4l2tuner.c @@ -122,16 +122,6 @@ gst_v4l2_tuner_norm_init (GstV4l2TunerNorm * norm) norm->index = 0; } -#if 0 /* output not handled by now */ -static gboolean -gst_v4l2_tuner_is_sink (GstV4l2Object * v4l2object) -{ - GstPadDirection dir = GST_PAD_UNKNOWN; - - return (dir == GST_PAD_SINK); -} -#endif /* #if 0 - output not handled by now */ - static G_GNUC_UNUSED gboolean gst_v4l2_tuner_contains_channel (GstV4l2Object * v4l2object, GstV4l2TunerChannel * v4l2channel) diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index 1d287d1762..318508cfc6 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -83,113 +83,64 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) { gint n; -#if 0 /* output not handled by now */ - GstPadDirection dir = GST_PAD_UNKNOWN; -#endif /* #if 0 - output not handled by now */ - GST_DEBUG_OBJECT (v4l2object->element, "getting enumerations"); GST_V4L2_CHECK_OPEN (v4l2object); -#if 0 /* output not handled by now */ - if (dir != GST_PAD_SINK) { -#endif /* #if 0 - output not handled by now */ + GST_DEBUG_OBJECT (v4l2object->element, " inputs"); + /* and now, the inputs */ + for (n = 0;; n++) { + struct v4l2_input input; + GstV4l2TunerChannel *v4l2channel; + GstTunerChannel *channel; - GST_DEBUG_OBJECT (v4l2object->element, " inputs"); - /* and now, the inputs */ - for (n = 0;; n++) { - struct v4l2_input input; - GstV4l2TunerChannel *v4l2channel; - GstTunerChannel *channel; - - input.index = n; - if (ioctl (v4l2object->video_fd, VIDIOC_ENUMINPUT, &input) < 0) { - if (errno == EINVAL) - break; /* end of enumeration */ - else { - GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, - ("Failed to get %d in input enumeration for %s", - n, v4l2object->videodev), GST_ERROR_SYSTEM); - return FALSE; - } + input.index = n; + if (ioctl (v4l2object->video_fd, VIDIOC_ENUMINPUT, &input) < 0) { + if (errno == EINVAL) + break; /* end of enumeration */ + else { + GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, + ("Failed to get %d in input enumeration for %s", + n, v4l2object->videodev), GST_ERROR_SYSTEM); + return FALSE; } - - v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL); - channel = GST_TUNER_CHANNEL (v4l2channel); - channel->label = g_strdup ((const gchar *) input.name); - channel->flags = GST_TUNER_CHANNEL_INPUT; - v4l2channel->index = n; - if (input.type == V4L2_INPUT_TYPE_TUNER) { - struct v4l2_tuner vtun; - - v4l2channel->tuner = input.tuner; - channel->flags |= GST_TUNER_CHANNEL_FREQUENCY; - - vtun.index = input.tuner; - if (ioctl (v4l2object->video_fd, VIDIOC_G_TUNER, &vtun) < 0) { - GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, - ("Failed to get tuner %d settings on %s", - input.tuner, v4l2object->videodev), GST_ERROR_SYSTEM); - g_object_unref (G_OBJECT (channel)); - return FALSE; - } - channel->freq_multiplicator = - 62.5 * ((vtun.capability & V4L2_TUNER_CAP_LOW) ? 1 : 1000); - channel->min_frequency = vtun.rangelow * channel->freq_multiplicator; - channel->max_frequency = vtun.rangehigh * channel->freq_multiplicator; - channel->min_signal = 0; - channel->max_signal = 0xffff; - } - if (input.audioset) { - /* we take the first. We don't care for - * the others for now */ - while (!(input.audioset & (1 << v4l2channel->audio))) - v4l2channel->audio++; - channel->flags |= GST_TUNER_CHANNEL_AUDIO; - } - - v4l2object->inputs = - g_list_append (v4l2object->inputs, (gpointer) channel); } -#if 0 /* output not handled by now */ - } else { - /* outputs */ - for (n = 0;; n++) { - struct v4l2_output output; - GstV4l2TunerChannel *v4l2channel; - GstTunerChannel *channel; + v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL); + channel = GST_TUNER_CHANNEL (v4l2channel); + channel->label = g_strdup ((const gchar *) input.name); + channel->flags = GST_TUNER_CHANNEL_INPUT; + v4l2channel->index = n; + if (input.type == V4L2_INPUT_TYPE_TUNER) { + struct v4l2_tuner vtun; - output.index = n; - if (ioctl (v4l2object->video_fd, VIDIOC_ENUMOUTPUT, &output) < 0) { - if (errno == EINVAL) - break; /* end of enumeration */ - else { - GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, - ("Failed to get %d in output enumeration for %s", - n, v4l2object->videodev) - , GST_ERROR_SYSTEM); - return FALSE; - } + v4l2channel->tuner = input.tuner; + channel->flags |= GST_TUNER_CHANNEL_FREQUENCY; + + vtun.index = input.tuner; + if (ioctl (v4l2object->video_fd, VIDIOC_G_TUNER, &vtun) < 0) { + GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, + ("Failed to get tuner %d settings on %s", + input.tuner, v4l2object->videodev), GST_ERROR_SYSTEM); + g_object_unref (G_OBJECT (channel)); + return FALSE; } - - v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL); - channel = GST_TUNER_CHANNEL (v4l2channel); - channel->label = g_strdup ((const gchar *) output.name); - channel->flags = GST_TUNER_CHANNEL_OUTPUT; - v4l2channel->index = n; - if (output.audioset) { - /* we take the first. We don't care for - * the others for now */ - while (!(output.audioset & (1 << v4l2channel->audio))) - v4l2channel->audio++; - channel->flags |= GST_TUNER_CHANNEL_AUDIO; - } - - v4l2object->inputs = - g_list_append (v4l2object->inputs, (gpointer) channel); + channel->freq_multiplicator = + 62.5 * ((vtun.capability & V4L2_TUNER_CAP_LOW) ? 1 : 1000); + channel->min_frequency = vtun.rangelow * channel->freq_multiplicator; + channel->max_frequency = vtun.rangehigh * channel->freq_multiplicator; + channel->min_signal = 0; + channel->max_signal = 0xffff; } + if (input.audioset) { + /* we take the first. We don't care for + * the others for now */ + while (!(input.audioset & (1 << v4l2channel->audio))) + v4l2channel->audio++; + channel->flags |= GST_TUNER_CHANNEL_AUDIO; + } + + v4l2object->inputs = g_list_append (v4l2object->inputs, (gpointer) channel); } -#endif /* #if 0 - output not handled by now */ GST_DEBUG_OBJECT (v4l2object->element, " norms"); /* norms... */ @@ -231,6 +182,9 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) if (n == V4L2_CID_LASTP1) { GST_DEBUG_OBJECT (v4l2object->element, "checking private CIDs"); n = V4L2_CID_PRIVATE_BASE; + /* FIXME: We are still not handling private controls. We need a new GstInterface + to export those controls */ + break; } control.id = n; @@ -267,6 +221,21 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) case V4L2_CID_GAIN: /* we only handle these for now (why?) */ break; + case V4L2_CID_HFLIP: + case V4L2_CID_VFLIP: + case V4L2_CID_HCENTER: + case V4L2_CID_VCENTER: + /* not handled here, handled by VideoOrientation interface */ + control.id++; + break; + case V4L2_CID_AUDIO_VOLUME: + case V4L2_CID_AUDIO_BALANCE: + case V4L2_CID_AUDIO_BASS: + case V4L2_CID_AUDIO_TREBLE: + case V4L2_CID_AUDIO_MUTE: + case V4L2_CID_AUDIO_LOUDNESS: + /* FIXME: We should implement GstMixer interface */ + /* fall through */ default: GST_DEBUG_OBJECT (v4l2object->element, "ControlID %s (%x) unhandled, FIXME", control.name, n); @@ -283,7 +252,8 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) channel->label = g_strdup ((const gchar *) control.name); v4l2channel->id = n; -#if 0 /* FIXME: will be be need just when handling private controls */ +#if 0 /* FIXME: it will be need just when handling private controls + (currently none of base controls are of this type) */ if (control.type == V4L2_CTRL_TYPE_MENU) { struct v4l2_querymenu menu, *mptr; int i; @@ -319,9 +289,11 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) channel->max_value = TRUE; break; default: - /* FIX ME we should find out how to handle V4L2_CTRL_TYPE_BUTTON */ + /* FIXME we should find out how to handle V4L2_CTRL_TYPE_BUTTON. + BUTTON controls like V4L2_CID_DO_WHITE_BALANCE can just be set (1) or + unset (0), but can't be queried */ GST_DEBUG_OBJECT (v4l2object->element, - "No range for ControlID %s (%x), type=%d", + "Control with non supported type %s (%x), type=%d", control.name, n, control.type); channel->min_value = channel->max_value = 0; break; @@ -497,9 +469,8 @@ gst_v4l2_get_norm (GstV4l2Object * v4l2object, v4l2_std_id * norm) /* ERRORS */ std_failed: { - GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to get the current norm for device %s"), - v4l2object->videodev), GST_ERROR_SYSTEM); + GST_DEBUG ("Failed to get the current norm for device %s", + v4l2object->videodev); return FALSE; } } @@ -765,48 +736,3 @@ input_failed: return FALSE; } } - - -#if 0 /* output not handled by now, Indeed it will be another element */ - -gboolean -gst_v4l2_get_output (GstV4l2Object * v4l2object, gint * output) -{ - gint n; - - GST_DEBUG_OBJECT (v4l2object->element, "trying to get output"); - if (!GST_V4L2_IS_OPEN (v4l2object)) - return FALSE; - - if (ioctl (v4l2object->video_fd, VIDIOC_G_OUTPUT, &n) < 0) { - GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to get current output on device %s"), - v4l2object->videodev), GST_ERROR_SYSTEM); - return FALSE; - } - - *output = n; - - return TRUE; -} - -gboolean -gst_v4l2_set_output (GstV4l2Object * v4l2object, gint output) -{ - GST_DEBUG_OBJECT (v4l2object->element, "trying to set output to %d", output); - if (!GST_V4L2_IS_OPEN (v4l2object)) - return FALSE; - if (!GST_V4L2_IS_ACTIVE (v4l2object)) - return FALSE; - - if (ioctl (v4l2object->video_fd, VIDIOC_S_OUTPUT, &output) < 0) { - GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to set current output on device %s to %d"), - v4l2object->videodev, output), GST_ERROR_SYSTEM); - return FALSE; - } - - return TRUE; -} - -#endif /* #if 0 - output not handled by now , Indeed it will be another element */ diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c index 21b07f5c49..489c11182c 100644 --- a/sys/v4l2/v4l2src_calls.c +++ b/sys/v4l2/v4l2src_calls.c @@ -604,30 +604,6 @@ gst_v4l2src_buffer_pool_free (GstV4l2BufferPool * pool, gboolean do_close) g_free (pool); } -#if 0 - -void -gst_v4l2src_free_buffer (GstBuffer * buffer) -{ - GstV4l2Buffer *buf = (GstV4l2Buffer *) GST_BUFFER_PRIVATE (buffer); - - GST_LOG ("freeing buffer %p (nr. %d)", buffer, buf->buffer.index); - - if (!g_atomic_int_dec_and_test (&buf->refcount)) { - /* we're still in use, add to queue again - note: this might fail because the device is already stopped (race) */ - if (ioctl (buf->pool->video_fd, VIDIOC_QBUF, &buf->buffer) < 0) - GST_INFO ("readding to queue failed, assuming video device is stopped"); - } - if (g_atomic_int_dec_and_test (&buf->pool->refcount)) { - /* we're last thing that used all this */ - gst_v4l2src_buffer_pool_free (buf->pool, TRUE); - } -} - - -#endif - /****************************************************** * gst_v4l2src_capture_deinit(): * deinitialize the capture system @@ -717,8 +693,8 @@ gst_v4l2src_get_size_limits (GstV4l2Src * v4l2src, GST_LOG_OBJECT (v4l2src, "got min size %dx%d", fmt.fmt.pix.width, fmt.fmt.pix.height); - fmt.fmt.pix.width = 4096; - fmt.fmt.pix.height = 4096; + fmt.fmt.pix.width = GST_V4L2_MAX_SIZE; + fmt.fmt.pix.height = GST_V4L2_MAX_SIZE; if (ioctl (v4l2src->v4l2object->video_fd, VIDIOC_TRY_FMT, &fmt) < 0) { GST_DEBUG_OBJECT (v4l2src, "failed to get max size: %s", g_strerror (errno)); diff --git a/tests/icles/v4l2src-test.c b/tests/icles/v4l2src-test.c index eb0c18dc52..cb2e98fa2c 100644 --- a/tests/icles/v4l2src-test.c +++ b/tests/icles/v4l2src-test.c @@ -335,7 +335,7 @@ main (int argc, char *argv[]) gchar device[128] = { '\0' }; gchar input[128] = { '\0' }; gulong frequency = 0; - gboolean nofixedfps = TRUE; + gboolean undeffps = FALSE; /* see for input option */ @@ -348,7 +348,7 @@ main (int argc, char *argv[]) {"Device location. Common in /dev/video0"}, {"input/output (channel) to switch to"}, {"frequency to tune to (in Hz)"}, - {"set use-fixed-fps to FALSE"}, + {"set use-undef-fps to TRUE"}, {0, 0, 0, 0} }; static struct option long_options[] = { @@ -356,7 +356,7 @@ main (int argc, char *argv[]) {"device", 1, 0, 'd'}, {"input", 1, 0, 'i'}, {"frequency", 1, 0, 'f'}, - {"nofixedfps", 0, 0, 's'}, + {"undeffps", 0, 0, 's'}, {0, 0, 0, 0} }; /* getopt_long stores the option index here. */ @@ -398,7 +398,7 @@ main (int argc, char *argv[]) break; case 's': - nofixedfps = FALSE; + undeffps = TRUE; break; case 'h': @@ -464,8 +464,8 @@ main (int argc, char *argv[]) if (frequency) { g_object_set (source, "frequency", frequency, NULL); } - if (!nofixedfps) { - g_object_set (source, "use-fixed-fps", nofixedfps, NULL); + if (undeffps) { + g_object_set (source, "use-undef-fps", undeffps, NULL); } /* you would normally check that the elements were created properly */