build: Makefile.am cleanups
[platform/upstream/gst-plugins-good.git] / sys / directsound / gstdirectsoundsink.h
1 /* GStreamer
2  * Copyright (C)  2005 Sebastien Moutte <sebastien@moutte.net>
3  * Copyright (C) 2007 Pioneers of the Inevitable <songbird@songbirdnest.com>
4  *
5  * gstdirectsoundsink.h: 
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  *
22  * The development of this code was made possible due to the involvement
23  * of Pioneers of the Inevitable, the creators of the Songbird Music player
24  *
25  * 
26  */
27
28 #ifndef __GST_DIRECTSOUNDSINK_H__
29 #define __GST_DIRECTSOUNDSINK_H__
30
31 #include <gst/gst.h>
32 #include <gst/audio/gstaudiosink.h>
33 #include <gst/interfaces/mixer.h>
34
35 #include <windows.h>
36 #include <dxerr9.h>
37 #include <dsound.h>
38
39 G_BEGIN_DECLS
40 #define GST_TYPE_DIRECTSOUND_SINK            (gst_directsound_sink_get_type())
41 #define GST_DIRECTSOUND_SINK(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DIRECTSOUND_SINK,GstDirectSoundSink))
42 #define GST_DIRECTSOUND_SINK_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DIRECTSOUND_SINK,GstDirectSoundSinkClass))
43 #define GST_IS_DIRECTSOUND_SINK(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DIRECTSOUND_SINK))
44 #define GST_IS_DIRECTSOUND_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DIRECTSOUND_SINK))
45 typedef struct _GstDirectSoundSink GstDirectSoundSink;
46 typedef struct _GstDirectSoundSinkClass GstDirectSoundSinkClass;
47
48 #define GST_DSOUND_LOCK(obj)    (g_mutex_lock (obj->dsound_lock))
49 #define GST_DSOUND_UNLOCK(obj)  (g_mutex_unlock (obj->dsound_lock))
50
51 struct _GstDirectSoundSink
52 {
53   GstAudioSink sink;
54
55   /* directsound object interface pointer */
56   LPDIRECTSOUND pDS;
57
58   /* directsound sound object interface pointer */
59   LPDIRECTSOUNDBUFFER pDSBSecondary;
60
61   /* directSound buffer size */
62   guint buffer_size;
63
64   /* offset of the circular buffer where we must write next */
65   guint current_circular_offset;
66
67   guint bytes_per_sample;
68
69   /* current volume setup by mixer interface */
70   glong volume;
71
72   /* tracks list of our mixer interface implementation */
73   GList *tracks;
74
75   /* lock used to protect writes and resets */
76   GMutex *dsound_lock;
77
78   gboolean first_buffer_after_reset;
79 };
80
81 struct _GstDirectSoundSinkClass
82 {
83   GstAudioSinkClass parent_class;
84 };
85
86 GType gst_directsound_sink_get_type (void);
87
88 G_END_DECLS
89 #endif /* __GST_DIRECTSOUNDSINK_H__ */