gst/filter/: Reset the residue in BaseTransform::start to get a clean residue on stream changes.

Original commit message from CVS:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_class_init),
(bpwsinc_start):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(lpwsinc_start):
Reset the residue in BaseTransform::start to get a clean residue
on stream changes.
This commit is contained in:
Sebastian Dröge 2007-08-12 12:46:20 +00:00
parent 6871d561db
commit a1c029bab5
2 changed files with 39 additions and 2 deletions

View file

@ -148,6 +148,8 @@ static GstFlowReturn bpwsinc_transform (GstBaseTransform * base,
GstBuffer * inbuf, GstBuffer * outbuf);
static gboolean bpwsinc_get_unit_size (GstBaseTransform * base, GstCaps * caps,
guint * size);
static gboolean bpwsinc_start (GstBaseTransform * base);
static gboolean bpwsinc_setup (GstAudioFilter * base,
GstRingBufferSpec * format);
@ -190,9 +192,11 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass)
{
GObjectClass *gobject_class;
GstBaseTransformClass *trans_class;
GstAudioFilterClass *filter_class;
gobject_class = (GObjectClass *) klass;
trans_class = (GstBaseTransformClass *) klass;
filter_class = (GstAudioFilterClass *) klass;
gobject_class->set_property = bpwsinc_set_property;
gobject_class->get_property = bpwsinc_get_property;
@ -223,7 +227,8 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass)
trans_class->transform = GST_DEBUG_FUNCPTR (bpwsinc_transform);
trans_class->get_unit_size = GST_DEBUG_FUNCPTR (bpwsinc_get_unit_size);
GST_AUDIO_FILTER_CLASS (klass)->setup = GST_DEBUG_FUNCPTR (bpwsinc_setup);
trans_class->start = GST_DEBUG_FUNCPTR (bpwsinc_start);
filter_class->setup = GST_DEBUG_FUNCPTR (bpwsinc_setup);
}
static void
@ -508,6 +513,20 @@ bpwsinc_transform (GstBaseTransform * base, GstBuffer * inbuf,
return GST_FLOW_OK;
}
static gboolean
bpwsinc_start (GstBaseTransform * base)
{
GstBPWSinc *self = GST_BPWSINC (base);
gint channels = GST_AUDIO_FILTER (self)->format.channels;
/* Reset the residue if already existing */
if (channels && self->residue)
memset (self->residue, 0, channels *
self->kernel_length * sizeof (gdouble));
return TRUE;
}
static void
bpwsinc_set_property (GObject * object, guint prop_id, const GValue * value,
GParamSpec * pspec)

View file

@ -146,6 +146,7 @@ static GstFlowReturn lpwsinc_transform (GstBaseTransform * base,
GstBuffer * inbuf, GstBuffer * outbuf);
static gboolean lpwsinc_get_unit_size (GstBaseTransform * base, GstCaps * caps,
guint * size);
static gboolean lpwsinc_start (GstBaseTransform * base);
static gboolean lpwsinc_setup (GstAudioFilter * base,
GstRingBufferSpec * format);
@ -188,9 +189,11 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass)
{
GObjectClass *gobject_class;
GstBaseTransformClass *trans_class;
GstAudioFilterClass *filter_class;
gobject_class = (GObjectClass *) klass;
trans_class = (GstBaseTransformClass *) klass;
filter_class = (GstAudioFilterClass *) klass;
gobject_class->set_property = lpwsinc_set_property;
gobject_class->get_property = lpwsinc_get_property;
@ -218,7 +221,8 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass)
trans_class->transform = GST_DEBUG_FUNCPTR (lpwsinc_transform);
trans_class->get_unit_size = GST_DEBUG_FUNCPTR (lpwsinc_get_unit_size);
GST_AUDIO_FILTER_CLASS (klass)->setup = GST_DEBUG_FUNCPTR (lpwsinc_setup);
trans_class->start = GST_DEBUG_FUNCPTR (lpwsinc_start);
filter_class->setup = GST_DEBUG_FUNCPTR (lpwsinc_setup);
}
static void
@ -444,6 +448,20 @@ lpwsinc_transform (GstBaseTransform * base, GstBuffer * inbuf,
return GST_FLOW_OK;
}
static gboolean
lpwsinc_start (GstBaseTransform * base)
{
GstLPWSinc *self = GST_LPWSINC (base);
gint channels = GST_AUDIO_FILTER (self)->format.channels;
/* Reset the residue if already existing */
if (channels && self->residue)
memset (self->residue, 0, channels *
self->kernel_length * sizeof (gdouble));
return TRUE;
}
static void
lpwsinc_set_property (GObject * object, guint prop_id, const GValue * value,
GParamSpec * pspec)