diff options
Diffstat (limited to 'tools/element-templates/audiosrc')
-rw-r--r-- | tools/element-templates/audiosrc | 61 |
1 files changed, 48 insertions, 13 deletions
diff --git a/tools/element-templates/audiosrc b/tools/element-templates/audiosrc index fe4f6129f..2a47c93f1 100644 --- a/tools/element-templates/audiosrc +++ b/tools/element-templates/audiosrc @@ -4,19 +4,19 @@ GstAudioSrc % TYPE_CLASS_NAME GST_TYPE_AUDIO_SRC % pads -srcpad-simple +srcpad-audio % pkg-config -gstreamer-audio-0.10 +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, GstRingBufferSpec * spec); +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); +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 @@ -30,45 +30,80 @@ static void gst_replace_reset (GstAudioSrc * src); 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) { - return FALSE; + 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, GstRingBufferSpec * spec) +gst_replace_prepare (GstAudioSrc * src, GstAudioRingBufferSpec * spec) { - return FALSE; + 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) { - return FALSE; + GstReplace *replace = GST_REPLACE (src); + + GST_DEBUG_OBJECT (replace, "unprepare"); + + return TRUE; } +/* close the device */ static gboolean gst_replace_close (GstAudioSrc * src) { - return FALSE; + 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) +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 |