94544752cd843b9d9aad13d9908db32848f36d97
[framework/multimedia/gst-plugins-good0.10.git] / sys / sunaudio / gstsunaudiosink.h
1 /*
2  * GStreamer - SunAudio sink
3  * Copyright (C) 2004 David A. Schleef <ds@schleef.org>
4  * Copyright (C) 2005,2006 Sun Microsystems, Inc.,
5  *               Brian Cameron <brian.cameron@sun.com>
6  * Copyright (C) 2006 Jan Schmidt <thaytan@mad.scientist.com>
7  *
8  * gstsunaudiosink.h:
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the
22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  * Boston, MA 02111-1307, USA.
24  */
25
26 #ifndef __GST_SUNAUDIO_SINK_H__
27 #define __GST_SUNAUDIO_SINK_H__
28
29 #include <sys/audioio.h>
30 #include <gst/gst.h>
31 #include <gst/audio/gstaudiosink.h>
32
33 G_BEGIN_DECLS
34
35 #define GST_TYPE_SUNAUDIO_SINK            (gst_sunaudiosink_get_type())
36 #define GST_SUNAUDIO_SINK(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SUNAUDIO_SINK,GstSunAudioSink))
37 #define GST_SUNAUDIO_SINK_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SUNAUDIO_SINK,GstSunAudioSinkClass))
38 #define GST_IS_SUNAUDIO_SINK(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SUNAUDIO_SINK))
39 #define GST_IS_SUNAUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SUNAUDIO_SINK))
40
41 typedef struct _GstSunAudioSink GstSunAudioSink;
42 typedef struct _GstSunAudioSinkClass GstSunAudioSinkClass;
43
44 struct _GstSunAudioSink {
45   GstAudioSink    sink;
46
47   gchar *device;
48   gint   fd;
49
50   audio_device_t dev;
51   audio_info_t info;
52
53   /* Number of segments the ringbuffer is configured for */
54   guint segtotal;
55   guint segtotal_samples;
56
57   /* Number of segments written to the device */
58   gint segs_written;
59   /* Number of samples written to the device */
60   gint samples_written;
61   guint bytes_per_sample;
62
63   /* mutex and gcond used to control the write method */
64   GMutex *write_mutex;
65   GCond *sleep_cond;
66   gboolean flushing;
67 };
68
69 struct _GstSunAudioSinkClass {
70   GstAudioSinkClass parent_class;
71 };
72
73 GType gst_sunaudiosink_get_type(void);
74
75 G_END_DECLS
76
77 #endif /* __GST_SUNAUDIO_SINK_H__ */
78