2 * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * mixer.h: mixer interface design
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.
22 #ifndef __GST_MIXER_H__
23 #define __GST_MIXER_H__
26 #include <gst/audio/mixeroptions.h>
27 #include <gst/audio/mixertrack.h>
31 #define GST_TYPE_MIXER \
32 (gst_mixer_get_type ())
33 #define GST_MIXER(obj) \
34 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer))
35 #define GST_IS_MIXER(obj) \
36 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER))
37 #define GST_MIXER_GET_INTERFACE(inst) \
38 (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_MIXER, GstMixerInterface))
40 typedef struct _GstMixer GstMixer;
41 typedef struct _GstMixerInterface GstMixerInterface;
45 * @GST_MIXER_HARDWARE: mixing is implemented with dedicated hardware.
46 * @GST_MIXER_SOFTWARE: mixing is implemented via software processing.
48 * Mixer classification.
57 * GstMixerMessageType:
58 * @GST_MIXER_MESSAGE_INVALID: Not a GstMixer message
59 * @GST_MIXER_MESSAGE_MUTE_TOGGLED: A mute-toggled GstMixer message
60 * @GST_MIXER_MESSAGE_RECORD_TOGGLED: A record-toggled GstMixer message
61 * @GST_MIXER_MESSAGE_VOLUME_CHANGED: A volume-changed GstMixer message
62 * @GST_MIXER_MESSAGE_OPTION_CHANGED: An option-changed GstMixer message
63 * @GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED: An options-list-changed
64 * GstMixer message, posted when the list of available options for a
65 * GstMixerOptions object has changed (Since: 0.10.18)
66 * @GST_MIXER_MESSAGE_MIXER_CHANGED: A mixer-changed GstMixer message, posted
67 * when the list of available mixer tracks has changed. The application
68 * should re-build its interface in this case (Since: 0.10.18)
70 * An enumeration for the type of a GstMixer message received on the bus
76 GST_MIXER_MESSAGE_INVALID,
77 GST_MIXER_MESSAGE_MUTE_TOGGLED,
78 GST_MIXER_MESSAGE_RECORD_TOGGLED,
79 GST_MIXER_MESSAGE_VOLUME_CHANGED,
80 GST_MIXER_MESSAGE_OPTION_CHANGED,
81 GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED,
82 GST_MIXER_MESSAGE_MIXER_CHANGED
83 } GstMixerMessageType;
87 * @GST_MIXER_FLAG_NONE: No flags
88 * @GST_MIXER_FLAG_AUTO_NOTIFICATIONS: The mixer implementation automatically
89 * sends notification messages.
90 * @GST_MIXER_FLAG_HAS_WHITELIST: The mixer implementation flags tracks that
91 * should be displayed by default (whitelisted). Since: 0.10.23
92 * @GST_MIXER_FLAG_GROUPING: The mixer implementation will leave some controls
93 * marked without either input or output. Controls marked as input or
94 * output should be grouped with input & output sliders, even if they
95 * are options or bare switches. Since: 0.10.23
97 * Flags indicating which optional features are supported by a mixer
104 GST_MIXER_FLAG_NONE = 0,
105 GST_MIXER_FLAG_AUTO_NOTIFICATIONS = (1<<0),
106 GST_MIXER_FLAG_HAS_WHITELIST = (1<<1),
107 GST_MIXER_FLAG_GROUPING = (1<<2),
110 struct _GstMixerInterface {
111 GTypeInterface iface;
113 /* virtual functions */
114 const GList * (* list_tracks) (GstMixer *mixer);
116 void (* set_volume) (GstMixer *mixer,
117 GstMixerTrack *track,
119 void (* get_volume) (GstMixer *mixer,
120 GstMixerTrack *track,
123 void (* set_mute) (GstMixer *mixer,
124 GstMixerTrack *track,
126 void (* set_record) (GstMixer *mixer,
127 GstMixerTrack *track,
129 void (* set_option) (GstMixer *mixer,
130 GstMixerOptions *opts,
132 const gchar * (* get_option) (GstMixer *mixer,
133 GstMixerOptions *opts);
135 GstMixerFlags (* get_mixer_flags) (GstMixer *mixer);
137 GstMixerType (* get_mixer_type) (GstMixer *mixer);
140 GType gst_mixer_get_type (void);
142 /* virtual class function wrappers */
143 const GList * gst_mixer_list_tracks (GstMixer *mixer);
144 void gst_mixer_set_volume (GstMixer *mixer,
145 GstMixerTrack *track,
147 void gst_mixer_get_volume (GstMixer *mixer,
148 GstMixerTrack *track,
150 void gst_mixer_set_mute (GstMixer *mixer,
151 GstMixerTrack *track,
153 void gst_mixer_set_record (GstMixer *mixer,
154 GstMixerTrack *track,
156 void gst_mixer_set_option (GstMixer *mixer,
157 GstMixerOptions *opts,
159 const gchar * gst_mixer_get_option (GstMixer *mixer,
160 GstMixerOptions *opts);
162 /* trigger bus messages */
163 void gst_mixer_mute_toggled (GstMixer *mixer,
164 GstMixerTrack *track,
166 void gst_mixer_record_toggled (GstMixer *mixer,
167 GstMixerTrack *track,
169 void gst_mixer_volume_changed (GstMixer *mixer,
170 GstMixerTrack *track,
172 void gst_mixer_option_changed (GstMixer *mixer,
173 GstMixerOptions *opts,
176 void gst_mixer_mixer_changed (GstMixer *mixer);
178 void gst_mixer_options_list_changed (GstMixer *mixer,
179 GstMixerOptions *opts);
181 GstMixerType gst_mixer_get_mixer_type (GstMixer *mixer);
183 GstMixerFlags gst_mixer_get_mixer_flags (GstMixer *mixer);
185 /* Functions for recognising and parsing GstMixerMessages on the bus */
186 GstMixerMessageType gst_mixer_message_get_type (GstMessage *message);
187 void gst_mixer_message_parse_mute_toggled (GstMessage *message,
188 GstMixerTrack **track,
190 void gst_mixer_message_parse_record_toggled (GstMessage *message,
191 GstMixerTrack **track,
193 void gst_mixer_message_parse_volume_changed (GstMessage *message,
194 GstMixerTrack **track,
197 void gst_mixer_message_parse_option_changed (GstMessage *message,
198 GstMixerOptions **options,
199 const gchar **value);
200 void gst_mixer_message_parse_options_list_changed (GstMessage *message,
201 GstMixerOptions **options);
205 #endif /* __GST_MIXER_H__ */