2002-06-27 14:15:51 +00:00
|
|
|
/* -*- c-basic-offset: 2 -*-
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
*
|
2002-06-27 14:15:51 +00:00
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 1999-2001 Erik Walthinsen <omega@cse.ogi.edu>
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
* 2006 Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
* 2007 Sebastian Dröge <slomo@circular-chaos.org>
|
2002-06-27 14:15:51 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* this windowed sinc filter is taken from the freely downloadable DSP book,
|
2002-06-27 14:15:51 +00:00
|
|
|
* "The Scientist and Engineer's Guide to Digital Signal Processing",
|
|
|
|
* chapter 16
|
|
|
|
* available at http://www.dspguide.com/
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
*
|
2007-08-09 19:23:33 +00:00
|
|
|
* TODO: - Implement the convolution in place, probably only makes sense
|
|
|
|
* when using FFT convolution as currently the convolution itself
|
2007-08-10 05:35:25 +00:00
|
|
|
* is probably the bottleneck
|
2007-08-10 04:06:53 +00:00
|
|
|
* - Maybe allow cascading the filter to get a better stopband attenuation.
|
2007-08-13 13:50:39 +00:00
|
|
|
* Can be done by convolving a filter kernel with itself
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:element-lpwsinc
|
|
|
|
* @short_description: Windows Sinc low pass and high pass filter
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <para>
|
|
|
|
* Attenuates all frequencies above the cutoff frequency (low-pass) or all frequencies below the
|
|
|
|
* cutoff frequency (high-pass). The length parameter controls the rolloff, the window parameter
|
|
|
|
* controls rolloff and stopband attenuation. The Hamming window provides a faster rolloff but a bit
|
|
|
|
* worse stopband attenuation, the other way around for the Blackman window.
|
|
|
|
* </para>
|
2007-08-19 19:16:33 +00:00
|
|
|
* <para>
|
|
|
|
* This element has the advantage over the Chebyshev lowpass and highpass filter that it has
|
|
|
|
* a much better rolloff when using a larger kernel size and almost linear phase. The only
|
|
|
|
* disadvantage is the much slower execution time with larger kernels.
|
|
|
|
* </para>
|
2007-08-13 13:50:39 +00:00
|
|
|
* <title>Example launch line</title>
|
|
|
|
* <para>
|
|
|
|
* <programlisting>
|
|
|
|
* gst-launch audiotestsrc freq=1500 ! audioconvert ! lpwsinc mode=low-pass frequency=1000 length=501 ! audioconvert ! alsasink
|
|
|
|
* gst-launch filesrc location="melo1.ogg" ! oggdemux ! vorbisdec ! audioconvert ! lpwsinc mode=high-pass frequency=15000 length=501 ! audioconvert ! alsasink
|
|
|
|
* gst-launch audiotestsrc wave=white-noise ! audioconvert ! lpwsinc mode=low-pass frequency=1000 length=10001 window=blackman ! audioconvert ! alsasink
|
|
|
|
* </programlisting>
|
|
|
|
* </para>
|
|
|
|
* </refsect2>
|
2002-06-27 14:15:51 +00:00
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
2002-06-27 14:15:51 +00:00
|
|
|
#include <gst/gst.h>
|
2007-08-08 20:47:33 +00:00
|
|
|
#include <gst/audio/gstaudiofilter.h>
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
#include <gst/controller/gstcontroller.h>
|
|
|
|
|
|
|
|
#include "gstlpwsinc.h"
|
|
|
|
|
|
|
|
#define GST_CAT_DEFAULT gst_lpwsinc_debug
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
2002-06-27 14:15:51 +00:00
|
|
|
|
2007-08-10 04:21:39 +00:00
|
|
|
static const GstElementDetails lpwsinc_details = GST_ELEMENT_DETAILS ("LPWSinc",
|
2004-03-14 22:34:33 +00:00
|
|
|
"Filter/Effect/Audio",
|
2007-08-10 04:21:39 +00:00
|
|
|
"Low-pass and High-pass Windowed sinc filter",
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
"Thomas <thomas@apestaart.org>, "
|
|
|
|
"Steven W. Smith, "
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
"Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>, "
|
|
|
|
"Sebastian Dröge <slomo@circular-chaos.org>");
|
2004-03-14 22:34:33 +00:00
|
|
|
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
/* Filter signals and args */
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2002-06-27 14:15:51 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_LENGTH,
|
2007-08-10 04:21:39 +00:00
|
|
|
PROP_FREQUENCY,
|
2007-08-10 04:32:47 +00:00
|
|
|
PROP_MODE,
|
|
|
|
PROP_WINDOW
|
2002-06-27 14:15:51 +00:00
|
|
|
};
|
|
|
|
|
2007-08-10 04:21:39 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MODE_LOW_PASS = 0,
|
|
|
|
MODE_HIGH_PASS
|
|
|
|
};
|
|
|
|
|
|
|
|
#define GST_TYPE_LPWSINC_MODE (gst_lpwsinc_mode_get_type ())
|
|
|
|
static GType
|
|
|
|
gst_lpwsinc_mode_get_type (void)
|
|
|
|
{
|
|
|
|
static GType gtype = 0;
|
|
|
|
|
|
|
|
if (gtype == 0) {
|
|
|
|
static const GEnumValue values[] = {
|
|
|
|
{MODE_LOW_PASS, "Low pass (default)",
|
|
|
|
"low-pass"},
|
|
|
|
{MODE_HIGH_PASS, "High pass",
|
|
|
|
"high-pass"},
|
|
|
|
{0, NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
gtype = g_enum_register_static ("GstLPWSincMode", values);
|
|
|
|
}
|
|
|
|
return gtype;
|
|
|
|
}
|
|
|
|
|
2007-08-10 04:32:47 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
WINDOW_HAMMING = 0,
|
|
|
|
WINDOW_BLACKMAN
|
|
|
|
};
|
|
|
|
|
|
|
|
#define GST_TYPE_LPWSINC_WINDOW (gst_lpwsinc_window_get_type ())
|
|
|
|
static GType
|
|
|
|
gst_lpwsinc_window_get_type (void)
|
|
|
|
{
|
|
|
|
static GType gtype = 0;
|
|
|
|
|
|
|
|
if (gtype == 0) {
|
|
|
|
static const GEnumValue values[] = {
|
|
|
|
{WINDOW_HAMMING, "Hamming window (default)",
|
|
|
|
"hamming"},
|
|
|
|
{WINDOW_BLACKMAN, "Blackman window",
|
|
|
|
"blackman"},
|
|
|
|
{0, NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
gtype = g_enum_register_static ("GstLPWSincWindow", values);
|
|
|
|
}
|
|
|
|
return gtype;
|
|
|
|
}
|
|
|
|
|
2007-08-08 20:47:33 +00:00
|
|
|
#define ALLOWED_CAPS \
|
2007-08-10 05:20:06 +00:00
|
|
|
"audio/x-raw-float, " \
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
" width = (int) { 32, 64 }, " \
|
2007-08-10 05:20:06 +00:00
|
|
|
" endianness = (int) BYTE_ORDER, " \
|
|
|
|
" rate = (int) [ 1, MAX ], " \
|
2007-08-08 20:47:33 +00:00
|
|
|
" channels = (int) [ 1, MAX ]"
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
|
|
|
|
#define DEBUG_INIT(bla) \
|
2007-08-10 04:21:39 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_lpwsinc_debug, "lpwsinc", 0, "Low-pass and High-pass Windowed sinc filter plugin");
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
|
2007-08-08 20:47:33 +00:00
|
|
|
GST_BOILERPLATE_FULL (GstLPWSinc, gst_lpwsinc, GstAudioFilter,
|
|
|
|
GST_TYPE_AUDIO_FILTER, DEBUG_INIT);
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
|
|
|
|
static void lpwsinc_set_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:33 +00:00
|
|
|
const GValue * value, GParamSpec * pspec);
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
static void lpwsinc_get_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:33 +00:00
|
|
|
GValue * value, GParamSpec * pspec);
|
2002-06-27 14:15:51 +00:00
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
static GstFlowReturn lpwsinc_transform (GstBaseTransform * base,
|
|
|
|
GstBuffer * inbuf, GstBuffer * outbuf);
|
|
|
|
static gboolean lpwsinc_get_unit_size (GstBaseTransform * base, GstCaps * caps,
|
|
|
|
guint * size);
|
2007-08-12 12:46:20 +00:00
|
|
|
static gboolean lpwsinc_start (GstBaseTransform * base);
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
static gboolean lpwsinc_event (GstBaseTransform * base, GstEvent * event);
|
2007-08-08 20:47:33 +00:00
|
|
|
static gboolean lpwsinc_setup (GstAudioFilter * base,
|
|
|
|
GstRingBufferSpec * format);
|
2002-06-27 14:15:51 +00:00
|
|
|
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
static gboolean lpwsinc_query (GstPad * pad, GstQuery * query);
|
|
|
|
static const GstQueryType *lpwsinc_query_type (GstPad * pad);
|
|
|
|
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
/* Element class */
|
2004-03-14 22:34:33 +00:00
|
|
|
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
static void
|
|
|
|
gst_lpwsinc_dispose (GObject * object)
|
2002-06-27 14:15:51 +00:00
|
|
|
{
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
GstLPWSinc *self = GST_LPWSINC (object);
|
2007-08-08 20:47:33 +00:00
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
if (self->residue) {
|
|
|
|
g_free (self->residue);
|
|
|
|
self->residue = NULL;
|
2007-08-08 20:47:33 +00:00
|
|
|
}
|
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
if (self->kernel) {
|
|
|
|
g_free (self->kernel);
|
|
|
|
self->kernel = NULL;
|
2007-08-08 20:47:33 +00:00
|
|
|
}
|
|
|
|
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
2002-06-27 14:15:51 +00:00
|
|
|
}
|
|
|
|
|
2003-11-02 14:09:39 +00:00
|
|
|
static void
|
|
|
|
gst_lpwsinc_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
2007-08-08 20:47:33 +00:00
|
|
|
GstCaps *caps;
|
2003-11-02 14:09:39 +00:00
|
|
|
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
gst_element_class_set_details (element_class, &lpwsinc_details);
|
2007-08-08 20:47:33 +00:00
|
|
|
|
|
|
|
caps = gst_caps_from_string (ALLOWED_CAPS);
|
|
|
|
gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (g_class),
|
|
|
|
caps);
|
|
|
|
gst_caps_unref (caps);
|
2003-11-02 14:09:39 +00:00
|
|
|
}
|
|
|
|
|
2002-06-27 14:15:51 +00:00
|
|
|
static void
|
|
|
|
gst_lpwsinc_class_init (GstLPWSincClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
GstBaseTransformClass *trans_class;
|
2007-08-12 12:46:20 +00:00
|
|
|
GstAudioFilterClass *filter_class;
|
2002-06-27 14:15:51 +00:00
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
trans_class = (GstBaseTransformClass *) klass;
|
2007-08-12 12:46:20 +00:00
|
|
|
filter_class = (GstAudioFilterClass *) klass;
|
2002-06-27 14:15:51 +00:00
|
|
|
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
gobject_class->set_property = lpwsinc_set_property;
|
|
|
|
gobject_class->get_property = lpwsinc_get_property;
|
|
|
|
gobject_class->dispose = gst_lpwsinc_dispose;
|
2002-06-27 14:15:51 +00:00
|
|
|
|
2007-08-17 15:05:17 +00:00
|
|
|
|
|
|
|
/* FIXME: Don't use the complete possible range but restrict the upper boundary
|
|
|
|
* so automatically generated UIs can use a slider */
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_FREQUENCY,
|
2007-08-17 15:05:17 +00:00
|
|
|
g_param_spec_float ("cutoff", "Cutoff",
|
|
|
|
"Cut-off Frequency (Hz)", 0.0, 100000.0, 0.0,
|
2007-08-10 04:21:39 +00:00
|
|
|
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_LENGTH,
|
2004-03-14 22:34:33 +00:00
|
|
|
g_param_spec_int ("length", "Length",
|
2007-08-10 04:44:43 +00:00
|
|
|
"Filter kernel length, will be rounded to the next odd number",
|
2007-08-17 15:05:17 +00:00
|
|
|
3, 50000, 101, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
|
2007-08-10 04:21:39 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_MODE,
|
|
|
|
g_param_spec_enum ("mode", "Mode",
|
|
|
|
"Low pass or high pass mode", GST_TYPE_LPWSINC_MODE,
|
|
|
|
MODE_LOW_PASS, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
|
2002-06-27 14:15:51 +00:00
|
|
|
|
2007-08-10 04:32:47 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_WINDOW,
|
|
|
|
g_param_spec_enum ("window", "Window",
|
|
|
|
"Window function to use", GST_TYPE_LPWSINC_WINDOW,
|
|
|
|
WINDOW_HAMMING, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
|
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
trans_class->transform = GST_DEBUG_FUNCPTR (lpwsinc_transform);
|
|
|
|
trans_class->get_unit_size = GST_DEBUG_FUNCPTR (lpwsinc_get_unit_size);
|
2007-08-12 12:46:20 +00:00
|
|
|
trans_class->start = GST_DEBUG_FUNCPTR (lpwsinc_start);
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
trans_class->event = GST_DEBUG_FUNCPTR (lpwsinc_event);
|
2007-08-12 12:46:20 +00:00
|
|
|
filter_class->setup = GST_DEBUG_FUNCPTR (lpwsinc_setup);
|
2002-06-27 14:15:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
gst_lpwsinc_init (GstLPWSinc * self, GstLPWSincClass * g_class)
|
2002-06-27 14:15:51 +00:00
|
|
|
{
|
2007-08-10 04:32:47 +00:00
|
|
|
self->mode = MODE_LOW_PASS;
|
|
|
|
self->window = WINDOW_HAMMING;
|
2007-08-10 04:44:43 +00:00
|
|
|
self->kernel_length = 101;
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
self->latency = 50;
|
2007-08-17 15:05:17 +00:00
|
|
|
self->cutoff = 0.0;
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
self->kernel = NULL;
|
|
|
|
self->residue = NULL;
|
|
|
|
|
|
|
|
self->have_kernel = FALSE;
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
self->residue_length = 0;
|
|
|
|
self->next_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
self->next_off = GST_BUFFER_OFFSET_NONE;
|
|
|
|
|
|
|
|
gst_pad_set_query_function (GST_BASE_TRANSFORM (self)->srcpad, lpwsinc_query);
|
|
|
|
gst_pad_set_query_type_function (GST_BASE_TRANSFORM (self)->srcpad,
|
|
|
|
lpwsinc_query_type);
|
2002-06-27 14:15:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-17 15:05:17 +00:00
|
|
|
#define DEFINE_PROCESS_FUNC(width,ctype) \
|
|
|
|
static void \
|
|
|
|
process_##width (GstLPWSinc * self, g##ctype * src, g##ctype * dst, guint input_samples) \
|
|
|
|
{ \
|
|
|
|
gint kernel_length = self->kernel_length; \
|
|
|
|
gint i, j, k, l; \
|
|
|
|
gint channels = GST_AUDIO_FILTER (self)->format.channels; \
|
|
|
|
gint res_start; \
|
|
|
|
\
|
|
|
|
/* convolution */ \
|
|
|
|
for (i = 0; i < input_samples; i++) { \
|
|
|
|
dst[i] = 0.0; \
|
|
|
|
k = i % channels; \
|
|
|
|
l = i / channels; \
|
|
|
|
for (j = 0; j < kernel_length; j++) \
|
|
|
|
if (l < j) \
|
|
|
|
dst[i] += \
|
|
|
|
self->residue[(kernel_length + l - j) * channels + \
|
|
|
|
k] * self->kernel[j]; \
|
|
|
|
else \
|
|
|
|
dst[i] += src[(l - j) * channels + k] * self->kernel[j]; \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
/* copy the tail of the current input buffer to the residue, while \
|
|
|
|
* keeping parts of the residue if the input buffer is smaller than \
|
|
|
|
* the kernel length */ \
|
|
|
|
if (input_samples < kernel_length * channels) \
|
|
|
|
res_start = kernel_length * channels - input_samples; \
|
|
|
|
else \
|
|
|
|
res_start = 0; \
|
|
|
|
\
|
|
|
|
for (i = 0; i < res_start; i++) \
|
|
|
|
self->residue[i] = self->residue[i + input_samples]; \
|
|
|
|
for (i = res_start; i < kernel_length * channels; i++) \
|
|
|
|
self->residue[i] = src[input_samples - kernel_length * channels + i]; \
|
|
|
|
\
|
|
|
|
self->residue_length += kernel_length * channels - res_start; \
|
|
|
|
if (self->residue_length > kernel_length * channels) \
|
|
|
|
self->residue_length = kernel_length * channels; \
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
}
|
|
|
|
|
2007-08-17 15:05:17 +00:00
|
|
|
DEFINE_PROCESS_FUNC (32, float);
|
|
|
|
DEFINE_PROCESS_FUNC (64, double);
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
|
2007-08-17 15:05:17 +00:00
|
|
|
#undef DEFINE_PROCESS_FUNC
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
lpwsinc_build_kernel (GstLPWSinc * self)
|
2002-06-27 14:15:51 +00:00
|
|
|
{
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
gint i = 0;
|
|
|
|
gdouble sum = 0.0;
|
|
|
|
gint len = 0;
|
|
|
|
gdouble w;
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
|
2007-08-10 04:44:43 +00:00
|
|
|
len = self->kernel_length;
|
2007-08-08 20:47:33 +00:00
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
if (GST_AUDIO_FILTER (self)->format.rate == 0) {
|
|
|
|
GST_DEBUG ("rate not set yet");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-08-10 04:06:53 +00:00
|
|
|
if (GST_AUDIO_FILTER (self)->format.channels == 0) {
|
|
|
|
GST_DEBUG ("channels not set yet");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
/* Clamp cutoff frequency between 0 and the nyquist frequency */
|
2007-08-17 15:05:17 +00:00
|
|
|
self->cutoff =
|
|
|
|
CLAMP (self->cutoff, 0.0, GST_AUDIO_FILTER (self)->format.rate / 2);
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
|
2007-08-12 15:41:57 +00:00
|
|
|
GST_DEBUG ("lpwsinc: initializing filter kernel of length %d "
|
|
|
|
"with cutoff %.2lf Hz "
|
|
|
|
"for mode %s",
|
2007-08-17 15:05:17 +00:00
|
|
|
len, self->cutoff,
|
2007-08-12 15:41:57 +00:00
|
|
|
(self->mode == MODE_LOW_PASS) ? "low-pass" : "high-pass");
|
|
|
|
|
|
|
|
/* fill the kernel */
|
2007-08-17 15:05:17 +00:00
|
|
|
w = 2 * M_PI * (self->cutoff / GST_AUDIO_FILTER (self)->format.rate);
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
|
|
|
|
if (self->kernel)
|
|
|
|
g_free (self->kernel);
|
2007-08-10 04:44:43 +00:00
|
|
|
self->kernel = g_new (gdouble, len);
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
|
2007-08-10 04:44:43 +00:00
|
|
|
for (i = 0; i < len; ++i) {
|
|
|
|
if (i == len / 2)
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
self->kernel[i] = w;
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
else
|
2007-08-10 04:44:43 +00:00
|
|
|
self->kernel[i] = sin (w * (i - len / 2)) / (i - len / 2);
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
/* windowing */
|
2007-08-10 04:32:47 +00:00
|
|
|
if (self->window == WINDOW_HAMMING)
|
2007-08-10 04:44:43 +00:00
|
|
|
self->kernel[i] *= (0.54 - 0.46 * cos (2 * M_PI * i / len));
|
2007-08-10 04:32:47 +00:00
|
|
|
else
|
|
|
|
self->kernel[i] *=
|
2007-08-10 04:44:43 +00:00
|
|
|
(0.42 - 0.5 * cos (2 * M_PI * i / len) +
|
|
|
|
0.08 * cos (4 * M_PI * i / len));
|
2002-06-27 14:15:51 +00:00
|
|
|
}
|
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
/* normalize for unity gain at DC */
|
2007-08-10 04:44:43 +00:00
|
|
|
for (i = 0; i < len; ++i)
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
sum += self->kernel[i];
|
2007-08-10 04:44:43 +00:00
|
|
|
for (i = 0; i < len; ++i)
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
self->kernel[i] /= sum;
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
|
2007-08-10 04:21:39 +00:00
|
|
|
/* convert to highpass if specified */
|
|
|
|
if (self->mode == MODE_HIGH_PASS) {
|
2007-08-10 04:44:43 +00:00
|
|
|
for (i = 0; i < len; ++i)
|
2007-08-10 04:21:39 +00:00
|
|
|
self->kernel[i] = -self->kernel[i];
|
2007-08-10 04:44:43 +00:00
|
|
|
self->kernel[len / 2] += 1.0;
|
2007-08-10 04:21:39 +00:00
|
|
|
}
|
|
|
|
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
/* set up the residue memory space */
|
gst/filter/gstbpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (process_32), (process_64),
(bpwsinc_build_kernel), (bpwsinc_push_residue),
(bpwsinc_transform), (bpwsinc_start), (bpwsinc_query),
(bpwsinc_query_type), (bpwsinc_event), (bpwsinc_set_property):
* gst/filter/gstbpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/bpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
* gst/filter/gstlpwsinc.c: (lpwsinc_build_kernel):
Reset residue length only when actually creating a residue.
2007-08-16 19:22:48 +00:00
|
|
|
if (!self->residue) {
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
self->residue =
|
|
|
|
g_new0 (gdouble, len * GST_AUDIO_FILTER (self)->format.channels);
|
gst/filter/gstbpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (process_32), (process_64),
(bpwsinc_build_kernel), (bpwsinc_push_residue),
(bpwsinc_transform), (bpwsinc_start), (bpwsinc_query),
(bpwsinc_query_type), (bpwsinc_event), (bpwsinc_set_property):
* gst/filter/gstbpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/bpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
* gst/filter/gstlpwsinc.c: (lpwsinc_build_kernel):
Reset residue length only when actually creating a residue.
2007-08-16 19:22:48 +00:00
|
|
|
self->residue_length = 0;
|
|
|
|
}
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
|
|
|
|
self->have_kernel = TRUE;
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
lpwsinc_push_residue (GstLPWSinc * self)
|
|
|
|
{
|
|
|
|
GstBuffer *outbuf;
|
|
|
|
GstFlowReturn res;
|
|
|
|
gint rate = GST_AUDIO_FILTER (self)->format.rate;
|
|
|
|
gint channels = GST_AUDIO_FILTER (self)->format.channels;
|
|
|
|
gint outsize, outsamples;
|
|
|
|
gint diffsize, diffsamples;
|
|
|
|
guint8 *in, *out;
|
|
|
|
|
|
|
|
/* Calculate the number of samples and their memory size that
|
|
|
|
* should be pushed from the residue */
|
|
|
|
outsamples = MIN (self->latency, self->residue_length / channels);
|
|
|
|
outsize = outsamples * channels * (GST_AUDIO_FILTER (self)->format.width / 8);
|
|
|
|
if (outsize == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Process the difference between latency and residue_length samples
|
|
|
|
* to start at the actual data instead of starting at the zeros before
|
|
|
|
* when we only got one buffer smaller than latency */
|
|
|
|
diffsamples = self->latency - self->residue_length / channels;
|
|
|
|
diffsize =
|
|
|
|
diffsamples * channels * (GST_AUDIO_FILTER (self)->format.width / 8);
|
|
|
|
if (diffsize > 0) {
|
|
|
|
in = g_new0 (guint8, diffsize);
|
|
|
|
out = g_new0 (guint8, diffsize);
|
|
|
|
self->process (self, in, out, diffsamples * channels);
|
|
|
|
g_free (in);
|
|
|
|
g_free (out);
|
|
|
|
}
|
|
|
|
|
|
|
|
res = gst_pad_alloc_buffer (GST_BASE_TRANSFORM (self)->srcpad,
|
|
|
|
GST_BUFFER_OFFSET_NONE, outsize,
|
|
|
|
GST_PAD_CAPS (GST_BASE_TRANSFORM (self)->srcpad), &outbuf);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (res != GST_FLOW_OK)) {
|
|
|
|
GST_WARNING_OBJECT (self, "failed allocating buffer of %d bytes", outsize);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convolve the residue with zeros to get the actual remaining data */
|
|
|
|
in = g_new0 (guint8, outsize);
|
|
|
|
self->process (self, in, GST_BUFFER_DATA (outbuf), outsamples * channels);
|
|
|
|
g_free (in);
|
|
|
|
|
|
|
|
/* Set timestamp, offset, etc from the values we
|
|
|
|
* saved when processing the regular buffers */
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (self->next_ts))
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = self->next_ts;
|
|
|
|
else
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = 0;
|
|
|
|
GST_BUFFER_DURATION (outbuf) =
|
|
|
|
gst_util_uint64_scale (outsamples, GST_SECOND, rate);
|
|
|
|
self->next_ts += gst_util_uint64_scale (outsamples, GST_SECOND, rate);
|
|
|
|
|
|
|
|
if (self->next_off != GST_BUFFER_OFFSET_NONE) {
|
|
|
|
GST_BUFFER_OFFSET (outbuf) = self->next_off;
|
|
|
|
GST_BUFFER_OFFSET_END (outbuf) = self->next_off + outsamples;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (self, "Pushing residue buffer of size %d with timestamp: %"
|
|
|
|
GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %lld,"
|
|
|
|
" offset_end: %lld, nsamples: %d", GST_BUFFER_SIZE (outbuf),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)), GST_BUFFER_OFFSET (outbuf),
|
|
|
|
GST_BUFFER_OFFSET_END (outbuf), outsamples);
|
|
|
|
|
|
|
|
res = gst_pad_push (GST_BASE_TRANSFORM (self)->srcpad, outbuf);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (res != GST_FLOW_OK)) {
|
|
|
|
GST_WARNING_OBJECT (self, "failed to push residue");
|
|
|
|
}
|
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* GstAudioFilter vmethod implementations */
|
|
|
|
|
|
|
|
/* get notified of caps and plug in the correct process function */
|
|
|
|
static gboolean
|
|
|
|
lpwsinc_setup (GstAudioFilter * base, GstRingBufferSpec * format)
|
|
|
|
{
|
|
|
|
GstLPWSinc *self = GST_LPWSINC (base);
|
|
|
|
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
|
|
|
|
if (format->width == 32)
|
|
|
|
self->process = (GstLPWSincProcessFunc) process_32;
|
|
|
|
else if (format->width == 64)
|
|
|
|
self->process = (GstLPWSincProcessFunc) process_64;
|
|
|
|
else
|
|
|
|
ret = FALSE;
|
|
|
|
|
|
|
|
self->have_kernel = FALSE;
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2002-06-27 14:15:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 20:47:33 +00:00
|
|
|
/* GstBaseTransform vmethod implementations */
|
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
static gboolean
|
|
|
|
lpwsinc_get_unit_size (GstBaseTransform * base, GstCaps * caps, guint * size)
|
|
|
|
{
|
|
|
|
gint width, channels;
|
|
|
|
GstStructure *structure;
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
g_assert (size);
|
|
|
|
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
ret = gst_structure_get_int (structure, "width", &width);
|
|
|
|
ret &= gst_structure_get_int (structure, "channels", &channels);
|
|
|
|
|
|
|
|
*size = width * channels / 8;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
static GstFlowReturn
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
lpwsinc_transform (GstBaseTransform * base, GstBuffer * inbuf,
|
|
|
|
GstBuffer * outbuf)
|
2002-06-27 14:15:51 +00:00
|
|
|
{
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
GstLPWSinc *self = GST_LPWSINC (base);
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
GstClockTime timestamp;
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
gint channels = GST_AUDIO_FILTER (self)->format.channels;
|
|
|
|
gint rate = GST_AUDIO_FILTER (self)->format.rate;
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
gint input_samples =
|
|
|
|
GST_BUFFER_SIZE (outbuf) / (GST_AUDIO_FILTER (self)->format.width / 8);
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
gint output_samples = input_samples;
|
|
|
|
gint diff;
|
2007-01-03 16:41:10 +00:00
|
|
|
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
/* don't process data in passthrough-mode */
|
|
|
|
if (gst_base_transform_is_passthrough (base))
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* FIXME: subdivide GST_BUFFER_SIZE into small chunks for smooth fades */
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (outbuf);
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (timestamp))
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
gst_object_sync_values (G_OBJECT (self), timestamp);
|
2002-06-27 14:15:51 +00:00
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
if (!self->have_kernel)
|
|
|
|
lpwsinc_build_kernel (self);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
/* Reset the residue if already existing on discont buffers */
|
|
|
|
if (GST_BUFFER_IS_DISCONT (inbuf)) {
|
|
|
|
if (channels && self->residue)
|
|
|
|
memset (self->residue, 0, channels *
|
|
|
|
self->kernel_length * sizeof (gdouble));
|
|
|
|
self->residue_length = 0;
|
|
|
|
self->next_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
self->next_off = GST_BUFFER_OFFSET_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Calculate the number of samples we can push out now without outputting
|
|
|
|
* kernel_length/2 zeros in the beginning */
|
|
|
|
diff = (self->kernel_length / 2) * channels - self->residue_length;
|
|
|
|
if (diff > 0)
|
|
|
|
output_samples -= diff;
|
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
self->process (self, GST_BUFFER_DATA (inbuf), GST_BUFFER_DATA (outbuf),
|
|
|
|
input_samples);
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
if (output_samples <= 0) {
|
|
|
|
/* Drop buffer and save original timestamp/offset for later use */
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (self->next_ts)
|
|
|
|
&& GST_BUFFER_TIMESTAMP_IS_VALID (outbuf))
|
|
|
|
self->next_ts = GST_BUFFER_TIMESTAMP (outbuf);
|
|
|
|
if (self->next_off == GST_BUFFER_OFFSET_NONE
|
|
|
|
&& GST_BUFFER_OFFSET_IS_VALID (outbuf))
|
|
|
|
self->next_off = GST_BUFFER_OFFSET (outbuf);
|
|
|
|
return GST_BASE_TRANSFORM_FLOW_DROPPED;
|
|
|
|
} else if (output_samples < input_samples) {
|
|
|
|
/* First (probably partial) buffer after starting from
|
|
|
|
* a clean residue. Use stored timestamp/offset here */
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (self->next_ts))
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = self->next_ts;
|
|
|
|
|
|
|
|
if (self->next_off != GST_BUFFER_OFFSET_NONE) {
|
|
|
|
GST_BUFFER_OFFSET (outbuf) = self->next_off;
|
|
|
|
if (GST_BUFFER_OFFSET_END_IS_VALID (outbuf))
|
|
|
|
GST_BUFFER_OFFSET_END (outbuf) =
|
|
|
|
self->next_off + output_samples / channels;
|
|
|
|
} else {
|
|
|
|
/* We dropped no buffer, offset is valid, offset_end must be adjusted by diff */
|
|
|
|
if (GST_BUFFER_OFFSET_END_IS_VALID (outbuf))
|
|
|
|
GST_BUFFER_OFFSET_END (outbuf) -= diff / channels;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GST_BUFFER_DURATION_IS_VALID (outbuf))
|
|
|
|
GST_BUFFER_DURATION (outbuf) -=
|
|
|
|
gst_util_uint64_scale (diff, GST_SECOND, channels * rate);
|
|
|
|
|
|
|
|
GST_BUFFER_DATA (outbuf) +=
|
|
|
|
diff * (GST_AUDIO_FILTER (self)->format.width / 8);
|
|
|
|
GST_BUFFER_SIZE (outbuf) -=
|
|
|
|
diff * (GST_AUDIO_FILTER (self)->format.width / 8);
|
|
|
|
} else {
|
|
|
|
GstClockTime ts_latency =
|
|
|
|
gst_util_uint64_scale (self->latency, GST_SECOND, rate);
|
|
|
|
|
|
|
|
/* Normal buffer, adjust timestamp/offset/etc by latency */
|
|
|
|
if (GST_BUFFER_TIMESTAMP (outbuf) < ts_latency) {
|
|
|
|
GST_WARNING_OBJECT (self, "GST_BUFFER_TIMESTAMP (outbuf) < latency");
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = 0;
|
|
|
|
} else {
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) -= ts_latency;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GST_BUFFER_OFFSET_IS_VALID (outbuf)) {
|
|
|
|
if (GST_BUFFER_OFFSET (outbuf) > self->latency) {
|
|
|
|
GST_BUFFER_OFFSET (outbuf) -= self->latency;
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (self, "GST_BUFFER_OFFSET (outbuf) < latency");
|
|
|
|
GST_BUFFER_OFFSET (outbuf) = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GST_BUFFER_OFFSET_END_IS_VALID (outbuf)) {
|
|
|
|
if (GST_BUFFER_OFFSET_END (outbuf) > self->latency) {
|
|
|
|
GST_BUFFER_OFFSET_END (outbuf) -= self->latency;
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (self, "GST_BUFFER_OFFSET_END (outbuf) < latency");
|
|
|
|
GST_BUFFER_OFFSET_END (outbuf) = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (self, "Pushing buffer of size %d with timestamp: %"
|
|
|
|
GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %lld,"
|
|
|
|
" offset_end: %lld, nsamples: %d", GST_BUFFER_SIZE (outbuf),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)), GST_BUFFER_OFFSET (outbuf),
|
|
|
|
GST_BUFFER_OFFSET_END (outbuf), output_samples / channels);
|
|
|
|
|
|
|
|
self->next_ts = GST_BUFFER_TIMESTAMP (outbuf) + GST_BUFFER_DURATION (outbuf);
|
|
|
|
self->next_off = GST_BUFFER_OFFSET_END (outbuf);
|
|
|
|
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
return GST_FLOW_OK;
|
2002-06-27 14:15:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-12 12:46:20 +00:00
|
|
|
static gboolean
|
|
|
|
lpwsinc_start (GstBaseTransform * base)
|
|
|
|
{
|
|
|
|
GstLPWSinc *self = GST_LPWSINC (base);
|
|
|
|
gint channels = GST_AUDIO_FILTER (self)->format.channels;
|
|
|
|
|
|
|
|
/* Reset the residue if already existing */
|
|
|
|
if (channels && self->residue)
|
|
|
|
memset (self->residue, 0, channels *
|
|
|
|
self->kernel_length * sizeof (gdouble));
|
|
|
|
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
self->residue_length = 0;
|
|
|
|
self->next_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
self->next_off = GST_BUFFER_OFFSET_NONE;
|
|
|
|
|
2007-08-12 12:46:20 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
static gboolean
|
|
|
|
lpwsinc_query (GstPad * pad, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstLPWSinc *self = GST_LPWSINC (gst_pad_get_parent (pad));
|
|
|
|
gboolean res = TRUE;
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_LATENCY:
|
|
|
|
{
|
|
|
|
GstClockTime min, max;
|
|
|
|
gboolean live;
|
|
|
|
guint64 latency;
|
|
|
|
GstPad *peer;
|
|
|
|
gint rate = GST_AUDIO_FILTER (self)->format.rate;
|
|
|
|
|
|
|
|
if ((peer = gst_pad_get_peer (GST_BASE_TRANSFORM (self)->sinkpad))) {
|
|
|
|
if ((res = gst_pad_query (peer, query))) {
|
|
|
|
gst_query_parse_latency (query, &live, &min, &max);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (self, "Peer latency: min %"
|
|
|
|
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (min), GST_TIME_ARGS (max));
|
|
|
|
|
|
|
|
/* add our own latency */
|
|
|
|
latency =
|
|
|
|
(rate != 0) ? gst_util_uint64_scale (self->latency, GST_SECOND,
|
|
|
|
rate) : 0;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (self, "Our latency: %"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (latency));
|
|
|
|
|
|
|
|
min += latency;
|
|
|
|
if (max != GST_CLOCK_TIME_NONE)
|
|
|
|
max += latency;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (self, "Calculated total latency : min %"
|
|
|
|
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (min), GST_TIME_ARGS (max));
|
|
|
|
|
|
|
|
gst_query_set_latency (query, live, min, max);
|
|
|
|
}
|
|
|
|
gst_object_unref (peer);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = gst_pad_query_default (pad, query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
gst_object_unref (self);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GstQueryType *
|
|
|
|
lpwsinc_query_type (GstPad * pad)
|
|
|
|
{
|
|
|
|
static const GstQueryType types[] = {
|
|
|
|
GST_QUERY_LATENCY,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
return types;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
lpwsinc_event (GstBaseTransform * base, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstLPWSinc *self = GST_LPWSINC (base);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
lpwsinc_push_residue (self);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GST_BASE_TRANSFORM_CLASS (parent_class)->event (base, event);
|
|
|
|
}
|
|
|
|
|
2002-06-27 14:15:51 +00:00
|
|
|
static void
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
lpwsinc_set_property (GObject * object, guint prop_id, const GValue * value,
|
2004-03-14 22:34:33 +00:00
|
|
|
GParamSpec * pspec)
|
2002-06-27 14:15:51 +00:00
|
|
|
{
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
GstLPWSinc *self = GST_LPWSINC (object);
|
2002-06-27 14:15:51 +00:00
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
g_return_if_fail (GST_IS_LPWSINC (self));
|
2002-06-27 14:15:51 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2007-08-10 04:44:43 +00:00
|
|
|
case PROP_LENGTH:{
|
|
|
|
gint val;
|
|
|
|
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
GST_BASE_TRANSFORM_LOCK (self);
|
2007-08-10 04:44:43 +00:00
|
|
|
val = g_value_get_int (value);
|
|
|
|
if (val % 2 == 0)
|
|
|
|
val++;
|
gst/filter/gstlpwsinc.*: Implement latency query and only forward those samples downstream that actually contain the ...
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (process_32), (process_64),
(lpwsinc_build_kernel), (lpwsinc_push_residue),
(lpwsinc_transform), (lpwsinc_start), (lpwsinc_query),
(lpwsinc_query_type), (lpwsinc_event), (lpwsinc_set_property):
* gst/filter/gstlpwsinc.h:
Implement latency query and only forward those samples downstream
that actually contain the data we want, i.e. drop kernel_length/2
in the beginning and append kernel_length/2 (created by convolving
the filter kernel with zeroes) to the end.
* tests/check/elements/lpwsinc.c: (GST_START_TEST):
Adjust the unit test for this slightly changed behaviour.
2007-08-16 09:48:27 +00:00
|
|
|
|
|
|
|
if (val != self->kernel_length) {
|
|
|
|
if (self->residue) {
|
|
|
|
lpwsinc_push_residue (self);
|
|
|
|
g_free (self->residue);
|
|
|
|
self->residue = NULL;
|
|
|
|
}
|
|
|
|
self->kernel_length = val;
|
|
|
|
self->latency = val / 2;
|
|
|
|
lpwsinc_build_kernel (self);
|
|
|
|
}
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
GST_BASE_TRANSFORM_UNLOCK (self);
|
2004-03-14 22:34:33 +00:00
|
|
|
break;
|
2007-08-10 04:44:43 +00:00
|
|
|
}
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
case PROP_FREQUENCY:
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
GST_BASE_TRANSFORM_LOCK (self);
|
2007-08-17 15:05:17 +00:00
|
|
|
self->cutoff = g_value_get_float (value);
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
lpwsinc_build_kernel (self);
|
|
|
|
GST_BASE_TRANSFORM_UNLOCK (self);
|
2004-03-14 22:34:33 +00:00
|
|
|
break;
|
2007-08-10 04:21:39 +00:00
|
|
|
case PROP_MODE:
|
|
|
|
GST_BASE_TRANSFORM_LOCK (self);
|
|
|
|
self->mode = g_value_get_enum (value);
|
|
|
|
lpwsinc_build_kernel (self);
|
|
|
|
GST_BASE_TRANSFORM_UNLOCK (self);
|
|
|
|
break;
|
2007-08-10 04:32:47 +00:00
|
|
|
case PROP_WINDOW:
|
|
|
|
GST_BASE_TRANSFORM_LOCK (self);
|
|
|
|
self->window = g_value_get_enum (value);
|
|
|
|
lpwsinc_build_kernel (self);
|
|
|
|
GST_BASE_TRANSFORM_UNLOCK (self);
|
|
|
|
break;
|
2002-06-27 14:15:51 +00:00
|
|
|
default:
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2002-06-27 14:15:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
lpwsinc_get_property (GObject * object, guint prop_id, GValue * value,
|
2004-03-14 22:34:33 +00:00
|
|
|
GParamSpec * pspec)
|
2002-06-27 14:15:51 +00:00
|
|
|
{
|
gst/filter/gstlpwsinc.*: Add double support, replace "this" with "self" as the former is a C++ keyword.
Original commit message from CVS:
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_class_init), (gst_lpwsinc_init), (process_32),
(process_64), (lpwsinc_build_kernel), (lpwsinc_setup),
(lpwsinc_get_unit_size), (lpwsinc_transform),
(lpwsinc_set_property), (lpwsinc_get_property):
* gst/filter/gstlpwsinc.h:
Add double support, replace "this" with "self" as the former
is a C++ keyword.
Implement the frequency property in Hz instead of fraction
of sampling frequency.
Remove some unecessary FIXMEs and add some TODOs, add some
required locking and refactor the kernel generation into a
separate function that is also called when the properties
change now.
And use BaseTransform::transform instead of transform_ip
as the convolution is done out of place anyway. Should
be done in place later.
2007-08-09 18:08:05 +00:00
|
|
|
GstLPWSinc *self = GST_LPWSINC (object);
|
2002-06-27 14:15:51 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
case PROP_LENGTH:
|
2007-08-10 04:44:43 +00:00
|
|
|
g_value_set_int (value, self->kernel_length);
|
2002-06-27 14:15:51 +00:00
|
|
|
break;
|
Ported the gstfilter plugin to GStreamer 0.10.
Original commit message from CVS:
Patch by: Mathis Hofer <mathis dot hofer at dreamlab dot net>
* configure.ac:
* gst/filter/Makefile.am:
* gst/filter/gstbpwsinc.c: (gst_bpwsinc_dispose),
(gst_bpwsinc_base_init), (gst_bpwsinc_class_init),
(gst_bpwsinc_init), (bpwsinc_set_caps), (bpwsinc_transform_ip),
(bpwsinc_set_property), (bpwsinc_get_property):
* gst/filter/gstfilter.c: (plugin_init):
* gst/filter/gstfilter.h:
* gst/filter/gstiir.c: (gst_iir_dispose), (gst_iir_base_init),
(gst_iir_class_init), (gst_iir_init), (iir_set_caps),
(iir_transform_ip), (iir_set_property), (iir_get_property):
* gst/filter/gstlpwsinc.c: (gst_lpwsinc_dispose),
(gst_lpwsinc_base_init), (gst_lpwsinc_class_init),
(gst_lpwsinc_init), (lpwsinc_set_caps), (lpwsinc_transform_ip),
(lpwsinc_set_property), (lpwsinc_get_property):
Ported the gstfilter plugin to GStreamer 0.10.
2006-07-10 14:42:15 +00:00
|
|
|
case PROP_FREQUENCY:
|
2007-08-17 15:05:17 +00:00
|
|
|
g_value_set_float (value, self->cutoff);
|
2002-06-27 14:15:51 +00:00
|
|
|
break;
|
2007-08-10 04:21:39 +00:00
|
|
|
case PROP_MODE:
|
|
|
|
g_value_set_enum (value, self->mode);
|
|
|
|
break;
|
2007-08-10 04:32:47 +00:00
|
|
|
case PROP_WINDOW:
|
|
|
|
g_value_set_enum (value, self->window);
|
|
|
|
break;
|
2002-06-27 14:15:51 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|