1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
/* vim: set filetype=c: */
% ClassName
GstAudioSrc
% TYPE_CLASS_NAME
GST_TYPE_AUDIO_SRC
% pads
srcpad-audio
% pkg-config
gstreamer-audio-1.0
% includes
#include <gst/audio/gstaudiosrc.h>
% prototypes
static gboolean gst_replace_open (GstAudioSrc * src);
static gboolean gst_replace_prepare (GstAudioSrc * src,
GstAudioRingBufferSpec * spec);
static gboolean gst_replace_unprepare (GstAudioSrc * src);
static gboolean gst_replace_close (GstAudioSrc * src);
static guint gst_replace_read (GstAudioSrc * src, gpointer data, guint length,
GstClockTime * timestamp);
static guint gst_replace_delay (GstAudioSrc * src);
static void gst_replace_reset (GstAudioSrc * src);
% declare-class
GstAudioSrcClass *audio_src_class = GST_AUDIO_SRC_CLASS (klass);
% set-methods
audio_src_class->open = GST_DEBUG_FUNCPTR (gst_replace_open);
audio_src_class->prepare = GST_DEBUG_FUNCPTR (gst_replace_prepare);
audio_src_class->unprepare = GST_DEBUG_FUNCPTR (gst_replace_unprepare);
audio_src_class->close = GST_DEBUG_FUNCPTR (gst_replace_close);
audio_src_class->read = GST_DEBUG_FUNCPTR (gst_replace_read);
audio_src_class->delay = GST_DEBUG_FUNCPTR (gst_replace_delay);
audio_src_class->reset = GST_DEBUG_FUNCPTR (gst_replace_reset);
% methods
/* open the device with given specs */
static gboolean
gst_replace_open (GstAudioSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "open");
return TRUE;
}
/* prepare resources and state to operate with the given specs */
static gboolean
gst_replace_prepare (GstAudioSrc * src, GstAudioRingBufferSpec * spec)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "prepare");
return TRUE;
}
/* undo anything that was done in prepare() */
static gboolean
gst_replace_unprepare (GstAudioSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "unprepare");
return TRUE;
}
/* close the device */
static gboolean
gst_replace_close (GstAudioSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "close");
return TRUE;
}
/* read samples from the device */
static guint
gst_replace_read (GstAudioSrc * src, gpointer data, guint length,
GstClockTime * timestamp)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "read");
return 0;
}
/* get number of samples queued in the device */
static guint
gst_replace_delay (GstAudioSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "delay");
return 0;
}
/* reset the audio device, unblock from a write */
static void
gst_replace_reset (GstAudioSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "reset");
}
% end
|