tizen 2.0 init
[framework/multimedia/gst-plugins-good0.10.git] / ext / pulse / pulsesink.h
1 /*-*- Mode: C; c-basic-offset: 2 -*-*/
2
3 /*
4  *  GStreamer pulseaudio plugin
5  *
6  *  Copyright (c) 2004-2008 Lennart Poettering
7  *
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.
12  *
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.
17  *
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
21  *  USA.
22  */
23
24 #ifndef __GST_PULSESINK_H__
25 #define __GST_PULSESINK_H__
26
27 #ifdef HAVE_CONFIG_H
28 #include "config.h"
29 #endif
30
31 #include <gst/gst.h>
32 #include <gst/audio/gstaudiosink.h>
33
34 #include <pulse/pulseaudio.h>
35 #include <pulse/thread-mainloop.h>
36
37 #include "pulseprobe.h"
38
39 G_BEGIN_DECLS
40
41 #define GST_TYPE_PULSESINK \
42   (gst_pulsesink_get_type())
43 #define GST_PULSESINK(obj) \
44   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PULSESINK,GstPulseSink))
45 #define GST_PULSESINK_CLASS(klass) \
46   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PULSESINK,GstPulseSinkClass))
47 #define GST_IS_PULSESINK(obj) \
48   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PULSESINK))
49 #define GST_IS_PULSESINK_CLASS(obj) \
50   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSESINK))
51 #define GST_PULSESINK_CAST(obj) \
52   ((GstPulseSink *)(obj))
53
54 typedef struct _GstPulseSink GstPulseSink;
55 typedef struct _GstPulseSinkClass GstPulseSinkClass;
56
57 struct _GstPulseSink
58 {
59   GstBaseAudioSink sink;
60
61   gchar *server, *device, *stream_name, *client_name;
62   gchar *device_description;
63
64   GstPulseProbe *probe;
65
66   gdouble volume;
67   gboolean volume_set:1;
68   gboolean mute:1;
69   gboolean mute_set:1;
70
71   guint defer_pending;
72
73   gint notify; /* atomic */
74
75   const gchar *pa_version;
76
77   GstStructure *properties;
78   pa_proplist *proplist;
79
80 #ifdef HAVE_PULSE_1_0
81   GMutex *sink_formats_lock;
82   GList *sink_formats;
83   volatile gint format_lost;
84   GstClockTime format_lost_time;
85 #endif
86 };
87
88 struct _GstPulseSinkClass
89 {
90   GstBaseAudioSinkClass parent_class;
91 };
92
93 GType gst_pulsesink_get_type (void);
94
95 #if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
96 # define ENDIANNESS   "LITTLE_ENDIAN, BIG_ENDIAN"
97 #else
98 # define ENDIANNESS   "BIG_ENDIAN, LITTLE_ENDIAN"
99 #endif
100
101 #define _PULSE_SINK_CAPS_COMMON \
102     "audio/x-raw-int, " \
103       "endianness = (int) { " ENDIANNESS " }, " \
104       "signed = (boolean) TRUE, " \
105       "width = (int) 16, " \
106       "depth = (int) 16, " \
107       "rate = (int) [ 1, MAX ], " \
108       "channels = (int) [ 1, 32 ];" \
109     "audio/x-raw-float, " \
110       "endianness = (int) { " ENDIANNESS " }, " \
111       "width = (int) 32, " \
112       "rate = (int) [ 1, MAX ], " \
113       "channels = (int) [ 1, 32 ];" \
114     "audio/x-raw-int, " \
115       "endianness = (int) { " ENDIANNESS " }, " \
116       "signed = (boolean) TRUE, " \
117       "width = (int) 32, " \
118       "depth = (int) 32, " \
119       "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 32 ];" \
120     "audio/x-raw-int, " \
121       "signed = (boolean) FALSE, " \
122       "width = (int) 8, " \
123       "depth = (int) 8, " \
124       "rate = (int) [ 1, MAX ], " \
125       "channels = (int) [ 1, 32 ];" \
126     "audio/x-alaw, " \
127       "rate = (int) [ 1, MAX], " \
128       "channels = (int) [ 1, 32 ];" \
129     "audio/x-mulaw, " \
130       "rate = (int) [ 1, MAX], " "channels = (int) [ 1, 32 ];" \
131     "audio/x-raw-int, " \
132       "endianness = (int) { " ENDIANNESS " }, " \
133       "signed = (boolean) TRUE, " \
134       "width = (int) 24, " \
135       "depth = (int) 24, " \
136       "rate = (int) [ 1, MAX ], " \
137       "channels = (int) [ 1, 32 ];" \
138     "audio/x-raw-int, " \
139       "endianness = (int) { " ENDIANNESS " }, " \
140       "signed = (boolean) TRUE, " \
141       "width = (int) 32, " \
142       "depth = (int) 24, " \
143       "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 32 ];"
144
145 #ifdef HAVE_PULSE_1_0
146 #define _PULSE_SINK_CAPS_1_0 \
147     "audio/x-ac3, framed = (boolean) true;" \
148     "audio/x-eac3, framed = (boolean) true; " \
149     "audio/x-dts, framed = (boolean) true, " \
150       "block-size = (int) { 512, 1024, 2048 }; " \
151     "audio/mpeg, mpegversion = (int) 1, " \
152       "mpegaudioversion = (int) [ 1, 2 ], parsed = (boolean) true;"
153 #else
154 #define _PULSE_SINK_CAPS_1_0 ""
155 #endif
156
157 #define PULSE_SINK_TEMPLATE_CAPS \
158   _PULSE_SINK_CAPS_COMMON \
159   _PULSE_SINK_CAPS_1_0
160
161 #ifdef HAVE_PULSE_1_0
162
163 #define GST_TYPE_PULSE_AUDIO_SINK \
164   (gst_pulse_audio_sink_get_type())
165 #define GST_PULSE_AUDIO_SINK(obj) \
166   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PULSE_AUDIO_SINK,GstPulseAudioSink))
167 #define GST_PULSE_AUDIO_SINK_CLASS(klass) \
168   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PULSE_AUDIO_SINK,GstPulseAudioSinkClass))
169 #define GST_IS_PULSE_AUDIO_SINK(obj) \
170   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PULSE_AUDIO_SINK))
171 #define GST_IS_PULSE_AUDIO_SINK_CLASS(obj) \
172   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSE_AUDIO_SINK))
173 #define GST_PULSE_AUDIO_SINK_CAST(obj) \
174   ((GstPulseAudioSink *)(obj))
175
176 GType gst_pulse_audio_sink_get_type (void);
177
178 #endif /* HAVE_PULSE_1_0 */
179
180 G_END_DECLS
181
182 #endif /* __GST_PULSESINK_H__ */