Tizen 2.0 Release
[framework/multimedia/gst-plugins-good0.10.git] / sys / waveform / gstwaveformsink.h
1 /* GStreamer
2  * Copyright (C)  2005 Sebastien Moutte <sebastien@moutte.net>
3  *
4  * gstwaveformsink.h: 
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __GST_WAVEFORMSINK_H__
23 #define __GST_WAVEFORMSINK_H__
24
25 #include <gst/gst.h>
26 #include <gst/audio/gstaudiosink.h>
27
28 #include <windows.h>
29 #include <mmsystem.h>
30
31 #ifndef WAVE_FORMAT_96M08
32 #define WAVE_FORMAT_96M08       0x00001000       /* 96   kHz, Mono,   8-bit  */
33 #endif
34
35 #ifndef WAVE_FORMAT_96S08
36 #define WAVE_FORMAT_96S08       0x00002000       /* 96   kHz, Stereo, 8-bit  */
37 #endif
38
39 #ifndef WAVE_FORMAT_96M16
40 #define WAVE_FORMAT_96M16       0x00004000       /* 96   kHz, Mono,   16-bit */
41 #endif
42
43 #ifndef WAVE_FORMAT_96S16
44 #define WAVE_FORMAT_96S16       0x00008000       /* 96   kHz, Stereo, 16-bit */
45 #endif
46
47 #define ERROR_LENGTH MAXERRORLENGTH+50
48 #define BUFFER_COUNT 20
49 #define BUFFER_SIZE 8192
50
51 G_BEGIN_DECLS
52 #define GST_TYPE_WAVEFORM_SINK                (gst_waveform_sink_get_type())
53 #define GST_WAVEFORM_SINK(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WAVEFORM_SINK,GstWaveFormSink))
54 #define GST_WAVEFORM_SINK_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_WAVEFORM_SINK,GstWaveFormSinkClass))
55 #define GST_IS_WAVEFORM_SINK(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WAVEFORM_SINK))
56 #define GST_IS_WAVEFORM_SINK_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_WAVEFORM_SINK))
57 typedef struct _GstWaveFormSink GstWaveFormSink;
58 typedef struct _GstWaveFormSinkClass GstWaveFormSinkClass;
59
60 struct _GstWaveFormSink
61 {
62   /* parent object */
63   GstAudioSink sink;
64
65   /* supported caps */
66   GstCaps *cached_caps;
67   
68   /* handle to the waveform-audio output device */
69   HWAVEOUT hwaveout;
70   
71   /* table of buffer headers */
72   WAVEHDR *wave_buffers;
73
74   /* critical section protecting access to the number of free buffers */
75   CRITICAL_SECTION critic_wave;
76
77   /* number of free buffers available */
78   guint free_buffers_count;
79   
80   /* current free buffer where you have to write incoming data */
81   guint write_buffer;
82   
83   /* size of buffers streamed to the device */
84   guint buffer_size;
85
86   /* number of buffers streamed to the device */
87   guint buffer_count;
88
89   /* total of bytes in queue before they are written to the device */
90   guint bytes_in_queue;
91
92   /* bytes per sample from setcaps used to evaluate the number samples returned by delay */
93   guint bytes_per_sample;
94
95   /* wave form error string */
96   gchar error_string[ERROR_LENGTH];
97 };
98
99 struct _GstWaveFormSinkClass
100 {
101   GstAudioSinkClass parent_class;
102 };
103
104 GType gst_waveform_sink_get_type (void);
105
106 G_END_DECLS
107 #endif /* __GST_WAVEFORMSINK_H__ */