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