summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sourceforge.net>2007-03-07 11:23:20 +0000
committerStefan Kost <ensonic@users.sourceforge.net>2007-03-07 11:23:20 +0000
commitac4fc0ed0a3415a9ca289719c28a1e38634603d3 (patch)
treea2cba7482419060811e4e779b6055c59975d8fc2 /gst
parent91ffb37c7ab94679c3e337522c8de6d045162cf5 (diff)
downloadgst-plugins-bad-ac4fc0ed0a3415a9ca289719c28a1e38634603d3.tar.gz
gst-plugins-bad-ac4fc0ed0a3415a9ca289719c28a1e38634603d3.tar.bz2
gst-plugins-bad-ac4fc0ed0a3415a9ca289719c28a1e38634603d3.zip
gst/spectrum/gstspectrum.*: One FIXME less, by resolving message timestamps against the playback segment.
Original commit message from CVS: * gst/spectrum/gstspectrum.c: (gst_spectrum_start), (gst_spectrum_event), (gst_spectrum_transform_ip): * gst/spectrum/gstspectrum.h: One FIXME less, by resolving message timestamps against the playback segment.
Diffstat (limited to 'gst')
-rw-r--r--gst/spectrum/gstspectrum.c23
-rw-r--r--gst/spectrum/gstspectrum.h1
2 files changed, 21 insertions, 3 deletions
diff --git a/gst/spectrum/gstspectrum.c b/gst/spectrum/gstspectrum.c
index 36e8b6a3..3747b249 100644
--- a/gst/spectrum/gstspectrum.c
+++ b/gst/spectrum/gstspectrum.c
@@ -297,6 +297,7 @@ gst_spectrum_start (GstBaseTransform * trans)
GstSpectrum *filter = GST_SPECTRUM (trans);
filter->num_frames = 0;
+ gst_segment_init (&filter->segment, GST_FORMAT_UNDEFINED);
return TRUE;
}
@@ -321,6 +322,22 @@ gst_spectrum_event (GstBaseTransform * trans, GstEvent * event)
case GST_EVENT_EOS:
gst_adapter_clear (filter->adapter);
break;
+ case GST_EVENT_NEWSEGMENT:{
+ GstFormat format;
+ gdouble rate, arate;
+ gint64 start, stop, time;
+ gboolean update;
+
+ /* the newsegment values are used to clip the input samples
+ * and to convert the incomming timestamps to running time */
+ gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
+ &start, &stop, &time);
+
+ /* now configure the values */
+ gst_segment_set_newsegment_full (&filter->segment, update,
+ rate, arate, format, start, stop, time);
+ break;
+ }
default:
break;
}
@@ -369,9 +386,9 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * in)
gfloat pos, step;
guchar *spect = spectrum->spect;
- /* FIXME, the buffer timestamp does not mean anything, maybe you mean
- * stream_time or running_time? */
- GstClockTime endtime = GST_BUFFER_TIMESTAMP (in);
+ GstClockTime endtime =
+ gst_segment_to_running_time (&spectrum->segment, GST_FORMAT_TIME,
+ GST_BUFFER_TIMESTAMP (in));
GstClockTime blktime =
GST_FRAMES_TO_CLOCK_TIME (spectrum->len, spectrum->rate);
diff --git a/gst/spectrum/gstspectrum.h b/gst/spectrum/gstspectrum.h
index 3bfdd489..70ab25c9 100644
--- a/gst/spectrum/gstspectrum.h
+++ b/gst/spectrum/gstspectrum.h
@@ -45,6 +45,7 @@ struct _GstSpectrum {
GstPad *sinkpad,*srcpad;
GstAdapter *adapter;
+ GstSegment segment;
/* properties */
gboolean message; /* whether or not to post messages */