Initialize Tizen 2.3
[framework/multimedia/gst-plugins-base0.10.git] / gst-libs / gst / interfaces / mixer.h
1 /* GStreamer Mixer
2  * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  *
4  * mixer.h: mixer interface design
5  *
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.
10  *
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.
15  *
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.
20  */
21
22 #ifndef __GST_MIXER_H__
23 #define __GST_MIXER_H__
24
25 #include <gst/gst.h>
26 #include <gst/interfaces/mixeroptions.h>
27 #include <gst/interfaces/mixertrack.h>
28 #include <gst/interfaces/interfaces-enumtypes.h>
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_MIXER \
33   (gst_mixer_get_type ())
34 #define GST_MIXER(obj) \
35   (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer))
36 #define GST_MIXER_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER, GstMixerClass))
38 #define GST_IS_MIXER(obj) \
39   (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER))
40 #define GST_IS_MIXER_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER))
42 #define GST_MIXER_GET_CLASS(inst) \
43   (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_MIXER, GstMixerClass))
44
45 #define GST_MIXER_TYPE(klass) (klass->mixer_type)
46
47 typedef struct _GstMixer GstMixer;
48 typedef struct _GstMixerClass GstMixerClass;
49
50 /**
51  * GstMixerType:
52  * @GST_MIXER_HARDWARE: mixing is implemented with dedicated hardware.
53  * @GST_MIXER_SOFTWARE: mixing is implemented via software processing.
54  *
55  * Mixer classification.
56  */
57 typedef enum
58 {
59   GST_MIXER_HARDWARE,
60   GST_MIXER_SOFTWARE
61 } GstMixerType;
62
63 /**
64  * GstMixerMessageType:
65  * @GST_MIXER_MESSAGE_INVALID: Not a GstMixer message
66  * @GST_MIXER_MESSAGE_MUTE_TOGGLED: A mute-toggled GstMixer message
67  * @GST_MIXER_MESSAGE_RECORD_TOGGLED: A record-toggled GstMixer message
68  * @GST_MIXER_MESSAGE_VOLUME_CHANGED: A volume-changed GstMixer message
69  * @GST_MIXER_MESSAGE_OPTION_CHANGED: An option-changed GstMixer message
70  * @GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED: An options-list-changed
71  *     GstMixer message, posted when the list of available options for a
72  *     GstMixerOptions object has changed (Since: 0.10.18)
73  * @GST_MIXER_MESSAGE_MIXER_CHANGED: A mixer-changed GstMixer message, posted
74  *     when the list of available mixer tracks has changed. The application
75  *     should re-build its interface in this case (Since: 0.10.18)
76  *
77  * An enumeration for the type of a GstMixer message received on the bus
78  *
79  * Since: 0.10.14
80  */
81 typedef enum
82 {
83   GST_MIXER_MESSAGE_INVALID,
84   GST_MIXER_MESSAGE_MUTE_TOGGLED,
85   GST_MIXER_MESSAGE_RECORD_TOGGLED,
86   GST_MIXER_MESSAGE_VOLUME_CHANGED,
87   GST_MIXER_MESSAGE_OPTION_CHANGED,
88   GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED,
89   GST_MIXER_MESSAGE_MIXER_CHANGED
90 } GstMixerMessageType;
91
92 /**
93  * GstMixerFlags:
94  * @GST_MIXER_FLAG_NONE: No flags
95  * @GST_MIXER_FLAG_AUTO_NOTIFICATIONS: The mixer implementation automatically
96  *    sends notification messages.
97  * @GST_MIXER_FLAG_HAS_WHITELIST: The mixer implementation flags tracks that
98  *    should be displayed by default (whitelisted). Since: 0.10.23
99  * @GST_MIXER_FLAG_GROUPING: The mixer implementation will leave some controls
100  *    marked without either input or output.  Controls marked as input or
101  *    output should be grouped with input & output sliders, even if they
102  *    are options or bare switches. Since: 0.10.23
103  *
104  * Flags indicating which optional features are supported by a mixer
105  * implementation.
106  *
107  * Since: 0.10.14
108  */
109 typedef enum
110 {
111   GST_MIXER_FLAG_NONE                = 0,
112   GST_MIXER_FLAG_AUTO_NOTIFICATIONS  = (1<<0),
113   GST_MIXER_FLAG_HAS_WHITELIST       = (1<<1),
114   GST_MIXER_FLAG_GROUPING            = (1<<2),
115 } GstMixerFlags;
116
117 struct _GstMixerClass {
118   GTypeInterface klass;
119
120   GstMixerType mixer_type;
121
122   /* virtual functions */
123   const GList *  (* list_tracks)   (GstMixer      *mixer);
124
125   void           (* set_volume)    (GstMixer      *mixer,
126                                     GstMixerTrack *track,
127                                     gint          *volumes);
128   void           (* get_volume)    (GstMixer      *mixer,
129                                     GstMixerTrack *track,
130                                     gint          *volumes);
131
132   void           (* set_mute)      (GstMixer      *mixer,
133                                     GstMixerTrack *track,
134                                     gboolean       mute);
135   void           (* set_record)    (GstMixer      *mixer,
136                                     GstMixerTrack *track,
137                                     gboolean       record);
138 #ifndef GST_DISABLE_DEPRECATED
139   /* signals (deprecated) */
140   void (* mute_toggled)   (GstMixer      *mixer,
141                            GstMixerTrack *channel,
142                            gboolean       mute);
143   void (* record_toggled) (GstMixer      *mixer,
144                            GstMixerTrack *channel,
145                            gboolean       record);
146   void (* volume_changed) (GstMixer      *mixer,
147                            GstMixerTrack *channel,
148                            gint          *volumes);
149 #else
150   gpointer padding1[3];
151 #endif /* not GST_DISABLE_DEPRECATED */
152
153   void          (* set_option)     (GstMixer      *mixer,
154                                     GstMixerOptions *opts,
155                                     gchar         *value);
156   const gchar * (* get_option)     (GstMixer      *mixer,
157                                     GstMixerOptions *opts);
158
159 #ifndef GST_DISABLE_DEPRECATED
160   void (* option_changed) (GstMixer      *mixer,
161                            GstMixerOptions *opts,
162                            gchar   *option);
163 #else
164   gpointer padding2;
165 #endif /* not GST_DISABLE_DEPRECATED */
166
167   GstMixerFlags (* get_mixer_flags) (GstMixer *mixer);
168
169   /*< private >*/
170   gpointer _gst_reserved[GST_PADDING-1];
171 };
172
173 GType           gst_mixer_get_type      (void);
174
175 /* virtual class function wrappers */
176 const GList *   gst_mixer_list_tracks    (GstMixer      *mixer);
177 void            gst_mixer_set_volume     (GstMixer      *mixer,
178                                           GstMixerTrack *track,
179                                           gint          *volumes);
180 void            gst_mixer_get_volume     (GstMixer      *mixer,
181                                           GstMixerTrack *track,
182                                           gint          *volumes);
183 void            gst_mixer_set_mute       (GstMixer      *mixer,
184                                           GstMixerTrack *track,
185                                           gboolean       mute);
186 void            gst_mixer_set_record     (GstMixer      *mixer,
187                                           GstMixerTrack *track,
188                                           gboolean       record);
189 void            gst_mixer_set_option     (GstMixer      *mixer,
190                                           GstMixerOptions *opts,
191                                           gchar         *value);
192 const gchar *   gst_mixer_get_option     (GstMixer      *mixer,
193                                           GstMixerOptions *opts);
194
195 /* trigger bus messages */
196 void            gst_mixer_mute_toggled   (GstMixer      *mixer,
197                                           GstMixerTrack *track,
198                                           gboolean       mute);
199 void            gst_mixer_record_toggled (GstMixer      *mixer,
200                                           GstMixerTrack *track,
201                                           gboolean       record);
202 void            gst_mixer_volume_changed (GstMixer      *mixer,
203                                           GstMixerTrack *track,
204                                           gint          *volumes);
205 void            gst_mixer_option_changed (GstMixer      *mixer,
206                                           GstMixerOptions *opts,
207                                           const gchar   *value);
208
209 void            gst_mixer_mixer_changed   (GstMixer        *mixer);
210
211 void            gst_mixer_options_list_changed (GstMixer        *mixer,
212                                                 GstMixerOptions *opts);
213
214 GstMixerType    gst_mixer_get_mixer_type  (GstMixer *mixer);
215
216 GstMixerFlags   gst_mixer_get_mixer_flags (GstMixer *mixer);
217
218 /* Functions for recognising and parsing GstMixerMessages on the bus */
219 GstMixerMessageType gst_mixer_message_get_type (GstMessage *message);
220 void            gst_mixer_message_parse_mute_toggled (GstMessage *message,
221                                                       GstMixerTrack **track,
222                                                       gboolean *mute);
223 void            gst_mixer_message_parse_record_toggled (GstMessage *message,
224                                                         GstMixerTrack **track,
225                                                         gboolean *record);
226 void            gst_mixer_message_parse_volume_changed (GstMessage *message,
227                                                         GstMixerTrack **track,
228                                                         gint **volumes,
229                                                         gint *num_channels);
230 void            gst_mixer_message_parse_option_changed (GstMessage *message,
231                                                         GstMixerOptions **options,
232                                                         const gchar **value);
233 void            gst_mixer_message_parse_options_list_changed (GstMessage *message,
234                                                               GstMixerOptions **options);
235
236 G_END_DECLS
237
238 #endif /* __GST_MIXER_H__ */