upload tizen1.0 source
[framework/multimedia/gst-plugins-good0.10.git] / ext / pulse / pulseutil.h
1 /*
2  *  GStreamer pulseaudio plugin
3  *
4  *  Copyright (c) 2004-2008 Lennart Poettering
5  *
6  *  gst-pulse is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU Lesser General Public License as
8  *  published by the Free Software Foundation; either version 2.1 of the
9  *  License, or (at your option) any later version.
10  *
11  *  gst-pulse is distributed in the hope that it will be useful, but
12  *  WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  *  Lesser General Public License for more details.
15  *
16  *  You should have received a copy of the GNU Lesser General Public
17  *  License along with gst-pulse; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  *  USA.
20  */
21
22 #ifndef __GST_PULSEUTIL_H__
23 #define __GST_PULSEUTIL_H__
24
25 #include <gst/gst.h>
26 #include <pulse/pulseaudio.h>
27 #include <gst/audio/gstaudiosink.h>
28
29 gboolean gst_pulse_fill_sample_spec (GstRingBufferSpec * spec,
30     pa_sample_spec * ss);
31
32 gchar *gst_pulse_client_name (void);
33
34 pa_channel_map *gst_pulse_gst_to_channel_map (pa_channel_map * map,
35     const GstRingBufferSpec * spec);
36
37 GstRingBufferSpec *gst_pulse_channel_map_to_gst (const pa_channel_map * map,
38     GstRingBufferSpec * spec);
39
40 void gst_pulse_cvolume_from_linear (pa_cvolume *v, unsigned channels, gdouble volume);
41
42 pa_proplist *gst_pulse_make_proplist (const GstStructure *properties);
43
44 #if !HAVE_PULSE_0_9_11
45 static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x) {
46     return
47         x == PA_CONTEXT_CONNECTING ||
48         x == PA_CONTEXT_AUTHORIZING ||
49         x == PA_CONTEXT_SETTING_NAME ||
50         x == PA_CONTEXT_READY;
51 }
52
53 /** Return non-zero if the passed state is one of the connected states */
54 static inline int PA_STREAM_IS_GOOD(pa_stream_state_t x) {
55     return
56         x == PA_STREAM_CREATING ||
57         x == PA_STREAM_READY;
58 }
59
60 #endif
61
62 #endif