2 * GStreamer - SunAudio mixer
3 * Copyright (C) 2005,2006 Sun Microsystems, Inc.,
4 * Brian Cameron <brian.cameron@sun.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 * SECTION:element-sunaudiomixer
25 * sunaudiomixer is an mixer that controls the sound input and output
26 * levels with the Sun Audio interface available in Solaris.
33 #include "gstsunaudiomixer.h"
35 GST_BOILERPLATE_WITH_INTERFACE (GstSunAudioMixer, gst_sunaudiomixer,
36 GstElement, GST_TYPE_ELEMENT, GstMixer, GST_TYPE_MIXER, gst_sunaudiomixer);
38 GST_IMPLEMENT_SUNAUDIO_MIXER_CTRL_METHODS (GstSunAudioMixer, gst_sunaudiomixer);
40 static GstStateChangeReturn gst_sunaudiomixer_change_state (GstElement *
41 element, GstStateChange transition);
44 gst_sunaudiomixer_base_init (gpointer klass)
46 gst_element_class_set_details_simple (GST_ELEMENT_CLASS (klass),
47 "Sun Audio Mixer", "Generic/Audio",
48 "Control sound input and output levels with Sun Audio",
49 "Brian Cameron <brian.cameron@sun.com>");
53 gst_sunaudiomixer_class_init (GstSunAudioMixerClass * klass)
55 GstElementClass *element_class;
57 element_class = (GstElementClass *) klass;
59 element_class->change_state = gst_sunaudiomixer_change_state;
63 gst_sunaudiomixer_init (GstSunAudioMixer * this,
64 GstSunAudioMixerClass * g_class)
69 static GstStateChangeReturn
70 gst_sunaudiomixer_change_state (GstElement * element, GstStateChange transition)
72 GstSunAudioMixer *this = GST_SUNAUDIO_MIXER (element);
75 case GST_STATE_CHANGE_NULL_TO_READY:
79 audiodev = g_getenv ("AUDIODEV");
80 if (audiodev == NULL) {
81 this->mixer = gst_sunaudiomixer_ctrl_new ("/dev/audioctl");
83 gchar *device = g_strdup_printf ("%sctl", audiodev);
85 this->mixer = gst_sunaudiomixer_ctrl_new (device);
90 case GST_STATE_CHANGE_READY_TO_NULL:
92 gst_sunaudiomixer_ctrl_free (this->mixer);
100 if (GST_ELEMENT_CLASS (parent_class)->change_state)
101 return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
103 return GST_STATE_CHANGE_SUCCESS;