Debian Codegraph @

tools/element-templates/audiosrc

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