diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2007-08-12 12:46:20 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2007-08-12 12:46:20 +0000 |
commit | 0cbaaf092923aead941dadb6728d64cd554d1d2b (patch) | |
tree | fb4461b6b89e4ed4c22f70bca5d21471cb19cd1f | |
parent | e76b5aa96b7e9a672ee493a2760ec9ad3b839014 (diff) | |
download | gst-plugins-bad-0cbaaf092923aead941dadb6728d64cd554d1d2b.tar.gz gst-plugins-bad-0cbaaf092923aead941dadb6728d64cd554d1d2b.tar.bz2 gst-plugins-bad-0cbaaf092923aead941dadb6728d64cd554d1d2b.zip |
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.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | gst/filter/gstbpwsinc.c | 21 | ||||
-rw-r--r-- | gst/filter/gstlpwsinc.c | 20 |
3 files changed, 48 insertions, 2 deletions
@@ -1,3 +1,12 @@ +2007-08-12 Sebastian Dröge <slomo@circular-chaos.org> + + * 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. + 2007-08-11 Sebastian Dröge <slomo@circular-chaos.org> * gst/filter/gstbpwsinc.c: (process_32), (process_64): diff --git a/gst/filter/gstbpwsinc.c b/gst/filter/gstbpwsinc.c index 9d550ba3..f2bfda74 100644 --- a/gst/filter/gstbpwsinc.c +++ b/gst/filter/gstbpwsinc.c @@ -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) diff --git a/gst/filter/gstlpwsinc.c b/gst/filter/gstlpwsinc.c index 54ebc2a3..55daaf7b 100644 --- a/gst/filter/gstlpwsinc.c +++ b/gst/filter/gstlpwsinc.c @@ -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) |