Release 1.16.2
[platform/upstream/gst-plugins-good.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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
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/audio.h>
33 #include <gst/audio/gstaudiosink.h>
34
35 #include <pulse/pulseaudio.h>
36 #include <pulse/thread-mainloop.h>
37
38 #include "pulseutil.h"
39
40 G_BEGIN_DECLS
41
42 #define GST_TYPE_PULSESINK \
43   (gst_pulsesink_get_type())
44 #define GST_PULSESINK(obj) \
45   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PULSESINK,GstPulseSink))
46 #define GST_PULSESINK_CLASS(klass) \
47   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PULSESINK,GstPulseSinkClass))
48 #define GST_IS_PULSESINK(obj) \
49   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PULSESINK))
50 #define GST_IS_PULSESINK_CLASS(obj) \
51   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSESINK))
52 #define GST_PULSESINK_CAST(obj) \
53   ((GstPulseSink *)(obj))
54
55 typedef struct _GstPulseSink GstPulseSink;
56 typedef struct _GstPulseSinkClass GstPulseSinkClass;
57
58 typedef struct _GstPulseDeviceInfo {
59   gchar *description;
60   GList *formats;
61 } GstPulseDeviceInfo;
62
63 struct _GstPulseSink
64 {
65   GstAudioBaseSink sink;
66
67   gchar *server, *device, *stream_name, *client_name;
68   GstPulseDeviceInfo device_info;
69
70   gdouble volume;
71   gboolean volume_set:1;
72   gboolean mute:1;
73   gboolean mute_set:1;
74   guint32 current_sink_idx;
75   gchar *current_sink_name;
76
77   guint defer_pending;
78
79   gint notify; /* atomic */
80
81   const gchar *pa_version;
82
83   GstStructure *properties;
84   pa_proplist *proplist;
85
86   volatile gint format_lost;
87   GstClockTime format_lost_time;
88 };
89
90 struct _GstPulseSinkClass
91 {
92   GstAudioBaseSinkClass parent_class;
93 };
94
95 GType gst_pulsesink_get_type (void);
96
97 #define PULSE_SINK_TEMPLATE_CAPS \
98   _PULSE_CAPS_PCM \
99   _PULSE_CAPS_AC3 \
100   _PULSE_CAPS_EAC3 \
101   _PULSE_CAPS_DTS \
102   _PULSE_CAPS_MP3 \
103   _PULSE_CAPS_AAC
104
105 G_END_DECLS
106
107 #endif /* __GST_PULSESINK_H__ */