From 909da9fb0489c3744547e6386531461c072da5fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 10 Feb 2005 15:06:13 +0000 Subject: and make it handle more than one channel. Original commit message from CVS: Fix speed element and make it chain-based (fixes #156467), and make it handle more than one channel. --- gst/speed/filter.func | 60 --------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 gst/speed/filter.func (limited to 'gst/speed/filter.func') diff --git a/gst/speed/filter.func b/gst/speed/filter.func deleted file mode 100644 index 6802b20c..00000000 --- a/gst/speed/filter.func +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- 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 */ - in_data = (_FORMAT*) GST_BUFFER_DATA(in); - nin = GST_BUFFER_SIZE(in)/sizeof(_FORMAT); - lower = in_data[0]; - i_float = 0.5 * (speed - 1.0); - i = i_float + 1.0; /* ciel(i_float) for ints */ - - do { - speed = filter->speed; /* update this, it might have changed */ - - out = gst_buffer_new(); - GST_BUFFER_DATA(out) = (gchar*) g_new(_FORMAT,SPEED_BUFSIZE/sizeof(_FORMAT)); - GST_BUFFER_SIZE(out) = SPEED_BUFSIZE; - 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= nin) { - i = i % nin; - i_float = i_float - nin; - lower = in_data[nin-1]; - gst_buffer_unref(in); - in = GST_BUFFER (gst_pad_pull (filter->sinkpad)); - - while (GST_IS_EVENT (in)) { - gst_pad_event_default (filter->srcpad, GST_EVENT (in)); - in = GST_BUFFER (gst_pad_pull (filter->sinkpad)); - } - - in_data = (_FORMAT*) GST_BUFFER_DATA(in); - nin = GST_BUFFER_SIZE(in) / sizeof(_FORMAT); - } - - if (i>0) - lower = in_data[i-1]; - - interp = i_float - floor(i_float); - - out_data[j] = lower*(1-interp) + in_data[i]*interp; - - lower = in_data[i]; - } - - gst_pad_push(filter->srcpad, GST_DATA (out)); - - gst_element_yield (element); - } while (TRUE); -- cgit v1.2.1