Commit bca6983c authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠

sys/oss/gstossmixerelement.c: Add 'device-name' property and fix state change function.

Original commit message from CVS:
* sys/oss/gstossmixerelement.c: (gst_oss_mixer_element_class_init),
(gst_oss_mixer_element_get_property),
(gst_oss_mixer_element_change_state):
Add 'device-name' property and fix state change function.
parent f5b7ab5a
2005-12-13 Tim-Philipp Müller <tim at centricular dot net>
* sys/oss/gstossmixerelement.c: (gst_oss_mixer_element_class_init),
(gst_oss_mixer_element_get_property),
(gst_oss_mixer_element_change_state):
Add 'device-name' property and fix state change function.
2005-12-13 Edward Hervey <edward@fluendo.com>
* gst/flx/gstflxdec.c: (gst_flxdec_chain):
......
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment