2 * GStreamer - SunAudio mixer interface element.
3 * Copyright (C) 2005,2006,2009 Sun Microsystems, Inc.,
4 * Brian Cameron <brian.cameron@sun.com>
5 * Copyright (C) 2009 Sun Microsystems, Inc.,
6 * Garrett D'Amore <garrett.damore@sun.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
23 #ifndef __GST_SUNAUDIO_MIXER_CTRL_H
24 #define __GST_SUNAUDIO_MIXER_CTRL_H
26 #include <sys/audioio.h>
29 #include <gst/interfaces/mixer.h>
33 #define GST_SUNAUDIO_MIXER_CTRL(obj) ((GstSunAudioMixerCtrl*)(obj))
35 typedef struct _GstSunAudioMixerCtrl GstSunAudioMixerCtrl;
37 struct _GstSunAudioMixerCtrl {
38 GList * tracklist; /* list of available tracks */
46 GstSunAudioMixerCtrl* gst_sunaudiomixer_ctrl_new (const gchar *device);
47 void gst_sunaudiomixer_ctrl_free (GstSunAudioMixerCtrl *mixer);
49 const GList* gst_sunaudiomixer_ctrl_list_tracks (GstSunAudioMixerCtrl * mixer);
50 void gst_sunaudiomixer_ctrl_set_volume (GstSunAudioMixerCtrl * mixer,
51 GstMixerTrack * track,
53 void gst_sunaudiomixer_ctrl_get_volume (GstSunAudioMixerCtrl * mixer,
54 GstMixerTrack * track,
56 void gst_sunaudiomixer_ctrl_set_record (GstSunAudioMixerCtrl * mixer,
57 GstMixerTrack * track,
59 void gst_sunaudiomixer_ctrl_set_mute (GstSunAudioMixerCtrl * mixer,
60 GstMixerTrack * track,
62 void gst_sunaudiomixer_ctrl_set_option (GstSunAudioMixerCtrl * mixer,
63 GstMixerOptions * options,
65 const gchar * gst_sunaudiomixer_ctrl_get_option (GstSunAudioMixerCtrl * mixer,
66 GstMixerOptions * options);
67 GstMixerFlags gst_sunaudiomixer_ctrl_get_mixer_flags (GstSunAudioMixerCtrl *mixer);
69 #define GST_IMPLEMENT_SUNAUDIO_MIXER_CTRL_METHODS(Type, interface_as_function) \
71 interface_as_function ## _supported (Type *this, GType iface_type) \
73 g_assert (iface_type == GST_TYPE_MIXER); \
75 return (this->mixer != NULL); \
79 interface_as_function ## _list_tracks (GstMixer * mixer) \
81 Type *this = (Type*) mixer; \
83 g_return_val_if_fail (this != NULL, NULL); \
84 g_return_val_if_fail (this->mixer != NULL, NULL); \
86 return gst_sunaudiomixer_ctrl_list_tracks (this->mixer); \
90 interface_as_function ## _set_volume (GstMixer * mixer, GstMixerTrack * track, \
93 Type *this = (Type*) mixer; \
95 g_return_if_fail (this != NULL); \
96 g_return_if_fail (this->mixer != NULL); \
98 gst_sunaudiomixer_ctrl_set_volume (this->mixer, track, volumes); \
102 interface_as_function ## _get_volume (GstMixer * mixer, GstMixerTrack * track, \
105 Type *this = (Type*) mixer; \
107 g_return_if_fail (this != NULL); \
108 g_return_if_fail (this->mixer != NULL); \
110 gst_sunaudiomixer_ctrl_get_volume (this->mixer, track, volumes); \
114 interface_as_function ## _set_record (GstMixer * mixer, GstMixerTrack * track, \
117 Type *this = (Type*) mixer; \
119 g_return_if_fail (this != NULL); \
120 g_return_if_fail (this->mixer != NULL); \
122 gst_sunaudiomixer_ctrl_set_record (this->mixer, track, record); \
126 interface_as_function ## _set_mute (GstMixer * mixer, GstMixerTrack * track, \
129 Type *this = (Type*) mixer; \
131 g_return_if_fail (this != NULL); \
132 g_return_if_fail (this->mixer != NULL); \
134 gst_sunaudiomixer_ctrl_set_mute (this->mixer, track, mute); \
137 static const gchar * \
138 interface_as_function ## _get_option (GstMixer * mixer, GstMixerOptions * opts) \
140 Type *this = (Type*) mixer; \
142 g_return_val_if_fail (this != NULL, NULL); \
143 g_return_val_if_fail (this->mixer != NULL, NULL); \
145 return gst_sunaudiomixer_ctrl_get_option (this->mixer, opts); \
149 interface_as_function ## _set_option (GstMixer * mixer, GstMixerOptions * opts, \
152 Type *this = (Type*) mixer; \
154 g_return_if_fail (this != NULL); \
155 g_return_if_fail (this->mixer != NULL); \
157 gst_sunaudiomixer_ctrl_set_option (this->mixer, opts, value); \
160 static GstMixerFlags \
161 interface_as_function ## _get_mixer_flags (GstMixer * mixer) \
163 Type *this = (Type*) mixer; \
165 g_return_val_if_fail (this != NULL, GST_MIXER_FLAG_NONE); \
166 g_return_val_if_fail (this->mixer != NULL, GST_MIXER_FLAG_NONE); \
168 return gst_sunaudiomixer_ctrl_get_mixer_flags (this->mixer); \
172 interface_as_function ## _interface_init (GstMixerInterface * iface) \
174 GST_MIXER_TYPE (iface) = GST_MIXER_HARDWARE; \
176 /* set up the interface hooks */ \
177 iface->list_tracks = interface_as_function ## _list_tracks; \
178 iface->set_volume = interface_as_function ## _set_volume; \
179 iface->get_volume = interface_as_function ## _get_volume; \
180 iface->set_mute = interface_as_function ## _set_mute; \
181 iface->set_record = interface_as_function ## _set_record; \
182 iface->get_option = interface_as_function ## _get_option; \
183 iface->set_option = interface_as_function ## _set_option; \
184 iface->get_mixer_flags = interface_as_function ## _get_mixer_flags; \