1 /*-*- Mode: C; c-basic-offset: 2 -*-*/
4 * GStreamer pulseaudio plugin
6 * Copyright (c) 2004-2008 Lennart Poettering
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.
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.
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
24 #ifndef __GST_PULSESINK_H__
25 #define __GST_PULSESINK_H__
32 #include <gst/audio/gstaudiosink.h>
34 #include <pulse/pulseaudio.h>
35 #include <pulse/thread-mainloop.h>
37 #include "pulseprobe.h"
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))
54 typedef struct _GstPulseSink GstPulseSink;
55 typedef struct _GstPulseSinkClass GstPulseSinkClass;
59 GstBaseAudioSink sink;
61 gchar *server, *device, *stream_name, *client_name;
62 gchar *device_description;
67 gboolean volume_set:1;
73 gint notify; /* atomic */
75 const gchar *pa_version;
77 GstStructure *properties;
78 pa_proplist *proplist;
81 GMutex *sink_formats_lock;
83 volatile gint format_lost;
84 GstClockTime format_lost_time;
88 struct _GstPulseSinkClass
90 GstBaseAudioSinkClass parent_class;
93 GType gst_pulsesink_get_type (void);
95 #if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
96 # define FORMATS "{ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, " \
97 "S24LE, S24BE, S24_32LE, S24_32BE, S8 }"
99 # define FORMATS "{ S16BE, S16LE, F32BE, F32LE, S32BE, S32LE, " \
100 "S24BE, S24LE, S24_32BE, S24_32LE, S8 }"
103 #define _PULSE_SINK_CAPS_COMMON \
105 "format = (string) " FORMATS ", " \
106 "rate = (int) [ 1, MAX ], " \
107 "channels = (int) [ 1, 32 ];" \
109 "rate = (int) [ 1, MAX], " \
110 "channels = (int) [ 1, 32 ];" \
112 "rate = (int) [ 1, MAX], " "channels = (int) [ 1, 32 ];"
114 #ifdef HAVE_PULSE_1_0
115 #define _PULSE_SINK_CAPS_1_0 \
116 "audio/x-ac3, framed = (boolean) true;" \
117 "audio/x-eac3, framed = (boolean) true; " \
118 "audio/x-dts, framed = (boolean) true, " \
119 "block-size = (int) { 512, 1024, 2048 }; " \
120 "audio/mpeg, mpegversion = (int) 1, " \
121 "mpegaudioversion = (int) [ 1, 2 ], parsed = (boolean) true;"
123 #define _PULSE_SINK_CAPS_1_0 ""
126 #define PULSE_SINK_TEMPLATE_CAPS \
127 _PULSE_SINK_CAPS_COMMON \
130 #ifdef HAVE_PULSE_1_0
132 #define GST_TYPE_PULSE_AUDIO_SINK \
133 (gst_pulse_audio_sink_get_type())
134 #define GST_PULSE_AUDIO_SINK(obj) \
135 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PULSE_AUDIO_SINK,GstPulseAudioSink))
136 #define GST_PULSE_AUDIO_SINK_CLASS(klass) \
137 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PULSE_AUDIO_SINK,GstPulseAudioSinkClass))
138 #define GST_IS_PULSE_AUDIO_SINK(obj) \
139 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PULSE_AUDIO_SINK))
140 #define GST_IS_PULSE_AUDIO_SINK_CLASS(obj) \
141 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSE_AUDIO_SINK))
142 #define GST_PULSE_AUDIO_SINK_CAST(obj) \
143 ((GstPulseAudioSink *)(obj))
145 GType gst_pulse_audio_sink_get_type (void);
147 #endif /* HAVE_PULSE_1_0 */
151 #endif /* __GST_PULSESINK_H__ */