pulsesrc: Move to extended stream API
[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 G_BEGIN_DECLS
34
35 #define GST_TYPE_PULSESRC \
36   (gst_pulsesrc_get_type())
37 #define GST_PULSESRC(obj) \
38   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PULSESRC,GstPulseSrc))
39 #define GST_PULSESRC_CLASS(klass) \
40   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PULSESRC,GstPulseSrcClass))
41 #define GST_IS_PULSESRC(obj) \
42   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PULSESRC))
43 #define GST_IS_PULSESRC_CLASS(obj) \
44   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSESRC))
45 #define GST_PULSESRC_CAST(obj) \
46   ((GstPulseSrc *)(obj))
47
48 typedef struct _GstPulseSrc GstPulseSrc;
49 typedef struct _GstPulseSrcClass GstPulseSrcClass;
50
51 struct _GstPulseSrc
52 {
53   GstAudioSrc src;
54
55   gchar *server, *device, *client_name;
56
57   pa_threaded_mainloop *mainloop;
58
59   pa_context *context;
60   pa_stream *stream;
61   guint32 source_output_idx;
62
63   pa_format_info *format;
64   guint rate;
65   guint channels;
66
67   const void *read_buffer;
68   size_t read_buffer_length;
69
70   gchar *device_description;
71
72   gdouble volume;
73   gboolean volume_set:1;
74   gboolean mute:1;
75   gboolean mute_set:1;
76   guint32 current_source_idx;
77   gchar *current_source_name;
78
79   gint notify; /* atomic */
80
81   gboolean corked:1;
82   gboolean stream_connected:1;
83   gboolean operation_success:1;
84   gboolean paused:1;
85   gboolean in_read:1;
86
87   GstStructure *properties;
88   pa_proplist *proplist;
89 };
90
91 struct _GstPulseSrcClass
92 {
93   GstAudioSrcClass parent_class;
94 };
95
96 GType gst_pulsesrc_get_type (void);
97
98 G_END_DECLS
99
100 #endif /* __GST_PULSESRC_H__ */