/* GStreamer
*
* Copyright (C) 2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- * 2006 Edgard Lima <edgard.lima@indt.org.br>
+ * 2006 Edgard Lima <edgard.lima@gmail.com>
*
* v4l2_calls.c - generic V4L2 calls handling
*
#include <string.h>
#include <errno.h>
#include <unistd.h>
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+#include <glob.h>
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
#ifdef __sun
/* Needed on older Solaris Nevada builds (72 at least) */
#include <stropts.h>
#include "gstv4l2src.h"
#include "gstv4l2sink.h"
+#include "gstv4l2videodec.h"
#include "gst/gst-i18n-plugin.h"
-/* Those are ioctl calls */
-#ifndef V4L2_CID_HCENTER
-#define V4L2_CID_HCENTER V4L2_CID_HCENTER_DEPRECATED
-#endif
-#ifndef V4L2_CID_VCENTER
-#define V4L2_CID_VCENTER V4L2_CID_VCENTER_DEPRECATED
-#endif
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+enum {
+ V4L2_OPEN_ERROR = 0,
+ V4L2_OPEN_ERROR_STAT_FAILED,
+ V4L2_OPEN_ERROR_NO_DEVICE,
+ V4L2_OPEN_ERROR_NOT_OPEN,
+ V4L2_OPEN_ERROR_NOT_CAPTURE,
+ V4L2_OPEN_ERROR_NOT_OUTPUT
+};
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
GST_DEBUG_CATEGORY_EXTERN (v4l2_debug);
#define GST_CAT_DEFAULT v4l2_debug
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_QUERYCAP, &v4l2object->vcap) < 0)
goto cap_failed;
+ if (v4l2object->vcap.capabilities & V4L2_CAP_DEVICE_CAPS)
+ v4l2object->device_caps = v4l2object->vcap.device_caps;
+ else
+ v4l2object->device_caps = v4l2object->vcap.capabilities;
+
GST_LOG_OBJECT (e, "driver: '%s'", v4l2object->vcap.driver);
GST_LOG_OBJECT (e, "card: '%s'", v4l2object->vcap.card);
GST_LOG_OBJECT (e, "bus_info: '%s'", v4l2object->vcap.bus_info);
GST_LOG_OBJECT (e, "version: %08x", v4l2object->vcap.version);
- GST_LOG_OBJECT (e, "capabilites: %08x", v4l2object->vcap.capabilities);
+ GST_LOG_OBJECT (e, "capabilites: %08x", v4l2object->device_caps);
return TRUE;
}
}
+/******************************************************
+ * The video4linux command line tool v4l2-ctrl
+ * normalises the names of the controls received from
+ * the kernel like:
+ *
+ * "Exposure (absolute)" -> "exposure_absolute"
+ *
+ * We follow their lead here. @name is modified
+ * in-place.
+ ******************************************************/
+static void
+gst_v4l2_normalise_control_name (gchar * name)
+{
+ int i, j;
+ for (i = 0, j = 0; name[j]; ++j) {
+ if (g_ascii_isalnum (name[j])) {
+ if (i > 0 && !g_ascii_isalnum (name[j - 1]))
+ name[i++] = '_';
+ name[i++] = g_ascii_tolower (name[j]);
+ }
+ }
+ name[i++] = '\0';
+}
/******************************************************
* gst_v4l2_empty_lists() and gst_v4l2_fill_lists():
GST_DEBUG_OBJECT (e, " controls+menus");
/* and lastly, controls+menus (if appropriate) */
-#ifdef V4L2_CTRL_FLAG_NEXT_CTRL
next = V4L2_CTRL_FLAG_NEXT_CTRL;
n = 0;
-#else
- next = 0;
- n = V4L2_CID_BASE;
-#endif
control.id = next;
+
while (TRUE) {
GstV4l2ColorBalanceChannel *v4l2channel;
GstColorBalanceChannel *channel;
if (n < V4L2_CID_PRIVATE_BASE) {
GST_DEBUG_OBJECT (e, "skipping control %08x", n);
/* continue so that we also check private controls */
+ n = V4L2_CID_PRIVATE_BASE - 1;
continue;
} else {
GST_DEBUG_OBJECT (e, "controls finished");
GST_DEBUG_OBJECT (e, "skipping disabled control");
continue;
}
-#ifdef V4L2_CTRL_TYPE_CTRL_CLASS
+
if (control.type == V4L2_CTRL_TYPE_CTRL_CLASS) {
GST_DEBUG_OBJECT (e, "starting control class '%s'", control.name);
continue;
}
-#endif
+
switch (control.type) {
case V4L2_CTRL_TYPE_INTEGER:
case V4L2_CTRL_TYPE_BOOLEAN:
case V4L2_CTRL_TYPE_MENU:
-#ifdef V4L2_CTRL_TYPE_INTEGER_MENU
case V4L2_CTRL_TYPE_INTEGER_MENU:
-#endif
-#ifdef V4L2_CTRL_TYPE_BITMASK
case V4L2_CTRL_TYPE_BITMASK:
-#endif
case V4L2_CTRL_TYPE_BUTTON:{
- int i;
control.name[31] = '\0';
- for (i = 0; control.name[i]; ++i) {
- control.name[i] = g_ascii_tolower (control.name[i]);
- if (!g_ascii_isalnum (control.name[i]))
- control.name[i] = '_';
- }
- GST_INFO_OBJECT (e, "adding generic controls '%s'", control.name);
+ gst_v4l2_normalise_control_name ((gchar *) control.name);
g_datalist_id_set_data (&v4l2object->controls,
g_quark_from_string ((const gchar *) control.name),
GINT_TO_POINTER (n));
case V4L2_CID_EXPOSURE:
case V4L2_CID_AUTOGAIN:
case V4L2_CID_GAIN:
-#ifdef V4L2_CID_SHARPNESS
case V4L2_CID_SHARPNESS:
-#endif
/* we only handle these for now (why?) */
break;
case V4L2_CID_HFLIP:
case V4L2_CID_VFLIP:
-#ifndef V4L2_CID_PAN_RESET
- case V4L2_CID_HCENTER:
-#endif
-#ifndef V4L2_CID_TILT_RESET
- case V4L2_CID_VCENTER:
-#endif
-#ifdef V4L2_CID_PAN_RESET
case V4L2_CID_PAN_RESET:
-#endif
-#ifdef V4L2_CID_TILT_RESET
case V4L2_CID_TILT_RESET:
-#endif
/* not handled here, handled by VideoOrientation interface */
control.id++;
break;
case V4L2_CID_AUDIO_TREBLE:
case V4L2_CID_AUDIO_MUTE:
case V4L2_CID_AUDIO_LOUDNESS:
- /* FIXME: We should implement GstMixer interface */
- /* fall through */
+ /* FIXME: We should implement GstMixer interface instead */
+ /* but let's not be pedantic and make element more useful for now */
+ break;
+ case V4L2_CID_ALPHA_COMPONENT:
+ v4l2object->has_alpha_component = TRUE;
+ break;
default:
GST_DEBUG_OBJECT (e,
"ControlID %s (%x) unhandled, FIXME", control.name, n);
* in a contiguous manner. In this case the first v4l2 plane
* contains all the gst planes.
*/
-#ifdef V4L2_CAP_VIDEO_M2M_MPLANE
-#define CHECK_CAPS (V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE)
-#else
-#define CHECK_CAPS (V4L2_CAP_VIDEO_OUTPUT_MPLANE)
-#endif
-
switch (v4l2object->type) {
case V4L2_BUF_TYPE_VIDEO_OUTPUT:
- if (v4l2object->vcap.capabilities & CHECK_CAPS) {
+ if (v4l2object->device_caps &
+ (V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE)) {
GST_DEBUG ("adjust type to multi-planar output");
v4l2object->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
}
break;
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
- if (v4l2object->vcap.capabilities & CHECK_CAPS) {
- /* FIXME: for now it's an untested case so just put a warning */
- GST_WARNING ("untested V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE");
-
+ if (v4l2object->device_caps &
+ (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE)) {
GST_DEBUG ("adjust type to multi-planar capture");
v4l2object->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
}
{
struct stat st;
int libv4l2_fd;
- GstPollFD pollfd = GST_POLL_FD_INIT;
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+ int error_type = V4L2_OPEN_ERROR_STAT_FAILED;
+ int device_index = 0;
+ glob_t glob_buf;
+
+ memset(&glob_buf, 0x0, sizeof(glob_t));
+
+ if (!v4l2object) {
+ GST_ERROR("v4l2object is NULL");
+ return FALSE;
+ }
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
GST_DEBUG_OBJECT (v4l2object->element, "Trying to open device %s",
v4l2object->videodev);
if (!v4l2object->videodev)
v4l2object->videodev = g_strdup ("/dev/video");
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+ if (!v4l2object->videodev) {
+ GST_ERROR_OBJECT(v4l2object->element, "videodev is NULL");
+ return FALSE;
+ }
+
+CHECK_AGAIN:
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
/* check if it is a device */
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+ if (stat (v4l2object->videodev, &st) == -1) {
+ error_type = V4L2_OPEN_ERROR_STAT_FAILED;
+ goto pre_error_check;
+ }
+#else /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
if (stat (v4l2object->videodev, &st) == -1)
goto stat_failed;
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+ if (!S_ISCHR (st.st_mode)) {
+ error_type = V4L2_OPEN_ERROR_NO_DEVICE;
+ goto pre_error_check;
+ }
+#else /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
if (!S_ISCHR (st.st_mode))
goto no_device;
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
/* open the device */
v4l2object->video_fd =
open (v4l2object->videodev, O_RDWR /* | O_NONBLOCK */ );
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+ if (!GST_V4L2_IS_OPEN (v4l2object)) {
+ error_type = V4L2_OPEN_ERROR_NOT_OPEN;
+ goto pre_error_check;
+ }
+#else /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
if (!GST_V4L2_IS_OPEN (v4l2object))
goto not_open;
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
libv4l2_fd = v4l2_fd_open (v4l2object->video_fd,
V4L2_ENABLE_ENUM_FMT_EMULATION);
if (libv4l2_fd != -1)
v4l2object->video_fd = libv4l2_fd;
- v4l2object->can_poll_device = TRUE;
-
/* get capabilities, error will be posted */
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+ if (!gst_v4l2_get_capabilities (v4l2object)) {
+ error_type = V4L2_OPEN_ERROR;
+ goto pre_error_check;
+ }
+#else /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
if (!gst_v4l2_get_capabilities (v4l2object))
goto error;
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
/* do we need to be a capture device? */
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+ GST_INFO_OBJECT(v4l2object->element, "device_caps 0x%x", v4l2object->device_caps);
+ if (GST_IS_V4L2SRC (v4l2object->element) &&
+ (!(v4l2object->device_caps & (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE)) ||
+ (v4l2object->device_caps & (V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_MPLANE)))) {
+ error_type = V4L2_OPEN_ERROR_NOT_CAPTURE;
+ goto pre_error_check;
+ }
+#else /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
if (GST_IS_V4L2SRC (v4l2object->element) &&
- !(v4l2object->vcap.capabilities & (V4L2_CAP_VIDEO_CAPTURE |
+ !(v4l2object->device_caps & (V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_VIDEO_CAPTURE_MPLANE)))
goto not_capture;
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
if (GST_IS_V4L2SINK (v4l2object->element) &&
- !(v4l2object->vcap.capabilities & (V4L2_CAP_VIDEO_OUTPUT |
+ !(v4l2object->device_caps & (V4L2_CAP_VIDEO_OUTPUT |
+ V4L2_CAP_VIDEO_OUTPUT_MPLANE))) {
+ error_type = V4L2_OPEN_ERROR_NOT_OUTPUT;
+ goto pre_error_check;
+ }
+#else /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
+ if (GST_IS_V4L2SINK (v4l2object->element) &&
+ !(v4l2object->device_caps & (V4L2_CAP_VIDEO_OUTPUT |
V4L2_CAP_VIDEO_OUTPUT_MPLANE)))
goto not_output;
-
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
+
+ if (GST_IS_V4L2_VIDEO_DEC (v4l2object->element) &&
+ /* Today's M2M device only expose M2M */
+ !((v4l2object->device_caps & (V4L2_CAP_VIDEO_M2M |
+ V4L2_CAP_VIDEO_M2M_MPLANE)) ||
+ /* But legacy driver may expose both CAPTURE and OUTPUT */
+ ((v4l2object->device_caps &
+ (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE)) &&
+ (v4l2object->device_caps &
+ (V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_MPLANE)))))
+ goto not_m2m;
gst_v4l2_adjust_buf_type (v4l2object);
/* create enumerations, posts errors. */
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+ if (!gst_v4l2_fill_lists (v4l2object)) {
+ error_type = V4L2_OPEN_ERROR;
+ goto pre_error_check;
+ }
+#else /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
if (!gst_v4l2_fill_lists (v4l2object))
goto error;
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
GST_INFO_OBJECT (v4l2object->element,
"Opened device '%s' (%s) successfully",
v4l2object->vcap.card, v4l2object->videodev);
- pollfd.fd = v4l2object->video_fd;
- gst_poll_add_fd (v4l2object->poll, &pollfd);
- if (v4l2object->type == V4L2_BUF_TYPE_VIDEO_CAPTURE
- || v4l2object->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
- gst_poll_fd_ctl_read (v4l2object->poll, &pollfd, TRUE);
- else
- gst_poll_fd_ctl_write (v4l2object->poll, &pollfd, TRUE);
-
if (v4l2object->extra_controls)
gst_v4l2_set_controls (v4l2object, v4l2object->extra_controls);
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+ globfree(&glob_buf);
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
+
/* UVC devices are never interlaced, and doing VIDIOC_TRY_FMT on them
* causes expensive and slow USB IO, so don't probe them for interlaced
*/
return TRUE;
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+pre_error_check:
+ {
+ if (GST_IS_V4L2SRC(v4l2object->element) && glob_buf.gl_pathc == 0) {
+ if (glob("/dev/video*", 0, 0, &glob_buf) != 0) {
+ GST_WARNING_OBJECT(v4l2object->element, "glob failed");
+ }
+ }
+
+ if (glob_buf.gl_pathc > 0 && device_index < glob_buf.gl_pathc) {
+ if (v4l2object->videodev) {
+ g_free(v4l2object->videodev);
+ v4l2object->videodev = NULL;
+ }
+ v4l2object->videodev = g_strdup(glob_buf.gl_pathv[device_index]);
+ if (v4l2object->videodev) {
+ device_index++;
+ GST_INFO_OBJECT(v4l2object->element, "check device [%s]",
+ v4l2object->videodev);
+
+ if (GST_V4L2_IS_OPEN (v4l2object)) {
+ /* close device */
+ v4l2_close (v4l2object->video_fd);
+ v4l2object->video_fd = -1;
+ }
+ /* empty lists */
+ gst_v4l2_empty_lists (v4l2object);
+
+ goto CHECK_AGAIN;
+ } else {
+ GST_WARNING_OBJECT(v4l2object->element, "g_strdup failed [%s]",
+ glob_buf.gl_pathv[device_index]);
+ }
+ }
+
+ GST_WARNING_OBJECT(v4l2object->element, "error type : %d", error_type);
+
+ switch (error_type) {
+ case V4L2_OPEN_ERROR_STAT_FAILED:
+ goto stat_failed;
+ case V4L2_OPEN_ERROR_NO_DEVICE:
+ goto no_device;
+ case V4L2_OPEN_ERROR_NOT_OPEN:
+ goto not_open;
+ case V4L2_OPEN_ERROR_NOT_CAPTURE:
+ goto not_capture;
+ case V4L2_OPEN_ERROR_NOT_OUTPUT:
+ goto not_output;
+ default:
+ goto error;
+ }
+ }
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
+
/* ERRORS */
stat_failed:
{
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND,
(_("Device '%s' is not a capture device."),
v4l2object->videodev),
- ("Capabilities: 0x%x", v4l2object->vcap.capabilities));
+ ("Capabilities: 0x%x", v4l2object->device_caps));
goto error;
}
not_output:
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND,
(_("Device '%s' is not a output device."),
v4l2object->videodev),
- ("Capabilities: 0x%x", v4l2object->vcap.capabilities));
+ ("Capabilities: 0x%x", v4l2object->device_caps));
+ goto error;
+ }
+not_m2m:
+ {
+ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND,
+ (_("Device '%s' is not a M2M device."),
+ v4l2object->videodev),
+ ("Capabilities: 0x%x", v4l2object->device_caps));
goto error;
}
error:
/* empty lists */
gst_v4l2_empty_lists (v4l2object);
+#ifdef TIZEN_FEATURE_V4L2SRC_MODIFICATION
+ globfree(&glob_buf);
+#endif /* TIZEN_FEATURE_V4L2SRC_MODIFICATION */
+
return FALSE;
}
}
gboolean
gst_v4l2_dup (GstV4l2Object * v4l2object, GstV4l2Object * other)
{
- GstPollFD pollfd = GST_POLL_FD_INIT;
-
GST_DEBUG_OBJECT (v4l2object->element, "Trying to dup device %s",
other->videodev);
GST_V4L2_CHECK_NOT_ACTIVE (v4l2object);
v4l2object->vcap = other->vcap;
+ v4l2object->device_caps = other->device_caps;
gst_v4l2_adjust_buf_type (v4l2object);
v4l2object->video_fd = v4l2_dup (other->video_fd);
"Cloned device '%s' (%s) successfully",
v4l2object->vcap.card, v4l2object->videodev);
- pollfd.fd = v4l2object->video_fd;
- gst_poll_add_fd (v4l2object->poll, &pollfd);
- if (v4l2object->type == V4L2_BUF_TYPE_VIDEO_CAPTURE
- || v4l2object->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
- gst_poll_fd_ctl_read (v4l2object->poll, &pollfd, TRUE);
- else
- gst_poll_fd_ctl_write (v4l2object->poll, &pollfd, TRUE);
-
v4l2object->never_interlaced = other->never_interlaced;
- v4l2object->can_poll_device = TRUE;
return TRUE;
gboolean
gst_v4l2_close (GstV4l2Object * v4l2object)
{
- GstPollFD pollfd = GST_POLL_FD_INIT;
GST_DEBUG_OBJECT (v4l2object->element, "Trying to close %s",
v4l2object->videodev);
/* close device */
v4l2_close (v4l2object->video_fd);
- pollfd.fd = v4l2object->video_fd;
- gst_poll_remove_fd (v4l2object->poll, &pollfd);
v4l2object->video_fd = -1;
/* empty lists */
freq.tuner = tunernum;
/* fill in type - ignore error */
- v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_FREQUENCY, &freq);
+ (void) v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_FREQUENCY, &freq);
freq.frequency = frequency / channel->freq_multiplicator;
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_FREQUENCY, &freq) < 0)
/* ERRORS */
ctrl_failed:
{
- GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
- (_("Failed to get value for control %d on device '%s'."),
- attribute_num, v4l2object->videodev), GST_ERROR_SYSTEM);
+ GST_WARNING_OBJECT (v4l2object,
+ _("Failed to get value for control %d on device '%s'."),
+ attribute_num, v4l2object->videodev);
return FALSE;
}
}
/* ERRORS */
ctrl_failed:
{
- GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
- (_("Failed to set value %d for control %d on device '%s'."),
- value, attribute_num, v4l2object->videodev), GST_ERROR_SYSTEM);
+ GST_WARNING_OBJECT (v4l2object,
+ _("Failed to set value %d for control %d on device '%s'."),
+ value, attribute_num, v4l2object->videodev);
return FALSE;
}
}
static gboolean
-set_contol (GQuark field_id, const GValue * value, gpointer user_data)
+set_control (GQuark field_id, const GValue * value, gpointer user_data)
{
GstV4l2Object *v4l2object = user_data;
- gpointer *d = g_datalist_id_get_data (&v4l2object->controls, field_id);
+ GQuark normalised_field_id;
+ gpointer *d;
+
+ /* 32 bytes is the maximum size for a control name according to v4l2 */
+ gchar name[32];
+
+ /* Backwards compatibility: in the past GStreamer would normalise strings in
+ a subtly different way to v4l2-ctl. e.g. the kernel's "Focus (absolute)"
+ would become "focus__absolute_" whereas now it becomes "focus_absolute".
+ Please remove the following in GStreamer 1.5 for 1.6 */
+ strncpy (name, g_quark_to_string (field_id), sizeof (name));
+ name[31] = '\0';
+ gst_v4l2_normalise_control_name (name);
+ normalised_field_id = g_quark_from_string (name);
+ if (normalised_field_id != field_id)
+ g_warning ("In GStreamer 1.4 the way V4L2 control names were normalised "
+ "changed. Instead of setting \"%s\" please use \"%s\". The former is "
+ "deprecated and will be removed in a future version of GStreamer",
+ g_quark_to_string (field_id), name);
+ field_id = normalised_field_id;
+
+ d = g_datalist_id_get_data (&v4l2object->controls, field_id);
if (!d) {
GST_WARNING_OBJECT (v4l2object,
"Control '%s' does not exist or has an unsupported type.",
gboolean
gst_v4l2_set_controls (GstV4l2Object * v4l2object, GstStructure * controls)
{
- return gst_structure_foreach (controls, set_contol, v4l2object);
+ return gst_structure_foreach (controls, set_control, v4l2object);
}
gboolean
/* ERRORS */
input_failed:
- if (v4l2object->vcap.capabilities & V4L2_CAP_TUNER) {
+ if (v4l2object->device_caps & V4L2_CAP_TUNER) {
/* only give a warning message if driver actually claims to have tuner
* support
*/
/* ERRORS */
input_failed:
- if (v4l2object->vcap.capabilities & V4L2_CAP_TUNER) {
+ if (v4l2object->device_caps & V4L2_CAP_TUNER) {
/* only give a warning message if driver actually claims to have tuner
* support
*/
/* ERRORS */
output_failed:
- if (v4l2object->vcap.capabilities & V4L2_CAP_TUNER) {
+ if (v4l2object->device_caps & V4L2_CAP_TUNER) {
/* only give a warning message if driver actually claims to have tuner
* support
*/
/* ERRORS */
output_failed:
- if (v4l2object->vcap.capabilities & V4L2_CAP_TUNER) {
+ if (v4l2object->device_caps & V4L2_CAP_TUNER) {
/* only give a warning message if driver actually claims to have tuner
* support
*/