diff options
-rw-r--r-- | gst/speed/filter.func | 17 | ||||
-rw-r--r-- | gst/speed/gstspeed.c | 8 |
2 files changed, 13 insertions, 12 deletions
diff --git a/gst/speed/filter.func b/gst/speed/filter.func index cf23725b..867a825d 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 5dea3374..38b83a57 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); } } |