mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
more useful error messages
Original commit message from CVS: more useful error messages - how about i18n ? - is this really the best way to pass user-visible error messages ?
This commit is contained in:
parent
2c758796f5
commit
a03ceeadcb
1 changed files with 32 additions and 2 deletions
|
@ -28,6 +28,7 @@
|
||||||
#include <sys/soundcard.h>
|
#include <sys/soundcard.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <gstosssink.h>
|
#include <gstosssink.h>
|
||||||
|
|
||||||
|
@ -810,6 +811,7 @@ gst_osssink_open_audio (GstOssSink *sink)
|
||||||
GST_INFO (GST_CAT_PLUGIN_INFO, "osssink: attempting to open sound device");
|
GST_INFO (GST_CAT_PLUGIN_INFO, "osssink: attempting to open sound device");
|
||||||
|
|
||||||
/* first try to open the sound card */
|
/* first try to open the sound card */
|
||||||
|
/* FIXME: this code is dubious, why do we need to open and close this ?*/
|
||||||
sink->fd = open (sink->device, O_WRONLY | O_NONBLOCK);
|
sink->fd = open (sink->device, O_WRONLY | O_NONBLOCK);
|
||||||
if (errno == EBUSY) {
|
if (errno == EBUSY) {
|
||||||
g_warning ("osssink: unable to open the sound device (in use ?)\n");
|
g_warning ("osssink: unable to open the sound device (in use ?)\n");
|
||||||
|
@ -822,10 +824,38 @@ gst_osssink_open_audio (GstOssSink *sink)
|
||||||
sink->fd = open (sink->device, O_WRONLY);
|
sink->fd = open (sink->device, O_WRONLY);
|
||||||
|
|
||||||
if (sink->fd < 0) {
|
if (sink->fd < 0) {
|
||||||
g_warning ("osssink: unable to open the sound device (errno=%d)\n", errno);
|
switch (errno) {
|
||||||
|
case EISDIR:
|
||||||
|
gst_element_error (GST_ELEMENT (sink),
|
||||||
|
"osssink: Device %s is a directory",
|
||||||
|
sink->device);
|
||||||
|
break;
|
||||||
|
case EACCES:
|
||||||
|
case ETXTBSY:
|
||||||
|
gst_element_error (GST_ELEMENT (sink),
|
||||||
|
"osssink: Cannot access %s, check permissions",
|
||||||
|
sink->device);
|
||||||
|
break;
|
||||||
|
case ENXIO:
|
||||||
|
case ENODEV:
|
||||||
|
case ENOENT:
|
||||||
|
gst_element_error (GST_ELEMENT (sink),
|
||||||
|
"osssink: Cannot access %s, does it exist ?",
|
||||||
|
sink->device);
|
||||||
|
break;
|
||||||
|
case EROFS:
|
||||||
|
gst_element_error (GST_ELEMENT (sink),
|
||||||
|
"osssink: Cannot access %s, read-only filesystem ?",
|
||||||
|
sink->device);
|
||||||
|
default:
|
||||||
|
/* FIXME: strerror is not threadsafe */
|
||||||
|
gst_element_error (GST_ELEMENT (sink),
|
||||||
|
"osssink: Cannot open %s, generic error: %s",
|
||||||
|
sink->device, strerror (errno));
|
||||||
|
break;
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we have it, set the default parameters and go have fun */
|
/* we have it, set the default parameters and go have fun */
|
||||||
/* set card state */
|
/* set card state */
|
||||||
ioctl (sink->fd, SNDCTL_DSP_GETCAPS, &caps);
|
ioctl (sink->fd, SNDCTL_DSP_GETCAPS, &caps);
|
||||||
|
|
Loading…
Reference in a new issue