summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-01-18 21:46:58 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-01-18 21:46:58 +0000
commit07ed811a0983771c45faa2f6f76a9fff186db407 (patch)
tree1c0250da756e8b2dce0b660515d72ab1352a11d3 /sys
parentb1e81d454192223e58f3225aa44785e940a90fd7 (diff)
downloadgst-plugins-bad-07ed811a0983771c45faa2f6f76a9fff186db407.tar.gz
gst-plugins-bad-07ed811a0983771c45faa2f6f76a9fff186db407.tar.bz2
gst-plugins-bad-07ed811a0983771c45faa2f6f76a9fff186db407.zip
use new error signal and classification
Original commit message from CVS: use new error signal and classification
Diffstat (limited to 'sys')
-rw-r--r--sys/dxr3/dxr3audiosink.c51
-rw-r--r--sys/dxr3/dxr3spusink.c26
-rw-r--r--sys/dxr3/dxr3videosink.c33
-rw-r--r--sys/v4l2/gstv4l2src.c2
-rw-r--r--sys/v4l2/v4l2src_calls.c56
-rw-r--r--sys/vcd/vcdsrc.c3
6 files changed, 78 insertions, 93 deletions
diff --git a/sys/dxr3/dxr3audiosink.c b/sys/dxr3/dxr3audiosink.c
index 58709e80..847c34b7 100644
--- a/sys/dxr3/dxr3audiosink.c
+++ b/sys/dxr3/dxr3audiosink.c
@@ -309,10 +309,9 @@ dxr3audiosink_open (Dxr3AudioSink *sink)
sink->audio_fd = open (sink->audio_filename, O_WRONLY);
if (sink->audio_fd < 0) {
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error opening device file \"",
- sink->audio_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, OPEN_WRITE,
+ (_("Could not open audio device \"%s\" for writing"), sink->audio_filename),
+ GST_ERROR_SYSTEM);
return FALSE;
}
@@ -322,10 +321,9 @@ dxr3audiosink_open (Dxr3AudioSink *sink)
sink->control_fd = open (sink->control_filename, O_WRONLY);
if (sink->control_fd < 0) {
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error opening device file \"",
- sink->control_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, OPEN_WRITE,
+ (_("Could not open control device \"%s\" for writing"), sink->control_filename),
+ GST_ERROR_SYSTEM);
return FALSE;
}
@@ -357,10 +355,9 @@ dxr3audiosink_set_mode_pcm (Dxr3AudioSink *sink)
tmp = oss_mode;
if (ioctl (sink->audio_fd, SNDCTL_DSP_SETFMT, &tmp) < 0 ||
tmp != oss_mode) {
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error configuring device mode for \"",
- sink->audio_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, SETTINGS,
+ (_("Could not configure audio device \"%s\""), sink->audio_filename),
+ GST_ERROR_SYSTEM);
return FALSE;
}
@@ -372,11 +369,9 @@ dxr3audiosink_set_mode_pcm (Dxr3AudioSink *sink)
/* Set the sampling rate. */
tmp = sink->rate;
if (ioctl (sink->audio_fd, SNDCTL_DSP_SPEED, &tmp) < 0) {
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error configuring device "
- "sampling rate for \"",
- sink->audio_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, SETTINGS,
+ (_("Could not set audio device \"%s\" to %d Hz"), sink->audio_filename, sink->rate),
+ GST_ERROR_SYSTEM);
return FALSE;
}
@@ -411,11 +406,9 @@ dxr3audiosink_set_mode_ac3 (Dxr3AudioSink *sink)
tmp = AC3_BYTE_RATE;
if (ioctl (sink->audio_fd, SNDCTL_DSP_SPEED, &tmp) < 0 ||
tmp != AC3_BYTE_RATE) {
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error configuring device "
- "sampling rate for \"",
- sink->audio_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, SETTINGS,
+ (_("Could not set audio device \"%s\" to %d Hz"), sink->audio_filename, AC3_BYTE_RATE),
+ GST_ERROR_SYSTEM);
return FALSE;
}
@@ -441,18 +434,16 @@ dxr3audiosink_close (Dxr3AudioSink *sink)
g_return_if_fail (GST_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN));
if (close (sink->audio_fd) != 0) {
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error closing file \"",
- sink->audio_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, CLOSE,
+ (_("Could not close audio device \"%s\""), sink->audio_filename),
+ GST_ERROR_SYSTEM);
return;
}
if (close (sink->control_fd) != 0) {
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error closing file \"",
- sink->control_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, CLOSE,
+ (_("Could not close control device \"%s\""), sink->audio_filename),
+ GST_ERROR_SYSTEM);
return;
}
diff --git a/sys/dxr3/dxr3spusink.c b/sys/dxr3/dxr3spusink.c
index 0b1ba010..6ce1bf6b 100644
--- a/sys/dxr3/dxr3spusink.c
+++ b/sys/dxr3/dxr3spusink.c
@@ -280,10 +280,8 @@ dxr3spusink_open (Dxr3SpuSink *sink)
sink->spu_fd = open (sink->spu_filename, O_WRONLY);
if (sink->spu_fd < 0) {
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error opening device file \"",
- sink->spu_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, OPEN_WRITE,
+ (_("Could not open spu device \"%s\" for writing"), sink->spu_filename), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -293,10 +291,8 @@ dxr3spusink_open (Dxr3SpuSink *sink)
sink->control_fd = open (sink->control_filename, O_WRONLY);
if (sink->control_fd < 0) {
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error opening device file \"",
- sink->control_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, OPEN_WRITE,
+ (_("Could not open control device \"%s\" for writing"), sink->control_filename), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -312,19 +308,17 @@ dxr3spusink_close (Dxr3SpuSink *sink)
g_return_if_fail (GST_FLAG_IS_SET (sink, DXR3SPUSINK_OPEN));
if (close (sink->spu_fd) != 0) {
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error closing file \"",
- sink->spu_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, CLOSE,
+ (_("Could not close spu device \"%s\""), sink->spu_filename),
+ GST_ERROR_SYSTEM);
return;
}
if (close (sink->control_fd) != 0)
{
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error closing file \"",
- sink->control_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, CLOSE,
+ (_("Could not close control device \"%s\""), sink->audio_filename),
+ GST_ERROR_SYSTEM);
return;
}
diff --git a/sys/dxr3/dxr3videosink.c b/sys/dxr3/dxr3videosink.c
index 9c4605e5..75a2d1c3 100644
--- a/sys/dxr3/dxr3videosink.c
+++ b/sys/dxr3/dxr3videosink.c
@@ -276,10 +276,9 @@ dxr3videosink_open (Dxr3VideoSink *sink)
sink->video_fd = open (sink->video_filename, O_WRONLY);
if (sink->video_fd < 0) {
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error opening device file \"",
- sink->video_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, OPEN_WRITE,
+ (_("Could not open video device \"%s\" for writing"), sink->video_filename),
+ GST_ERROR_SYSTEM);
return FALSE;
}
@@ -289,10 +288,9 @@ dxr3videosink_open (Dxr3VideoSink *sink)
sink->control_fd = open (sink->control_filename, O_WRONLY);
if (sink->control_fd < 0) {
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error opening device file \"",
- sink->control_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, OPEN_WRITE,
+ (_("Could not open control device \"%s\" for writing"), sink->control_filename),
+ GST_ERROR_SYSTEM);
return FALSE;
}
@@ -309,19 +307,17 @@ dxr3videosink_close (Dxr3VideoSink *sink)
if (close (sink->video_fd) != 0)
{
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error closing file \"",
- sink->video_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, CLOSE,
+ (_("Could not close video device \"%s\""), sink->video_filename),
+ GST_ERROR_SYSTEM);
return;
}
if (close (sink->control_fd) != 0)
{
- gst_element_error (GST_ELEMENT (sink),
- g_strconcat ("Error closing file \"",
- sink->control_filename, "\": ",
- g_strerror (errno), NULL));
+ gst_element_error (sink, RESOURCE, CLOSE,
+ (_("Could not close control device \"%s\""), sink->audio_filename),
+ GST_ERROR_SYSTEM);
return;
}
@@ -467,8 +463,9 @@ dxr3videosink_write_data (Dxr3VideoSink *sink, guint cut)
while (size > 0) {
written = write (sink->video_fd, data, size);
if (written < 0) {
- gst_element_error (GST_ELEMENT (sink), "Writing to %s: %s",
- sink->video_filename, strerror (errno));
+ gst_element_error (sink, RESOURCE, WRITE,
+ (_("Could not write to device %s"), sink->video_filename),
+ GST_ERROR_SYSTEM);
break;
}
size = size - written;
diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c
index edce2091..d0b480f9 100644
--- a/sys/v4l2/gstv4l2src.c
+++ b/sys/v4l2/gstv4l2src.c
@@ -817,7 +817,7 @@ gst_v4l2src_get (GstPad *pad)
if (v4l2src->use_fixed_fps &&
(fps = gst_v4l2src_get_fps(v4l2src)) == 0) {
- gst_element_error (GST_ELEMENT (v4l2src), "Could not get frame rate for element.");
+ gst_element_error (v4l2src, RESOURCE, SETTINGS, NULL, ("could not get frame rate for element"));
return NULL;
}
diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c
index 3a55a231..ec7028c2 100644
--- a/sys/v4l2/v4l2src_calls.c
+++ b/sys/v4l2/v4l2src_calls.c
@@ -72,9 +72,9 @@ gst_v4l2src_fill_format_list (GstV4l2Src *v4l2src)
if (errno == EINVAL) {
break; /* end of enumeration */
} else {
- gst_element_error(GST_ELEMENT(v4l2src),
- "Failed to get no. %d in pixelformat enumeration for %s: %s",
- n, GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno));
+ gst_element_error (v4l2src, RESOURCE, SETTINGS, NULL,
+ ("failed to get number %d in pixelformat enumeration for %s: %s",
+ n, GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno)));
g_free (format);
return FALSE;
}
@@ -117,8 +117,9 @@ gst_v4l2src_queue_frame (GstV4l2Src *v4l2src,
GST_LOG_OBJECT (v4l2src, "queueing frame %u", i);
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_QBUF, &v4l2src->pool->buffers[i].buffer) < 0) {
- gst_element_error(GST_ELEMENT(v4l2src), "Error queueing buffer %u on device %s: %s",
- i, GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno));
+ gst_element_error (v4l2src, RESOURCE, WRITE,
+ (_("Could not write to device \"%s\""), GST_V4L2ELEMENT(v4l2src)->device),
+ ("Error queueing buffer %u on device %s", i, g_strerror(errno)));
return FALSE;
}
@@ -141,8 +142,8 @@ gst_v4l2src_grab_frame (GstV4l2Src *v4l2src)
while (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_DQBUF, &buffer) < 0) {
/* if the sync() got interrupted, we can retry */
if (errno != EINTR) {
- gst_element_error(GST_ELEMENT(v4l2src), "Error syncing on a buffer on device %s: %s",
- GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno));
+ gst_element_error (v4l2src, RESOURCE, SYNC, NULL, ("could not sync on a buffer on device %s: %s",
+ GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno)));
return -1;
}
GST_DEBUG_OBJECT (v4l2src, "grab got interrupted");
@@ -169,9 +170,9 @@ gst_v4l2src_get_capture (GstV4l2Src *v4l2src)
v4l2src->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_G_FMT, &v4l2src->format) < 0) {
- gst_element_error(GST_ELEMENT(v4l2src),
- "Failed to get pixel format for device %s: %s",
- GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno));
+ gst_element_error (v4l2src, RESOURCE, SETTINGS, NULL,
+ ("failed to get pixelformat for device %s: %s",
+ n, GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno)));
return FALSE;
}
@@ -205,10 +206,9 @@ gst_v4l2src_set_capture (GstV4l2Src *v4l2src,
v4l2src->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_S_FMT, &v4l2src->format) < 0) {
- gst_element_error(GST_ELEMENT(v4l2src),
- "Failed to set pixel format to %s @ %dx%d for device %s: %s",
- fmt->description, width, height,
- GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno));
+ gst_element_error (v4l2src, RESOURCE, SETTINGS, NULL,
+ ("failed to set pixelformat to %s @ %dx%d for device %s: %s",
+ fmt->description, width, height, GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno)));
return FALSE;
}
@@ -245,14 +245,16 @@ gst_v4l2src_capture_init (GstV4l2Src *v4l2src)
v4l2src->breq.type = v4l2src->format.type;
v4l2src->breq.memory = V4L2_MEMORY_MMAP;
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_REQBUFS, &v4l2src->breq) < 0) {
- gst_element_error(GST_ELEMENT(v4l2src), "Error requesting buffers (%d) for %s: %s",
- v4l2src->breq.count, GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno));
+ gst_element_error (v4l2src, RESOURCE, READ,
+ (_("Could not get buffers from device \"%s\""), GST_V4L2ELEMENT(v4l2src)->device),
+ ("error requesting %d buffers: %s", v4l2src->breq.count, g_strerror (errno)));
return FALSE;
}
if (v4l2src->breq.count < GST_V4L2_MIN_BUFFERS) {
- gst_element_error(GST_ELEMENT(v4l2src), "Too little buffers. We got %d, we want at least %d",
- v4l2src->breq.count, GST_V4L2_MIN_BUFFERS);
+ gst_element_error (v4l2src, RESOURCE, READ,
+ (_("Could not get enough buffers from device \"%s\""), GST_V4L2ELEMENT(v4l2src)->device),
+ ("we received %d, we want at least %d", v4l2src->breq.count, GST_V4L2_MIN_BUFFERS));
v4l2src->breq.count = buffers;
return FALSE;
}
@@ -278,16 +280,16 @@ gst_v4l2src_capture_init (GstV4l2Src *v4l2src)
buffer->buffer.index = n;
buffer->buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_QUERYBUF, &buffer->buffer) < 0) {
- gst_element_error(GST_ELEMENT(v4l2src), "Failed to get buffer (%d) properties: %s",
- n, g_strerror(errno));
+ gst_element_error (v4l2src, RESOURCE, READ, NULL,
+ ("Could not get buffer properties of buffer %d: %s", n, g_strerror (errno)));
gst_v4l2src_capture_deinit(v4l2src);
return FALSE;
}
buffer->start = mmap (0, buffer->buffer.length, PROT_READ|PROT_WRITE, MAP_SHARED,
GST_V4L2ELEMENT(v4l2src)->video_fd, buffer->buffer.m.offset);
if (buffer->start == MAP_FAILED) {
- gst_element_error(GST_ELEMENT(v4l2src), "Error mapping video buffer (%d) on device %s: %s",
- n, GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno));
+ gst_element_error (v4l2src, RESOURCE, READ, NULL,
+ ("Could not mmap video buffer %d: %s", n, g_strerror (errno)));
buffer->start = 0;
gst_v4l2src_capture_deinit (v4l2src);
return FALSE;
@@ -326,8 +328,9 @@ gst_v4l2src_capture_start (GstV4l2Src *v4l2src)
v4l2src->quit = FALSE;
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_STREAMON, &type) < 0) {
- gst_element_error(GST_ELEMENT(v4l2src), "Error starting streaming capture for %s: %s",
- GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno));
+ gst_element_error (v4l2src, RESOURCE, OPEN_READ, NULL,
+ ("Error starting streaming capture from device %s: %s",
+ GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno)));
return FALSE;
}
@@ -353,8 +356,9 @@ gst_v4l2src_capture_stop (GstV4l2Src *v4l2src)
/* we actually need to sync on all queued buffers but not
* on the non-queued ones */
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_STREAMOFF, &type) < 0) {
- gst_element_error (GST_ELEMENT(v4l2src), "Error stopping streaming capture for %s: %s",
- GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno));
+ gst_element_error (v4l2src, RESOURCE, CLOSE, NULL,
+ ("Error stopping streaming capture from device %s: %s",
+ GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno)));
return FALSE;
}
diff --git a/sys/vcd/vcdsrc.c b/sys/vcd/vcdsrc.c
index 04db4410..3a3d13a8 100644
--- a/sys/vcd/vcdsrc.c
+++ b/sys/vcd/vcdsrc.c
@@ -303,8 +303,7 @@ vcdsrc_open_file(VCDSrc *src)
/* open the device */
src->fd = open(src->device,O_RDONLY);
if (src->fd < 0) {
- perror("open()");
- gst_element_error(GST_ELEMENT(src),"opening file");
+ gst_element_error (src, RESOURCE, OPEN_READ, NULL, GST_ERROR_SYSTEM);
return FALSE;
}