Debian Codegraph @

tools/element-templates/audiosink

raw
1 /* vim: set filetype=c: */
2 % ClassName
3 GstAudioSink
4 % TYPE_CLASS_NAME
5 GST_TYPE_AUDIO_SINK
6 % pads
7 sinkpad-audio
8 % pkg-config
9 gstreamer-audio-1.0
10 % includes
11 #include <gst/audio/gstaudiosink.h>
12 % prototypes
13 static gboolean gst_replace_open (GstAudioSink * sink);
14 static gboolean gst_replace_prepare (GstAudioSink * sink,
15 GstAudioRingBufferSpec * spec);
16 static gboolean gst_replace_unprepare (GstAudioSink * sink);
17 static gboolean gst_replace_close (GstAudioSink * sink);
18 static gint gst_replace_write (GstAudioSink * sink, gpointer data,
19 guint length);
20 static guint gst_replace_delay (GstAudioSink * sink);
21 static void gst_replace_reset (GstAudioSink * sink);
22 % declare-class
23 GstAudioSinkClass *audio_sink_class = GST_AUDIO_SINK_CLASS (klass);
24 % set-methods
25 audio_sink_class->open = GST_DEBUG_FUNCPTR (gst_replace_open);
26 audio_sink_class->prepare = GST_DEBUG_FUNCPTR (gst_replace_prepare);
27 audio_sink_class->unprepare = GST_DEBUG_FUNCPTR (gst_replace_unprepare);
28 audio_sink_class->close = GST_DEBUG_FUNCPTR (gst_replace_close);
29 audio_sink_class->write = GST_DEBUG_FUNCPTR (gst_replace_write);
30 audio_sink_class->delay = GST_DEBUG_FUNCPTR (gst_replace_delay);
31 audio_sink_class->reset = GST_DEBUG_FUNCPTR (gst_replace_reset);
32 % methods
33 /* open the device with given specs */
34 static gboolean
35 gst_replace_open (GstAudioSink * sink)
36 {
37 GstReplace *replace = GST_REPLACE (sink);
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 (GstAudioSink * sink, GstAudioRingBufferSpec * spec)
47 {
48 GstReplace *replace = GST_REPLACE (sink);
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 (GstAudioSink * sink)
58 {
59 GstReplace *replace = GST_REPLACE (sink);
60
61 GST_DEBUG_OBJECT (replace, "unprepare");
62
63 return TRUE;
64 }
65
66 /* close the device */
67 static gboolean
68 gst_replace_close (GstAudioSink * sink)
69 {
70 GstReplace *replace = GST_REPLACE (sink);
71
72 GST_DEBUG_OBJECT (replace, "close");
73
74 return TRUE;
75 }
76
77 /* write samples to the device */
78 static gint
79 gst_replace_write (GstAudioSink * sink, gpointer data, guint length)
80 {
81 GstReplace *replace = GST_REPLACE (sink);
82
83 GST_DEBUG_OBJECT (replace, "write");
84
85 return 0;
86 }
87
88 /* get number of samples queued in the device */
89 static guint
90 gst_replace_delay (GstAudioSink * sink)
91 {
92 GstReplace *replace = GST_REPLACE (sink);
93
94 GST_DEBUG_OBJECT (replace, "delay");
95
96 return 0;
97 }
98
99 /* reset the audio device, unblock from a write */
100 static void
101 gst_replace_reset (GstAudioSink * sink)
102 {
103 GstReplace *replace = GST_REPLACE (sink);
104
105 GST_DEBUG_OBJECT (replace, "reset");
106
107 }
108 % end