summaryrefslogtreecommitdiffstats
path: root/sys/oss
diff options
context:
space:
mode:
Diffstat (limited to 'sys/oss')
-rw-r--r--sys/oss/gstossmixerelement.c56
1 files changed, 51 insertions, 5 deletions
diff --git a/sys/oss/gstossmixerelement.c b/sys/oss/gstossmixerelement.c
index 9aeebcd4..01e7a3d9 100644
--- a/sys/oss/gstossmixerelement.c
+++ b/sys/oss/gstossmixerelement.c
@@ -27,6 +27,12 @@
GST_DEBUG_CATEGORY_EXTERN (oss_debug);
#define GST_CAT_DEFAULT oss_debug
+enum
+{
+ PROP_DEVICE_NAME = 1
+};
+
+
static GstElementDetails gst_oss_mixer_element_details =
GST_ELEMENT_DETAILS ("OSS Mixer",
"Generic/Audio",
@@ -43,6 +49,9 @@ GST_IMPLEMENT_OSS_MIXER_METHODS (GstOssMixerElement, gst_oss_mixer_element);
static GstStateChangeReturn gst_oss_mixer_element_change_state (GstElement *
element, GstStateChange transition);
+static void gst_oss_mixer_element_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec);
+
static void
gst_oss_mixer_element_base_init (gpointer klass)
{
@@ -54,10 +63,19 @@ static void
gst_oss_mixer_element_class_init (GstOssMixerElementClass * klass)
{
GstElementClass *element_class;
+ GObjectClass *gobject_class;
element_class = (GstElementClass *) klass;
+ gobject_class = (GObjectClass *) klass;
- element_class->change_state = gst_oss_mixer_element_change_state;
+ gobject_class->get_property = gst_oss_mixer_element_get_property;
+
+ 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));
+
+ element_class->change_state =
+ GST_DEBUG_FUNCPTR (gst_oss_mixer_element_change_state);
}
static void
@@ -67,10 +85,31 @@ gst_oss_mixer_element_init (GstOssMixerElement * this,
this->mixer = NULL;
}
+static void
+gst_oss_mixer_element_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
+{
+ GstOssMixerElement *this = GST_OSS_MIXER_ELEMENT (object);
+
+ switch (prop_id) {
+ case PROP_DEVICE_NAME:
+ if (this->mixer) {
+ g_value_set_string (value, this->mixer->cardname);
+ } else {
+ g_value_set_string (value, NULL);
+ }
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
static GstStateChangeReturn
gst_oss_mixer_element_change_state (GstElement * element,
GstStateChange transition)
{
+ GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
GstOssMixerElement *this = GST_OSS_MIXER_ELEMENT (element);
switch (transition) {
@@ -79,6 +118,16 @@ gst_oss_mixer_element_change_state (GstElement * element,
this->mixer = gst_ossmixer_new ("/dev/mixer", GST_OSS_MIXER_ALL);
}
break;
+ break;
+ default:
+ break;
+ }
+
+ ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+ if (ret == GST_STATE_CHANGE_FAILURE)
+ return ret;
+
+ switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
if (this->mixer) {
gst_ossmixer_free (this->mixer);
@@ -89,8 +138,5 @@ gst_oss_mixer_element_change_state (GstElement * element,
break;
}
- if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- return GST_STATE_CHANGE_SUCCESS;
+ return ret;
}