mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
ext/alsa/: Add a device-name property.
Original commit message from CVS: 2005-08-22 Andy Wingo <wingo@pobox.com> * ext/alsa/gstalsasink.c (gst_alsasink_get_property): * ext/alsa/gstalsasrc.c (gst_alsasrc_get_property): Add a device-name property.
This commit is contained in:
parent
13b122a106
commit
1bbfa09389
3 changed files with 38 additions and 0 deletions
|
@ -1,5 +1,9 @@
|
|||
2005-08-22 Andy Wingo <wingo@pobox.com>
|
||||
|
||||
* ext/alsa/gstalsasink.c (gst_alsasink_get_property):
|
||||
* ext/alsa/gstalsasrc.c (gst_alsasrc_get_property): Add a
|
||||
device-name property.
|
||||
|
||||
* gst-libs/gst/audio/gstaudiosrc.h:
|
||||
* gst-libs/gst/audio/gstaudiosrc.c: Implement open_device and
|
||||
close_device in the ring buffer, like gstaudiosink.
|
||||
|
|
|
@ -44,6 +44,7 @@ enum
|
|||
{
|
||||
PROP_0,
|
||||
PROP_DEVICE,
|
||||
PROP_DEVICE_NAME
|
||||
};
|
||||
|
||||
static void gst_alsasink_base_init (gpointer g_class);
|
||||
|
@ -176,6 +177,10 @@ gst_alsasink_class_init (GstAlsaSinkClass * klass)
|
|||
g_param_spec_string ("device", "Device",
|
||||
"ALSA device, as defined in an asound configuration file",
|
||||
"default", G_PARAM_READWRITE));
|
||||
|
||||
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", "", G_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -210,6 +215,18 @@ gst_alsasink_get_property (GObject * object, guint prop_id,
|
|||
case PROP_DEVICE:
|
||||
g_value_set_string (value, sink->device);
|
||||
break;
|
||||
case PROP_DEVICE_NAME:
|
||||
if (sink->handle) {
|
||||
snd_pcm_info_t *info;
|
||||
|
||||
snd_pcm_info_malloc (&info);
|
||||
snd_pcm_info (sink->handle, info);
|
||||
g_value_set_string (value, snd_pcm_info_get_name (info));
|
||||
snd_pcm_info_free (info);
|
||||
} else {
|
||||
g_value_set_string (value, NULL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
|
@ -44,6 +44,7 @@ enum
|
|||
{
|
||||
PROP_0,
|
||||
PROP_DEVICE,
|
||||
PROP_DEVICE_NAME,
|
||||
};
|
||||
|
||||
GST_BOILERPLATE_WITH_INTERFACE (GstAlsaSrc, gst_alsasrc, GstAudioSrc,
|
||||
|
@ -140,6 +141,10 @@ gst_alsasrc_class_init (GstAlsaSrcClass * klass)
|
|||
g_param_spec_string ("device", "Device",
|
||||
"ALSA device, as defined in an asound configuration file",
|
||||
"default", G_PARAM_READWRITE));
|
||||
|
||||
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", "", G_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -174,6 +179,18 @@ gst_alsasrc_get_property (GObject * object, guint prop_id,
|
|||
case PROP_DEVICE:
|
||||
g_value_set_string (value, src->device);
|
||||
break;
|
||||
case PROP_DEVICE_NAME:
|
||||
if (src->handle) {
|
||||
snd_pcm_info_t *info;
|
||||
|
||||
snd_pcm_info_malloc (&info);
|
||||
snd_pcm_info (src->handle, info);
|
||||
g_value_set_string (value, snd_pcm_info_get_name (info));
|
||||
snd_pcm_info_free (info);
|
||||
} else {
|
||||
g_value_set_string (value, NULL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue