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