diff options
author | Stefan Kost <ensonic@users.sourceforge.net> | 2006-09-12 20:18:55 +0000 |
---|---|---|
committer | Stefan Kost <ensonic@users.sourceforge.net> | 2006-09-12 20:18:55 +0000 |
commit | 5b377ab1431b9dc1b63a10595d0864502dcbc473 (patch) | |
tree | 2de3774710fd0fa50c68f7b8d3e5ca92bef7377c /gst | |
parent | 22ebcc3091b84f0082581ee30a944da993fc5bc7 (diff) | |
download | gst-plugins-bad-5b377ab1431b9dc1b63a10595d0864502dcbc473.tar.gz gst-plugins-bad-5b377ab1431b9dc1b63a10595d0864502dcbc473.tar.bz2 gst-plugins-bad-5b377ab1431b9dc1b63a10595d0864502dcbc473.zip |
gst/spectrum/gstspectrum.c: Implements stop() to clear the adapter and event() to clear the adapter on FLUSH_STOP and...
Original commit message from CVS:
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_start), (gst_spectrum_stop), (gst_spectrum_event):
Implements stop() to clear the adapter and event() to clear the
adapter on FLUSH_STOP and EOS.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/spectrum/gstspectrum.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/gst/spectrum/gstspectrum.c b/gst/spectrum/gstspectrum.c index ae3645bb..cfb31e5e 100644 --- a/gst/spectrum/gstspectrum.c +++ b/gst/spectrum/gstspectrum.c @@ -129,6 +129,8 @@ static GstStateChangeReturn gst_spectrum_change_state (GstElement * element, static gboolean gst_spectrum_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out); static gboolean gst_spectrum_start (GstBaseTransform * trans); +static gboolean gst_spectrum_stop (GstBaseTransform * trans); +static gboolean gst_spectrum_event (GstBaseTransform * trans, GstEvent * event); static GstFlowReturn gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * in); @@ -161,9 +163,10 @@ gst_spectrum_class_init (GstSpectrumClass * klass) gobject_class->get_property = gst_spectrum_get_property; gobject_class->dispose = gst_spectrum_dispose; - /*element->change_state = gst_spectrum_change_state; */ trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_spectrum_set_caps); trans_class->start = GST_DEBUG_FUNCPTR (gst_spectrum_start); + trans_class->stop = GST_DEBUG_FUNCPTR (gst_spectrum_stop); + trans_class->event = GST_DEBUG_FUNCPTR (gst_spectrum_event); trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_spectrum_transform_ip); trans_class->passthrough_on_same_caps = TRUE; @@ -349,12 +352,38 @@ gst_spectrum_start (GstBaseTransform * trans) { GstSpectrum *filter = GST_SPECTRUM (trans); - gst_adapter_clear (filter->adapter); filter->num_frames = 0; return TRUE; } +static gboolean +gst_spectrum_stop (GstBaseTransform * trans) +{ + GstSpectrum *filter = GST_SPECTRUM (trans); + + gst_adapter_clear (filter->adapter); + + return TRUE; +} + +static gboolean +gst_spectrum_event (GstBaseTransform * trans, GstEvent * event) +{ + GstSpectrum *filter = GST_SPECTRUM (trans); + + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_FLUSH_STOP: + case GST_EVENT_EOS: + gst_adapter_clear (filter->adapter); + break; + default: + break; + } + + return TRUE; +} + static GstMessage * gst_spectrum_message_new (GstSpectrum * spectrum, GstClockTime endtime) { |