Merge branch 'master' into 0.11
[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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
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 #include "pulsemixerctrl.h"
34 #include "pulseprobe.h"
35
36 G_BEGIN_DECLS
37
38 #define GST_TYPE_PULSESRC \
39   (gst_pulsesrc_get_type())
40 #define GST_PULSESRC(obj) \
41   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PULSESRC,GstPulseSrc))
42 #define GST_PULSESRC_CLASS(klass) \
43   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PULSESRC,GstPulseSrcClass))
44 #define GST_IS_PULSESRC(obj) \
45   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PULSESRC))
46 #define GST_IS_PULSESRC_CLASS(obj) \
47   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSESRC))
48 #define GST_PULSESRC_CAST(obj) \
49   ((GstPulseSrc *)(obj))
50
51 typedef struct _GstPulseSrc GstPulseSrc;
52 typedef struct _GstPulseSrcClass GstPulseSrcClass;
53
54 struct _GstPulseSrc
55 {
56   GstAudioSrc src;
57
58   gchar *server, *device, *client_name;
59
60   pa_threaded_mainloop *mainloop;
61
62   pa_context *context;
63   pa_stream *stream;
64   guint32 source_output_idx;
65
66   pa_sample_spec sample_spec;
67
68   const void *read_buffer;
69   size_t read_buffer_length;
70
71   gchar *device_description;
72   GstPulseMixerCtrl *mixer;
73   GstPulseProbe *probe;
74
75   gboolean corked:1;
76   gboolean stream_connected:1;
77   gboolean operation_success:1;
78   gboolean paused:1;
79   gboolean in_read:1;
80
81   GstStructure *properties;
82   pa_proplist *proplist;
83 };
84
85 struct _GstPulseSrcClass
86 {
87   GstAudioSrcClass parent_class;
88 };
89
90 GType gst_pulsesrc_get_type (void);
91
92 G_END_DECLS
93
94 #endif /* __GST_PULSESRC_H__ */