pulsesrc; cleanups, report real latency
[platform/upstream/gst-plugins-good.git] / ext / pulse / pulsesrc.h
1 /*
2  *  GStreamer pulseaudio plugin
3  *
4  *  Copyright (c) 2004-2008 Lennart Poettering
5  *
6  *  gst-pulse is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU Lesser General Public License as
8  *  published by the Free Software Foundation; either version 2.1 of the
9  *  License, or (at your option) any later version.
10  *
11  *  gst-pulse is distributed in the hope that it will be useful, but
12  *  WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  *  Lesser General Public License for more details.
15  *
16  *  You should have received a copy of the GNU Lesser General Public
17  *  License along with gst-pulse; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  *  USA.
20  */
21
22 #ifndef __GST_PULSESRC_H__
23 #define __GST_PULSESRC_H__
24
25 #include <gst/gst.h>
26 #include <gst/audio/gstaudiosrc.h>
27
28 #include <pulse/pulseaudio.h>
29 #include <pulse/thread-mainloop.h>
30
31 #include "pulsemixerctrl.h"
32 #include "pulseprobe.h"
33
34 G_BEGIN_DECLS
35
36 #define GST_TYPE_PULSESRC \
37   (gst_pulsesrc_get_type())
38 #define GST_PULSESRC(obj) \
39   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PULSESRC,GstPulseSrc))
40 #define GST_PULSESRC_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PULSESRC,GstPulseSrcClass))
42 #define GST_IS_PULSESRC(obj) \
43   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PULSESRC))
44 #define GST_IS_PULSESRC_CLASS(obj) \
45   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSESRC))
46 #define GST_PULSESRC_CAST(obj) \
47   ((GstPulseSrc *)(obj))
48
49 typedef struct _GstPulseSrc GstPulseSrc;
50 typedef struct _GstPulseSrcClass GstPulseSrcClass;
51
52 struct _GstPulseSrc
53 {
54   GstAudioSrc src;
55
56   gchar *server, *device;
57
58   pa_threaded_mainloop *mainloop;
59
60   pa_context *context;
61   pa_stream *stream;
62
63   pa_sample_spec sample_spec;
64
65   const void *read_buffer;
66   size_t read_buffer_length;
67
68   gchar *device_description;
69
70   GstPulseMixerCtrl *mixer;
71   GstPulseProbe *probe;
72
73   gboolean operation_success;
74   gboolean did_reset, in_read;
75 };
76
77 struct _GstPulseSrcClass
78 {
79   GstAudioSrcClass parent_class;
80 };
81
82 GType gst_pulsesrc_get_type (void);
83
84 G_END_DECLS
85
86 #endif /* __GST_PULSESRC_H__ */