GST_V4L2_CHECK_OPEN(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_QUERYCAP, &(v4l2element->vcap)) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Error getting %s capabilities: %s",
- v4l2element->device, g_strerror(errno));
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Error getting %s capabilities: %s",
+ v4l2element->device, g_strerror(errno)));
return FALSE;
}
if (errno == EINVAL)
break; /* end of enumeration */
else {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to get no. %d in input enumeration for %s: %s",
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Failed to get %d in input enumeration for %s: %s",
n, v4l2element->device,
- g_strerror(errno));
+ g_strerror (errno)));
return FALSE;
}
}
vtun.index = input.tuner;
if (ioctl(v4l2element->video_fd, VIDIOC_G_TUNER,
&vtun) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to get tuner %d settings on %s: %s",
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Failed to get tuner %d settings on %s: %s",
input.tuner,
v4l2element->device,
- g_strerror(errno));
+ g_strerror (errno)));
g_object_unref(G_OBJECT(channel));
return FALSE;
}
if (errno == EINVAL)
break; /* end of enumeration */
else {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to get no. %d in output enumeration for %s: %s",
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Failed to get %d in output enumeration for %s: %s",
n, v4l2element->device,
- g_strerror(errno));
+ g_strerror (errno)));
return FALSE;
}
}
if (errno == EINVAL)
break; /* end of enumeration */
else {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to get no. %d in norm enumeration for %s: %s",
- n, v4l2element->device, g_strerror(errno));
+ 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;
}
}
else
break;
} else {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to get no. %d in control enumeration for %s: %s",
- n, v4l2element->device, g_strerror(errno));
+ 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 (errno == EINVAL)
break; /* end of enumeration */
else {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to get no. %d in menu %d enumeration for %s: %s",
- i, n, v4l2element->device, g_strerror(errno));
+ 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;
}
}
/* open the device */
v4l2element->video_fd = open(v4l2element->device, O_RDWR);
if (!GST_V4L2_IS_OPEN(v4l2element)) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to open device %s: %s",
- v4l2element->device, g_strerror(errno));
+ gst_element_error (v4l2element, RESOURCE, OPEN_READ_WRITE,
+ (_("Could not open device \"%s\" for reading and writing"), v4l2element->device),
+ GST_ERROR_SYSTEM);
goto error;
}
/* do we need to be a capture device? */
if (GST_IS_V4L2SRC(v4l2element) &&
!(v4l2element->vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Not a capture device (0x%x)",
- v4l2element->vcap.capabilities);
+ gst_element_error (v4l2element, RESOURCE, NOT_FOUND,
+ (_("Device \"%s\" is not a capture device"), v4l2element->device),
+ ("Capabilities: 0x%x", v4l2element->vcap.capabilities));
goto error;
}
GST_V4L2_CHECK_OPEN(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_G_STD, norm) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to get the current norm for device %s: %s",
- v4l2element->device, g_strerror(errno));
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Failed to get the current norm for device %s: %s",
+ v4l2element->device, g_strerror(errno)));
return FALSE;
}
GST_V4L2_CHECK_NOT_ACTIVE(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_S_STD, &norm) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to set norm 0x%llx for device %s: %s",
- norm, v4l2element->device, g_strerror(errno));
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Failed to set norm 0x%llx for device %s: %s",
+ norm, v4l2element->device, g_strerror(errno)));
return FALSE;
}
GST_V4L2_CHECK_OPEN(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_G_INPUT, &n) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to get current input on device %s: %s",
- v4l2element->device, g_strerror(errno));
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Failed to get current input on device %s: %s",
+ v4l2element->device, g_strerror(errno)));
return FALSE;
}
GST_V4L2_CHECK_NOT_ACTIVE(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_S_INPUT, &input) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to set input %d on device %s: %s",
- input, v4l2element->device, g_strerror(errno));
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Failed to set input %d on device %s: %s",
+ input, v4l2element->device, g_strerror(errno)));
return FALSE;
}
GST_V4L2_CHECK_OPEN(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_G_OUTPUT, &n) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to get current output on device %s: %s",
- v4l2element->device, g_strerror(errno));
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Failed to get current output on device %s: %s",
+ v4l2element->device, g_strerror(errno)));
return FALSE;
}
GST_V4L2_CHECK_NOT_ACTIVE(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_S_OUTPUT, &output) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to set output %d on device %s: %s",
- output, v4l2element->device, g_strerror(errno));
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Failed to set output %d on device %s: %s",
+ output, v4l2element->device, g_strerror(errno)));
return FALSE;
}
freq.tuner = tunernum;
if (ioctl(v4l2element->video_fd, VIDIOC_G_FREQUENCY, &freq) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to get current tuner frequency for device %s: %s",
- v4l2element->device, g_strerror(errno));
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Failed to get current tuner frequency for device %s: %s",
+ v4l2element->device, g_strerror(errno)));
return FALSE;
}
freq.frequency = frequency;
if (ioctl(v4l2element->video_fd, VIDIOC_S_FREQUENCY, &freq) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to set tuner frequency to %lu for device %s: %s",
- frequency, v4l2element->device, g_strerror(errno));
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Failed to set tuner frequency to %lu for device %s: %s",
+ frequency, v4l2element->device, g_strerror(errno)));
return FALSE;
}
tuner.index = tunernum;
if (ioctl(v4l2element->video_fd, VIDIOC_G_TUNER, &tuner) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to get signal strength for device %s: %s",
- v4l2element->device, g_strerror(errno));
+ gst_element_error (v4l2element, RESOURCE, SETTINGS, NULL,
+ ("Failed to get signal strength for device %s: %s",
+ v4l2element->device, g_strerror(errno)));
return FALSE;
}
control.id = attribute_num;
if (ioctl(v4l2element->video_fd, VIDIOC_G_CTRL, &control) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to get value for control %d on device %s: %s",
- attribute_num, v4l2element->device, g_strerror(errno));
+ 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)));
return FALSE;
}
control.value = value;
if (ioctl(v4l2element->video_fd, VIDIOC_S_CTRL, &control) < 0) {
- gst_element_error(GST_ELEMENT(v4l2element),
- "Failed to set value %d for control %d on device %s: %s",
- value, attribute_num, v4l2element->device, g_strerror(errno));
+ 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)));
return FALSE;
}