Merge branch 'upstream/1.16' into tizen_gst_1.16.2
[platform/upstream/gst-plugins-good.git] / ext / pulse / pulsesrc.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_PULSESRC_H__
25 #define __GST_PULSESRC_H__
26
27 #include <gst/gst.h>
28 #include <gst/audio/gstaudiosrc.h>
29
30 #include <pulse/pulseaudio.h>
31 #include <pulse/thread-mainloop.h>
32
33 #if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
34 #include <stdio.h>
35 #endif
36
37 G_BEGIN_DECLS
38
39 #define GST_TYPE_PULSESRC \
40   (gst_pulsesrc_get_type())
41 #define GST_PULSESRC(obj) \
42   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PULSESRC,GstPulseSrc))
43 #define GST_PULSESRC_CLASS(klass) \
44   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PULSESRC,GstPulseSrcClass))
45 #define GST_IS_PULSESRC(obj) \
46   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PULSESRC))
47 #define GST_IS_PULSESRC_CLASS(obj) \
48   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSESRC))
49 #define GST_PULSESRC_CAST(obj) \
50   ((GstPulseSrc *)(obj))
51
52 typedef struct _GstPulseSrc GstPulseSrc;
53 typedef struct _GstPulseSrcClass GstPulseSrcClass;
54
55 struct _GstPulseSrc
56 {
57   GstAudioSrc src;
58
59   gchar *server, *device, *client_name;
60
61   pa_threaded_mainloop *mainloop;
62
63   pa_context *context;
64   pa_stream *stream;
65   guint32 source_output_idx;
66
67   pa_sample_spec sample_spec;
68
69   const void *read_buffer;
70   size_t read_buffer_length;
71
72   gchar *device_description;
73
74   gdouble volume;
75   gboolean volume_set:1;
76   gboolean mute:1;
77   gboolean mute_set:1;
78   guint32 current_source_idx;
79   gchar *current_source_name;
80
81   gint notify; /* atomic */
82
83   gboolean corked:1;
84   gboolean stream_connected:1;
85   gboolean operation_success:1;
86   gboolean paused:1;
87   gboolean in_read:1;
88
89 #ifdef __TIZEN__
90   gchar *latency;
91 #endif /* __TIZEN__ */
92
93   GstStructure *properties;
94   pa_proplist *proplist;
95
96 #if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
97   gint need_dump_output;
98   FILE *dump_fd_output;
99 #endif
100 };
101
102 struct _GstPulseSrcClass
103 {
104   GstAudioSrcClass parent_class;
105 };
106
107 GType gst_pulsesrc_get_type (void);
108
109 G_END_DECLS
110
111 #endif /* __GST_PULSESRC_H__ */