From 6fe3c141d711f0796a893369b3d715b7ef11c00b Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Thu, 7 Feb 2008 21:57:54 +0000 Subject: [PATCH] Move the lpwsinc and bpwsinc elements from gst-plugins-bad into the audiofx plugin, and rename to audiowsinclimit and... Original commit message from CVS: * docs/plugins/Makefile.am: * docs/plugins/gst-plugins-good-plugins-docs.sgml: * docs/plugins/gst-plugins-good-plugins-sections.txt: * docs/plugins/gst-plugins-good-plugins.args: * docs/plugins/inspect/plugin-audiofx.xml: * gst/audiofx/Makefile.am: * gst/audiofx/audiofx.c: * gst/audiofx/audiowsincband.c: * gst/audiofx/audiowsincband.h: * gst/audiofx/audiowsinclimit.c: * gst/audiofx/audiowsinclimit.h: * tests/check/Makefile.am: * tests/check/elements/audiowsincband.c: * tests/check/elements/audiowsinclimit.c: Move the lpwsinc and bpwsinc elements from gst-plugins-bad into the audiofx plugin, and rename to audiowsinclimit and audiowsincband respectively. Fixes: #467666 --- ChangeLog | 23 ++ docs/plugins/Makefile.am | 2 + docs/plugins/gst-plugins-good-plugins-docs.sgml | 2 + docs/plugins/gst-plugins-good-plugins-sections.txt | 30 ++ docs/plugins/gst-plugins-good-plugins.args | 100 ++++++ docs/plugins/inspect/plugin-audiofx.xml | 42 +++ gst/audiofx/Makefile.am | 4 +- gst/audiofx/audiofx.c | 8 +- gst/audiofx/audiowsincband.c | 146 ++++----- gst/audiofx/audiowsincband.h | 43 ++- gst/audiofx/audiowsinclimit.c | 145 ++++----- gst/audiofx/audiowsinclimit.h | 43 ++- tests/check/Makefile.am | 2 + tests/check/elements/audiowsincband.c | 342 ++++++++++----------- tests/check/elements/audiowsinclimit.c | 198 ++++++------ 15 files changed, 671 insertions(+), 459 deletions(-) diff --git a/ChangeLog b/ChangeLog index ebcba0f..bb39613 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2008-02-07 Jan Schmidt + + * docs/plugins/Makefile.am: + * docs/plugins/gst-plugins-good-plugins-docs.sgml: + * docs/plugins/gst-plugins-good-plugins-sections.txt: + * docs/plugins/gst-plugins-good-plugins.args: + * docs/plugins/inspect/plugin-audiofx.xml: + * gst/audiofx/Makefile.am: + * gst/audiofx/audiofx.c: + * gst/audiofx/audiowsincband.c: + * gst/audiofx/audiowsincband.h: + * gst/audiofx/audiowsinclimit.c: + * gst/audiofx/audiowsinclimit.h: + * tests/check/Makefile.am: + * tests/check/elements/audiowsincband.c: + * tests/check/elements/audiowsinclimit.c: + + Move the lpwsinc and bpwsinc elements from gst-plugins-bad into + the audiofx plugin, and rename to audiowsinclimit and audiowsincband + respectively. + + Fixes: #467666 + 2008-02-07 Tim-Philipp Müller * gst/icydemux/gsticydemux.c: (gst_icydemux_chain): diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am index 1b044ec..b54d287 100644 --- a/docs/plugins/Makefile.am +++ b/docs/plugins/Makefile.am @@ -102,6 +102,8 @@ EXTRA_HFILES = \ $(top_srcdir)/gst/audiofx/audiopanorama.h \ $(top_srcdir)/gst/audiofx/audiocheblimit.h \ $(top_srcdir)/gst/audiofx/audiochebband.h \ + $(top_srcdir)/gst/audiofx/audiowsincband.h \ + $(top_srcdir)/gst/audiofx/audiowsinclimit.h \ $(top_srcdir)/gst/autodetect/gstautoaudiosink.h \ $(top_srcdir)/gst/autodetect/gstautovideosink.h \ $(top_srcdir)/gst/avi/gstavidemux.h \ diff --git a/docs/plugins/gst-plugins-good-plugins-docs.sgml b/docs/plugins/gst-plugins-good-plugins-docs.sgml index c921b64..9a99842 100644 --- a/docs/plugins/gst-plugins-good-plugins-docs.sgml +++ b/docs/plugins/gst-plugins-good-plugins-docs.sgml @@ -18,6 +18,8 @@ + + diff --git a/docs/plugins/gst-plugins-good-plugins-sections.txt b/docs/plugins/gst-plugins-good-plugins-sections.txt index 9461328..b4ee20b 100644 --- a/docs/plugins/gst-plugins-good-plugins-sections.txt +++ b/docs/plugins/gst-plugins-good-plugins-sections.txt @@ -138,6 +138,36 @@ gst_audio_panorama_get_type
+element-audiowsincband +audiowsincband +GstAudioWSincBand + +GstAudioWSincBandClass +GstAudioWSincBandProcessFunc +GST_AUDIO_WSINC_BAND +GST_AUDIO_WSINC_BAND_CLASS +GST_IS_AUDIO_WSINC_BAND +GST_IS_AUDIO_WSINC_BAND_CLASS +GST_TYPE_AUDIO_WSINC_BAND +audio_wsincband_get_type +
+ +
+element-audiowsinclimit +audiowsinclimit +GstAudioWSincLimit + +GstAudioWSincLimitClass +GstAudioWSincLimitProcessFunc +GST_AUDIO_WSINC_LIMIT +GST_AUDIO_WSINC_LIMIT_CLASS +GST_IS_AUDIO_WSINC_LIMIT +GST_IS_AUDIO_WSINC_LIMIT_CLASS +GST_TYPE_AUDIO_WSINC_LIMIT +audio_wsinclimit_get_type +
+ +
element-autoaudiosink autoaudiosink GstAutoAudioSink diff --git a/docs/plugins/gst-plugins-good-plugins.args b/docs/plugins/gst-plugins-good-plugins.args index 03f31a9..9d6d8b6 100644 --- a/docs/plugins/gst-plugins-good-plugins.args +++ b/docs/plugins/gst-plugins-good-plugins.args @@ -17508,6 +17508,106 @@ 1 +ARG> +GstAudioWSincBand::length +gint +[3,50000] +rw +Length +Filter kernel length, will be rounded to the next odd number. +101 + + + +GstAudioWSincBand::lower-frequency +gfloat +[0,100000] +rw +Lower Frequency +Cut-off lower frequency (Hz). +0 + + + +GstAudioWSincBand::upper-frequency +gfloat +[0,100000] +rw +Upper Frequency +Cut-off upper frequency (Hz). +0 + + + +GstAudioWSincBand::mode +GstAudioWSincBandMode + +rw +Mode +Band pass or band reject mode. +Band pass (default) + + + +GstAudioWSincBand::window +GstAudioWSincBandWindow + +rw +Window +Window function to use. +Hamming window (default) + + + +GstAudioWSincLimit::frequency +gdouble +>= 0 +rw +Frequency +Cut-off Frequency (Hz). +0 + + + +GstAudioWSincLimit::length +gint +[3,50000] +rw +Length +Filter kernel length, will be rounded to the next odd number. +101 + + + +GstAudioWSincLimit::mode +GstAudioWSincLimitMode + +rw +Mode +Low pass or high pass mode. +Low pass (default) + + + +GstAudioWSincLimit::window +GstAudioWSincLimitWindow + +rw +Window +Window function to use. +Hamming window (default) + + + +GstAudioWSincLimit::cutoff +gfloat +[0,100000] +rw +Cutoff +Cut-off Frequency (Hz). +0 + + GstRndBufferSize::max glong diff --git a/docs/plugins/inspect/plugin-audiofx.xml b/docs/plugins/inspect/plugin-audiofx.xml index 8853eb6..8d8d0ff 100644 --- a/docs/plugins/inspect/plugin-audiofx.xml +++ b/docs/plugins/inspect/plugin-audiofx.xml @@ -135,5 +135,47 @@ + + audiowsincband + Band-pass and Band-reject Windowed sinc filter + Filter/Effect/Audio + Band-pass Windowed sinc filter + Thomas <thomas@apestaart.org>, Steven W. Smith, Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>, Sebastian Dröge <slomo@circular-chaos.org> + + + src + source + always +
audio/x-raw-float, width=(int){ 32, 64 }, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]
+
+ + sink + sink + always +
audio/x-raw-float, width=(int){ 32, 64 }, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]
+
+
+
+ + audiowsinclimit + AudioWSincLimit + Filter/Effect/Audio + Low-pass and High-pass Windowed sinc filter + Thomas <thomas@apestaart.org>, Steven W. Smith, Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>, Sebastian Dröge <slomo@circular-chaos.org> + + + src + source + always +
audio/x-raw-float, width=(int){ 32, 64 }, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]
+
+ + sink + sink + always +
audio/x-raw-float, width=(int){ 32, 64 }, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]
+
+
+
\ No newline at end of file diff --git a/gst/audiofx/Makefile.am b/gst/audiofx/Makefile.am index 02b85be..72f4f58 100644 --- a/gst/audiofx/Makefile.am +++ b/gst/audiofx/Makefile.am @@ -9,7 +9,9 @@ libgstaudiofx_la_SOURCES = audiofx.c\ audioamplify.c \ audiodynamic.c \ audiocheblimit.c \ - audiochebband.c + audiochebband.c \ + audiowsincband.c \ + audiowsinclimit.c # flags used to compile this plugin libgstaudiofx_la_CFLAGS = $(GST_CFLAGS) \ diff --git a/gst/audiofx/audiofx.c b/gst/audiofx/audiofx.c index e5087a4..d23b64d 100644 --- a/gst/audiofx/audiofx.c +++ b/gst/audiofx/audiofx.c @@ -31,6 +31,8 @@ #include "audiodynamic.h" #include "audiocheblimit.h" #include "audiochebband.h" +#include "audiowsincband.h" +#include "audiowsinclimit.h" /* entry point to initialize the plug-in * initialize the plug-in itself @@ -54,7 +56,11 @@ plugin_init (GstPlugin * plugin) gst_element_register (plugin, "audiocheblimit", GST_RANK_NONE, GST_TYPE_AUDIO_CHEB_LIMIT) && gst_element_register (plugin, "audiochebband", GST_RANK_NONE, - GST_TYPE_AUDIO_CHEB_BAND)); + GST_TYPE_AUDIO_CHEB_BAND) && + gst_element_register (plugin, "audiowsinclimit", GST_RANK_NONE, + GST_TYPE_AUDIO_WSINC_LIMIT) && + gst_element_register (plugin, "audiowsincband", GST_RANK_NONE, + GST_TYPE_AUDIO_WSINC_BAND)); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/audiofx/audiowsincband.c b/gst/audiofx/audiowsincband.c index 929daec..3cccbd2 100644 --- a/gst/audiofx/audiowsincband.c +++ b/gst/audiofx/audiowsincband.c @@ -36,7 +36,7 @@ */ /** - * SECTION:element-bpwsinc + * SECTION:element-audiowsincband * @short_description: Windowed Sinc band pass and band reject filter * * @@ -54,9 +54,9 @@ * Example launch line * * - * gst-launch audiotestsrc freq=1500 ! audioconvert ! bpwsinc mode=band-pass lower-frequency=3000 upper-frequency=10000 length=501 window=blackman ! audioconvert ! alsasink - * gst-launch filesrc location="melo1.ogg" ! oggdemux ! vorbisdec ! audioconvert ! bpwsinc mode=band-reject lower-frequency=59 upper-frequency=61 length=10001 window=hamming ! audioconvert ! alsasink - * gst-launch audiotestsrc wave=white-noise ! audioconvert ! bpwsinc mode=band-pass lower-frequency=1000 upper-frequency=2000 length=31 ! audioconvert ! alsasink + * gst-launch audiotestsrc freq=1500 ! audioconvert ! audiosincband mode=band-pass lower-frequency=3000 upper-frequency=10000 length=501 window=blackman ! audioconvert ! alsasink + * gst-launch filesrc location="melo1.ogg" ! oggdemux ! vorbisdec ! audioconvert ! audiowsincband mode=band-reject lower-frequency=59 upper-frequency=61 length=10001 window=hamming ! audioconvert ! alsasink + * gst-launch audiotestsrc wave=white-noise ! audioconvert ! audiowsincband mode=band-pass lower-frequency=1000 upper-frequency=2000 length=31 ! audioconvert ! alsasink * * * @@ -72,12 +72,12 @@ #include #include -#include "gstbpwsinc.h" +#include "audiowsincband.h" -#define GST_CAT_DEFAULT gst_bpwsinc_debug +#define GST_CAT_DEFAULT gst_audio_wsincband_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); -static const GstElementDetails bpwsinc_details = +static const GstElementDetails audio_wsincband_details = GST_ELEMENT_DETAILS ("Band-pass and Band-reject Windowed sinc filter", "Filter/Effect/Audio", "Band-pass Windowed sinc filter", @@ -109,9 +109,9 @@ enum MODE_BAND_REJECT }; -#define GST_TYPE_BPWSINC_MODE (gst_bpwsinc_mode_get_type ()) +#define GST_TYPE_AUDIO_WSINC_BAND_MODE (gst_audio_wsincband_mode_get_type ()) static GType -gst_bpwsinc_mode_get_type (void) +gst_audio_wsincband_mode_get_type (void) { static GType gtype = 0; @@ -124,7 +124,7 @@ gst_bpwsinc_mode_get_type (void) {0, NULL, NULL} }; - gtype = g_enum_register_static ("GstBPWSincMode", values); + gtype = g_enum_register_static ("GstAudioWSincBandMode", values); } return gtype; } @@ -135,9 +135,9 @@ enum WINDOW_BLACKMAN }; -#define GST_TYPE_BPWSINC_WINDOW (gst_bpwsinc_window_get_type ()) +#define GST_TYPE_AUDIO_WSINC_BAND_WINDOW (gst_audio_wsincband_window_get_type ()) static GType -gst_bpwsinc_window_get_type (void) +gst_audio_wsincband_window_get_type (void) { static GType gtype = 0; @@ -150,7 +150,7 @@ gst_bpwsinc_window_get_type (void) {0, NULL, NULL} }; - gtype = g_enum_register_static ("GstBPWSincWindow", values); + gtype = g_enum_register_static ("GstAudioWSincBandWindow", values); } return gtype; } @@ -163,33 +163,35 @@ gst_bpwsinc_window_get_type (void) " channels = (int) [ 1, MAX ] " #define DEBUG_INIT(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_bpwsinc_debug, "bpwsinc", 0, "Band-pass and Band-reject Windowed sinc filter plugin"); + GST_DEBUG_CATEGORY_INIT (gst_audio_wsincband_debug, "audiowsincband", 0, \ + "Band-pass and Band-reject Windowed sinc filter plugin"); -GST_BOILERPLATE_FULL (GstBPWSinc, gst_bpwsinc, GstAudioFilter, +GST_BOILERPLATE_FULL (GstAudioWSincBand, audio_wsincband, GstAudioFilter, GST_TYPE_AUDIO_FILTER, DEBUG_INIT); -static void bpwsinc_set_property (GObject * object, guint prop_id, +static void audio_wsincband_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); -static void bpwsinc_get_property (GObject * object, guint prop_id, +static void audio_wsincband_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstFlowReturn bpwsinc_transform (GstBaseTransform * base, +static GstFlowReturn audio_wsincband_transform (GstBaseTransform * base, GstBuffer * inbuf, GstBuffer * outbuf); -static gboolean bpwsinc_start (GstBaseTransform * base); -static gboolean bpwsinc_event (GstBaseTransform * base, GstEvent * event); +static gboolean audio_wsincband_start (GstBaseTransform * base); +static gboolean audio_wsincband_event (GstBaseTransform * base, + GstEvent * event); -static gboolean bpwsinc_setup (GstAudioFilter * base, +static gboolean audio_wsincband_setup (GstAudioFilter * base, GstRingBufferSpec * format); -static gboolean bpwsinc_query (GstPad * pad, GstQuery * query); -static const GstQueryType *bpwsinc_query_type (GstPad * pad); +static gboolean audio_wsincband_query (GstPad * pad, GstQuery * query); +static const GstQueryType *audio_wsincband_query_type (GstPad * pad); /* Element class */ static void -gst_bpwsinc_dispose (GObject * object) +audio_wsincband_dispose (GObject * object) { - GstBPWSinc *self = GST_BPWSINC (object); + GstAudioWSincBand *self = GST_AUDIO_WSINC_BAND (object); if (self->residue) { g_free (self->residue); @@ -205,12 +207,12 @@ gst_bpwsinc_dispose (GObject * object) } static void -gst_bpwsinc_base_init (gpointer g_class) +audio_wsincband_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); GstCaps *caps; - gst_element_class_set_details (element_class, &bpwsinc_details); + gst_element_class_set_details (element_class, &audio_wsincband_details); caps = gst_caps_from_string (ALLOWED_CAPS); gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (g_class), @@ -219,7 +221,7 @@ gst_bpwsinc_base_init (gpointer g_class) } static void -gst_bpwsinc_class_init (GstBPWSincClass * klass) +audio_wsincband_class_init (GstAudioWSincBandClass * klass) { GObjectClass *gobject_class; GstBaseTransformClass *trans_class; @@ -229,9 +231,9 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass) trans_class = (GstBaseTransformClass *) klass; filter_class = (GstAudioFilterClass *) klass; - gobject_class->set_property = bpwsinc_set_property; - gobject_class->get_property = bpwsinc_get_property; - gobject_class->dispose = gst_bpwsinc_dispose; + gobject_class->set_property = audio_wsincband_set_property; + gobject_class->get_property = audio_wsincband_get_property; + gobject_class->dispose = audio_wsincband_dispose; /* FIXME: Don't use the complete possible range but restrict the upper boundary * so automatically generated UIs can use a slider */ @@ -248,22 +250,23 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass) g_object_class_install_property (gobject_class, PROP_MODE, g_param_spec_enum ("mode", "Mode", - "Band pass or band reject mode", GST_TYPE_BPWSINC_MODE, + "Band pass or band reject mode", GST_TYPE_AUDIO_WSINC_BAND_MODE, MODE_BAND_PASS, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); g_object_class_install_property (gobject_class, PROP_WINDOW, g_param_spec_enum ("window", "Window", - "Window function to use", GST_TYPE_BPWSINC_WINDOW, + "Window function to use", GST_TYPE_AUDIO_WSINC_BAND_WINDOW, WINDOW_HAMMING, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); - trans_class->transform = GST_DEBUG_FUNCPTR (bpwsinc_transform); - trans_class->start = GST_DEBUG_FUNCPTR (bpwsinc_start); - trans_class->event = GST_DEBUG_FUNCPTR (bpwsinc_event); - filter_class->setup = GST_DEBUG_FUNCPTR (bpwsinc_setup); + trans_class->transform = GST_DEBUG_FUNCPTR (audio_wsincband_transform); + trans_class->start = GST_DEBUG_FUNCPTR (audio_wsincband_start); + trans_class->event = GST_DEBUG_FUNCPTR (audio_wsincband_event); + filter_class->setup = GST_DEBUG_FUNCPTR (audio_wsincband_setup); } static void -gst_bpwsinc_init (GstBPWSinc * self, GstBPWSincClass * g_class) +audio_wsincband_init (GstAudioWSincBand * self, + GstAudioWSincBandClass * g_class) { self->kernel_length = 101; self->latency = 50; @@ -279,14 +282,15 @@ gst_bpwsinc_init (GstBPWSinc * self, GstBPWSincClass * g_class) self->next_ts = GST_CLOCK_TIME_NONE; self->next_off = GST_BUFFER_OFFSET_NONE; - gst_pad_set_query_function (GST_BASE_TRANSFORM (self)->srcpad, bpwsinc_query); + gst_pad_set_query_function (GST_BASE_TRANSFORM (self)->srcpad, + audio_wsincband_query); gst_pad_set_query_type_function (GST_BASE_TRANSFORM (self)->srcpad, - bpwsinc_query_type); + audio_wsincband_query_type); } #define DEFINE_PROCESS_FUNC(width,ctype) \ static void \ -process_##width (GstBPWSinc * self, g##ctype * src, g##ctype * dst, guint input_samples) \ +process_##width (GstAudioWSincBand * self, g##ctype * src, g##ctype * dst, guint input_samples) \ { \ gint kernel_length = self->kernel_length; \ gint i, j, k, l; \ @@ -331,7 +335,7 @@ DEFINE_PROCESS_FUNC (64, double); #undef DEFINE_PROCESS_FUNC static void -bpwsinc_build_kernel (GstBPWSinc * self) +audio_wsincband_build_kernel (GstAudioWSincBand * self) { gint i = 0; gdouble sum = 0.0; @@ -365,7 +369,7 @@ bpwsinc_build_kernel (GstBPWSinc * self) self->upper_frequency = tmp; } - GST_DEBUG ("bpwsinc: initializing filter kernel of length %d " + GST_DEBUG ("audio_wsincband: initializing filter kernel of length %d " "with lower frequency %.2lf Hz " ", upper frequency %.2lf Hz for mode %s", len, self->lower_frequency, self->upper_frequency, @@ -457,7 +461,7 @@ bpwsinc_build_kernel (GstBPWSinc * self) } static void -bpwsinc_push_residue (GstBPWSinc * self) +audio_wsincband_push_residue (GstAudioWSincBand * self) { GstBuffer *outbuf; GstFlowReturn res; @@ -536,16 +540,16 @@ bpwsinc_push_residue (GstBPWSinc * self) /* get notified of caps and plug in the correct process function */ static gboolean -bpwsinc_setup (GstAudioFilter * base, GstRingBufferSpec * format) +audio_wsincband_setup (GstAudioFilter * base, GstRingBufferSpec * format) { - GstBPWSinc *self = GST_BPWSINC (base); + GstAudioWSincBand *self = GST_AUDIO_WSINC_BAND (base); gboolean ret = TRUE; if (format->width == 32) - self->process = (GstBPWSincProcessFunc) process_32; + self->process = (GstAudioWSincBandProcessFunc) process_32; else if (format->width == 64) - self->process = (GstBPWSincProcessFunc) process_64; + self->process = (GstAudioWSincBandProcessFunc) process_64; else ret = FALSE; @@ -557,10 +561,10 @@ bpwsinc_setup (GstAudioFilter * base, GstRingBufferSpec * format) /* GstBaseTransform vmethod implementations */ static GstFlowReturn -bpwsinc_transform (GstBaseTransform * base, GstBuffer * inbuf, +audio_wsincband_transform (GstBaseTransform * base, GstBuffer * inbuf, GstBuffer * outbuf) { - GstBPWSinc *self = GST_BPWSINC (base); + GstAudioWSincBand *self = GST_AUDIO_WSINC_BAND (base); GstClockTime timestamp; gint channels = GST_AUDIO_FILTER (self)->format.channels; gint rate = GST_AUDIO_FILTER (self)->format.rate; @@ -575,7 +579,7 @@ bpwsinc_transform (GstBaseTransform * base, GstBuffer * inbuf, gst_object_sync_values (G_OBJECT (self), timestamp); if (!self->have_kernel) - bpwsinc_build_kernel (self); + audio_wsincband_build_kernel (self); /* Reset the residue if already existing on discont buffers */ if (GST_BUFFER_IS_DISCONT (inbuf)) { @@ -675,9 +679,9 @@ bpwsinc_transform (GstBaseTransform * base, GstBuffer * inbuf, } static gboolean -bpwsinc_start (GstBaseTransform * base) +audio_wsincband_start (GstBaseTransform * base) { - GstBPWSinc *self = GST_BPWSINC (base); + GstAudioWSincBand *self = GST_AUDIO_WSINC_BAND (base); gint channels = GST_AUDIO_FILTER (self)->format.channels; /* Reset the residue if already existing */ @@ -693,9 +697,9 @@ bpwsinc_start (GstBaseTransform * base) } static gboolean -bpwsinc_query (GstPad * pad, GstQuery * query) +audio_wsincband_query (GstPad * pad, GstQuery * query) { - GstBPWSinc *self = GST_BPWSINC (gst_pad_get_parent (pad)); + GstAudioWSincBand *self = GST_AUDIO_WSINC_BAND (gst_pad_get_parent (pad)); gboolean res = TRUE; switch (GST_QUERY_TYPE (query)) { @@ -746,7 +750,7 @@ bpwsinc_query (GstPad * pad, GstQuery * query) } static const GstQueryType * -bpwsinc_query_type (GstPad * pad) +audio_wsincband_query_type (GstPad * pad) { static const GstQueryType types[] = { GST_QUERY_LATENCY, @@ -757,13 +761,13 @@ bpwsinc_query_type (GstPad * pad) } static gboolean -bpwsinc_event (GstBaseTransform * base, GstEvent * event) +audio_wsincband_event (GstBaseTransform * base, GstEvent * event) { - GstBPWSinc *self = GST_BPWSINC (base); + GstAudioWSincBand *self = GST_AUDIO_WSINC_BAND (base); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - bpwsinc_push_residue (self); + audio_wsincband_push_residue (self); break; default: break; @@ -773,12 +777,12 @@ bpwsinc_event (GstBaseTransform * base, GstEvent * event) } static void -bpwsinc_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) +audio_wsincband_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) { - GstBPWSinc *self = GST_BPWSINC (object); + GstAudioWSincBand *self = GST_AUDIO_WSINC_BAND (object); - g_return_if_fail (GST_IS_BPWSINC (self)); + g_return_if_fail (GST_IS_AUDIO_WSINC_BAND (self)); switch (prop_id) { case PROP_LENGTH:{ @@ -791,13 +795,13 @@ bpwsinc_set_property (GObject * object, guint prop_id, const GValue * value, if (val != self->kernel_length) { if (self->residue) { - bpwsinc_push_residue (self); + audio_wsincband_push_residue (self); g_free (self->residue); self->residue = NULL; } self->kernel_length = val; self->latency = val / 2; - bpwsinc_build_kernel (self); + audio_wsincband_build_kernel (self); gst_element_post_message (GST_ELEMENT (self), gst_message_new_latency (GST_OBJECT (self))); } @@ -807,25 +811,25 @@ bpwsinc_set_property (GObject * object, guint prop_id, const GValue * value, case PROP_LOWER_FREQUENCY: GST_BASE_TRANSFORM_LOCK (self); self->lower_frequency = g_value_get_float (value); - bpwsinc_build_kernel (self); + audio_wsincband_build_kernel (self); GST_BASE_TRANSFORM_UNLOCK (self); break; case PROP_UPPER_FREQUENCY: GST_BASE_TRANSFORM_LOCK (self); self->upper_frequency = g_value_get_float (value); - bpwsinc_build_kernel (self); + audio_wsincband_build_kernel (self); GST_BASE_TRANSFORM_UNLOCK (self); break; case PROP_MODE: GST_BASE_TRANSFORM_LOCK (self); self->mode = g_value_get_enum (value); - bpwsinc_build_kernel (self); + audio_wsincband_build_kernel (self); GST_BASE_TRANSFORM_UNLOCK (self); break; case PROP_WINDOW: GST_BASE_TRANSFORM_LOCK (self); self->window = g_value_get_enum (value); - bpwsinc_build_kernel (self); + audio_wsincband_build_kernel (self); GST_BASE_TRANSFORM_UNLOCK (self); break; default: @@ -835,10 +839,10 @@ bpwsinc_set_property (GObject * object, guint prop_id, const GValue * value, } static void -bpwsinc_get_property (GObject * object, guint prop_id, GValue * value, +audio_wsincband_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { - GstBPWSinc *self = GST_BPWSINC (object); + GstAudioWSincBand *self = GST_AUDIO_WSINC_BAND (object); switch (prop_id) { case PROP_LENGTH: diff --git a/gst/audiofx/audiowsincband.h b/gst/audiofx/audiowsincband.h index 24a4d2d..d99c788 100644 --- a/gst/audiofx/audiowsincband.h +++ b/gst/audiofx/audiowsincband.h @@ -27,41 +27,40 @@ * */ -#ifndef __GST_BPWSINC_H__ -#define __GST_BPWSINC_H__ +#ifndef __GST_AUDIO_WSINC_BAND_H__ +#define __GST_AUDIO_WSINC_BAND_H__ -#include "gstfilter.h" #include #include G_BEGIN_DECLS -#define GST_TYPE_BPWSINC \ - (gst_bpwsinc_get_type()) -#define GST_BPWSINC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BPWSINC,GstBPWSinc)) -#define GST_BPWSINC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BPWSINC,GstBPWSincClass)) -#define GST_IS_BPWSINC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BPWSINC)) -#define GST_IS_BPWSINC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BPWSINC)) +#define GST_TYPE_AUDIO_WSINC_BAND \ + (audio_wsincband_get_type()) +#define GST_AUDIO_WSINC_BAND(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_WSINC_BAND,GstAudioWSincBand)) +#define GST_AUDIO_WSINC_BAND_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_WSINC_BAND,GstAudioWSincBandClass)) +#define GST_IS_AUDIO_WSINC_BAND(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_WSINC_BAND)) +#define GST_IS_AUDIO_WSINC_BAND_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_WSINC_BAND)) -typedef struct _GstBPWSinc GstBPWSinc; -typedef struct _GstBPWSincClass GstBPWSincClass; +typedef struct _GstAudioWSincBand GstAudioWSincBand; +typedef struct _GstAudioWSincBandClass GstAudioWSincBandClass; -typedef void (*GstBPWSincProcessFunc) (GstBPWSinc *, guint8 *, guint8 *, guint); +typedef void (*GstAudioWSincBandProcessFunc) (GstAudioWSincBand *, guint8 *, guint8 *, guint); /** - * GstBPWSinc: + * GstAudioWSincBand: * * Opaque data structure. */ -struct _GstBPWSinc { +struct _GstAudioWSincBand { GstAudioFilter element; /* < private > */ - GstBPWSincProcessFunc process; + GstAudioWSincBandProcessFunc process; gint mode; gint window; @@ -77,12 +76,12 @@ struct _GstBPWSinc { guint64 next_off; }; -struct _GstBPWSincClass { +struct _GstAudioWSincBandClass { GstAudioFilterClass parent_class; }; -GType gst_bpwsinc_get_type (void); +GType audio_wsincband_get_type (void); G_END_DECLS -#endif /* __GST_BPWSINC_H__ */ +#endif /* __GST_AUDIO_WSINC_BAND_H__ */ diff --git a/gst/audiofx/audiowsinclimit.c b/gst/audiofx/audiowsinclimit.c index 7189aaa..9ee2070 100644 --- a/gst/audiofx/audiowsinclimit.c +++ b/gst/audiofx/audiowsinclimit.c @@ -34,7 +34,7 @@ */ /** - * SECTION:element-lpwsinc + * SECTION:element-audiowsinclimit * @short_description: Windowed Sinc low pass and high pass filter * * @@ -52,9 +52,9 @@ * Example launch line * * - * 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 + * gst-launch audiotestsrc freq=1500 ! audioconvert ! audiowsinclimit mode=low-pass frequency=1000 length=501 ! audioconvert ! alsasink + * gst-launch filesrc location="melo1.ogg" ! oggdemux ! vorbisdec ! audioconvert ! audiowsinclimit mode=high-pass frequency=15000 length=501 ! audioconvert ! alsasink + * gst-launch audiotestsrc wave=white-noise ! audioconvert ! audiowsinclimit mode=low-pass frequency=1000 length=10001 window=blackman ! audioconvert ! alsasink * * * @@ -70,12 +70,13 @@ #include #include -#include "gstlpwsinc.h" +#include "audiowsinclimit.h" -#define GST_CAT_DEFAULT gst_lpwsinc_debug +#define GST_CAT_DEFAULT audio_wsinclimit_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); -static const GstElementDetails lpwsinc_details = GST_ELEMENT_DETAILS ("LPWSinc", +static const GstElementDetails audio_wsinclimit_details = +GST_ELEMENT_DETAILS ("AudioWSincLimit", "Filter/Effect/Audio", "Low-pass and High-pass Windowed sinc filter", "Thomas , " @@ -105,9 +106,9 @@ enum MODE_HIGH_PASS }; -#define GST_TYPE_LPWSINC_MODE (gst_lpwsinc_mode_get_type ()) +#define GST_TYPE_AUDIO_WSINC_LIMIT_MODE (audio_wsinclimit_mode_get_type ()) static GType -gst_lpwsinc_mode_get_type (void) +audio_wsinclimit_mode_get_type (void) { static GType gtype = 0; @@ -120,7 +121,7 @@ gst_lpwsinc_mode_get_type (void) {0, NULL, NULL} }; - gtype = g_enum_register_static ("GstLPWSincMode", values); + gtype = g_enum_register_static ("GstAudioWSincLimitMode", values); } return gtype; } @@ -131,9 +132,9 @@ enum WINDOW_BLACKMAN }; -#define GST_TYPE_LPWSINC_WINDOW (gst_lpwsinc_window_get_type ()) +#define GST_TYPE_AUDIO_WSINC_LIMIT_WINDOW (audio_wsinclimit_window_get_type ()) static GType -gst_lpwsinc_window_get_type (void) +audio_wsinclimit_window_get_type (void) { static GType gtype = 0; @@ -146,7 +147,7 @@ gst_lpwsinc_window_get_type (void) {0, NULL, NULL} }; - gtype = g_enum_register_static ("GstLPWSincWindow", values); + gtype = g_enum_register_static ("GstAudioWSincLimitWindow", values); } return gtype; } @@ -159,32 +160,34 @@ gst_lpwsinc_window_get_type (void) " channels = (int) [ 1, MAX ]" #define DEBUG_INIT(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_lpwsinc_debug, "lpwsinc", 0, "Low-pass and High-pass Windowed sinc filter plugin"); + GST_DEBUG_CATEGORY_INIT (audio_wsinclimit_debug, "audiowsinclimit", 0, \ + "Low-pass and High-pass Windowed sinc filter plugin"); -GST_BOILERPLATE_FULL (GstLPWSinc, gst_lpwsinc, GstAudioFilter, +GST_BOILERPLATE_FULL (GstAudioWSincLimit, audio_wsinclimit, GstAudioFilter, GST_TYPE_AUDIO_FILTER, DEBUG_INIT); -static void lpwsinc_set_property (GObject * object, guint prop_id, +static void audio_wsinclimit_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); -static void lpwsinc_get_property (GObject * object, guint prop_id, +static void audio_wsinclimit_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstFlowReturn lpwsinc_transform (GstBaseTransform * base, +static GstFlowReturn audio_wsinclimit_transform (GstBaseTransform * base, GstBuffer * inbuf, GstBuffer * outbuf); -static gboolean lpwsinc_start (GstBaseTransform * base); -static gboolean lpwsinc_event (GstBaseTransform * base, GstEvent * event); -static gboolean lpwsinc_setup (GstAudioFilter * base, +static gboolean audio_wsinclimit_start (GstBaseTransform * base); +static gboolean audio_wsinclimit_event (GstBaseTransform * base, + GstEvent * event); +static gboolean audio_wsinclimit_setup (GstAudioFilter * base, GstRingBufferSpec * format); -static gboolean lpwsinc_query (GstPad * pad, GstQuery * query); -static const GstQueryType *lpwsinc_query_type (GstPad * pad); +static gboolean audio_wsinclimit_query (GstPad * pad, GstQuery * query); +static const GstQueryType *audio_wsinclimit_query_type (GstPad * pad); /* Element class */ static void -gst_lpwsinc_dispose (GObject * object) +audio_wsinclimit_dispose (GObject * object) { - GstLPWSinc *self = GST_LPWSINC (object); + GstAudioWSincLimit *self = GST_AUDIO_WSINC_LIMIT (object); if (self->residue) { g_free (self->residue); @@ -200,12 +203,12 @@ gst_lpwsinc_dispose (GObject * object) } static void -gst_lpwsinc_base_init (gpointer g_class) +audio_wsinclimit_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); GstCaps *caps; - gst_element_class_set_details (element_class, &lpwsinc_details); + gst_element_class_set_details (element_class, &audio_wsinclimit_details); caps = gst_caps_from_string (ALLOWED_CAPS); gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (g_class), @@ -214,7 +217,7 @@ gst_lpwsinc_base_init (gpointer g_class) } static void -gst_lpwsinc_class_init (GstLPWSincClass * klass) +audio_wsinclimit_class_init (GstAudioWSincLimitClass * klass) { GObjectClass *gobject_class; GstBaseTransformClass *trans_class; @@ -224,9 +227,9 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass) trans_class = (GstBaseTransformClass *) klass; filter_class = (GstAudioFilterClass *) klass; - gobject_class->set_property = lpwsinc_set_property; - gobject_class->get_property = lpwsinc_get_property; - gobject_class->dispose = gst_lpwsinc_dispose; + gobject_class->set_property = audio_wsinclimit_set_property; + gobject_class->get_property = audio_wsinclimit_get_property; + gobject_class->dispose = audio_wsinclimit_dispose; /* FIXME: Don't use the complete possible range but restrict the upper boundary @@ -242,22 +245,23 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass) 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, + "Low pass or high pass mode", GST_TYPE_AUDIO_WSINC_LIMIT_MODE, MODE_LOW_PASS, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); g_object_class_install_property (gobject_class, PROP_WINDOW, g_param_spec_enum ("window", "Window", - "Window function to use", GST_TYPE_LPWSINC_WINDOW, + "Window function to use", GST_TYPE_AUDIO_WSINC_LIMIT_WINDOW, WINDOW_HAMMING, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); - trans_class->transform = GST_DEBUG_FUNCPTR (lpwsinc_transform); - trans_class->start = GST_DEBUG_FUNCPTR (lpwsinc_start); - trans_class->event = GST_DEBUG_FUNCPTR (lpwsinc_event); - filter_class->setup = GST_DEBUG_FUNCPTR (lpwsinc_setup); + trans_class->transform = GST_DEBUG_FUNCPTR (audio_wsinclimit_transform); + trans_class->start = GST_DEBUG_FUNCPTR (audio_wsinclimit_start); + trans_class->event = GST_DEBUG_FUNCPTR (audio_wsinclimit_event); + filter_class->setup = GST_DEBUG_FUNCPTR (audio_wsinclimit_setup); } static void -gst_lpwsinc_init (GstLPWSinc * self, GstLPWSincClass * g_class) +audio_wsinclimit_init (GstAudioWSincLimit * self, + GstAudioWSincLimitClass * g_class) { self->mode = MODE_LOW_PASS; self->window = WINDOW_HAMMING; @@ -272,14 +276,15 @@ gst_lpwsinc_init (GstLPWSinc * self, GstLPWSincClass * g_class) 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_function (GST_BASE_TRANSFORM (self)->srcpad, + audio_wsinclimit_query); gst_pad_set_query_type_function (GST_BASE_TRANSFORM (self)->srcpad, - lpwsinc_query_type); + audio_wsinclimit_query_type); } #define DEFINE_PROCESS_FUNC(width,ctype) \ static void \ -process_##width (GstLPWSinc * self, g##ctype * src, g##ctype * dst, guint input_samples) \ +process_##width (GstAudioWSincLimit * self, g##ctype * src, g##ctype * dst, guint input_samples) \ { \ gint kernel_length = self->kernel_length; \ gint i, j, k, l; \ @@ -324,7 +329,7 @@ DEFINE_PROCESS_FUNC (64, double); #undef DEFINE_PROCESS_FUNC static void -lpwsinc_build_kernel (GstLPWSinc * self) +audio_wsinclimit_build_kernel (GstAudioWSincLimit * self) { gint i = 0; gdouble sum = 0.0; @@ -347,7 +352,7 @@ lpwsinc_build_kernel (GstLPWSinc * self) self->cutoff = CLAMP (self->cutoff, 0.0, GST_AUDIO_FILTER (self)->format.rate / 2); - GST_DEBUG ("lpwsinc: initializing filter kernel of length %d " + GST_DEBUG ("audio_wsinclimit_: initializing filter kernel of length %d " "with cutoff %.2lf Hz " "for mode %s", len, self->cutoff, @@ -398,7 +403,7 @@ lpwsinc_build_kernel (GstLPWSinc * self) } static void -lpwsinc_push_residue (GstLPWSinc * self) +audio_wsinclimit_push_residue (GstAudioWSincLimit * self) { GstBuffer *outbuf; GstFlowReturn res; @@ -477,16 +482,16 @@ lpwsinc_push_residue (GstLPWSinc * self) /* get notified of caps and plug in the correct process function */ static gboolean -lpwsinc_setup (GstAudioFilter * base, GstRingBufferSpec * format) +audio_wsinclimit_setup (GstAudioFilter * base, GstRingBufferSpec * format) { - GstLPWSinc *self = GST_LPWSINC (base); + GstAudioWSincLimit *self = GST_AUDIO_WSINC_LIMIT (base); gboolean ret = TRUE; if (format->width == 32) - self->process = (GstLPWSincProcessFunc) process_32; + self->process = (GstAudioWSincLimitProcessFunc) process_32; else if (format->width == 64) - self->process = (GstLPWSincProcessFunc) process_64; + self->process = (GstAudioWSincLimitProcessFunc) process_64; else ret = FALSE; @@ -498,10 +503,10 @@ lpwsinc_setup (GstAudioFilter * base, GstRingBufferSpec * format) /* GstBaseTransform vmethod implementations */ static GstFlowReturn -lpwsinc_transform (GstBaseTransform * base, GstBuffer * inbuf, +audio_wsinclimit_transform (GstBaseTransform * base, GstBuffer * inbuf, GstBuffer * outbuf) { - GstLPWSinc *self = GST_LPWSINC (base); + GstAudioWSincLimit *self = GST_AUDIO_WSINC_LIMIT (base); GstClockTime timestamp; gint channels = GST_AUDIO_FILTER (self)->format.channels; gint rate = GST_AUDIO_FILTER (self)->format.rate; @@ -516,7 +521,7 @@ lpwsinc_transform (GstBaseTransform * base, GstBuffer * inbuf, gst_object_sync_values (G_OBJECT (self), timestamp); if (!self->have_kernel) - lpwsinc_build_kernel (self); + audio_wsinclimit_build_kernel (self); /* Reset the residue if already existing on discont buffers */ if (GST_BUFFER_IS_DISCONT (inbuf)) { @@ -616,9 +621,9 @@ lpwsinc_transform (GstBaseTransform * base, GstBuffer * inbuf, } static gboolean -lpwsinc_start (GstBaseTransform * base) +audio_wsinclimit_start (GstBaseTransform * base) { - GstLPWSinc *self = GST_LPWSINC (base); + GstAudioWSincLimit *self = GST_AUDIO_WSINC_LIMIT (base); gint channels = GST_AUDIO_FILTER (self)->format.channels; /* Reset the residue if already existing */ @@ -634,9 +639,9 @@ lpwsinc_start (GstBaseTransform * base) } static gboolean -lpwsinc_query (GstPad * pad, GstQuery * query) +audio_wsinclimit_query (GstPad * pad, GstQuery * query) { - GstLPWSinc *self = GST_LPWSINC (gst_pad_get_parent (pad)); + GstAudioWSincLimit *self = GST_AUDIO_WSINC_LIMIT (gst_pad_get_parent (pad)); gboolean res = TRUE; switch (GST_QUERY_TYPE (query)) { @@ -687,7 +692,7 @@ lpwsinc_query (GstPad * pad, GstQuery * query) } static const GstQueryType * -lpwsinc_query_type (GstPad * pad) +audio_wsinclimit_query_type (GstPad * pad) { static const GstQueryType types[] = { GST_QUERY_LATENCY, @@ -698,13 +703,13 @@ lpwsinc_query_type (GstPad * pad) } static gboolean -lpwsinc_event (GstBaseTransform * base, GstEvent * event) +audio_wsinclimit_event (GstBaseTransform * base, GstEvent * event) { - GstLPWSinc *self = GST_LPWSINC (base); + GstAudioWSincLimit *self = GST_AUDIO_WSINC_LIMIT (base); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - lpwsinc_push_residue (self); + audio_wsinclimit_push_residue (self); break; default: break; @@ -714,12 +719,12 @@ lpwsinc_event (GstBaseTransform * base, GstEvent * event) } static void -lpwsinc_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) +audio_wsinclimit_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) { - GstLPWSinc *self = GST_LPWSINC (object); + GstAudioWSincLimit *self = GST_AUDIO_WSINC_LIMIT (object); - g_return_if_fail (GST_IS_LPWSINC (self)); + g_return_if_fail (GST_IS_AUDIO_WSINC_LIMIT (self)); switch (prop_id) { case PROP_LENGTH:{ @@ -732,13 +737,13 @@ lpwsinc_set_property (GObject * object, guint prop_id, const GValue * value, if (val != self->kernel_length) { if (self->residue) { - lpwsinc_push_residue (self); + audio_wsinclimit_push_residue (self); g_free (self->residue); self->residue = NULL; } self->kernel_length = val; self->latency = val / 2; - lpwsinc_build_kernel (self); + audio_wsinclimit_build_kernel (self); gst_element_post_message (GST_ELEMENT (self), gst_message_new_latency (GST_OBJECT (self))); } @@ -748,19 +753,19 @@ lpwsinc_set_property (GObject * object, guint prop_id, const GValue * value, case PROP_FREQUENCY: GST_BASE_TRANSFORM_LOCK (self); self->cutoff = g_value_get_float (value); - lpwsinc_build_kernel (self); + audio_wsinclimit_build_kernel (self); GST_BASE_TRANSFORM_UNLOCK (self); break; case PROP_MODE: GST_BASE_TRANSFORM_LOCK (self); self->mode = g_value_get_enum (value); - lpwsinc_build_kernel (self); + audio_wsinclimit_build_kernel (self); GST_BASE_TRANSFORM_UNLOCK (self); break; case PROP_WINDOW: GST_BASE_TRANSFORM_LOCK (self); self->window = g_value_get_enum (value); - lpwsinc_build_kernel (self); + audio_wsinclimit_build_kernel (self); GST_BASE_TRANSFORM_UNLOCK (self); break; default: @@ -770,10 +775,10 @@ lpwsinc_set_property (GObject * object, guint prop_id, const GValue * value, } static void -lpwsinc_get_property (GObject * object, guint prop_id, GValue * value, +audio_wsinclimit_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { - GstLPWSinc *self = GST_LPWSINC (object); + GstAudioWSincLimit *self = GST_AUDIO_WSINC_LIMIT (object); switch (prop_id) { case PROP_LENGTH: diff --git a/gst/audiofx/audiowsinclimit.h b/gst/audiofx/audiowsinclimit.h index f56f5a4..b781a42 100644 --- a/gst/audiofx/audiowsinclimit.h +++ b/gst/audiofx/audiowsinclimit.h @@ -27,41 +27,40 @@ * */ -#ifndef __GST_LPWSINC_H__ -#define __GST_LPWSINC_H__ +#ifndef __GST_AUDIO_WSINC_LIMIT_H__ +#define __GST_AUDIO_WSINC_LIMIT_H__ -#include "gstfilter.h" #include #include G_BEGIN_DECLS -#define GST_TYPE_LPWSINC \ - (gst_lpwsinc_get_type()) -#define GST_LPWSINC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LPWSINC,GstLPWSinc)) -#define GST_LPWSINC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_LPWSINC,GstLPWSincClass)) -#define GST_IS_LPWSINC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_LPWSINC)) -#define GST_IS_LPWSINC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LPWSINC)) +#define GST_TYPE_AUDIO_WSINC_LIMIT \ + (audio_wsinclimit_get_type()) +#define GST_AUDIO_WSINC_LIMIT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_WSINC_LIMIT,GstAudioWSincLimit)) +#define GST_AUDIO_WSINC_LIMIT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_WSINC_LIMIT,GstAudioWSincLimitClass)) +#define GST_IS_AUDIO_WSINC_LIMIT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_WSINC_LIMIT)) +#define GST_IS_AUDIO_WSINC_LIMIT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_WSINC_LIMIT)) -typedef struct _GstLPWSinc GstLPWSinc; -typedef struct _GstLPWSincClass GstLPWSincClass; +typedef struct _GstAudioWSincLimit GstAudioWSincLimit; +typedef struct _GstAudioWSincLimitClass GstAudioWSincLimitClass; -typedef void (*GstLPWSincProcessFunc) (GstLPWSinc *, guint8 *, guint8 *, guint); +typedef void (*GstAudioWSincLimitProcessFunc) (GstAudioWSincLimit *, guint8 *, guint8 *, guint); /** - * GstLPWSinc: + * GstAudioWSincLimit: * * Opaque data structure. */ -struct _GstLPWSinc { +struct _GstAudioWSincLimit { GstAudioFilter element; /* < private > */ - GstLPWSincProcessFunc process; + GstAudioWSincLimitProcessFunc process; gint mode; gint window; @@ -77,12 +76,12 @@ struct _GstLPWSinc { guint64 next_off; }; -struct _GstLPWSincClass { +struct _GstAudioWSincLimitClass { GstAudioFilterClass parent_class; }; -GType gst_lpwsinc_get_type (void); +GType audio_wsinclimit_get_type (void); G_END_DECLS -#endif /* __GST_LPWSINC_H__ */ +#endif /* __GST_AUDIO_WSINC_LIMIT_H__ */ diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index dac5d16..68abd27 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -59,6 +59,8 @@ check_PROGRAMS = \ elements/audiocheblimit \ elements/audioamplify \ elements/audiodynamic \ + elements/audiowsincband \ + elements/audiowsinclimit \ elements/avimux \ elements/avisubtitle \ elements/icydemux \ diff --git a/tests/check/elements/audiowsincband.c b/tests/check/elements/audiowsincband.c index 7d2e416..c3ea37f 100644 --- a/tests/check/elements/audiowsincband.c +++ b/tests/check/elements/audiowsincband.c @@ -2,7 +2,7 @@ * * Copyright (C) 2007 Sebastian Dröge * - * bpwsinc.c: Unit test for the bpwsinc element + * audiowsincband.c: Unit test for the audiowsincband element * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -31,14 +31,14 @@ * get_peer, and then remove references in every test function */ GstPad *mysrcpad, *mysinkpad; -#define BPWSINC_CAPS_STRING_32 \ +#define AUDIO_WSINC_BAND_CAPS_STRING_32 \ "audio/x-raw-float, " \ "channels = (int) 1, " \ "rate = (int) 44100, " \ "endianness = (int) BYTE_ORDER, " \ "width = (int) 32" \ -#define BPWSINC_CAPS_STRING_64 \ +#define AUDIO_WSINC_BAND_CAPS_STRING_64 \ "audio/x-raw-float, " \ "channels = (int) 1, " \ "rate = (int) 44100, " \ @@ -63,24 +63,24 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", ); GstElement * -setup_bpwsinc () +setup_audiowsincband () { - GstElement *bpwsinc; + GstElement *audiowsincband; - GST_DEBUG ("setup_bpwsinc"); - bpwsinc = gst_check_setup_element ("bpwsinc"); - mysrcpad = gst_check_setup_src_pad (bpwsinc, &srctemplate, NULL); - mysinkpad = gst_check_setup_sink_pad (bpwsinc, &sinktemplate, NULL); + GST_DEBUG ("setup_audiowsincband"); + audiowsincband = gst_check_setup_element ("audiowsincband"); + mysrcpad = gst_check_setup_src_pad (audiowsincband, &srctemplate, NULL); + mysinkpad = gst_check_setup_sink_pad (audiowsincband, &sinktemplate, NULL); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); - return bpwsinc; + return audiowsincband; } void -cleanup_bpwsinc (GstElement * bpwsinc) +cleanup_audiowsincband (GstElement * audiowsincband) { - GST_DEBUG ("cleanup_bpwsinc"); + GST_DEBUG ("cleanup_audiowsincband"); g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); g_list_free (buffers); @@ -88,9 +88,9 @@ cleanup_bpwsinc (GstElement * bpwsinc) gst_pad_set_active (mysrcpad, FALSE); gst_pad_set_active (mysinkpad, FALSE); - gst_check_teardown_src_pad (bpwsinc); - gst_check_teardown_sink_pad (bpwsinc); - gst_check_teardown_element (bpwsinc); + gst_check_teardown_src_pad (audiowsincband); + gst_check_teardown_sink_pad (audiowsincband); + gst_check_teardown_element (audiowsincband); } /* Test if data containing only one frequency component @@ -98,32 +98,32 @@ cleanup_bpwsinc (GstElement * bpwsinc) * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_32_bp_0hz) { - GstElement *bpwsinc; + GstElement *audiowsincband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; GList *node; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandpass */ - g_object_set (G_OBJECT (bpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 31, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", 44100 / 4.0 - 1000, - NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", 44100 / 4.0 + 1000, - NULL); + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", + 44100 / 4.0 - 1000, NULL); + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", + 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 1024; i++) in[i] = 1.0; - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_32); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -149,7 +149,7 @@ GST_START_TEST (test_32_bp_0hz) } /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -159,26 +159,26 @@ GST_END_TEST; * and a 2000Hz frequency band around rate/4 */ GST_START_TEST (test_32_bp_11025hz) { - GstElement *bpwsinc; + GstElement *audiowsincband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; GList *node; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandpass */ - g_object_set (G_OBJECT (bpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 31, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", 44100 / 4.0 - 1000, - NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", 44100 / 4.0 + 1000, - NULL); + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", + 44100 / 4.0 - 1000, NULL); + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", + 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 1024; i += 4) { @@ -188,7 +188,7 @@ GST_START_TEST (test_32_bp_11025hz) in[i + 3] = -1.0; } - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_32); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -214,7 +214,7 @@ GST_START_TEST (test_32_bp_11025hz) } /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -225,26 +225,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_32_bp_22050hz) { - GstElement *bpwsinc; + GstElement *audiowsincband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; GList *node; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandpass */ - g_object_set (G_OBJECT (bpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 31, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", 44100 / 4.0 - 1000, - NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", 44100 / 4.0 + 1000, - NULL); + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", + 44100 / 4.0 - 1000, NULL); + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", + 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 1024; i += 2) { @@ -252,7 +252,7 @@ GST_START_TEST (test_32_bp_22050hz) in[i + 1] = -1.0; } - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_32); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -278,7 +278,7 @@ GST_START_TEST (test_32_bp_22050hz) } /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -288,32 +288,32 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_32_br_0hz) { - GstElement *bpwsinc; + GstElement *audiowsincband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; GList *node; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandreject */ - g_object_set (G_OBJECT (bpwsinc), "mode", 1, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 31, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", 44100 / 4.0 - 1000, - NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", 44100 / 4.0 + 1000, - NULL); + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", + 44100 / 4.0 - 1000, NULL); + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", + 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 1024; i++) in[i] = 1.0; - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_32); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -339,7 +339,7 @@ GST_START_TEST (test_32_br_0hz) } /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -349,26 +349,26 @@ GST_END_TEST; * and a 2000Hz frequency band around rate/4 */ GST_START_TEST (test_32_br_11025hz) { - GstElement *bpwsinc; + GstElement *audiowsincband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; GList *node; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandreject */ - g_object_set (G_OBJECT (bpwsinc), "mode", 1, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 31, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", 44100 / 4.0 - 1000, - NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", 44100 / 4.0 + 1000, - NULL); + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", + 44100 / 4.0 - 1000, NULL); + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", + 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -379,7 +379,7 @@ GST_START_TEST (test_32_br_11025hz) in[i + 3] = -1.0; } - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_32); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -405,7 +405,7 @@ GST_START_TEST (test_32_br_11025hz) } /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -416,26 +416,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_32_br_22050hz) { - GstElement *bpwsinc; + GstElement *audiowsincband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; GList *node; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandreject */ - g_object_set (G_OBJECT (bpwsinc), "mode", 1, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 31, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", 44100 / 4.0 - 1000, - NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", 44100 / 4.0 + 1000, - NULL); + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", + 44100 / 4.0 - 1000, NULL); + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", + 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 1024; i += 2) { @@ -443,7 +443,7 @@ GST_START_TEST (test_32_br_22050hz) in[i + 1] = -1.0; } - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_32); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -469,7 +469,7 @@ GST_START_TEST (test_32_br_22050hz) } /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -478,32 +478,31 @@ GST_END_TEST; * correctly without accessing wrong memory areas */ GST_START_TEST (test_32_small_buffer) { - GstElement *bpwsinc; - GstBuffer *inbuffer, *outbuffer; + GstElement *audiowsincband; + GstBuffer *inbuffer; GstCaps *caps; gfloat *in; - gfloat *res; gint i; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandpass */ - g_object_set (G_OBJECT (bpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 101, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 101, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", 44100 / 4.0 - 44100 / 16.0, NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", 44100 / 4.0 + 44100 / 16.0, NULL); inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 20; i++) in[i] = 1.0; - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_32); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -515,7 +514,7 @@ GST_START_TEST (test_32_small_buffer) fail_unless (g_list_length (buffers) >= 1); /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -533,32 +532,32 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_64_bp_0hz) { - GstElement *bpwsinc; + GstElement *audiowsincband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; GList *node; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandpass */ - g_object_set (G_OBJECT (bpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 31, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", 44100 / 4.0 - 1000, - NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", 44100 / 4.0 + 1000, - NULL); + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", + 44100 / 4.0 - 1000, NULL); + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", + 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 1024; i++) in[i] = 1.0; - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_64); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -584,7 +583,7 @@ GST_START_TEST (test_64_bp_0hz) } /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -594,26 +593,26 @@ GST_END_TEST; * and a 2000Hz frequency band around rate/4 */ GST_START_TEST (test_64_bp_11025hz) { - GstElement *bpwsinc; + GstElement *audiowsincband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; GList *node; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandpass */ - g_object_set (G_OBJECT (bpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 31, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", 44100 / 4.0 - 1000, - NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", 44100 / 4.0 + 1000, - NULL); + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", + 44100 / 4.0 - 1000, NULL); + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", + 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 1024; i += 4) { @@ -623,7 +622,7 @@ GST_START_TEST (test_64_bp_11025hz) in[i + 3] = -1.0; } - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_64); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -649,7 +648,7 @@ GST_START_TEST (test_64_bp_11025hz) } /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -660,26 +659,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_64_bp_22050hz) { - GstElement *bpwsinc; + GstElement *audiowsincband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; GList *node; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandpass */ - g_object_set (G_OBJECT (bpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 31, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", 44100 / 4.0 - 1000, - NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", 44100 / 4.0 + 1000, - NULL); + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", + 44100 / 4.0 - 1000, NULL); + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", + 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 1024; i += 2) { @@ -687,7 +686,7 @@ GST_START_TEST (test_64_bp_22050hz) in[i + 1] = -1.0; } - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_64); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -713,7 +712,7 @@ GST_START_TEST (test_64_bp_22050hz) } /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -723,32 +722,32 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_64_br_0hz) { - GstElement *bpwsinc; + GstElement *audiowsincband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; GList *node; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandreject */ - g_object_set (G_OBJECT (bpwsinc), "mode", 1, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 31, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", 44100 / 4.0 - 1000, - NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", 44100 / 4.0 + 1000, - NULL); + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", + 44100 / 4.0 - 1000, NULL); + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", + 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 1024; i++) in[i] = 1.0; - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_64); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -774,7 +773,7 @@ GST_START_TEST (test_64_br_0hz) } /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -784,26 +783,26 @@ GST_END_TEST; * and a 2000Hz frequency band around rate/4 */ GST_START_TEST (test_64_br_11025hz) { - GstElement *bpwsinc; + GstElement *audiowsincband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; GList *node; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandreject */ - g_object_set (G_OBJECT (bpwsinc), "mode", 1, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 31, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", 44100 / 4.0 - 1000, - NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", 44100 / 4.0 + 1000, - NULL); + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", + 44100 / 4.0 - 1000, NULL); + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", + 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -814,7 +813,7 @@ GST_START_TEST (test_64_br_11025hz) in[i + 3] = -1.0; } - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_64); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -840,7 +839,7 @@ GST_START_TEST (test_64_br_11025hz) } /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -851,26 +850,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_64_br_22050hz) { - GstElement *bpwsinc; + GstElement *audiowsincband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; GList *node; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandreject */ - g_object_set (G_OBJECT (bpwsinc), "mode", 1, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 31, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", 44100 / 4.0 - 1000, - NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", 44100 / 4.0 + 1000, - NULL); + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", + 44100 / 4.0 - 1000, NULL); + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", + 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 1024; i += 2) { @@ -878,7 +877,7 @@ GST_START_TEST (test_64_br_22050hz) in[i + 1] = -1.0; } - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_64); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -904,7 +903,7 @@ GST_START_TEST (test_64_br_22050hz) } /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; @@ -913,32 +912,31 @@ GST_END_TEST; * correctly without accessing wrong memory areas */ GST_START_TEST (test_64_small_buffer) { - GstElement *bpwsinc; - GstBuffer *inbuffer, *outbuffer; + GstElement *audiowsincband; + GstBuffer *inbuffer; GstCaps *caps; gdouble *in; - gdouble *res; gint i; - bpwsinc = setup_bpwsinc (); + audiowsincband = setup_audiowsincband (); /* Set to bandpass */ - g_object_set (G_OBJECT (bpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (bpwsinc), "length", 101, NULL); + g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsincband), "length", 101, NULL); - fail_unless (gst_element_set_state (bpwsinc, + fail_unless (gst_element_set_state (audiowsincband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (bpwsinc), "lower-frequency", + g_object_set (G_OBJECT (audiowsincband), "lower-frequency", 44100 / 4.0 - 44100 / 16.0, NULL); - g_object_set (G_OBJECT (bpwsinc), "upper-frequency", + g_object_set (G_OBJECT (audiowsincband), "upper-frequency", 44100 / 4.0 + 44100 / 16.0, NULL); inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 20; i++) in[i] = 1.0; - caps = gst_caps_from_string (BPWSINC_CAPS_STRING_64); + caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -950,15 +948,15 @@ GST_START_TEST (test_64_small_buffer) fail_unless (g_list_length (buffers) >= 1); /* cleanup */ - cleanup_bpwsinc (bpwsinc); + cleanup_audiowsincband (audiowsincband); } GST_END_TEST; Suite * -bpwsinc_suite (void) +audiowsincband_suite (void) { - Suite *s = suite_create ("bpwsinc"); + Suite *s = suite_create ("audiowsincband"); TCase *tc_chain = tcase_create ("general"); suite_add_tcase (s, tc_chain); @@ -985,7 +983,7 @@ main (int argc, char **argv) { int nf; - Suite *s = bpwsinc_suite (); + Suite *s = audiowsincband_suite (); SRunner *sr = srunner_create (s); gst_check_init (&argc, &argv); diff --git a/tests/check/elements/audiowsinclimit.c b/tests/check/elements/audiowsinclimit.c index 934a29d..da17604 100644 --- a/tests/check/elements/audiowsinclimit.c +++ b/tests/check/elements/audiowsinclimit.c @@ -2,7 +2,7 @@ * * Copyright (C) 2007 Sebastian Dröge * - * lpwsinc.c: Unit test for the lpwsinc element + * audiowsinclimit.c: Unit test for the audiowsinclimit element * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -31,14 +31,14 @@ * get_peer, and then remove references in every test function */ GstPad *mysrcpad, *mysinkpad; -#define LPWSINC_CAPS_STRING_32 \ +#define AUDIO_WSINC_LIMIT_CAPS_STRING_32 \ "audio/x-raw-float, " \ "channels = (int) 1, " \ "rate = (int) 44100, " \ "endianness = (int) BYTE_ORDER, " \ "width = (int) 32" \ -#define LPWSINC_CAPS_STRING_64 \ +#define AUDIO_WSINC_LIMIT_CAPS_STRING_64 \ "audio/x-raw-float, " \ "channels = (int) 1, " \ "rate = (int) 44100, " \ @@ -63,24 +63,24 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", ); GstElement * -setup_lpwsinc () +setup_audiowsinclimit () { - GstElement *lpwsinc; + GstElement *audiowsinclimit; - GST_DEBUG ("setup_lpwsinc"); - lpwsinc = gst_check_setup_element ("lpwsinc"); - mysrcpad = gst_check_setup_src_pad (lpwsinc, &srctemplate, NULL); - mysinkpad = gst_check_setup_sink_pad (lpwsinc, &sinktemplate, NULL); + GST_DEBUG ("setup_audiowsinclimit"); + audiowsinclimit = gst_check_setup_element ("audiowsinclimit"); + mysrcpad = gst_check_setup_src_pad (audiowsinclimit, &srctemplate, NULL); + mysinkpad = gst_check_setup_sink_pad (audiowsinclimit, &sinktemplate, NULL); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); - return lpwsinc; + return audiowsinclimit; } void -cleanup_lpwsinc (GstElement * lpwsinc) +cleanup_audiowsinclimit (GstElement * audiowsinclimit) { - GST_DEBUG ("cleanup_lpwsinc"); + GST_DEBUG ("cleanup_audiowsinclimit"); g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); g_list_free (buffers); @@ -88,9 +88,9 @@ cleanup_lpwsinc (GstElement * lpwsinc) gst_pad_set_active (mysrcpad, FALSE); gst_pad_set_active (mysinkpad, FALSE); - gst_check_teardown_src_pad (lpwsinc); - gst_check_teardown_sink_pad (lpwsinc); - gst_check_teardown_element (lpwsinc); + gst_check_teardown_src_pad (audiowsinclimit); + gst_check_teardown_sink_pad (audiowsinclimit); + gst_check_teardown_element (audiowsinclimit); } /* Test if data containing only one frequency component @@ -98,30 +98,30 @@ cleanup_lpwsinc (GstElement * lpwsinc) * at rate/4 */ GST_START_TEST (test_32_lp_0hz) { - GstElement *lpwsinc; + GstElement *audiowsinclimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; GList *node; - lpwsinc = setup_lpwsinc (); + audiowsinclimit = setup_audiowsinclimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (lpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (lpwsinc), "length", 21, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "length", 21, NULL); - fail_unless (gst_element_set_state (lpwsinc, + fail_unless (gst_element_set_state (audiowsinclimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); /* cutoff = sampling rate / 4, data = 0 */ - g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i++) in[i] = 1.0; - caps = gst_caps_from_string (LPWSINC_CAPS_STRING_32); + caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -147,7 +147,7 @@ GST_START_TEST (test_32_lp_0hz) } /* cleanup */ - cleanup_lpwsinc (lpwsinc); + cleanup_audiowsinclimit (audiowsinclimit); } GST_END_TEST; @@ -157,23 +157,23 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_32_lp_22050hz) { - GstElement *lpwsinc; + GstElement *audiowsinclimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; GList *node; - lpwsinc = setup_lpwsinc (); + audiowsinclimit = setup_audiowsinclimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (lpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (lpwsinc), "length", 21, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "length", 21, NULL); - fail_unless (gst_element_set_state (lpwsinc, + fail_unless (gst_element_set_state (audiowsinclimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i += 2) { @@ -181,7 +181,7 @@ GST_START_TEST (test_32_lp_22050hz) in[i + 1] = -1.0; } - caps = gst_caps_from_string (LPWSINC_CAPS_STRING_32); + caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -207,7 +207,7 @@ GST_START_TEST (test_32_lp_22050hz) } /* cleanup */ - cleanup_lpwsinc (lpwsinc); + cleanup_audiowsinclimit (audiowsinclimit); } GST_END_TEST; @@ -217,29 +217,29 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_32_hp_0hz) { - GstElement *lpwsinc; + GstElement *audiowsinclimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; GList *node; - lpwsinc = setup_lpwsinc (); + audiowsinclimit = setup_audiowsinclimit (); /* Set to highpass */ - g_object_set (G_OBJECT (lpwsinc), "mode", 1, NULL); - g_object_set (G_OBJECT (lpwsinc), "length", 21, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "mode", 1, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "length", 21, NULL); - fail_unless (gst_element_set_state (lpwsinc, + fail_unless (gst_element_set_state (audiowsinclimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i++) in[i] = 1.0; - caps = gst_caps_from_string (LPWSINC_CAPS_STRING_32); + caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -265,7 +265,7 @@ GST_START_TEST (test_32_hp_0hz) } /* cleanup */ - cleanup_lpwsinc (lpwsinc); + cleanup_audiowsinclimit (audiowsinclimit); } GST_END_TEST; @@ -275,23 +275,23 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_32_hp_22050hz) { - GstElement *lpwsinc; + GstElement *audiowsinclimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; GList *node; - lpwsinc = setup_lpwsinc (); + audiowsinclimit = setup_audiowsinclimit (); /* Set to highpass */ - g_object_set (G_OBJECT (lpwsinc), "mode", 1, NULL); - g_object_set (G_OBJECT (lpwsinc), "length", 21, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "mode", 1, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "length", 21, NULL); - fail_unless (gst_element_set_state (lpwsinc, + fail_unless (gst_element_set_state (audiowsinclimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i += 2) { @@ -299,7 +299,7 @@ GST_START_TEST (test_32_hp_22050hz) in[i + 1] = -1.0; } - caps = gst_caps_from_string (LPWSINC_CAPS_STRING_32); + caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -326,7 +326,7 @@ GST_START_TEST (test_32_hp_22050hz) } /* cleanup */ - cleanup_lpwsinc (lpwsinc); + cleanup_audiowsinclimit (audiowsinclimit); } GST_END_TEST; @@ -335,29 +335,28 @@ GST_END_TEST; * correctly without accessing wrong memory areas */ GST_START_TEST (test_32_small_buffer) { - GstElement *lpwsinc; + GstElement *audiowsinclimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in; - gfloat *res; gint i; - lpwsinc = setup_lpwsinc (); + audiowsinclimit = setup_audiowsinclimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (lpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (lpwsinc), "length", 101, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "length", 101, NULL); - fail_unless (gst_element_set_state (lpwsinc, + fail_unless (gst_element_set_state (audiowsinclimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 20; i++) in[i] = 1.0; - caps = gst_caps_from_string (LPWSINC_CAPS_STRING_32); + caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -370,7 +369,7 @@ GST_START_TEST (test_32_small_buffer) fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); /* cleanup */ - cleanup_lpwsinc (lpwsinc); + cleanup_audiowsinclimit (audiowsinclimit); } GST_END_TEST; @@ -380,30 +379,30 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_64_lp_0hz) { - GstElement *lpwsinc; + GstElement *audiowsinclimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; GList *node; - lpwsinc = setup_lpwsinc (); + audiowsinclimit = setup_audiowsinclimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (lpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (lpwsinc), "length", 21, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "length", 21, NULL); - fail_unless (gst_element_set_state (lpwsinc, + fail_unless (gst_element_set_state (audiowsinclimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); /* cutoff = sampling rate / 4, data = 0 */ - g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i++) in[i] = 1.0; - caps = gst_caps_from_string (LPWSINC_CAPS_STRING_64); + caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -429,7 +428,7 @@ GST_START_TEST (test_64_lp_0hz) } /* cleanup */ - cleanup_lpwsinc (lpwsinc); + cleanup_audiowsinclimit (audiowsinclimit); } GST_END_TEST; @@ -439,23 +438,23 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_64_lp_22050hz) { - GstElement *lpwsinc; + GstElement *audiowsinclimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; GList *node; - lpwsinc = setup_lpwsinc (); + audiowsinclimit = setup_audiowsinclimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (lpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (lpwsinc), "length", 21, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "length", 21, NULL); - fail_unless (gst_element_set_state (lpwsinc, + fail_unless (gst_element_set_state (audiowsinclimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i += 2) { @@ -463,7 +462,7 @@ GST_START_TEST (test_64_lp_22050hz) in[i + 1] = -1.0; } - caps = gst_caps_from_string (LPWSINC_CAPS_STRING_64); + caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -489,7 +488,7 @@ GST_START_TEST (test_64_lp_22050hz) } /* cleanup */ - cleanup_lpwsinc (lpwsinc); + cleanup_audiowsinclimit (audiowsinclimit); } GST_END_TEST; @@ -499,29 +498,29 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_64_hp_0hz) { - GstElement *lpwsinc; + GstElement *audiowsinclimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; GList *node; - lpwsinc = setup_lpwsinc (); + audiowsinclimit = setup_audiowsinclimit (); /* Set to highpass */ - g_object_set (G_OBJECT (lpwsinc), "mode", 1, NULL); - g_object_set (G_OBJECT (lpwsinc), "length", 21, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "mode", 1, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "length", 21, NULL); - fail_unless (gst_element_set_state (lpwsinc, + fail_unless (gst_element_set_state (audiowsinclimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i++) in[i] = 1.0; - caps = gst_caps_from_string (LPWSINC_CAPS_STRING_64); + caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -547,7 +546,7 @@ GST_START_TEST (test_64_hp_0hz) } /* cleanup */ - cleanup_lpwsinc (lpwsinc); + cleanup_audiowsinclimit (audiowsinclimit); } GST_END_TEST; @@ -557,23 +556,23 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_64_hp_22050hz) { - GstElement *lpwsinc; + GstElement *audiowsinclimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; GList *node; - lpwsinc = setup_lpwsinc (); + audiowsinclimit = setup_audiowsinclimit (); /* Set to highpass */ - g_object_set (G_OBJECT (lpwsinc), "mode", 1, NULL); - g_object_set (G_OBJECT (lpwsinc), "length", 21, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "mode", 1, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "length", 21, NULL); - fail_unless (gst_element_set_state (lpwsinc, + fail_unless (gst_element_set_state (audiowsinclimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i += 2) { @@ -581,7 +580,7 @@ GST_START_TEST (test_64_hp_22050hz) in[i + 1] = -1.0; } - caps = gst_caps_from_string (LPWSINC_CAPS_STRING_64); + caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -608,7 +607,7 @@ GST_START_TEST (test_64_hp_22050hz) } /* cleanup */ - cleanup_lpwsinc (lpwsinc); + cleanup_audiowsinclimit (audiowsinclimit); } GST_END_TEST; @@ -617,29 +616,28 @@ GST_END_TEST; * correctly without accessing wrong memory areas */ GST_START_TEST (test_64_small_buffer) { - GstElement *lpwsinc; + GstElement *audiowsinclimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in; - gdouble *res; gint i; - lpwsinc = setup_lpwsinc (); + audiowsinclimit = setup_audiowsinclimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (lpwsinc), "mode", 0, NULL); - g_object_set (G_OBJECT (lpwsinc), "length", 101, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "length", 101, NULL); - fail_unless (gst_element_set_state (lpwsinc, + fail_unless (gst_element_set_state (audiowsinclimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL); + g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 20; i++) in[i] = 1.0; - caps = gst_caps_from_string (LPWSINC_CAPS_STRING_64); + caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64); gst_buffer_set_caps (inbuffer, caps); gst_caps_unref (caps); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); @@ -652,15 +650,15 @@ GST_START_TEST (test_64_small_buffer) fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); /* cleanup */ - cleanup_lpwsinc (lpwsinc); + cleanup_audiowsinclimit (audiowsinclimit); } GST_END_TEST; Suite * -lpwsinc_suite (void) +audiowsinclimit_suite (void) { - Suite *s = suite_create ("lpwsinc"); + Suite *s = suite_create ("audiowsinclimit"); TCase *tc_chain = tcase_create ("general"); suite_add_tcase (s, tc_chain); @@ -683,7 +681,7 @@ main (int argc, char **argv) { int nf; - Suite *s = lpwsinc_suite (); + Suite *s = audiowsinclimit_suite (); SRunner *sr = srunner_create (s); gst_check_init (&argc, &argv); -- 2.7.4