mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
equalizer: port to 0.11
This commit is contained in:
parent
f886681367
commit
d9ba4b7616
4 changed files with 45 additions and 99 deletions
|
@ -61,21 +61,12 @@ static GstFlowReturn gst_iir_equalizer_transform_ip (GstBaseTransform * btrans,
|
|||
" rate=(int)[1000,MAX]," \
|
||||
" channels=(int)[1,MAX]"
|
||||
|
||||
static void
|
||||
_do_init (GType object_type)
|
||||
{
|
||||
const GInterfaceInfo child_proxy_interface_info = {
|
||||
(GInterfaceInitFunc) gst_iir_equalizer_child_proxy_interface_init,
|
||||
NULL, /* interface_finalize */
|
||||
NULL /* interface_data */
|
||||
};
|
||||
#define gst_iir_equalizer_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstIirEqualizer, gst_iir_equalizer,
|
||||
GST_TYPE_AUDIO_FILTER,
|
||||
G_IMPLEMENT_INTERFACE (GST_TYPE_CHILD_PROXY,
|
||||
gst_iir_equalizer_child_proxy_interface_init));
|
||||
|
||||
g_type_add_interface_static (object_type, GST_TYPE_CHILD_PROXY,
|
||||
&child_proxy_interface_info);
|
||||
}
|
||||
|
||||
GST_BOILERPLATE_FULL (GstIirEqualizer, gst_iir_equalizer,
|
||||
GstAudioFilter, GST_TYPE_AUDIO_FILTER, _do_init);
|
||||
|
||||
/* child object */
|
||||
|
||||
|
@ -363,31 +354,25 @@ gst_iir_equalizer_child_proxy_interface_init (gpointer g_iface,
|
|||
|
||||
/* equalizer implementation */
|
||||
|
||||
static void
|
||||
gst_iir_equalizer_base_init (gpointer g_class)
|
||||
{
|
||||
GstAudioFilterClass *audiofilter_class = GST_AUDIO_FILTER_CLASS (g_class);
|
||||
GstCaps *caps;
|
||||
|
||||
caps = gst_caps_from_string (ALLOWED_CAPS);
|
||||
gst_audio_filter_class_add_pad_templates (audiofilter_class, caps);
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_iir_equalizer_class_init (GstIirEqualizerClass * klass)
|
||||
{
|
||||
GstAudioFilterClass *audio_filter_class = (GstAudioFilterClass *) klass;
|
||||
GstBaseTransformClass *btrans_class = (GstBaseTransformClass *) klass;
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
GstCaps *caps;
|
||||
|
||||
gobject_class->finalize = gst_iir_equalizer_finalize;
|
||||
audio_filter_class->setup = gst_iir_equalizer_setup;
|
||||
btrans_class->transform_ip = gst_iir_equalizer_transform_ip;
|
||||
|
||||
caps = gst_caps_from_string (ALLOWED_CAPS);
|
||||
gst_audio_filter_class_add_pad_templates (audio_filter_class, caps);
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_iir_equalizer_init (GstIirEqualizer * eq, GstIirEqualizerClass * g_class)
|
||||
gst_iir_equalizer_init (GstIirEqualizer * eq)
|
||||
{
|
||||
eq->bands_lock = g_mutex_new ();
|
||||
eq->need_new_coefficients = TRUE;
|
||||
|
@ -832,6 +817,8 @@ gst_iir_equalizer_transform_ip (GstBaseTransform * btrans, GstBuffer * buf)
|
|||
GstAudioFilter *filter = GST_AUDIO_FILTER (btrans);
|
||||
GstIirEqualizer *equ = GST_IIR_EQUALIZER (btrans);
|
||||
GstClockTime timestamp;
|
||||
guint8 *data;
|
||||
gsize size;
|
||||
|
||||
if (G_UNLIKELY (filter->format.channels < 1 || equ->process == NULL))
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
|
@ -853,8 +840,9 @@ gst_iir_equalizer_transform_ip (GstBaseTransform * btrans, GstBuffer * buf)
|
|||
if (GST_CLOCK_TIME_IS_VALID (timestamp))
|
||||
gst_object_sync_values (G_OBJECT (equ), timestamp);
|
||||
|
||||
equ->process (equ, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf),
|
||||
filter->format.channels);
|
||||
data = gst_buffer_map (buf, &size, NULL, GST_MAP_WRITE);
|
||||
equ->process (equ, data, size, filter->format.channels);
|
||||
gst_buffer_unmap (buf, data, size);
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
|
|
@ -62,39 +62,17 @@ GST_DEBUG_CATEGORY_EXTERN (equalizer_debug);
|
|||
#define GST_CAT_DEFAULT equalizer_debug
|
||||
|
||||
|
||||
static void
|
||||
_do_init (GType object_type)
|
||||
{
|
||||
const GInterfaceInfo preset_interface_info = {
|
||||
NULL, /* interface_init */
|
||||
NULL, /* interface_finalize */
|
||||
NULL /* interface_data */
|
||||
};
|
||||
|
||||
g_type_add_interface_static (object_type, GST_TYPE_PRESET,
|
||||
&preset_interface_info);
|
||||
}
|
||||
|
||||
GST_BOILERPLATE_FULL (GstIirEqualizer10Bands, gst_iir_equalizer_10bands,
|
||||
GstIirEqualizer, GST_TYPE_IIR_EQUALIZER, _do_init);
|
||||
#define gst_iir_equalizer_10bands_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstIirEqualizer10Bands, gst_iir_equalizer_10bands,
|
||||
GST_TYPE_IIR_EQUALIZER, G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
|
||||
|
||||
/* equalizer implementation */
|
||||
|
||||
static void
|
||||
gst_iir_equalizer_10bands_base_init (gpointer g_class)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "10 Band Equalizer",
|
||||
"Filter/Effect/Audio",
|
||||
"Direct Form 10 band IIR equalizer",
|
||||
"Stefan Kost <ensonic@users.sf.net>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_iir_equalizer_10bands_class_init (GstIirEqualizer10BandsClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
GstElementClass *gstelement_class = (GstElementClass *) klass;
|
||||
|
||||
gobject_class->set_property = gst_iir_equalizer_10bands_set_property;
|
||||
gobject_class->get_property = gst_iir_equalizer_10bands_get_property;
|
||||
|
@ -149,11 +127,15 @@ gst_iir_equalizer_10bands_class_init (GstIirEqualizer10BandsClass * klass)
|
|||
"gain for the frequency band 15011 Hz, ranging from -24 dB to +12 dB",
|
||||
-24.0, 12.0, 0.0,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
|
||||
|
||||
gst_element_class_set_details_simple (gstelement_class, "10 Band Equalizer",
|
||||
"Filter/Effect/Audio",
|
||||
"Direct Form 10 band IIR equalizer",
|
||||
"Stefan Kost <ensonic@users.sf.net>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_iir_equalizer_10bands_init (GstIirEqualizer10Bands * equ_n,
|
||||
GstIirEqualizer10BandsClass * g_class)
|
||||
gst_iir_equalizer_10bands_init (GstIirEqualizer10Bands * equ_n)
|
||||
{
|
||||
GstIirEqualizer *equ = GST_IIR_EQUALIZER (equ_n);
|
||||
|
||||
|
|
|
@ -53,39 +53,17 @@ static void gst_iir_equalizer_3bands_get_property (GObject * object,
|
|||
GST_DEBUG_CATEGORY_EXTERN (equalizer_debug);
|
||||
#define GST_CAT_DEFAULT equalizer_debug
|
||||
|
||||
|
||||
static void
|
||||
_do_init (GType object_type)
|
||||
{
|
||||
const GInterfaceInfo preset_interface_info = {
|
||||
NULL, /* interface_init */
|
||||
NULL, /* interface_finalize */
|
||||
NULL /* interface_data */
|
||||
};
|
||||
|
||||
g_type_add_interface_static (object_type, GST_TYPE_PRESET,
|
||||
&preset_interface_info);
|
||||
}
|
||||
|
||||
GST_BOILERPLATE_FULL (GstIirEqualizer3Bands, gst_iir_equalizer_3bands,
|
||||
GstIirEqualizer, GST_TYPE_IIR_EQUALIZER, _do_init);
|
||||
#define gst_iir_equalizer_3bands_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstIirEqualizer3Bands, gst_iir_equalizer_3bands,
|
||||
GST_TYPE_IIR_EQUALIZER, G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
|
||||
|
||||
/* equalizer implementation */
|
||||
|
||||
static void
|
||||
gst_iir_equalizer_3bands_base_init (gpointer g_class)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "3 Band Equalizer",
|
||||
"Filter/Effect/Audio",
|
||||
"Direct Form 3 band IIR equalizer", "Stefan Kost <ensonic@users.sf.net>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_iir_equalizer_3bands_class_init (GstIirEqualizer3BandsClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
GstElementClass *gstelement_class = (GstElementClass *) klass;
|
||||
|
||||
gobject_class->set_property = gst_iir_equalizer_3bands_set_property;
|
||||
gobject_class->get_property = gst_iir_equalizer_3bands_get_property;
|
||||
|
@ -105,11 +83,14 @@ gst_iir_equalizer_3bands_class_init (GstIirEqualizer3BandsClass * klass)
|
|||
"gain for the frequency band 11 kHz, ranging from -24.0 to +12.0",
|
||||
-24.0, 12.0, 0.0,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
|
||||
|
||||
gst_element_class_set_details_simple (gstelement_class, "3 Band Equalizer",
|
||||
"Filter/Effect/Audio",
|
||||
"Direct Form 3 band IIR equalizer", "Stefan Kost <ensonic@users.sf.net>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_iir_equalizer_3bands_init (GstIirEqualizer3Bands * equ_n,
|
||||
GstIirEqualizer3BandsClass * g_class)
|
||||
gst_iir_equalizer_3bands_init (GstIirEqualizer3Bands * equ_n)
|
||||
{
|
||||
GstIirEqualizer *equ = GST_IIR_EQUALIZER (equ_n);
|
||||
|
||||
|
|
|
@ -97,26 +97,17 @@ static void gst_iir_equalizer_nbands_get_property (GObject * object,
|
|||
GST_DEBUG_CATEGORY_EXTERN (equalizer_debug);
|
||||
#define GST_CAT_DEFAULT equalizer_debug
|
||||
|
||||
GST_BOILERPLATE (GstIirEqualizerNBands, gst_iir_equalizer_nbands,
|
||||
GstIirEqualizer, GST_TYPE_IIR_EQUALIZER);
|
||||
#define gst_iir_equalizer_nbands_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstIirEqualizerNBands, gst_iir_equalizer_nbands,
|
||||
GST_TYPE_IIR_EQUALIZER);
|
||||
|
||||
/* equalizer implementation */
|
||||
|
||||
static void
|
||||
gst_iir_equalizer_nbands_base_init (gpointer g_class)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "N Band Equalizer",
|
||||
"Filter/Effect/Audio",
|
||||
"Direct Form IIR equalizer",
|
||||
"Benjamin Otte <otte@gnome.org>," " Stefan Kost <ensonic@users.sf.net>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_iir_equalizer_nbands_class_init (GstIirEqualizerNBandsClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
GstElementClass *gstelement_class = (GstElementClass *) klass;
|
||||
|
||||
gobject_class->set_property = gst_iir_equalizer_nbands_set_property;
|
||||
gobject_class->get_property = gst_iir_equalizer_nbands_get_property;
|
||||
|
@ -125,11 +116,15 @@ gst_iir_equalizer_nbands_class_init (GstIirEqualizerNBandsClass * klass)
|
|||
g_param_spec_uint ("num-bands", "num-bands",
|
||||
"number of different bands to use", 1, 64, 10,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT));
|
||||
|
||||
gst_element_class_set_details_simple (gstelement_class, "N Band Equalizer",
|
||||
"Filter/Effect/Audio",
|
||||
"Direct Form IIR equalizer",
|
||||
"Benjamin Otte <otte@gnome.org>," " Stefan Kost <ensonic@users.sf.net>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_iir_equalizer_nbands_init (GstIirEqualizerNBands * equ_n,
|
||||
GstIirEqualizerNBandsClass * g_class)
|
||||
gst_iir_equalizer_nbands_init (GstIirEqualizerNBands * equ_n)
|
||||
{
|
||||
GstIirEqualizer *equ = GST_IIR_EQUALIZER (equ_n);
|
||||
|
||||
|
|
Loading…
Reference in a new issue