1 /* GStreamer OSS Mixer implementation
2 * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * gstossmixer.h: mixer interface implementation for OSS
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 #ifndef __GST_OSS_MIXER_H__
24 #define __GST_OSS_MIXER_H__
28 #include <gst/interfaces/mixer.h>
30 #include "gstosshelper.h"
36 #define GST_OSS_MIXER(obj) ((GstOssMixer*)(obj))
40 GST_OSS_MIXER_CAPTURE = 1<<0,
41 GST_OSS_MIXER_PLAYBACK = 1<<1,
42 GST_OSS_MIXER_ALL = GST_OSS_MIXER_CAPTURE | GST_OSS_MIXER_PLAYBACK
43 } GstOssMixerDirection;
46 typedef struct _GstOssMixer GstOssMixer;
50 GList * tracklist; /* list of available tracks */
63 GstOssMixerDirection dir;
67 GstOssMixer* gst_ossmixer_new (const gchar *device,
68 GstOssMixerDirection dir);
69 void gst_ossmixer_free (GstOssMixer *mixer);
71 const GList* gst_ossmixer_list_tracks (GstOssMixer * mixer);
72 void gst_ossmixer_set_volume (GstOssMixer * mixer,
73 GstMixerTrack * track,
75 void gst_ossmixer_get_volume (GstOssMixer * mixer,
76 GstMixerTrack * track,
78 void gst_ossmixer_set_record (GstOssMixer * mixer,
79 GstMixerTrack * track,
81 void gst_ossmixer_set_mute (GstOssMixer * mixer,
82 GstMixerTrack * track,
86 #define GST_IMPLEMENT_OSS_MIXER_METHODS(Type, interface_as_function) \
88 interface_as_function ## _supported (Type *this, GType iface_type) \
90 g_assert (iface_type == GST_TYPE_MIXER); \
92 return (this->mixer != NULL); \
96 interface_as_function ## _list_tracks (GstMixer * mixer) \
98 Type *this = (Type*) mixer; \
100 g_return_val_if_fail (this != NULL, NULL); \
101 g_return_val_if_fail (this->mixer != NULL, NULL); \
103 return gst_ossmixer_list_tracks (this->mixer); \
107 interface_as_function ## _set_volume (GstMixer * mixer, GstMixerTrack * track, \
110 Type *this = (Type*) mixer; \
112 g_return_if_fail (this != NULL); \
113 g_return_if_fail (this->mixer != NULL); \
115 gst_ossmixer_set_volume (this->mixer, track, volumes); \
119 interface_as_function ## _get_volume (GstMixer * mixer, GstMixerTrack * track, \
122 Type *this = (Type*) mixer; \
124 g_return_if_fail (this != NULL); \
125 g_return_if_fail (this->mixer != NULL); \
127 gst_ossmixer_get_volume (this->mixer, track, volumes); \
131 interface_as_function ## _set_record (GstMixer * mixer, GstMixerTrack * track, \
134 Type *this = (Type*) mixer; \
136 g_return_if_fail (this != NULL); \
137 g_return_if_fail (this->mixer != NULL); \
139 gst_ossmixer_set_record (this->mixer, track, record); \
143 interface_as_function ## _set_mute (GstMixer * mixer, GstMixerTrack * track, \
146 Type *this = (Type*) mixer; \
148 g_return_if_fail (this != NULL); \
149 g_return_if_fail (this->mixer != NULL); \
151 gst_ossmixer_set_mute (this->mixer, track, mute); \
155 interface_as_function ## _interface_init (GstMixerClass * klass) \
157 GST_MIXER_TYPE (klass) = GST_MIXER_HARDWARE; \
159 /* set up the interface hooks */ \
160 klass->list_tracks = interface_as_function ## _list_tracks; \
161 klass->set_volume = interface_as_function ## _set_volume; \
162 klass->get_volume = interface_as_function ## _get_volume; \
163 klass->set_mute = interface_as_function ## _set_mute; \
164 klass->set_record = interface_as_function ## _set_record; \
171 #endif /* __GST_OSS_MIXER_H__ */