ext/pulse/pulsesrc.c: Add "device-name" property, which provides a human readable string for the audio device, to mak...

Original commit message from CVS:
Patch by: Laszlo Pandy <laszlok2 at gmail dot com>
* ext/pulse/pulsesrc.c: (gst_pulsesrc_class_init),
(gst_pulsesrc_get_property):
Add "device-name" property, which provides a human readable string
for the audio device, to make it more consisten with other audio
sources. Fixes bug #547519.
This commit is contained in:
Laszlo Pandy 2008-08-13 12:37:26 +00:00 committed by Sebastian Dröge
parent 9e572ebf00
commit 97bc37b5b6
2 changed files with 29 additions and 4 deletions

View file

@ -1,3 +1,13 @@
2008-08-13 Sebastian Dröge <sebastian.droege@collabora.co.uk>
Patch by: Laszlo Pandy <laszlok2 at gmail dot com>
* ext/pulse/pulsesrc.c: (gst_pulsesrc_class_init),
(gst_pulsesrc_get_property):
Add "device-name" property, which provides a human readable string
for the audio device, to make it more consisten with other audio
sources. Fixes bug #547519.
2008-08-13 Sebastian Dröge <sebastian.droege@collabora.co.uk> 2008-08-13 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* ext/pulse/pulsemixer.c: (gst_pulsemixer_change_state): * ext/pulse/pulsemixer.c: (gst_pulsemixer_change_state):

View file

@ -58,7 +58,8 @@ GST_DEBUG_CATEGORY_EXTERN (pulse_debug);
enum enum
{ {
PROP_SERVER = 1, PROP_SERVER = 1,
PROP_DEVICE PROP_DEVICE,
PROP_DEVICE_NAME
}; };
static GstAudioSrcClass *parent_class = NULL; static GstAudioSrcClass *parent_class = NULL;
@ -233,6 +234,12 @@ gst_pulsesrc_class_init (gpointer g_class, gpointer class_data)
g_param_spec_string ("device", "Source", g_param_spec_string ("device", "Source",
"The PulseAudio source device to connect to", NULL, "The PulseAudio source device to connect to", NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_DEVICE_NAME,
g_param_spec_string ("device-name", "Device name",
"Human-readable name of the sound device", NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
} }
static void static void
@ -360,6 +367,15 @@ gst_pulsesrc_get_property (GObject * object,
g_value_set_string (value, pulsesrc->device); g_value_set_string (value, pulsesrc->device);
break; break;
case PROP_DEVICE_NAME:
if (pulsesrc->mixer)
g_value_set_string (value, pulsesrc->mixer->description);
else
g_value_set_string (value, NULL);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -493,9 +509,8 @@ gst_pulsesrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
if (!pulsesrc->context if (!pulsesrc->context
|| pa_context_get_state (pulsesrc->context) != PA_CONTEXT_READY) { || pa_context_get_state (pulsesrc->context) != PA_CONTEXT_READY) {
GST_ELEMENT_ERROR (pulsesrc, RESOURCE, FAILED, ("Bad context state: %s", GST_ELEMENT_ERROR (pulsesrc, RESOURCE, FAILED, ("Bad context state: %s",
pulsesrc-> pulsesrc->context ? pa_strerror (pa_context_errno (pulsesrc->
context ? pa_strerror (pa_context_errno (pulsesrc->context)) : context)) : NULL), (NULL));
NULL), (NULL));
goto unlock_and_fail; goto unlock_and_fail;
} }