2005-08-22 15:11:31 +00:00
|
|
|
/* ALSA mixer implementation.
|
|
|
|
* Copyright (C) 2003 Leif Johnson <leif@ambient.2y.net>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "gstalsamixerelement.h"
|
2005-12-14 17:58:48 +00:00
|
|
|
#include "gstalsadeviceprobe.h"
|
|
|
|
|
2006-03-01 18:25:18 +00:00
|
|
|
#define DEFAULT_PROP_DEVICE "default"
|
|
|
|
#define DEFAULT_PROP_DEVICE_NAME ""
|
|
|
|
|
2005-12-14 17:58:48 +00:00
|
|
|
enum
|
|
|
|
{
|
2006-03-01 18:25:18 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_DEVICE,
|
2005-12-14 17:58:48 +00:00
|
|
|
PROP_DEVICE_NAME
|
|
|
|
};
|
2005-08-22 15:11:31 +00:00
|
|
|
|
2006-04-28 19:46:37 +00:00
|
|
|
static const GstElementDetails gst_alsa_mixer_element_details =
|
2006-03-29 14:00:08 +00:00
|
|
|
GST_ELEMENT_DETAILS ("Alsa mixer",
|
2005-08-22 15:11:31 +00:00
|
|
|
"Generic/Audio",
|
|
|
|
"Control sound input and output levels with ALSA",
|
|
|
|
"Leif Johnson <leif@ambient.2y.net>");
|
|
|
|
|
2005-12-14 17:58:48 +00:00
|
|
|
static void gst_alsa_mixer_element_init_interfaces (GType type);
|
|
|
|
|
|
|
|
GST_BOILERPLATE_FULL (GstAlsaMixerElement, gst_alsa_mixer_element,
|
2007-07-21 09:21:12 +00:00
|
|
|
GstElement, GST_TYPE_ELEMENT, gst_alsa_mixer_element_init_interfaces);
|
2005-12-14 17:58:48 +00:00
|
|
|
|
|
|
|
/* massive macro that takes care of all the GstMixer stuff */
|
2007-07-21 09:21:12 +00:00
|
|
|
GST_IMPLEMENT_ALSA_MIXER_METHODS (GstAlsaMixerElement, gst_alsa_mixer_element);
|
2005-08-22 15:11:31 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
static void gst_alsa_mixer_element_get_property (GObject * object,
|
2005-12-14 17:58:48 +00:00
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
2007-07-21 09:21:12 +00:00
|
|
|
static void gst_alsa_mixer_element_set_property (GObject * object,
|
2005-12-14 17:58:48 +00:00
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
2007-07-21 09:21:12 +00:00
|
|
|
static void gst_alsa_mixer_element_finalize (GObject * object);
|
2005-08-22 15:11:31 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
static GstStateChangeReturn gst_alsa_mixer_element_change_state (GstElement
|
2005-12-14 17:58:48 +00:00
|
|
|
* element, GstStateChange transition);
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
static gboolean
|
|
|
|
gst_alsa_mixer_element_interface_supported (GstAlsaMixerElement * this,
|
2005-12-14 17:58:48 +00:00
|
|
|
GType interface_type)
|
|
|
|
{
|
|
|
|
if (interface_type == GST_TYPE_MIXER) {
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
return gst_alsa_mixer_element_supported (this, interface_type);
|
2005-12-14 17:58:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_return_val_if_reached (FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_implements_interface_init (GstImplementsInterfaceClass * klass)
|
|
|
|
{
|
|
|
|
klass->supported = (gpointer) gst_alsa_mixer_element_interface_supported;
|
|
|
|
}
|
2005-08-22 15:11:31 +00:00
|
|
|
|
2005-12-14 17:58:48 +00:00
|
|
|
static void
|
|
|
|
gst_alsa_mixer_element_init_interfaces (GType type)
|
|
|
|
{
|
|
|
|
static const GInterfaceInfo implements_iface_info = {
|
|
|
|
(GInterfaceInitFunc) gst_implements_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
static const GInterfaceInfo mixer_iface_info = {
|
|
|
|
(GInterfaceInitFunc) gst_alsa_mixer_element_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
|
|
|
|
&implements_iface_info);
|
|
|
|
g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_iface_info);
|
|
|
|
|
2006-05-18 17:19:39 +00:00
|
|
|
gst_alsa_type_add_device_property_probe_interface (type);
|
2005-12-14 17:58:48 +00:00
|
|
|
}
|
2005-08-22 15:11:31 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_alsa_mixer_element_base_init (gpointer klass)
|
|
|
|
{
|
|
|
|
gst_element_class_set_details (GST_ELEMENT_CLASS (klass),
|
|
|
|
&gst_alsa_mixer_element_details);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_alsa_mixer_element_class_init (GstAlsaMixerElementClass * klass)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class;
|
2005-12-14 17:58:48 +00:00
|
|
|
GObjectClass *gobject_class;
|
2005-08-22 15:11:31 +00:00
|
|
|
|
|
|
|
element_class = (GstElementClass *) klass;
|
2005-12-14 17:58:48 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
|
|
|
|
gobject_class->finalize = gst_alsa_mixer_element_finalize;
|
|
|
|
gobject_class->get_property = gst_alsa_mixer_element_get_property;
|
|
|
|
gobject_class->set_property = gst_alsa_mixer_element_set_property;
|
2005-08-22 15:11:31 +00:00
|
|
|
|
2005-12-14 17:58:48 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_DEVICE,
|
|
|
|
g_param_spec_string ("device", "Device",
|
|
|
|
"ALSA device, as defined in an asound configuration file",
|
2008-03-22 15:00:53 +00:00
|
|
|
DEFAULT_PROP_DEVICE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-12-14 17:58:48 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
|
|
|
|
g_param_spec_string ("device-name", "Device name",
|
2006-03-01 18:25:18 +00:00
|
|
|
"Human-readable name of the sound device",
|
2008-03-22 15:00:53 +00:00
|
|
|
DEFAULT_PROP_DEVICE_NAME, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
2005-12-14 17:58:48 +00:00
|
|
|
|
|
|
|
element_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_alsa_mixer_element_change_state);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_alsa_mixer_element_finalize (GObject * obj)
|
|
|
|
{
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (obj);
|
2005-12-14 17:58:48 +00:00
|
|
|
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
g_free (this->device);
|
2005-12-14 17:58:48 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
2005-08-22 15:11:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
gst_alsa_mixer_element_init (GstAlsaMixerElement * this,
|
2005-08-28 17:52:45 +00:00
|
|
|
GstAlsaMixerElementClass * klass)
|
2005-08-22 15:11:31 +00:00
|
|
|
{
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
this->mixer = NULL;
|
|
|
|
this->device = g_strdup (DEFAULT_PROP_DEVICE);
|
2005-12-14 17:58:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_alsa_mixer_element_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (object);
|
2005-12-14 17:58:48 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_DEVICE:{
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
GST_OBJECT_LOCK (this);
|
|
|
|
g_free (this->device);
|
|
|
|
this->device = g_value_dup_string (value);
|
2006-08-13 14:34:48 +00:00
|
|
|
/* make sure we never set NULL, this is nice when we want to open the
|
|
|
|
* device. */
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
if (this->device == NULL)
|
|
|
|
this->device = g_strdup (DEFAULT_PROP_DEVICE);
|
|
|
|
GST_OBJECT_UNLOCK (this);
|
2005-12-14 17:58:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_alsa_mixer_element_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (object);
|
2005-12-14 17:58:48 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_DEVICE:{
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
GST_OBJECT_LOCK (this);
|
|
|
|
g_value_set_string (value, this->device);
|
|
|
|
GST_OBJECT_UNLOCK (this);
|
2005-12-14 17:58:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PROP_DEVICE_NAME:{
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
GST_OBJECT_LOCK (this);
|
|
|
|
if (this->mixer) {
|
|
|
|
g_value_set_string (value, this->mixer->cardname);
|
2005-12-14 17:58:48 +00:00
|
|
|
} else {
|
|
|
|
g_value_set_string (value, NULL);
|
|
|
|
}
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (this);
|
2005-12-14 17:58:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2005-08-22 15:11:31 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_alsa_mixer_element_change_state (GstElement * element,
|
|
|
|
GstStateChange transition)
|
2005-08-22 15:11:31 +00:00
|
|
|
{
|
2005-12-14 17:58:48 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (element);
|
2005-08-22 15:11:31 +00:00
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
if (!this->mixer) {
|
|
|
|
this->mixer = gst_alsa_mixer_new (this->device, GST_ALSA_MIXER_ALL);
|
|
|
|
if (!this->mixer)
|
2006-08-13 14:34:48 +00:00
|
|
|
goto open_failed;
|
2007-07-21 09:21:12 +00:00
|
|
|
_gst_alsa_mixer_set_interface (this->mixer, GST_MIXER (element));
|
2005-08-22 15:11:31 +00:00
|
|
|
}
|
|
|
|
break;
|
2005-12-14 17:58:48 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
if (this->mixer) {
|
|
|
|
gst_alsa_mixer_free (this->mixer);
|
|
|
|
this->mixer = NULL;
|
2005-08-22 15:11:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-12-14 17:58:48 +00:00
|
|
|
return ret;
|
2006-08-13 14:34:48 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
open_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (element, RESOURCE, OPEN_READ_WRITE, (NULL),
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
("Failed to open alsa mixer device '%s'", this->device));
|
2006-08-13 14:34:48 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
|
|
|
}
|
2005-08-22 15:11:31 +00:00
|
|
|
}
|