mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
ext/alsa/: Update all error messages. All of them should either use the default translated message, or actually prov...
Original commit message from CVS: * ext/alsa/gstalsasink.c: (gst_alsasink_init), (set_hwparams), (set_swparams), (gst_alsasink_prepare), (gst_alsasink_unprepare), (gst_alsasink_close), (gst_alsasink_write), (gst_alsasink_reset): * ext/alsa/gstalsasrc.c: (gst_alsasrc_init), (set_hwparams), (set_swparams), (gst_alsasrc_open), (gst_alsasrc_prepare), (gst_alsasrc_unprepare), (gst_alsasrc_read): Update all error messages. All of them should either use the default translated message, or actually provide a translatable string. Make the string for channel count problems meaningful.
This commit is contained in:
parent
27ed152e10
commit
786e3c74e9
3 changed files with 151 additions and 130 deletions
13
ChangeLog
13
ChangeLog
|
@ -3,6 +3,19 @@
|
||||||
* gst-libs/gst/audio/gstringbuffer.c: (build_linear_format):
|
* gst-libs/gst/audio/gstringbuffer.c: (build_linear_format):
|
||||||
Make gcc-4.1 happy (part of #327357).
|
Make gcc-4.1 happy (part of #327357).
|
||||||
|
|
||||||
|
2006-01-28 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
* ext/alsa/gstalsasink.c: (gst_alsasink_init), (set_hwparams),
|
||||||
|
(set_swparams), (gst_alsasink_prepare), (gst_alsasink_unprepare),
|
||||||
|
(gst_alsasink_close), (gst_alsasink_write), (gst_alsasink_reset):
|
||||||
|
* ext/alsa/gstalsasrc.c: (gst_alsasrc_init), (set_hwparams),
|
||||||
|
(set_swparams), (gst_alsasrc_open), (gst_alsasrc_prepare),
|
||||||
|
(gst_alsasrc_unprepare), (gst_alsasrc_read):
|
||||||
|
Update all error messages. All of them should either use
|
||||||
|
the default translated message, or actually provide a
|
||||||
|
translatable string.
|
||||||
|
Make the string for channel count problems meaningful.
|
||||||
|
|
||||||
2006-01-28 Thomas Vander Stichele <thomas at apestaart dot org>
|
2006-01-28 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* sys/v4l/v4l_calls.c: (gst_v4l_open):
|
* sys/v4l/v4l_calls.c: (gst_v4l_open):
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include "gstalsa.h"
|
#include "gstalsa.h"
|
||||||
#include "gstalsasink.h"
|
#include "gstalsasink.h"
|
||||||
|
|
||||||
|
#include <gst/gst-i18n-plugin.h>
|
||||||
|
|
||||||
/* elementfactory information */
|
/* elementfactory information */
|
||||||
static GstElementDetails gst_alsasink_details =
|
static GstElementDetails gst_alsasink_details =
|
||||||
GST_ELEMENT_DETAILS ("Audio Sink (ALSA)",
|
GST_ELEMENT_DETAILS ("Audio Sink (ALSA)",
|
||||||
|
@ -247,7 +249,7 @@ gst_alsasink_get_property (GObject * object, guint prop_id,
|
||||||
static void
|
static void
|
||||||
gst_alsasink_init (GstAlsaSink * alsasink)
|
gst_alsasink_init (GstAlsaSink * alsasink)
|
||||||
{
|
{
|
||||||
GST_DEBUG ("initializing alsasink");
|
GST_DEBUG_OBJECT (alsasink, "initializing alsasink");
|
||||||
|
|
||||||
alsasink->device = g_strdup ("default");
|
alsasink->device = g_strdup ("default");
|
||||||
alsasink->handle = NULL;
|
alsasink->handle = NULL;
|
||||||
|
@ -274,7 +276,8 @@ set_hwparams (GstAlsaSink * alsa)
|
||||||
|
|
||||||
snd_pcm_hw_params_alloca (¶ms);
|
snd_pcm_hw_params_alloca (¶ms);
|
||||||
|
|
||||||
GST_DEBUG ("Negotiating to %d channels @ %d Hz", alsa->channels, alsa->rate);
|
GST_DEBUG_OBJECT (alsa, "Negotiating to %d channels @ %d Hz", alsa->channels,
|
||||||
|
alsa->rate);
|
||||||
|
|
||||||
/* choose all parameters */
|
/* choose all parameters */
|
||||||
CHECK (snd_pcm_hw_params_any (alsa->handle, params), no_config);
|
CHECK (snd_pcm_hw_params_any (alsa->handle, params), no_config);
|
||||||
|
@ -319,79 +322,83 @@ set_hwparams (GstAlsaSink * alsa)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
no_config:
|
no_config:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Broken configuration for playback: no configurations available: %s",
|
("Broken configuration for playback: no configurations available: %s",
|
||||||
snd_strerror (err)), (NULL));
|
snd_strerror (err)));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
wrong_access:
|
wrong_access:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Access type not available for playback: %s", snd_strerror (err)),
|
("Access type not available for playback: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
no_sample_format:
|
no_sample_format:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Sample format not available for playback: %s", snd_strerror (err)),
|
("Sample format not available for playback: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
no_channels:
|
no_channels:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
gchar *msg = NULL;
|
||||||
("Channels count (%i) not available for playbacks: %s",
|
|
||||||
alsa->channels, snd_strerror (err)), (NULL));
|
if ((alsa->channels) == 1)
|
||||||
|
msg = g_strdup (_("Could not open device for playback in mono mode."));
|
||||||
|
if ((alsa->channels) == 2)
|
||||||
|
msg = g_strdup (_("Could not open device for playback in stereo mode."));
|
||||||
|
if ((alsa->channels) > 2)
|
||||||
|
msg =
|
||||||
|
g_strdup_printf (_
|
||||||
|
("Could not open device for playback in %d-channel mode."),
|
||||||
|
alsa->channels);
|
||||||
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (msg), (snd_strerror (err)));
|
||||||
|
g_free (msg);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
no_rate:
|
no_rate:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Rate %iHz not available for playback: %s",
|
("Rate %iHz not available for playback: %s",
|
||||||
alsa->rate, snd_strerror (err)), (NULL));
|
alsa->rate, snd_strerror (err)));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
rate_match:
|
rate_match:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Rate doesn't match (requested %iHz, get %iHz)",
|
("Rate doesn't match (requested %iHz, get %iHz)", alsa->rate, err));
|
||||||
alsa->rate, err), (NULL));
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
buffer_time:
|
buffer_time:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set buffer time %i for playback: %s",
|
("Unable to set buffer time %i for playback: %s",
|
||||||
alsa->buffer_time, snd_strerror (err)), (NULL));
|
alsa->buffer_time, snd_strerror (err)));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
buffer_size:
|
buffer_size:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to get buffer size for playback: %s", snd_strerror (err)),
|
("Unable to get buffer size for playback: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
period_time:
|
period_time:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set period time %i for playback: %s", alsa->period_time,
|
("Unable to set period time %i for playback: %s", alsa->period_time,
|
||||||
snd_strerror (err)), (NULL));
|
snd_strerror (err)));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
period_size:
|
period_size:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to get period size for playback: %s", snd_strerror (err)),
|
("Unable to get period size for playback: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
set_hw_params:
|
set_hw_params:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set hw params for playback: %s", snd_strerror (err)),
|
("Unable to set hw params for playback: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -426,37 +433,34 @@ set_swparams (GstAlsaSink * alsa)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
no_config:
|
no_config:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to determine current swparams for playback: %s",
|
("Unable to determine current swparams for playback: %s",
|
||||||
snd_strerror (err)), (NULL));
|
snd_strerror (err)));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
start_threshold:
|
start_threshold:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set start threshold mode for playback: %s",
|
("Unable to set start threshold mode for playback: %s",
|
||||||
snd_strerror (err)), (NULL));
|
snd_strerror (err)));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
set_avail:
|
set_avail:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set avail min for playback: %s", snd_strerror (err)),
|
("Unable to set avail min for playback: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
set_align:
|
set_align:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set transfer align for playback: %s", snd_strerror (err)),
|
("Unable to set transfer align for playback: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
set_sw_params:
|
set_sw_params:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set sw params for playback: %s", snd_strerror (err)),
|
("Unable to set sw params for playback: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,26 +571,26 @@ gst_alsasink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
spec_parse:
|
spec_parse:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Error parsing spec"), (NULL));
|
("Error parsing spec"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
non_block:
|
non_block:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Could not set device to blocking: %s", snd_strerror (err)), (NULL));
|
("Could not set device to blocking: %s", snd_strerror (err)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
hw_params_failed:
|
hw_params_failed:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Setting of hwparams failed: %s", snd_strerror (err)), (NULL));
|
("Setting of hwparams failed: %s", snd_strerror (err)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
sw_params_failed:
|
sw_params_failed:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Setting of swparams failed: %s", snd_strerror (err)), (NULL));
|
("Setting of swparams failed: %s", snd_strerror (err)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -610,21 +614,20 @@ gst_alsasink_unprepare (GstAudioSink * asink)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
drop:
|
drop:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Could not drop samples: %s", snd_strerror (err)), (NULL));
|
("Could not drop samples: %s", snd_strerror (err)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
hw_free:
|
hw_free:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Could not free hw params: %s", snd_strerror (err)), (NULL));
|
("Could not free hw params: %s", snd_strerror (err)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
non_block:
|
non_block:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Could not set device to nonblocking: %s", snd_strerror (err)),
|
("Could not set device to nonblocking: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -643,8 +646,8 @@ gst_alsasink_close (GstAudioSink * asink)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
close_error:
|
close_error:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, CLOSE,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, CLOSE, (NULL),
|
||||||
("Playback close error: %s", snd_strerror (err)), (NULL));
|
("Playback close error: %s", snd_strerror (err)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -697,7 +700,7 @@ gst_alsasink_write (GstAudioSink * asink, gpointer data, guint length)
|
||||||
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
if (err == -EAGAIN) {
|
if (err == -EAGAIN) {
|
||||||
GST_DEBUG ("Write error: %s", snd_strerror (err));
|
GST_DEBUG_OBJECT (asink, "Write error: %s", snd_strerror (err));
|
||||||
continue;
|
continue;
|
||||||
} else if (xrun_recovery (alsa->handle, err) < 0) {
|
} else if (xrun_recovery (alsa->handle, err) < 0) {
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
@ -747,13 +750,13 @@ gst_alsasink_reset (GstAudioSink * asink)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
drop_error:
|
drop_error:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS,
|
||||||
("alsa-reset: pcm drop error: %s", snd_strerror (err)), (NULL));
|
("alsa-reset: pcm drop error: %s", snd_strerror (err)), (NULL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
prepare_error:
|
prepare_error:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS,
|
||||||
("alsa-reset: pcm prepare error: %s", snd_strerror (err)), (NULL));
|
("alsa-reset: pcm prepare error: %s", snd_strerror (err)), (NULL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,10 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
|
|
||||||
|
|
||||||
#include "gstalsasrc.h"
|
#include "gstalsasrc.h"
|
||||||
|
|
||||||
|
#include <gst/gst-i18n-plugin.h>
|
||||||
|
|
||||||
/* elementfactory information */
|
/* elementfactory information */
|
||||||
static GstElementDetails gst_alsasrc_details =
|
static GstElementDetails gst_alsasrc_details =
|
||||||
GST_ELEMENT_DETAILS ("Audio Src (ALSA)",
|
GST_ELEMENT_DETAILS ("Audio Src (ALSA)",
|
||||||
|
@ -201,7 +202,7 @@ gst_alsasrc_get_property (GObject * object, guint prop_id,
|
||||||
static void
|
static void
|
||||||
gst_alsasrc_init (GstAlsaSrc * alsasrc, GstAlsaSrcClass * g_class)
|
gst_alsasrc_init (GstAlsaSrc * alsasrc, GstAlsaSrcClass * g_class)
|
||||||
{
|
{
|
||||||
GST_DEBUG ("initializing alsasrc");
|
GST_DEBUG_OBJECT (alsasrc, "initializing");
|
||||||
|
|
||||||
alsasrc->device = g_strdup ("default");
|
alsasrc->device = g_strdup ("default");
|
||||||
}
|
}
|
||||||
|
@ -270,79 +271,83 @@ set_hwparams (GstAlsaSrc * alsa)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
no_config:
|
no_config:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Broken configuration for recording: no configurations available: %s",
|
("Broken configuration for recording: no configurations available: %s",
|
||||||
snd_strerror (err)), (NULL));
|
snd_strerror (err)));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
wrong_access:
|
wrong_access:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Access type not available for recording: %s", snd_strerror (err)),
|
("Access type not available for recording: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
no_sample_format:
|
no_sample_format:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Sample format not available for recording: %s", snd_strerror (err)),
|
("Sample format not available for recording: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
no_channels:
|
no_channels:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
gchar *msg = NULL;
|
||||||
("Channels count (%i) not available for recording: %s",
|
|
||||||
alsa->channels, snd_strerror (err)), (NULL));
|
if ((alsa->channels) == 1)
|
||||||
|
msg = g_strdup (_("Could not open device for recording in mono mode."));
|
||||||
|
if ((alsa->channels) == 2)
|
||||||
|
msg = g_strdup (_("Could not open device for recording in stereo mode."));
|
||||||
|
if ((alsa->channels) > 2)
|
||||||
|
msg =
|
||||||
|
g_strdup_printf (_
|
||||||
|
("Could not open device for recording in %d-channel mode"),
|
||||||
|
alsa->channels);
|
||||||
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (msg), (snd_strerror (err)));
|
||||||
|
g_free (msg);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
no_rate:
|
no_rate:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Rate %iHz not available for recording: %s",
|
("Rate %iHz not available for recording: %s",
|
||||||
alsa->rate, snd_strerror (err)), (NULL));
|
alsa->rate, snd_strerror (err)));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
rate_match:
|
rate_match:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Rate doesn't match (requested %iHz, get %iHz)",
|
("Rate doesn't match (requested %iHz, get %iHz)", alsa->rate, err));
|
||||||
alsa->rate, err), (NULL));
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
buffer_time:
|
buffer_time:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set buffer time %i for recording: %s",
|
("Unable to set buffer time %i for recording: %s",
|
||||||
alsa->buffer_time, snd_strerror (err)), (NULL));
|
alsa->buffer_time, snd_strerror (err)));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
buffer_size:
|
buffer_size:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to get buffer size for recording: %s", snd_strerror (err)),
|
("Unable to get buffer size for recording: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
period_time:
|
period_time:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set period time %i for recording: %s", alsa->period_time,
|
("Unable to set period time %i for recording: %s", alsa->period_time,
|
||||||
snd_strerror (err)), (NULL));
|
snd_strerror (err)));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
period_size:
|
period_size:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to get period size for recording: %s", snd_strerror (err)),
|
("Unable to get period size for recording: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
set_hw_params:
|
set_hw_params:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set hw params for recording: %s", snd_strerror (err)),
|
("Unable to set hw params for recording: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -379,39 +384,36 @@ set_swparams (GstAlsaSrc * alsa)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
no_config:
|
no_config:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to determine current swparams for recording: %s",
|
("Unable to determine current swparams for playback: %s",
|
||||||
snd_strerror (err)), (NULL));
|
snd_strerror (err)));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
start_threshold:
|
start_threshold:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set start threshold mode for recording: %s",
|
("Unable to set start threshold mode for playback: %s",
|
||||||
snd_strerror (err)), (NULL));
|
snd_strerror (err)));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
set_avail:
|
set_avail:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set avail min for recording: %s", snd_strerror (err)),
|
("Unable to set avail min for playback: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
set_align:
|
set_align:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set transfer align for recording: %s", snd_strerror (err)),
|
("Unable to set transfer align for playback: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
set_sw_params:
|
set_sw_params:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Unable to set sw params for recording: %s", snd_strerror (err)),
|
("Unable to set sw params for playback: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -486,8 +488,12 @@ gst_alsasrc_open (GstAudioSrc * asrc)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
open_error:
|
open_error:
|
||||||
{
|
{
|
||||||
|
if (err == -EBUSY) {
|
||||||
|
GST_ELEMENT_ERROR (alsa, RESOURCE, BUSY, (NULL), (NULL));
|
||||||
|
} else {
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
||||||
("Capture open error: %s", snd_strerror (err)), (NULL));
|
(NULL), ("Recording open error: %s", snd_strerror (err)));
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,32 +528,32 @@ gst_alsasrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
spec_parse:
|
spec_parse:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Error parsing spec"), (NULL));
|
("Error parsing spec"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
non_block:
|
non_block:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Could not set device to blocking: %s", snd_strerror (err)), (NULL));
|
("Could not set device to blocking: %s", snd_strerror (err)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
hw_params_failed:
|
hw_params_failed:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Setting of hwparams failed: %s", snd_strerror (err)), (NULL));
|
("Setting of hwparams failed: %s", snd_strerror (err)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
sw_params_failed:
|
sw_params_failed:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Setting of swparams failed: %s", snd_strerror (err)), (NULL));
|
("Setting of swparams failed: %s", snd_strerror (err)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
prepare_failed:
|
prepare_failed:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Prepare failed: %s", snd_strerror (err)), (NULL));
|
("Prepare failed: %s", snd_strerror (err)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -571,21 +577,20 @@ gst_alsasrc_unprepare (GstAudioSrc * asrc)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
drop:
|
drop:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Could not drop samples: %s", snd_strerror (err)), (NULL));
|
("Could not drop samples: %s", snd_strerror (err)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
hw_free:
|
hw_free:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Could not free hw params: %s", snd_strerror (err)), (NULL));
|
("Could not free hw params: %s", snd_strerror (err)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
non_block:
|
non_block:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||||
("Could not set device to nonblocking: %s", snd_strerror (err)),
|
("Could not set device to nonblocking: %s", snd_strerror (err)));
|
||||||
(NULL));
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -650,7 +655,7 @@ gst_alsasrc_read (GstAudioSrc * asrc, gpointer data, guint length)
|
||||||
while (cptr > 0) {
|
while (cptr > 0) {
|
||||||
if ((err = snd_pcm_readi (alsa->handle, ptr, cptr)) < 0) {
|
if ((err = snd_pcm_readi (alsa->handle, ptr, cptr)) < 0) {
|
||||||
if (err == -EAGAIN) {
|
if (err == -EAGAIN) {
|
||||||
GST_DEBUG ("Read error: %s", snd_strerror (err));
|
GST_DEBUG_OBJECT (asrc, "Read error: %s", snd_strerror (err));
|
||||||
continue;
|
continue;
|
||||||
} else if (xrun_recovery (alsa->handle, err) < 0) {
|
} else if (xrun_recovery (alsa->handle, err) < 0) {
|
||||||
goto read_error;
|
goto read_error;
|
||||||
|
|
Loading…
Reference in a new issue