mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
109 lines
2.7 KiB
C
109 lines
2.7 KiB
C
/* 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
|