2 * GStreamer pulseaudio plugin
4 * Copyright (c) 2004-2008 Lennart Poettering
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22 #ifndef __GST_PULSEUTIL_H__
23 #define __GST_PULSEUTIL_H__
30 #include <pulse/pulseaudio.h>
31 #include <gst/audio/gstaudioringbuffer.h>
32 #include <gst/audio/gstaudiosink.h>
35 #if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
36 # define _PULSE_FORMATS "{ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, " \
37 "S24LE, S24BE, S24_32LE, S24_32BE, U8 }"
39 # define _PULSE_FORMATS "{ S16BE, S16LE, F32BE, F32LE, S32BE, S32LE, " \
40 "S24BE, S24LE, S24_32BE, S24_32LE, U8 }"
43 #define _PULSE_CAPS_LINEAR \
45 "format = (string) " _PULSE_FORMATS ", " \
46 "layout = (string) interleaved, " \
47 "rate = (int) [ 1, MAX ], " \
48 "channels = (int) [ 1, 32 ]; "
49 #define _PULSE_CAPS_ALAW \
51 "rate = (int) [ 1, MAX], " \
52 "channels = (int) [ 1, 32 ]; "
53 #define _PULSE_CAPS_MULAW \
55 "rate = (int) [ 1, MAX], " \
56 "channels = (int) [ 1, 32 ]; "
58 #define _PULSE_CAPS_AC3 "audio/x-ac3, framed = (boolean) true; "
59 #define _PULSE_CAPS_EAC3 "audio/x-eac3, framed = (boolean) true; "
60 #define _PULSE_CAPS_DTS "audio/x-dts, framed = (boolean) true, " \
61 "block-size = (int) { 512, 1024, 2048 }; "
62 #define _PULSE_CAPS_MP3 "audio/mpeg, mpegversion = (int) 1, " \
63 "mpegaudioversion = (int) [ 1, 2 ], parsed = (boolean) true;"
64 #define _PULSE_CAPS_AAC "audio/mpeg, mpegversion = (int) { 2, 4 }, " \
65 "framed = (boolean) true, stream-format = (string) adts;"
67 #define _PULSE_CAPS_PCM \
73 gboolean gst_pulse_fill_sample_spec (GstAudioRingBufferSpec * spec,
75 gboolean gst_pulse_fill_format_info (GstAudioRingBufferSpec * spec,
76 pa_format_info ** f, guint * channels);
77 const char * gst_pulse_sample_format_to_caps_format (pa_sample_format_t sf);
79 gchar *gst_pulse_client_name (void);
81 pa_channel_map *gst_pulse_gst_to_channel_map (pa_channel_map * map,
82 const GstAudioRingBufferSpec * spec);
84 GstAudioRingBufferSpec *gst_pulse_channel_map_to_gst (const pa_channel_map * map,
85 GstAudioRingBufferSpec * spec);
87 void gst_pulse_cvolume_from_linear (pa_cvolume *v, unsigned channels, gdouble volume);
89 pa_proplist *gst_pulse_make_proplist (const GstStructure *properties);
90 GstStructure *gst_pulse_make_structure (pa_proplist *properties);
92 GstCaps * gst_pulse_format_info_to_caps (pa_format_info * format);
95 void gst_pulse_set_volume_ratio (uint32_t stream_index, const char *direction, double ratio);