mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 14:36:24 +00:00
element-templates: improve the audiofilter template
Add comments. Add start/stop methods. Add (commented) instance casts at the begin of the method. Make transform_ip returning FLOW_OK by default.
This commit is contained in:
parent
f76feeb632
commit
c46725845b
1 changed files with 30 additions and 1 deletions
|
@ -12,27 +12,56 @@ gstreamer-audio-0.10
|
||||||
% prototypes
|
% prototypes
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_setup (GstAudioFilter * filter, GstRingBufferSpec * format);
|
gst_replace_setup (GstAudioFilter * filter, GstRingBufferSpec * format);
|
||||||
|
static gboolean
|
||||||
|
gst_replace_start (GstBaseTransform * trans);
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf);
|
gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf);
|
||||||
|
static gboolean
|
||||||
|
gst_replace_stop (GstBaseTransform * trans);
|
||||||
% declare-class
|
% declare-class
|
||||||
GstAudioFilterClass *audio_filter_class = GST_AUDIO_FILTER_CLASS (klass);
|
GstAudioFilterClass *audio_filter_class = GST_AUDIO_FILTER_CLASS (klass);
|
||||||
GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass);
|
GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass);
|
||||||
% set-methods
|
% set-methods
|
||||||
audio_filter_class->setup = GST_DEBUG_FUNCPTR (gst_replace_setup);
|
audio_filter_class->setup = GST_DEBUG_FUNCPTR (gst_replace_setup);
|
||||||
|
base_transform_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
|
||||||
base_transform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_replace_transform_ip);
|
base_transform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_replace_transform_ip);
|
||||||
|
base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
|
||||||
% methods
|
% methods
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_setup (GstAudioFilter * filter, GstRingBufferSpec * format)
|
gst_replace_setup (GstAudioFilter * filter, GstRingBufferSpec * format)
|
||||||
{
|
{
|
||||||
|
/* GstReplace *replace = GST_REPLACE (filter); */
|
||||||
|
|
||||||
|
/* handle audio format changes */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_replace_start (GstBaseTransform * trans)
|
||||||
|
{
|
||||||
|
/* GstReplace *replace = GST_REPLACE (trans); */
|
||||||
|
|
||||||
|
/* initialize processing */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
|
gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
|
/* GstReplace *replace = GST_REPLACE (trans); */
|
||||||
|
|
||||||
return GST_FLOW_ERROR;
|
/* process the audio data in the buffer in-place */
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_replace_stop (GstBaseTransform * trans)
|
||||||
|
{
|
||||||
|
/* GstReplace *replace = GST_REPLACE (trans); */
|
||||||
|
|
||||||
|
/* finalize processing */
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
% end
|
% end
|
||||||
|
|
Loading…
Reference in a new issue