• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* vim: set filetype=c: */
2% ClassName
3GstAudioSink
4% TYPE_CLASS_NAME
5GST_TYPE_AUDIO_SINK
6% pads
7sinkpad-audio
8% pkg-config
9gstreamer-audio-1.0
10% includes
11#include <gst/audio/gstaudiosink.h>
12% prototypes
13static gboolean gst_replace_open (GstAudioSink * sink);
14static gboolean gst_replace_prepare (GstAudioSink * sink,
15    GstAudioRingBufferSpec * spec);
16static gboolean gst_replace_unprepare (GstAudioSink * sink);
17static gboolean gst_replace_close (GstAudioSink * sink);
18static gint gst_replace_write (GstAudioSink * sink, gpointer data,
19    guint length);
20static guint gst_replace_delay (GstAudioSink * sink);
21static 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 */
34static gboolean
35gst_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 */
45static gboolean
46gst_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() */
56static gboolean
57gst_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 */
67static gboolean
68gst_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 */
78static gint
79gst_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 */
89static guint
90gst_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 */
100static void
101gst_replace_reset (GstAudioSink * sink)
102{
103  GstReplace *replace = GST_REPLACE (sink);
104
105  GST_DEBUG_OBJECT (replace, "reset");
106
107}
108% end
109