mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
ext/alsa/: Avoid setting and using a NULL device name.
Original commit message from CVS: * ext/alsa/gstalsasink.c: (gst_alsasink_set_property), (gst_alsasink_open): * ext/alsa/gstalsasrc.c: (gst_alsasrc_set_property), (gst_alsasrc_open): Avoid setting and using a NULL device name. Print more info when we fail to open a device.
This commit is contained in:
parent
6aeb8149dd
commit
e71487073c
3 changed files with 27 additions and 8 deletions
|
@ -1,3 +1,12 @@
|
|||
2006-08-16 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* ext/alsa/gstalsasink.c: (gst_alsasink_set_property),
|
||||
(gst_alsasink_open):
|
||||
* ext/alsa/gstalsasrc.c: (gst_alsasrc_set_property),
|
||||
(gst_alsasrc_open):
|
||||
Avoid setting and using a NULL device name.
|
||||
Print more info when we fail to open a device.
|
||||
|
||||
2006-08-16 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* docs/libs/gst-plugins-base-libs-sections.txt:
|
||||
|
|
|
@ -227,9 +227,12 @@ gst_alsasink_set_property (GObject * object, guint prop_id,
|
|||
|
||||
switch (prop_id) {
|
||||
case PROP_DEVICE:
|
||||
if (sink->device)
|
||||
g_free (sink->device);
|
||||
sink->device = g_strdup (g_value_get_string (value));
|
||||
g_free (sink->device);
|
||||
sink->device = g_value_dup_string (value);
|
||||
/* setting NULL restores the default device */
|
||||
if (sink->device == NULL) {
|
||||
sink->device = g_strdup (DEFAULT_DEVICE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -629,10 +632,12 @@ gst_alsasink_open (GstAudioSink * asink)
|
|||
open_error:
|
||||
{
|
||||
if (err == -EBUSY) {
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, BUSY, (NULL), ("Device is busy"));
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, BUSY, (NULL), ("Device '%s' is busy",
|
||||
alsa->device));
|
||||
} else {
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_WRITE,
|
||||
(NULL), ("Playback open error: %s", snd_strerror (err)));
|
||||
(NULL), ("Playback open error on device '%s': %s", alsa->device,
|
||||
snd_strerror (err)));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -242,6 +242,9 @@ gst_alsasrc_set_property (GObject * object, guint prop_id,
|
|||
case PROP_DEVICE:
|
||||
g_free (src->device);
|
||||
src->device = g_value_dup_string (value);
|
||||
if (src->device == NULL) {
|
||||
src->device = g_strdup (DEFAULT_PROP_DEVICE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -601,10 +604,12 @@ gst_alsasrc_open (GstAudioSrc * asrc)
|
|||
open_error:
|
||||
{
|
||||
if (err == -EBUSY) {
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, BUSY, (NULL), (NULL));
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, BUSY, (NULL), ("Device '%s' is busy",
|
||||
alsa->device));
|
||||
} else {
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
|
||||
(NULL), ("Recording open error: %s", snd_strerror (err)));
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_WRITE,
|
||||
(NULL), ("Recording open error on device '%s': %s", alsa->device,
|
||||
snd_strerror (err)));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue