1 /*-*- Mode: C; c-basic-offset: 2 -*-*/
4 * GStreamer pulseaudio plugin
6 * Copyright (c) 2004-2008 Lennart Poettering
8 * gst-pulse is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as
10 * published by the Free Software Foundation; either version 2.1 of the
11 * License, or (at your option) any later version.
13 * gst-pulse is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with gst-pulse; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 #ifndef __GST_PULSEMIXERCTRL_H__
25 #define __GST_PULSEMIXERCTRL_H__
28 #include <gst/interfaces/mixer.h>
30 #include <pulse/pulseaudio.h>
31 #include <pulse/thread-mainloop.h>
35 #define GST_PULSEMIXER_CTRL(obj) ((GstPulseMixerCtrl*)(obj))
36 typedef struct _GstPulseMixerCtrl GstPulseMixerCtrl;
40 GST_PULSEMIXER_UNKNOWN,
45 struct _GstPulseMixerCtrl
51 gchar *server, *device;
53 pa_threaded_mainloop *mainloop;
56 gchar *name, *description;
57 pa_channel_map channel_map;
62 gboolean update_volume:1;
63 gboolean update_mute:1;
65 gboolean operation_success:1;
68 GstPulseMixerType type;
72 pa_time_event *time_event;
74 int outstandig_queries;
79 GstPulseMixerCtrl *gst_pulsemixer_ctrl_new (GObject *object, const gchar * server,
80 const gchar * device, GstPulseMixerType type);
81 void gst_pulsemixer_ctrl_free (GstPulseMixerCtrl * mixer);
83 const GList *gst_pulsemixer_ctrl_list_tracks (GstPulseMixerCtrl * mixer);
85 void gst_pulsemixer_ctrl_set_volume (GstPulseMixerCtrl * mixer,
86 GstMixerTrack * track, gint * volumes);
87 void gst_pulsemixer_ctrl_get_volume (GstPulseMixerCtrl * mixer,
88 GstMixerTrack * track, gint * volumes);
89 void gst_pulsemixer_ctrl_set_mute (GstPulseMixerCtrl * mixer,
90 GstMixerTrack * track, gboolean mute);
91 void gst_pulsemixer_ctrl_set_record (GstPulseMixerCtrl * mixer,
92 GstMixerTrack * track, gboolean record);
93 GstMixerFlags gst_pulsemixer_ctrl_get_mixer_flags (GstPulseMixerCtrl * mixer);
95 #define GST_IMPLEMENT_PULSEMIXER_CTRL_METHODS(Type, interface_as_function) \
97 interface_as_function ## _list_tracks (GstMixer * mixer) \
99 Type *this = (Type*) mixer; \
101 g_return_val_if_fail (this != NULL, NULL); \
102 g_return_val_if_fail (this->mixer != NULL, NULL); \
104 return gst_pulsemixer_ctrl_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_pulsemixer_ctrl_set_volume (this->mixer, track, volumes); \
118 interface_as_function ## _get_volume (GstMixer * mixer, GstMixerTrack * track, \
121 Type *this = (Type*) mixer; \
123 g_return_if_fail (this != NULL); \
124 g_return_if_fail (this->mixer != NULL); \
126 gst_pulsemixer_ctrl_get_volume (this->mixer, track, volumes); \
129 interface_as_function ## _set_record (GstMixer * mixer, GstMixerTrack * track, \
132 Type *this = (Type*) mixer; \
134 g_return_if_fail (this != NULL); \
135 g_return_if_fail (this->mixer != NULL); \
137 gst_pulsemixer_ctrl_set_record (this->mixer, track, record); \
140 interface_as_function ## _set_mute (GstMixer * mixer, GstMixerTrack * track, \
143 Type *this = (Type*) mixer; \
145 g_return_if_fail (this != NULL); \
146 g_return_if_fail (this->mixer != NULL); \
148 gst_pulsemixer_ctrl_set_mute (this->mixer, track, mute); \
150 static GstMixerFlags \
151 interface_as_function ## _get_mixer_flags (GstMixer * mixer) \
153 Type *this = (Type*) mixer; \
155 g_return_val_if_fail (this != NULL, GST_MIXER_FLAG_NONE); \
156 g_return_val_if_fail (this->mixer != NULL, GST_MIXER_FLAG_NONE); \
158 return gst_pulsemixer_ctrl_get_mixer_flags (this->mixer); \
161 interface_as_function ## _mixer_interface_init (GstMixerClass * klass) \
163 GST_MIXER_TYPE (klass) = GST_MIXER_HARDWARE; \
165 klass->list_tracks = interface_as_function ## _list_tracks; \
166 klass->set_volume = interface_as_function ## _set_volume; \
167 klass->get_volume = interface_as_function ## _get_volume; \
168 klass->set_mute = interface_as_function ## _set_mute; \
169 klass->set_record = interface_as_function ## _set_record; \
170 klass->get_mixer_flags = interface_as_function ## _get_mixer_flags; \