mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
configure.ac: Depend on gstreamer-0.10.12.1. gst/equalizer/gstiirequalizer.c (ARG_BAND_WIDTH, _do_init, ARG_GAIN, _Gs...
Original commit message from CVS: * configure.ac: Depend on gstreamer-0.10.12.1. * gst/equalizer/gstiirequalizer.c (ARG_BAND_WIDTH, _do_init, ARG_GAIN, _GstIirEqualizerBand, object, _GstIirEqualizerBandClass, parent_class, gst_iir_equalizer_band_set_property, gst_iir_equalizer_band_class_init, gst_iir_equalizer_band_get_type, gst_iir_equalizer_child_proxy_get_child_by_index, gst_iir_equalizer_child_proxy_get_children_count, gst_iir_equalizer_child_proxy_interface_init, setup_filter, gst_iir_equalizer_compute_frequencies, gst_iir_equalizer_set_property, gst_iir_equalizer_get_property, plugin_init): * gst/equalizer/gstiirequalizer.h (audiofilter): * gst/equalizer/gstiirequalizernbands.c (ARG_NUM_BANDS, gst_iir_equalizer_nbands_base_init, gst_iir_equalizer_nbands_init, gst_iir_equalizer_nbands_set_property): Use new locking macros. * gst/filter/gstbpwsinc.c (bpwsinc_set_caps): Add fixme. * gst/spectrum/gstspectrum.c (SPECTRUM_WINDOW_BASE, SPECTRUM_WINDOW_LEN, gst_spectrum_init, gst_spectrum_set_property, gst_spectrum_event, gst_spectrum_transform_ip): Use new locking macros. Turn two fixed values into #defines.
This commit is contained in:
parent
8a718ff686
commit
b2a310f5c0
7 changed files with 59 additions and 33 deletions
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
||||||
|
2007-05-22 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
|
* configure.ac:
|
||||||
|
Depend on gstreamer-0.10.12.1.
|
||||||
|
|
||||||
|
* gst/equalizer/gstiirequalizer.c (ARG_BAND_WIDTH, _do_init, ARG_GAIN,
|
||||||
|
_GstIirEqualizerBand, object, _GstIirEqualizerBandClass,
|
||||||
|
parent_class, gst_iir_equalizer_band_set_property,
|
||||||
|
gst_iir_equalizer_band_class_init, gst_iir_equalizer_band_get_type,
|
||||||
|
gst_iir_equalizer_child_proxy_get_child_by_index,
|
||||||
|
gst_iir_equalizer_child_proxy_get_children_count,
|
||||||
|
gst_iir_equalizer_child_proxy_interface_init, setup_filter,
|
||||||
|
gst_iir_equalizer_compute_frequencies,
|
||||||
|
gst_iir_equalizer_set_property, gst_iir_equalizer_get_property,
|
||||||
|
plugin_init):
|
||||||
|
* gst/equalizer/gstiirequalizer.h (audiofilter):
|
||||||
|
* gst/equalizer/gstiirequalizernbands.c (ARG_NUM_BANDS,
|
||||||
|
gst_iir_equalizer_nbands_base_init, gst_iir_equalizer_nbands_init,
|
||||||
|
gst_iir_equalizer_nbands_set_property):
|
||||||
|
Use new locking macros.
|
||||||
|
|
||||||
|
* gst/filter/gstbpwsinc.c (bpwsinc_set_caps):
|
||||||
|
Add fixme.
|
||||||
|
|
||||||
|
* gst/spectrum/gstspectrum.c (SPECTRUM_WINDOW_BASE,
|
||||||
|
SPECTRUM_WINDOW_LEN, gst_spectrum_init, gst_spectrum_set_property,
|
||||||
|
gst_spectrum_event, gst_spectrum_transform_ip):
|
||||||
|
Use new locking macros. Turn two fixed values into #defines.
|
||||||
|
|
||||||
2007-05-22 Edward Hervey <edward@fluendo.com>
|
2007-05-22 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
* docs/plugins/Makefile.am:
|
* docs/plugins/Makefile.am:
|
||||||
|
|
|
@ -45,8 +45,8 @@ AM_PROG_LIBTOOL
|
||||||
|
|
||||||
dnl *** required versions of GStreamer stuff ***
|
dnl *** required versions of GStreamer stuff ***
|
||||||
dnl *** remove rtpmanager/equalizer stuff below when this is updated
|
dnl *** remove rtpmanager/equalizer stuff below when this is updated
|
||||||
GST_REQ=0.10.12
|
GST_REQ=0.10.12.1
|
||||||
GSTPB_REQ=0.10.12
|
GSTPB_REQ=0.10.12.1
|
||||||
|
|
||||||
dnl *** autotools stuff ****
|
dnl *** autotools stuff ****
|
||||||
|
|
||||||
|
|
|
@ -433,7 +433,8 @@ gst_iir_equalizer_set_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
|
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
|
||||||
|
|
||||||
GST_EQUALIZER_TRANSFORM_LOCK (equ);
|
g_mutex_lock (((GstBaseTransform *) (equ))->transform_lock);
|
||||||
|
//GST_BASE_TRANSFORM_LOCK (equ);
|
||||||
GST_OBJECT_LOCK (equ);
|
GST_OBJECT_LOCK (equ);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_BAND_WIDTH:
|
case ARG_BAND_WIDTH:
|
||||||
|
@ -453,7 +454,7 @@ gst_iir_equalizer_set_property (GObject * object, guint prop_id,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (equ);
|
GST_OBJECT_UNLOCK (equ);
|
||||||
GST_EQUALIZER_TRANSFORM_UNLOCK (equ);
|
GST_BASE_TRANSFORM_UNLOCK (equ);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -462,7 +463,7 @@ gst_iir_equalizer_get_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
|
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
|
||||||
|
|
||||||
GST_EQUALIZER_TRANSFORM_LOCK (equ);
|
GST_BASE_TRANSFORM_LOCK (equ);
|
||||||
GST_OBJECT_LOCK (equ);
|
GST_OBJECT_LOCK (equ);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_BAND_WIDTH:
|
case ARG_BAND_WIDTH:
|
||||||
|
@ -473,7 +474,7 @@ gst_iir_equalizer_get_property (GObject * object, guint prop_id,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (equ);
|
GST_OBJECT_UNLOCK (equ);
|
||||||
GST_EQUALIZER_TRANSFORM_UNLOCK (equ);
|
GST_BASE_TRANSFORM_UNLOCK (equ);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start of code that is type specific */
|
/* start of code that is type specific */
|
||||||
|
|
|
@ -25,14 +25,6 @@
|
||||||
#include <gst/audio/gstringbuffer.h>
|
#include <gst/audio/gstringbuffer.h>
|
||||||
#include <gst/controller/gstcontroller.h>
|
#include <gst/controller/gstcontroller.h>
|
||||||
|
|
||||||
|
|
||||||
#define GST_EQUALIZER_TRANSFORM_LOCK(eq) \
|
|
||||||
g_mutex_lock (GST_BASE_TRANSFORM(eq)->transform_lock)
|
|
||||||
|
|
||||||
#define GST_EQUALIZER_TRANSFORM_UNLOCK(eq) \
|
|
||||||
g_mutex_unlock (GST_BASE_TRANSFORM(eq)->transform_lock)
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _GstIirEqualizer GstIirEqualizer;
|
typedef struct _GstIirEqualizer GstIirEqualizer;
|
||||||
typedef struct _GstIirEqualizerClass GstIirEqualizerClass;
|
typedef struct _GstIirEqualizerClass GstIirEqualizerClass;
|
||||||
typedef struct _GstIirEqualizerBand GstIirEqualizerBand;
|
typedef struct _GstIirEqualizerBand GstIirEqualizerBand;
|
||||||
|
@ -59,7 +51,7 @@ struct _GstIirEqualizer
|
||||||
GstAudioFilter audiofilter;
|
GstAudioFilter audiofilter;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
|
|
||||||
GstIirEqualizerBand **bands;
|
GstIirEqualizerBand **bands;
|
||||||
|
|
||||||
/* properties */
|
/* properties */
|
||||||
|
|
|
@ -103,7 +103,7 @@ gst_iir_equalizer_nbands_set_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
|
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
|
||||||
|
|
||||||
GST_EQUALIZER_TRANSFORM_LOCK (equ);
|
GST_BASE_TRANSFORM_LOCK (equ);
|
||||||
GST_OBJECT_LOCK (equ);
|
GST_OBJECT_LOCK (equ);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_NUM_BANDS:
|
case ARG_NUM_BANDS:
|
||||||
|
@ -114,7 +114,7 @@ gst_iir_equalizer_nbands_set_property (GObject * object, guint prop_id,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (equ);
|
GST_OBJECT_UNLOCK (equ);
|
||||||
GST_EQUALIZER_TRANSFORM_UNLOCK (equ);
|
GST_BASE_TRANSFORM_UNLOCK (equ);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -181,7 +181,9 @@ bpwsinc_set_caps (GstBaseTransform * base, GstCaps * incaps, GstCaps * outcaps)
|
||||||
"set_caps: in %" GST_PTR_FORMAT " out %" GST_PTR_FORMAT, incaps, outcaps);
|
"set_caps: in %" GST_PTR_FORMAT " out %" GST_PTR_FORMAT, incaps, outcaps);
|
||||||
|
|
||||||
len = this->wing_size;
|
len = this->wing_size;
|
||||||
/* fill the lp kernel */
|
/* fill the lp kernel
|
||||||
|
* FIXME: refactor to own function, this is not caps related
|
||||||
|
*/
|
||||||
GST_DEBUG ("bpwsinc: initializing LP kernel of length %d with cut-off %f",
|
GST_DEBUG ("bpwsinc: initializing LP kernel of length %d with cut-off %f",
|
||||||
len * 2 + 1, this->lower_frequency);
|
len * 2 + 1, this->lower_frequency);
|
||||||
kernel_lp = (double *) g_malloc (sizeof (double) * (2 * len + 1));
|
kernel_lp = (double *) g_malloc (sizeof (double) * (2 * len + 1));
|
||||||
|
|
|
@ -98,6 +98,9 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
#define DEFAULT_BANDS 128
|
#define DEFAULT_BANDS 128
|
||||||
#define DEFAULT_THRESHOLD -60
|
#define DEFAULT_THRESHOLD -60
|
||||||
|
|
||||||
|
#define SPECTRUM_WINDOW_BASE 9
|
||||||
|
#define SPECTRUM_WINDOW_LEN (1 << (SPECTRUM_WINDOW_BASE+1))
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
@ -191,12 +194,10 @@ gst_spectrum_init (GstSpectrum * spectrum, GstSpectrumClass * g_class)
|
||||||
spectrum->interval = DEFAULT_SIGNAL_INTERVAL;
|
spectrum->interval = DEFAULT_SIGNAL_INTERVAL;
|
||||||
spectrum->bands = DEFAULT_BANDS;
|
spectrum->bands = DEFAULT_BANDS;
|
||||||
spectrum->threshold = DEFAULT_THRESHOLD;
|
spectrum->threshold = DEFAULT_THRESHOLD;
|
||||||
spectrum->base = 9;
|
|
||||||
spectrum->len = 1024; /* 2 ^ (base+1) */
|
|
||||||
|
|
||||||
spectrum->loud = g_malloc (spectrum->len * sizeof (gint16));
|
spectrum->loud = g_malloc (SPECTRUM_WINDOW_LEN * sizeof (gint16));
|
||||||
spectrum->im = g_malloc0 (spectrum->len * sizeof (gint16));
|
spectrum->im = g_malloc0 (SPECTRUM_WINDOW_LEN * sizeof (gint16));
|
||||||
spectrum->re = g_malloc0 (spectrum->len * sizeof (gint16));
|
spectrum->re = g_malloc0 (SPECTRUM_WINDOW_LEN * sizeof (gint16));
|
||||||
spectrum->spect = g_malloc (spectrum->bands * sizeof (guchar));
|
spectrum->spect = g_malloc (spectrum->bands * sizeof (guchar));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,11 +238,11 @@ gst_spectrum_set_property (GObject * object, guint prop_id,
|
||||||
filter->interval = g_value_get_uint64 (value);
|
filter->interval = g_value_get_uint64 (value);
|
||||||
break;
|
break;
|
||||||
case PROP_BANDS:
|
case PROP_BANDS:
|
||||||
GST_OBJECT_LOCK (filter);
|
GST_BASE_TRANSFORM_LOCK (filter);
|
||||||
filter->bands = g_value_get_uint (value);
|
filter->bands = g_value_get_uint (value);
|
||||||
g_free (filter->spect);
|
g_free (filter->spect);
|
||||||
filter->spect = g_malloc (filter->bands * sizeof (guchar));
|
filter->spect = g_malloc (filter->bands * sizeof (guchar));
|
||||||
GST_OBJECT_UNLOCK (filter);
|
GST_BASE_TRANSFORM_UNLOCK (filter);
|
||||||
GST_DEBUG_OBJECT (filter, "reallocation, spect = %p, bands =%d ",
|
GST_DEBUG_OBJECT (filter, "reallocation, spect = %p, bands =%d ",
|
||||||
filter->spect, filter->bands);
|
filter->spect, filter->bands);
|
||||||
break;
|
break;
|
||||||
|
@ -391,15 +392,15 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * in)
|
||||||
gst_segment_to_running_time (&spectrum->segment, GST_FORMAT_TIME,
|
gst_segment_to_running_time (&spectrum->segment, GST_FORMAT_TIME,
|
||||||
GST_BUFFER_TIMESTAMP (in));
|
GST_BUFFER_TIMESTAMP (in));
|
||||||
GstClockTime blktime =
|
GstClockTime blktime =
|
||||||
GST_FRAMES_TO_CLOCK_TIME (spectrum->len, spectrum->rate);
|
GST_FRAMES_TO_CLOCK_TIME (SPECTRUM_WINDOW_LEN, spectrum->rate);
|
||||||
|
|
||||||
GST_LOG_OBJECT (spectrum, "input size: %d bytes", GST_BUFFER_SIZE (in));
|
GST_LOG_OBJECT (spectrum, "input size: %d bytes", GST_BUFFER_SIZE (in));
|
||||||
|
|
||||||
gst_adapter_push (spectrum->adapter, gst_buffer_ref (in));
|
gst_adapter_push (spectrum->adapter, gst_buffer_ref (in));
|
||||||
/* required number of bytes */
|
/* required number of bytes */
|
||||||
wanted = spectrum->channels * spectrum->len * sizeof (gint16);
|
wanted = spectrum->channels * SPECTRUM_WINDOW_LEN * sizeof (gint16);
|
||||||
/* FIXME: 4.0 was 2.0 before, but that include the mirrored spectrum */
|
/* FIXME: 4.0 was 2.0 before, but that include the mirrored spectrum */
|
||||||
step = (gfloat) spectrum->len / (spectrum->bands * 4.0);
|
step = (gfloat) SPECTRUM_WINDOW_LEN / (spectrum->bands * 4.0);
|
||||||
|
|
||||||
while (gst_adapter_available (spectrum->adapter) >= wanted) {
|
while (gst_adapter_available (spectrum->adapter) >= wanted) {
|
||||||
const gint16 *samples;
|
const gint16 *samples;
|
||||||
|
@ -408,17 +409,18 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * in)
|
||||||
|
|
||||||
/* the current fft code is gint16 based, so supporting other formats would
|
/* the current fft code is gint16 based, so supporting other formats would
|
||||||
* not really benefit now */
|
* not really benefit now */
|
||||||
for (i = 0, j = 0; i < spectrum->len; i++) {
|
for (i = 0, j = 0; i < SPECTRUM_WINDOW_LEN; i++) {
|
||||||
/* convert to mono */
|
/* convert to mono */
|
||||||
for (k = 0, acc = 0; k < spectrum->channels; k++)
|
for (k = 0, acc = 0; k < spectrum->channels; k++)
|
||||||
acc += samples[j++];
|
acc += samples[j++];
|
||||||
spectrum->re[i] = (gint16) (acc / spectrum->channels);
|
spectrum->re[i] = (gint16) (acc / spectrum->channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_spectrum_window (spectrum->re, spectrum->len);
|
gst_spectrum_window (spectrum->re, SPECTRUM_WINDOW_LEN);
|
||||||
gst_spectrum_fix_fft (spectrum->re, spectrum->im, spectrum->base, FALSE);
|
gst_spectrum_fix_fft (spectrum->re, spectrum->im, SPECTRUM_WINDOW_BASE,
|
||||||
|
FALSE);
|
||||||
gst_spectrum_fix_loud (spectrum->loud, spectrum->re, spectrum->im,
|
gst_spectrum_fix_loud (spectrum->loud, spectrum->re, spectrum->im,
|
||||||
spectrum->len, 0);
|
SPECTRUM_WINDOW_LEN, 0);
|
||||||
|
|
||||||
/* resample to requested number of bands */
|
/* resample to requested number of bands */
|
||||||
for (i = 0, pos = 0.0; i < spectrum->bands; i++, pos += step) {
|
for (i = 0, pos = 0.0; i < spectrum->bands; i++, pos += step) {
|
||||||
|
@ -433,7 +435,7 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * in)
|
||||||
spect[i] = 0;
|
spect[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
spectrum->num_frames += spectrum->len;
|
spectrum->num_frames += SPECTRUM_WINDOW_LEN;
|
||||||
endtime += blktime;
|
endtime += blktime;
|
||||||
/* do we need to message ? */
|
/* do we need to message ? */
|
||||||
if (spectrum->num_frames >=
|
if (spectrum->num_frames >=
|
||||||
|
|
Loading…
Reference in a new issue