summaryrefslogtreecommitdiffstats
path: root/sys/v4l2/v4l2_calls.c
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-03-15 19:32:27 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-03-15 19:32:27 +0000
commit6cc1c73d2baa95c46edc04f57cbe9ed690dc2f21 (patch)
tree82b5546809a42a56a7bc18bacf8ed6e209ad006e /sys/v4l2/v4l2_calls.c
parentd07ec45fa47fbd0e36224e11bcd8ba2faee1a78c (diff)
don't mix tabs and spaces
Original commit message from CVS: don't mix tabs and spaces
Diffstat (limited to 'sys/v4l2/v4l2_calls.c')
-rw-r--r--sys/v4l2/v4l2_calls.c232
1 files changed, 116 insertions, 116 deletions
diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c
index f75ea550..92de8a42 100644
--- a/sys/v4l2/v4l2_calls.c
+++ b/sys/v4l2/v4l2_calls.c
@@ -56,8 +56,8 @@ gst_v4l2_get_capabilities (GstV4l2Element * v4l2element)
if (ioctl (v4l2element->video_fd, VIDIOC_QUERYCAP, &(v4l2element->vcap)) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Error getting %s capabilities: %s",
- v4l2element->device, g_strerror (errno)));
+ ("Error getting %s capabilities: %s",
+ v4l2element->device, g_strerror (errno)));
return FALSE;
}
@@ -94,14 +94,14 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
input.index = n;
if (ioctl (v4l2element->video_fd, VIDIOC_ENUMINPUT, &input) < 0) {
- if (errno == EINVAL)
- break; /* end of enumeration */
- else {
- GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get %d in input enumeration for %s: %s",
- n, v4l2element->device, g_strerror (errno)));
- return FALSE;
- }
+ if (errno == EINVAL)
+ break; /* end of enumeration */
+ else {
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
+ ("Failed to get %d in input enumeration for %s: %s",
+ n, v4l2element->device, g_strerror (errno)));
+ return FALSE;
+ }
}
v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL);
@@ -110,34 +110,34 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
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 (v4l2element->video_fd, VIDIOC_G_TUNER, &vtun) < 0) {
- GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get tuner %d settings on %s: %s",
- input.tuner, v4l2element->device, g_strerror (errno)));
- g_object_unref (G_OBJECT (channel));
- return FALSE;
- }
- channel->min_frequency = vtun.rangelow;
- channel->max_frequency = vtun.rangehigh;
- channel->min_signal = 0;
- channel->max_signal = 0xffff;
+ struct v4l2_tuner vtun;
+
+ v4l2channel->tuner = input.tuner;
+ channel->flags |= GST_TUNER_CHANNEL_FREQUENCY;
+
+ vtun.index = input.tuner;
+ if (ioctl (v4l2element->video_fd, VIDIOC_G_TUNER, &vtun) < 0) {
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
+ ("Failed to get tuner %d settings on %s: %s",
+ input.tuner, v4l2element->device, g_strerror (errno)));
+ g_object_unref (G_OBJECT (channel));
+ return FALSE;
+ }
+ channel->min_frequency = vtun.rangelow;
+ channel->max_frequency = vtun.rangehigh;
+ 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;
+ /* 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;
}
v4l2element->channels =
- g_list_append (v4l2element->channels, (gpointer) channel);
+ g_list_append (v4l2element->channels, (gpointer) channel);
}
} else {
/* outputs */
@@ -148,14 +148,14 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
output.index = n;
if (ioctl (v4l2element->video_fd, VIDIOC_ENUMOUTPUT, &output) < 0) {
- if (errno == EINVAL)
- break; /* end of enumeration */
- else {
- GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get %d in output enumeration for %s: %s",
- n, v4l2element->device, g_strerror (errno)));
- return FALSE;
- }
+ if (errno == EINVAL)
+ break; /* end of enumeration */
+ else {
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
+ ("Failed to get %d in output enumeration for %s: %s",
+ n, v4l2element->device, g_strerror (errno)));
+ return FALSE;
+ }
}
v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL);
@@ -164,15 +164,15 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
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;
+ /* 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;
}
v4l2element->channels =
- g_list_append (v4l2element->channels, (gpointer) channel);
+ g_list_append (v4l2element->channels, (gpointer) channel);
}
}
@@ -185,12 +185,12 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
standard.index = n;
if (ioctl (v4l2element->video_fd, VIDIOC_ENUMSTD, &standard) < 0) {
if (errno == EINVAL)
- break; /* end of enumeration */
+ break; /* end of enumeration */
else {
- GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get %d in norm enumeration for %s: %s",
- n, v4l2element->device, g_strerror (errno)));
- return FALSE;
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
+ ("Failed to get %d in norm enumeration for %s: %s",
+ n, v4l2element->device, g_strerror (errno)));
+ return FALSE;
}
}
@@ -198,7 +198,7 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
norm = GST_TUNER_NORM (v4l2norm);
norm->label = g_strdup (standard.name);
norm->fps = (gfloat) standard.frameperiod.denominator /
- standard.frameperiod.numerator;
+ standard.frameperiod.numerator;
v4l2norm->index = standard.id;
v4l2element->norms = g_list_append (v4l2element->norms, (gpointer) norm);
@@ -217,15 +217,15 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
control.id = n;
if (ioctl (v4l2element->video_fd, VIDIOC_QUERYCTRL, &control) < 0) {
if (errno == EINVAL) {
- if (n < V4L2_CID_PRIVATE_BASE)
- continue;
- else
- break;
+ if (n < V4L2_CID_PRIVATE_BASE)
+ continue;
+ else
+ break;
} else {
- GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get %d in control enumeration for %s: %s",
- n, v4l2element->device, g_strerror (errno)));
- return FALSE;
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
+ ("Failed to get %d in control enumeration for %s: %s",
+ n, v4l2element->device, g_strerror (errno)));
+ return FALSE;
}
}
if (control.flags & V4L2_CTRL_FLAG_DISABLED)
@@ -245,12 +245,12 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
case V4L2_CID_EXPOSURE:
case V4L2_CID_AUTOGAIN:
case V4L2_CID_GAIN:
- /* we only handle these for now */
- break;
+ /* we only handle these for now */
+ break;
default:
- DEBUG ("ControlID %s (%d) unhandled, FIXME", control.name, n);
- control.id++;
- break;
+ DEBUG ("ControlID %s (%d) unhandled, FIXME", control.name, n);
+ control.id++;
+ break;
}
if (n != control.id)
continue;
@@ -267,20 +267,20 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
menu.id = n;
for (i = 0;; i++) {
- menu.index = i;
- if (ioctl (v4l2element->video_fd, VIDIOC_QUERYMENU, &menu) < 0) {
- if (errno == EINVAL)
- break; /* end of enumeration */
- else {
- GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get %d in menu enumeration for %s: %s",
- n, v4l2element->device, g_strerror (errno)));
- return FALSE;
- }
- }
- mptr = g_malloc (sizeof (menu));
- memcpy (mptr, &menu, sizeof (menu));
- menus = g_list_append (menus, mptr);
+ menu.index = i;
+ if (ioctl (v4l2element->video_fd, VIDIOC_QUERYMENU, &menu) < 0) {
+ if (errno == EINVAL)
+ break; /* end of enumeration */
+ else {
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
+ ("Failed to get %d in menu enumeration for %s: %s",
+ n, v4l2element->device, g_strerror (errno)));
+ return FALSE;
+ }
+ }
+ mptr = g_malloc (sizeof (menu));
+ memcpy (mptr, &menu, sizeof (menu));
+ menus = g_list_append (menus, mptr);
}
}
v4l2element->menus = g_list_append (v4l2element->menus, menus);
@@ -288,20 +288,20 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
switch (control.type) {
case V4L2_CTRL_TYPE_INTEGER:
- channel->min_value = control.minimum;
- channel->max_value = control.maximum;
- break;
+ channel->min_value = control.minimum;
+ channel->max_value = control.maximum;
+ break;
case V4L2_CTRL_TYPE_BOOLEAN:
- channel->min_value = FALSE;
- channel->max_value = TRUE;
- break;
+ channel->min_value = FALSE;
+ channel->max_value = TRUE;
+ break;
default:
- channel->min_value = channel->max_value = 0;
- break;
+ channel->min_value = channel->max_value = 0;
+ break;
}
v4l2element->colors = g_list_append (v4l2element->colors,
- (gpointer) channel);
+ (gpointer) channel);
}
return TRUE;
@@ -352,7 +352,7 @@ gst_v4l2_set_defaults (GstV4l2Element * v4l2element)
gst_tuner_set_channel (tuner, channel);
} else {
channel =
- GST_TUNER_CHANNEL (gst_tuner_get_channel (GST_TUNER (v4l2element)));
+ GST_TUNER_CHANNEL (gst_tuner_get_channel (GST_TUNER (v4l2element)));
v4l2element->channel = g_strdup (channel->label);
gst_tuner_channel_changed (tuner, channel);
g_object_notify (G_OBJECT (v4l2element), "channel");
@@ -392,8 +392,8 @@ gst_v4l2_open (GstV4l2Element * v4l2element)
v4l2element->video_fd = open (v4l2element->device, O_RDWR);
if (!GST_V4L2_IS_OPEN (v4l2element)) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, OPEN_READ_WRITE,
- (_("Could not open device \"%s\" for reading and writing."),
- v4l2element->device), GST_ERROR_SYSTEM);
+ (_("Could not open device \"%s\" for reading and writing."),
+ v4l2element->device), GST_ERROR_SYSTEM);
goto error;
}
@@ -406,8 +406,8 @@ gst_v4l2_open (GstV4l2Element * v4l2element)
if (GST_IS_V4L2SRC (v4l2element) &&
!(v4l2element->vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, NOT_FOUND,
- (_("Device \"%s\" is not a capture device."), v4l2element->device),
- ("Capabilities: 0x%x", v4l2element->vcap.capabilities));
+ (_("Device \"%s\" is not a capture device."), v4l2element->device),
+ ("Capabilities: 0x%x", v4l2element->vcap.capabilities));
goto error;
}
@@ -474,8 +474,8 @@ gst_v4l2_get_norm (GstV4l2Element * v4l2element, v4l2_std_id * norm)
if (ioctl (v4l2element->video_fd, VIDIOC_G_STD, norm) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get the current norm for device %s: %s",
- v4l2element->device, g_strerror (errno)));
+ ("Failed to get the current norm for device %s: %s",
+ v4l2element->device, g_strerror (errno)));
return FALSE;
}
@@ -498,8 +498,8 @@ gst_v4l2_set_norm (GstV4l2Element * v4l2element, v4l2_std_id norm)
if (ioctl (v4l2element->video_fd, VIDIOC_S_STD, &norm) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to set norm 0x%llx for device %s: %s",
- norm, v4l2element->device, g_strerror (errno)));
+ ("Failed to set norm 0x%llx for device %s: %s",
+ norm, v4l2element->device, g_strerror (errno)));
return FALSE;
}
@@ -523,8 +523,8 @@ gst_v4l2_get_input (GstV4l2Element * v4l2element, gint * input)
if (ioctl (v4l2element->video_fd, VIDIOC_G_INPUT, &n) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get current input on device %s: %s",
- v4l2element->device, g_strerror (errno)));
+ ("Failed to get current input on device %s: %s",
+ v4l2element->device, g_strerror (errno)));
return FALSE;
}
@@ -549,8 +549,8 @@ gst_v4l2_set_input (GstV4l2Element * v4l2element, gint input)
if (ioctl (v4l2element->video_fd, VIDIOC_S_INPUT, &input) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to set input %d on device %s: %s",
- input, v4l2element->device, g_strerror (errno)));
+ ("Failed to set input %d on device %s: %s",
+ input, v4l2element->device, g_strerror (errno)));
return FALSE;
}
@@ -574,8 +574,8 @@ gst_v4l2_get_output (GstV4l2Element * v4l2element, gint * output)
if (ioctl (v4l2element->video_fd, VIDIOC_G_OUTPUT, &n) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get current output on device %s: %s",
- v4l2element->device, g_strerror (errno)));
+ ("Failed to get current output on device %s: %s",
+ v4l2element->device, g_strerror (errno)));
return FALSE;
}
@@ -600,8 +600,8 @@ gst_v4l2_set_output (GstV4l2Element * v4l2element, gint output)
if (ioctl (v4l2element->video_fd, VIDIOC_S_OUTPUT, &output) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to set output %d on device %s: %s",
- output, v4l2element->device, g_strerror (errno)));
+ ("Failed to set output %d on device %s: %s",
+ output, v4l2element->device, g_strerror (errno)));
return FALSE;
}
@@ -627,8 +627,8 @@ gst_v4l2_get_frequency (GstV4l2Element * v4l2element,
freq.tuner = tunernum;
if (ioctl (v4l2element->video_fd, VIDIOC_G_FREQUENCY, &freq) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get current tuner frequency for device %s: %s",
- v4l2element->device, g_strerror (errno)));
+ ("Failed to get current tuner frequency for device %s: %s",
+ v4l2element->device, g_strerror (errno)));
return FALSE;
}
@@ -661,8 +661,8 @@ gst_v4l2_set_frequency (GstV4l2Element * v4l2element,
if (ioctl (v4l2element->video_fd, VIDIOC_S_FREQUENCY, &freq) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to set tuner frequency to %lu for device %s: %s",
- frequency, v4l2element->device, g_strerror (errno)));
+ ("Failed to set tuner frequency to %lu for device %s: %s",
+ frequency, v4l2element->device, g_strerror (errno)));
return FALSE;
}
@@ -688,8 +688,8 @@ gst_v4l2_signal_strength (GstV4l2Element * v4l2element,
tuner.index = tunernum;
if (ioctl (v4l2element->video_fd, VIDIOC_G_TUNER, &tuner) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get signal strength for device %s: %s",
- v4l2element->device, g_strerror (errno)));
+ ("Failed to get signal strength for device %s: %s",
+ v4l2element->device, g_strerror (errno)));
return FALSE;
}
@@ -719,8 +719,8 @@ gst_v4l2_get_attribute (GstV4l2Element * v4l2element,
if (ioctl (v4l2element->video_fd, VIDIOC_G_CTRL, &control) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get value for control %d on device %s: %s",
- attribute_num, v4l2element->device, g_strerror (errno)));
+ ("Failed to get value for control %d on device %s: %s",
+ attribute_num, v4l2element->device, g_strerror (errno)));
return FALSE;
}
@@ -751,8 +751,8 @@ gst_v4l2_set_attribute (GstV4l2Element * v4l2element,
if (ioctl (v4l2element->video_fd, VIDIOC_S_CTRL, &control) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to set value %d for control %d on device %s: %s",
- value, attribute_num, v4l2element->device, g_strerror (errno)));
+ ("Failed to set value %d for control %d on device %s: %s",
+ value, attribute_num, v4l2element->device, g_strerror (errno)));
return FALSE;
}