mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
sys/oss/: Post decent (and translated) error message when we can't open the audio device for some reason.
Original commit message from CVS: * sys/oss/gstossaudio.c: (plugin_init): * sys/oss/gstosssink.c: (gst_oss_sink_open): * sys/oss/gstosssrc.c: (gst_oss_src_open): Post decent (and translated) error message when we can't open the audio device for some reason.
This commit is contained in:
parent
0f1cc10947
commit
915732f5b5
4 changed files with 48 additions and 6 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2007-12-07 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* sys/oss/gstossaudio.c: (plugin_init):
|
||||||
|
* sys/oss/gstosssink.c: (gst_oss_sink_open):
|
||||||
|
* sys/oss/gstosssrc.c: (gst_oss_src_open):
|
||||||
|
Post decent (and translated) error message when we can't
|
||||||
|
open the audio device for some reason.
|
||||||
|
|
||||||
2007-12-07 Jan Schmidt <jan.schmidt@sun.com>
|
2007-12-07 Jan Schmidt <jan.schmidt@sun.com>
|
||||||
|
|
||||||
* sys/oss/gstosssink.c:
|
* sys/oss/gstosssink.c:
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "gstosssrc.h"
|
#include "gstosssrc.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (oss_debug);
|
GST_DEBUG_CATEGORY (oss_debug);
|
||||||
|
#define GST_CAT_DEFAULT oss_debug
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
|
@ -44,7 +45,8 @@ plugin_init (GstPlugin * plugin)
|
||||||
GST_DEBUG_CATEGORY_INIT (oss_debug, "oss", 0, "OSS elements");
|
GST_DEBUG_CATEGORY_INIT (oss_debug, "oss", 0, "OSS elements");
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
setlocale (LC_ALL, "");
|
GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
|
||||||
|
LOCALEDIR);
|
||||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||||
#endif /* ENABLE_NLS */
|
#endif /* ENABLE_NLS */
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,8 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "gstosssink.h"
|
#include "gstosssink.h"
|
||||||
|
|
||||||
|
#include <gst/gst-i18n-plugin.h>
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_EXTERN (oss_debug);
|
GST_DEBUG_CATEGORY_EXTERN (oss_debug);
|
||||||
#define GST_CAT_DEFAULT oss_debug
|
#define GST_CAT_DEFAULT oss_debug
|
||||||
|
|
||||||
|
@ -396,6 +398,8 @@ gst_oss_sink_open (GstAudioSink * asink)
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case EBUSY:
|
case EBUSY:
|
||||||
goto busy;
|
goto busy;
|
||||||
|
case EACCES:
|
||||||
|
goto no_permission;
|
||||||
default:
|
default:
|
||||||
goto open_failed;
|
goto open_failed;
|
||||||
}
|
}
|
||||||
|
@ -406,12 +410,23 @@ gst_oss_sink_open (GstAudioSink * asink)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
busy:
|
busy:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (oss, RESOURCE, BUSY, (NULL), (NULL));
|
GST_ELEMENT_ERROR (oss, RESOURCE, BUSY,
|
||||||
|
(_("Could not open audio device for playback. "
|
||||||
|
"Device is being used by another application.")), (NULL));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
no_permission:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE,
|
||||||
|
(_("Could not open audio device for playback."
|
||||||
|
"You don't have permission to open the device.")),
|
||||||
|
GST_ERROR_SYSTEM);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
open_failed:
|
open_failed:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE, (NULL), GST_ERROR_SYSTEM);
|
GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE,
|
||||||
|
(_("Could not open audio device for playback.")), GST_ERROR_SYSTEM);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,8 @@
|
||||||
#include "gstosssrc.h"
|
#include "gstosssrc.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <gst/gst-i18n-plugin.h>
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_EXTERN (oss_debug);
|
GST_DEBUG_CATEGORY_EXTERN (oss_debug);
|
||||||
#define GST_CAT_DEFAULT oss_debug
|
#define GST_CAT_DEFAULT oss_debug
|
||||||
|
|
||||||
|
@ -342,8 +344,14 @@ gst_oss_src_open (GstAudioSrc * asrc)
|
||||||
mode |= O_NONBLOCK;
|
mode |= O_NONBLOCK;
|
||||||
|
|
||||||
oss->fd = open (oss->device, mode, 0);
|
oss->fd = open (oss->device, mode, 0);
|
||||||
if (oss->fd == -1)
|
if (oss->fd == -1) {
|
||||||
goto open_failed;
|
switch (errno) {
|
||||||
|
case EACCES:
|
||||||
|
goto no_permission;
|
||||||
|
default:
|
||||||
|
goto open_failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!oss->mixer) {
|
if (!oss->mixer) {
|
||||||
oss->mixer = gst_ossmixer_new ("/dev/mixer", GST_OSS_MIXER_CAPTURE);
|
oss->mixer = gst_ossmixer_new ("/dev/mixer", GST_OSS_MIXER_CAPTURE);
|
||||||
|
@ -355,11 +363,20 @@ gst_oss_src_open (GstAudioSrc * asrc)
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
no_permission:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ,
|
||||||
|
(_("Could not open audio device for recording."
|
||||||
|
"You don't have permission to open the device.")),
|
||||||
|
GST_ERROR_SYSTEM);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
open_failed:
|
open_failed:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ,
|
||||||
|
(_("Could not open audio device for recording.")),
|
||||||
("Unable to open device %s for recording: %s",
|
("Unable to open device %s for recording: %s",
|
||||||
oss->device, g_strerror (errno)), (NULL));
|
oss->device, g_strerror (errno)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue