summaryrefslogtreecommitdiff
path: root/gst/speed
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2002-05-27 04:17:57 +0000
committerAndy Wingo <wingo@pobox.com>2002-05-27 04:17:57 +0000
commitdcd6da202ec36dc108030d97875a84bc7b30fbe4 (patch)
tree4d22cabd68494be27b7844bc9eb0f4fc3fe760b4 /gst/speed
parentd18d4fd5a1986d59af029a482e094a3707828438 (diff)
update to deal with events and set timestamps properly
Original commit message from CVS: update to deal with events and set timestamps properly
Diffstat (limited to 'gst/speed')
-rw-r--r--gst/speed/filter.func17
-rw-r--r--gst/speed/gstspeed.c8
2 files changed, 13 insertions, 12 deletions
diff --git a/gst/speed/filter.func b/gst/speed/filter.func
index cf23725b1..867a825de 100644
--- a/gst/speed/filter.func
+++ b/gst/speed/filter.func
@@ -1,5 +1,6 @@
/* -*- Mode: c; c-basic-offset: 2 -*- */
_FORMAT *in_data, *out_data;
+ static gint64 offset = 0, timestamp = 0;
/* get a buffer here so that we can have something to interpolate
* against for the first few samples if speed < 0.5 */
@@ -22,6 +23,9 @@
out_data = (_FORMAT*) GST_BUFFER_DATA(out);
}
nout = GST_BUFFER_SIZE(out) / sizeof(_FORMAT);
+ GST_BUFFER_TIMESTAMP (out) = timestamp;
+ offset += nout;
+ timestamp = offset * GST_SECOND / filter->rate;
for (j=0; j<nout; j++) {
/* index of upper bounds of interpolation for
@@ -36,16 +40,9 @@
gst_buffer_unref(in);
in = gst_pad_pull (filter->sinkpad);
- while (GST_IS_EVENT(in)) {
- switch (GST_EVENT_TYPE(in)) {
- case GST_EVENT_EOS:
- gst_element_set_eos((GstElement*)filter);
- gst_pad_push(filter->srcpad, in);
- return;
- default:
- gst_pad_push(filter->srcpad, in);
- in = gst_pad_pull (filter->sinkpad);
- }
+ while (GST_IS_EVENT (in)) {
+ gst_pad_event_default (filter->srcpad, GST_EVENT (in));
+ in = gst_pad_pull (filter->sinkpad);
}
in_data = (_FORMAT*) GST_BUFFER_DATA(in);
diff --git a/gst/speed/gstspeed.c b/gst/speed/gstspeed.c
index 5dea33741..38b83a576 100644
--- a/gst/speed/gstspeed.c
+++ b/gst/speed/gstspeed.c
@@ -256,6 +256,11 @@ speed_loop (GstElement *element)
in = gst_pad_pull(filter->sinkpad);
+ while (GST_IS_EVENT (in)) {
+ gst_pad_event_default (filter->srcpad, GST_EVENT (in));
+ in = gst_pad_pull (filter->sinkpad);
+ }
+
/* this is a bit nasty, but hey, it's what you've got to do to keep the same
* algorithm and multiple data types in c. */
if (filter->format==GST_SPEED_FORMAT_FLOAT) {
@@ -272,8 +277,7 @@ speed_loop (GstElement *element)
#undef _FORMAT
} else {
gst_element_error (element, "capsnego was never performed, bailing...");
- gst_element_yield (element); /* this is necessary for some reason with loop
- elements */
+ gst_element_yield (element);
}
}