Commit 237ca163 authored by Wim Taymans's avatar Wim Taymans

port some more elements to 0.11

parent a1894ed3
......@@ -193,7 +193,8 @@ static void gst_alpha_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void gst_alpha_finalize (GObject * object);
GST_BOILERPLATE (GstAlpha, gst_alpha, GstVideoFilter, GST_TYPE_VIDEO_FILTER);
#define gst_alpha_parent_class parent_class
G_DEFINE_TYPE (GstAlpha, gst_alpha, GST_TYPE_VIDEO_FILTER);
#define GST_TYPE_ALPHA_METHOD (gst_alpha_method_get_type())
static GType
......@@ -214,33 +215,16 @@ gst_alpha_method_get_type (void)
return alpha_method_type;
}
static void
gst_alpha_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class, "Alpha filter",
"Filter/Effect/Video",
"Adds an alpha channel to video - uniform or via chroma-keying",
"Wim Taymans <wim@fluendo.com>\n"
"Edward Hervey <edward.hervey@collabora.co.uk>\n"
"Jan Schmidt <thaytan@noraisin.net>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_alpha_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_alpha_src_template));
GST_DEBUG_CATEGORY_INIT (gst_alpha_debug, "alpha", 0,
"alpha - Element for adding alpha channel to streams");
}
static void
gst_alpha_class_init (GstAlphaClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstBaseTransformClass *btrans_class = (GstBaseTransformClass *) klass;
GST_DEBUG_CATEGORY_INIT (gst_alpha_debug, "alpha", 0,
"alpha - Element for adding alpha channel to streams");
gobject_class->set_property = gst_alpha_set_property;
gobject_class->get_property = gst_alpha_get_property;
gobject_class->finalize = gst_alpha_finalize;
......@@ -290,6 +274,18 @@ gst_alpha_class_init (GstAlphaClass * klass)
DEFAULT_PREFER_PASSTHROUGH,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class, "Alpha filter",
"Filter/Effect/Video",
"Adds an alpha channel to video - uniform or via chroma-keying",
"Wim Taymans <wim.taymans@gmail.com>\n"
"Edward Hervey <edward.hervey@collabora.co.uk>\n"
"Jan Schmidt <thaytan@noraisin.net>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_alpha_sink_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_alpha_src_template));
btrans_class->start = GST_DEBUG_FUNCPTR (gst_alpha_start);
btrans_class->transform = GST_DEBUG_FUNCPTR (gst_alpha_transform);
btrans_class->before_transform =
......@@ -300,7 +296,7 @@ gst_alpha_class_init (GstAlphaClass * klass)
}
static void
gst_alpha_init (GstAlpha * alpha, GstAlphaClass * klass)
gst_alpha_init (GstAlpha * alpha)
{
alpha->alpha = DEFAULT_ALPHA;
alpha->method = DEFAULT_METHOD;
......
......@@ -62,8 +62,7 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_VIDEO_CAPS_YUV ("AYUV"))
);
GST_BOILERPLATE (GstAlphaColor, gst_alpha_color, GstVideoFilter,
GST_TYPE_VIDEO_FILTER);
G_DEFINE_TYPE (GstAlphaColor, gst_alpha_color, GST_TYPE_VIDEO_FILTER);
static GstCaps *gst_alpha_color_transform_caps (GstBaseTransform * btrans,
GstPadDirection direction, GstCaps * caps);
......@@ -73,26 +72,24 @@ static GstFlowReturn gst_alpha_color_transform_ip (GstBaseTransform * btrans,
GstBuffer * inbuf);
static void
gst_alpha_color_base_init (gpointer g_class)
gst_alpha_color_class_init (GstAlphaColorClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstBaseTransformClass *gstbasetransform_class =
(GstBaseTransformClass *) klass;
GST_DEBUG_CATEGORY_INIT (alpha_color_debug, "alphacolor", 0,
"ARGB<->AYUV colorspace conversion preserving the alpha channels");
gst_element_class_set_details_simple (element_class, "Alpha color filter",
gst_element_class_set_details_simple (gstelement_class, "Alpha color filter",
"Filter/Converter/Video",
"ARGB from/to AYUV colorspace conversion preserving the alpha channel",
"Wim Taymans <wim@fluendo.com>");
gst_element_class_add_pad_template (element_class,
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sink_template));
gst_element_class_add_pad_template (element_class,
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&src_template));
}
static void
gst_alpha_color_class_init (GstAlphaColorClass * klass)
{
GstBaseTransformClass *gstbasetransform_class =
(GstBaseTransformClass *) klass;
gstbasetransform_class->transform_caps =
GST_DEBUG_FUNCPTR (gst_alpha_color_transform_caps);
......@@ -101,12 +98,10 @@ gst_alpha_color_class_init (GstAlphaColorClass * klass)
gstbasetransform_class->transform_ip =
GST_DEBUG_FUNCPTR (gst_alpha_color_transform_ip);
GST_DEBUG_CATEGORY_INIT (alpha_color_debug, "alphacolor", 0,
"ARGB<->AYUV colorspace conversion preserving the alpha channels");
}
static void
gst_alpha_color_init (GstAlphaColor * alpha, GstAlphaColorClass * g_class)
gst_alpha_color_init (GstAlphaColor * alpha)
{
GstBaseTransform *btrans = GST_BASE_TRANSFORM (alpha);
......
......@@ -72,31 +72,27 @@ static GstTagDemuxResult gst_ape_demux_parse_tag (GstTagDemux * demux,
GstBuffer * buffer, gboolean start_tag, guint * tag_size,
GstTagList ** tags);
GST_BOILERPLATE (GstApeDemux, gst_ape_demux, GstTagDemux, GST_TYPE_TAG_DEMUX);
G_DEFINE_TYPE (GstApeDemux, gst_ape_demux, GST_TYPE_TAG_DEMUX);
static void
gst_ape_demux_base_init (gpointer klass)
gst_ape_demux_class_init (GstApeDemuxClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstElementClass *element_class;
GstTagDemuxClass *tagdemux_class;
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
GST_DEBUG_CATEGORY_INIT (apedemux_debug, "apedemux", 0,
"GStreamer APE tag demuxer");
tagdemux_class = GST_TAG_DEMUX_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_set_details_simple (element_class, "APE tag demuxer",
"Codec/Demuxer/Metadata",
"Read and output APE tags while demuxing the contents",
"Tim-Philipp Müller <tim centricular net>");
GST_DEBUG_CATEGORY_INIT (apedemux_debug, "apedemux", 0,
"GStreamer APE tag demuxer");
}
static void
gst_ape_demux_class_init (GstApeDemuxClass * klass)
{
GstTagDemuxClass *tagdemux_class;
tagdemux_class = GST_TAG_DEMUX_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
tagdemux_class->identify_tag = GST_DEBUG_FUNCPTR (gst_ape_demux_identify_tag);
tagdemux_class->parse_tag = GST_DEBUG_FUNCPTR (gst_ape_demux_parse_tag);
......@@ -110,7 +106,7 @@ gst_ape_demux_class_init (GstApeDemuxClass * klass)
}
static void
gst_ape_demux_init (GstApeDemux * apedemux, GstApeDemuxClass * gclass)
gst_ape_demux_init (GstApeDemux * apedemux)
{
/* nothing to do here */
}
......
......@@ -125,11 +125,7 @@ gst_audio_amplify_clipping_method_get_type (void)
" rate=(int)[1,MAX]," \
" channels=(int)[1,MAX]"
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_audio_amplify_debug, "audioamplify", 0, "audioamplify element");
GST_BOILERPLATE_FULL (GstAudioAmplify, gst_audio_amplify, GstAudioFilter,
GST_TYPE_AUDIO_FILTER, DEBUG_INIT);
G_DEFINE_TYPE (GstAudioAmplify, gst_audio_amplify, GST_TYPE_AUDIO_FILTER);
static gboolean gst_audio_amplify_set_process_function (GstAudioAmplify *
filter, gint clipping, gint format, gint width);
......@@ -278,29 +274,19 @@ MAKE_FLOAT_FUNCS (gdouble)
/* GObject vmethod implementations */
static void
gst_audio_amplify_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstCaps *caps;
gst_element_class_set_details_simple (element_class, "Audio amplifier",
"Filter/Effect/Audio",
"Amplifies an audio stream by a given factor",
"Sebastian Dröge <slomo@circular-chaos.org>");
caps = gst_caps_from_string (ALLOWED_CAPS);
gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (klass),
caps);
gst_caps_unref (caps);
}
static void
gst_audio_amplify_class_init (GstAudioAmplifyClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstCaps *caps;
GST_DEBUG_CATEGORY_INIT (gst_audio_amplify_debug, "audioamplify", 0,
"audioamplify element");
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = gst_audio_amplify_set_property;
gobject_class->get_property = gst_audio_amplify_get_property;
......@@ -324,6 +310,16 @@ gst_audio_amplify_class_init (GstAudioAmplifyClass * klass)
GST_TYPE_AUDIO_AMPLIFY_CLIPPING_METHOD, METHOD_CLIP,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class, "Audio amplifier",
"Filter/Effect/Audio",
"Amplifies an audio stream by a given factor",
"Sebastian Dröge <slomo@circular-chaos.org>");
caps = gst_caps_from_string (ALLOWED_CAPS);
gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (klass),
caps);
gst_caps_unref (caps);
GST_AUDIO_FILTER_CLASS (klass)->setup =
GST_DEBUG_FUNCPTR (gst_audio_amplify_setup);
GST_BASE_TRANSFORM_CLASS (klass)->transform_ip =
......@@ -331,7 +327,7 @@ gst_audio_amplify_class_init (GstAudioAmplifyClass * klass)
}
static void
gst_audio_amplify_init (GstAudioAmplify * filter, GstAudioAmplifyClass * klass)
gst_audio_amplify_init (GstAudioAmplify * filter)
{
filter->amplification = 1.0;
gst_audio_amplify_set_process_function (filter, METHOD_CLIP,
......@@ -480,6 +476,8 @@ gst_audio_amplify_transform_ip (GstBaseTransform * base, GstBuffer * buf)
GstAudioAmplify *filter = GST_AUDIO_AMPLIFY (base);
guint num_samples;
GstClockTime timestamp, stream_time;
guint8 *data;
gsize size;
timestamp = GST_BUFFER_TIMESTAMP (buf);
stream_time =
......@@ -491,14 +489,16 @@ gst_audio_amplify_transform_ip (GstBaseTransform * base, GstBuffer * buf)
if (GST_CLOCK_TIME_IS_VALID (stream_time))
gst_object_sync_values (G_OBJECT (filter), stream_time);
num_samples =
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
if (gst_base_transform_is_passthrough (base) ||
G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP)))
return GST_FLOW_OK;
filter->process (filter, GST_BUFFER_DATA (buf), num_samples);
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READWRITE);
num_samples = size / (GST_AUDIO_FILTER (filter)->format.width / 8);
filter->process (filter, data, num_samples);
gst_buffer_unmap (buf, data, size);
return GST_FLOW_OK;
}
......@@ -96,11 +96,9 @@ enum
PROP_POLES
};
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_audio_cheb_band_debug, "audiochebband", 0, "audiochebband element");
GST_BOILERPLATE_FULL (GstAudioChebBand, gst_audio_cheb_band,
GstAudioFXBaseIIRFilter, GST_TYPE_AUDIO_FX_BASE_IIR_FILTER, DEBUG_INIT);
#define gst_audio_cheb_band_parent_class parent_class
G_DEFINE_TYPE (GstAudioChebBand, gst_audio_cheb_band,
GST_TYPE_AUDIO_FX_BASE_IIR_FILTER);
static void gst_audio_cheb_band_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
......@@ -139,23 +137,16 @@ gst_audio_cheb_band_mode_get_type (void)
/* GObject vmethod implementations */
static void
gst_audio_cheb_band_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_set_details_simple (element_class,
"Band pass & band reject filter", "Filter/Effect/Audio",
"Chebyshev band pass and band reject filter",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
}
static void
gst_audio_cheb_band_class_init (GstAudioChebBandClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstAudioFilterClass *filter_class = (GstAudioFilterClass *) klass;
GST_DEBUG_CATEGORY_INIT (gst_audio_cheb_band_debug, "audiochebband", 0,
"audiochebband element");
gobject_class->set_property = gst_audio_cheb_band_set_property;
gobject_class->get_property = gst_audio_cheb_band_get_property;
gobject_class->finalize = gst_audio_cheb_band_finalize;
......@@ -193,12 +184,16 @@ gst_audio_cheb_band_class_init (GstAudioChebBandClass * klass)
4, 32, 4,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class,
"Band pass & band reject filter", "Filter/Effect/Audio",
"Chebyshev band pass and band reject filter",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
filter_class->setup = GST_DEBUG_FUNCPTR (gst_audio_cheb_band_setup);
}
static void
gst_audio_cheb_band_init (GstAudioChebBand * filter,
GstAudioChebBandClass * klass)
gst_audio_cheb_band_init (GstAudioChebBand * filter)
{
filter->lower_frequency = filter->upper_frequency = 0.0;
filter->mode = MODE_BAND_PASS;
......
......@@ -91,12 +91,9 @@ enum
PROP_POLES
};
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_audio_cheb_limit_debug, "audiocheblimit", 0, "audiocheblimit element");
GST_BOILERPLATE_FULL (GstAudioChebLimit,
gst_audio_cheb_limit, GstAudioFXBaseIIRFilter,
GST_TYPE_AUDIO_FX_BASE_IIR_FILTER, DEBUG_INIT);
#define gst_audio_cheb_limit_parent_class parent_class
G_DEFINE_TYPE (GstAudioChebLimit,
gst_audio_cheb_limit, GST_TYPE_AUDIO_FX_BASE_IIR_FILTER);
static void gst_audio_cheb_limit_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
......@@ -135,24 +132,16 @@ gst_audio_cheb_limit_mode_get_type (void)
/* GObject vmethod implementations */
static void
gst_audio_cheb_limit_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_set_details_simple (element_class,
"Low pass & high pass filter",
"Filter/Effect/Audio",
"Chebyshev low pass and high pass filter",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
}
static void
gst_audio_cheb_limit_class_init (GstAudioChebLimitClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstAudioFilterClass *filter_class = (GstAudioFilterClass *) klass;
GST_DEBUG_CATEGORY_INIT (gst_audio_cheb_limit_debug, "audiocheblimit", 0,
"audiocheblimit element");
gobject_class->set_property = gst_audio_cheb_limit_set_property;
gobject_class->get_property = gst_audio_cheb_limit_get_property;
gobject_class->finalize = gst_audio_cheb_limit_finalize;
......@@ -186,12 +175,17 @@ gst_audio_cheb_limit_class_init (GstAudioChebLimitClass * klass)
2, 32, 4,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class,
"Low pass & high pass filter",
"Filter/Effect/Audio",
"Chebyshev low pass and high pass filter",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
filter_class->setup = GST_DEBUG_FUNCPTR (gst_audio_cheb_limit_setup);
}
static void
gst_audio_cheb_limit_init (GstAudioChebLimit * filter,
GstAudioChebLimitClass * klass)
gst_audio_cheb_limit_init (GstAudioChebLimit * filter)
{
filter->cutoff = 0.0;
filter->mode = MODE_LOW_PASS;
......
......@@ -83,11 +83,7 @@ enum
" rate=(int)[1,MAX]," \
" channels=(int)[1,MAX]"
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_audio_dynamic_debug, "audiodynamic", 0, "audiodynamic element");
GST_BOILERPLATE_FULL (GstAudioDynamic, gst_audio_dynamic, GstAudioFilter,
GST_TYPE_AUDIO_FILTER, DEBUG_INIT);
G_DEFINE_TYPE (GstAudioDynamic, gst_audio_dynamic, GST_TYPE_AUDIO_FILTER);
static void gst_audio_dynamic_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
......@@ -212,28 +208,19 @@ gst_audio_dynamic_set_process_function (GstAudioDynamic * filter)
/* GObject vmethod implementations */
static void
gst_audio_dynamic_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstCaps *caps;
gst_element_class_set_details_simple (element_class,
"Dynamic range controller", "Filter/Effect/Audio",
"Compressor and Expander", "Sebastian Dröge <slomo@circular-chaos.org>");
caps = gst_caps_from_string (ALLOWED_CAPS);
gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (klass),
caps);
gst_caps_unref (caps);
}
static void
gst_audio_dynamic_class_init (GstAudioDynamicClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstCaps *caps;
GST_DEBUG_CATEGORY_INIT (gst_audio_dynamic_debug, "audiodynamic", 0,
"audiodynamic element");
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = gst_audio_dynamic_set_property;
gobject_class->get_property = gst_audio_dynamic_get_property;
......@@ -263,6 +250,15 @@ gst_audio_dynamic_class_init (GstAudioDynamicClass * klass)
1.0,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class,
"Dynamic range controller", "Filter/Effect/Audio",
"Compressor and Expander", "Sebastian Dröge <slomo@circular-chaos.org>");
caps = gst_caps_from_string (ALLOWED_CAPS);
gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (klass),
caps);
gst_caps_unref (caps);
GST_AUDIO_FILTER_CLASS (klass)->setup =
GST_DEBUG_FUNCPTR (gst_audio_dynamic_setup);
GST_BASE_TRANSFORM_CLASS (klass)->transform_ip =
......@@ -270,7 +266,7 @@ gst_audio_dynamic_class_init (GstAudioDynamicClass * klass)
}
static void
gst_audio_dynamic_init (GstAudioDynamic * filter, GstAudioDynamicClass * klass)
gst_audio_dynamic_init (GstAudioDynamic * filter)
{
filter->ratio = 1.0;
filter->threshold = 0.0;
......@@ -696,6 +692,8 @@ gst_audio_dynamic_transform_ip (GstBaseTransform * base, GstBuffer * buf)
GstAudioDynamic *filter = GST_AUDIO_DYNAMIC (base);
guint num_samples;
GstClockTime timestamp, stream_time;
guint8 *data;
gsize size;
timestamp = GST_BUFFER_TIMESTAMP (buf);
stream_time =
......@@ -707,14 +705,16 @@ gst_audio_dynamic_transform_ip (GstBaseTransform * base, GstBuffer * buf)
if (GST_CLOCK_TIME_IS_VALID (stream_time))
gst_object_sync_values (G_OBJECT (filter), stream_time);
num_samples =
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
if (gst_base_transform_is_passthrough (base) ||
G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP)))
return GST_FLOW_OK;
filter->process (filter, GST_BUFFER_DATA (buf), num_samples);
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READWRITE);
num_samples = size / (GST_AUDIO_FILTER (filter)->format.width / 8);
filter->process (filter, data, num_samples);
gst_buffer_unmap (buf, data, size);
return GST_FLOW_OK;
}
......@@ -73,11 +73,8 @@ enum
" rate=(int)[1,MAX]," \
" channels=(int)[1,MAX]"
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_audio_echo_debug, "audioecho", 0, "audioecho element");
GST_BOILERPLATE_FULL (GstAudioEcho, gst_audio_echo, GstAudioFilter,
GST_TYPE_AUDIO_FILTER, DEBUG_INIT);
#define gst_audio_echo_parent_class parent_class
G_DEFINE_TYPE (GstAudioEcho, gst_audio_echo, GST_TYPE_AUDIO_FILTER);
static void gst_audio_echo_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
......@@ -98,29 +95,17 @@ static void gst_audio_echo_transform_double (GstAudioEcho * self,
/* GObject vmethod implementations */
static void
gst_audio_echo_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstCaps *caps;
gst_element_class_set_details_simple (element_class, "Audio echo",
"Filter/Effect/Audio",
"Adds an echo or reverb effect to an audio stream",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
caps = gst_caps_from_string (ALLOWED_CAPS);
gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (klass),
caps);
gst_caps_unref (caps);
}
static void
gst_audio_echo_class_init (GstAudioEchoClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstBaseTransformClass *basetransform_class = (GstBaseTransformClass *) klass;
GstAudioFilterClass *audioself_class = (GstAudioFilterClass *) klass;
GstCaps *caps;
GST_DEBUG_CATEGORY_INIT (gst_audio_echo_debug, "audioecho", 0,
"audioecho element");
gobject_class->set_property = gst_audio_echo_set_property;
gobject_class->get_property = gst_audio_echo_get_property;
......@@ -151,6 +136,16 @@ gst_audio_echo_class_init (GstAudioEchoClass * klass)
0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
| GST_PARAM_CONTROLLABLE));
gst_element_class_set_details_simple (gstelement_class, "Audio echo",
"Filter/Effect/Audio",
"Adds an echo or reverb effect to an audio stream",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
caps = gst_caps_from_string (ALLOWED_CAPS);
gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (klass),
caps);
gst_caps_unref (caps);
audioself_class->setup = GST_DEBUG_FUNCPTR (gst_audio_echo_setup);
basetransform_class->transform_ip =
GST_DEBUG_FUNCPTR (gst_audio_echo_transform_ip);
......@@ -158,7 +153,7 @@ gst_audio_echo_class_init (GstAudioEchoClass * klass)
}
static void
gst_audio_echo_init (GstAudioEcho * self, GstAudioEchoClass * klass)
gst_audio_echo_init (GstAudioEcho * self)
{
self->delay = 1;
self->max_delay = 1;
......@@ -359,6 +354,8 @@ gst_audio_echo_transform_ip (GstBaseTransform * base, GstBuffer * buf)
GstAudioEcho *self = GST_AUDIO_ECHO (base);
guint num_samples;
GstClockTime timestamp, stream_time;
guint8 *data;
gsize size;
timestamp = GST_BUFFER_TIMESTAMP (buf);
stream_time =
......@@ -370,9 +367,6 @@ gst_audio_echo_transform_ip (GstBaseTransform * base, GstBuffer * buf)
if (GST_CLOCK_TIME_IS_VALID (stream_time))
gst_object_sync_values (G_OBJECT (self), stream_time);
num_samples =
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (self)->format.width / 8);
if (self->buffer == NULL) {
guint width, rate, channels;
......@@ -395,7 +389,12 @@ gst_audio_echo_transform_ip (GstBaseTransform * base, GstBuffer * buf)
}
}
self->process (self, GST_BUFFER_DATA (buf), num_samples);
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READWRITE);
num_samples = size / (GST_AUDIO_FILTER (self)->format.width / 8);
self->process (self, data, num_samples);
gst_buffer_unmap (buf, data, size);
return GST_FLOW_OK;
}
......@@ -75,12 +75,9 @@ enum
static guint gst_audio_fir_filter_signals[LAST_SIGNAL] = { 0, };
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_audio_fir_filter_debug, "audiofirfilter", 0, \
"Generic audio FIR filter plugin");
GST_BOILERPLATE_FULL (GstAudioFIRFilter, gst_audio_fir_filter, GstAudioFilter,
GST_TYPE_AUDIO_FX_BASE_FIR_FILTER, DEBUG_INIT);
#define gst_audio_fir_filter_parent_class parent_class
G_DEFINE_TYPE (GstAudioFIRFilter, gst_audio_fir_filter,
GST_TYPE_AUDIO_FX_BASE_FIR_FILTER);
static void gst_audio_fir_filter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
......@@ -91,24 +88,17 @@ static void gst_audio_fir_filter_finalize (GObject * object);
static gboolean gst_audio_fir_filter_setup (GstAudioFilter * base,
GstRingBufferSpec * format);
/* Element class */
static void
gst_audio_fir_filter_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"Audio FIR filter", "Filter/Effect/Audio",
"Generic audio FIR filter with custom filter kernel",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
}
static void
gst_audio_fir_filter_class_init (GstAudioFIRFilterClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstAudioFilterClass *filter_class = (GstAudioFilterClass *) klass;
GST_DEBUG_CATEGORY_INIT (gst_audio_fir_filter_debug, "audiofirfilter", 0,
"Generic audio FIR filter plugin");
gobject_class->set_property = gst_audio_fir_filter_set_property;
gobject_class->get_property = gst_audio_fir_filter_get_property;
gobject_class->finalize = gst_audio_fir_filter_finalize;
......@@ -140,6 +130,11 @@ gst_audio_fir_filter_class_init (GstAudioFIRFilterClass * klass)
g_signal_new ("rate-changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstAudioFIRFilterClass, rate_changed),
NULL, NULL, gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
gst_element_class_set_details_simple (gstelement_class,
"Audio FIR filter", "Filter/Effect/Audio",
"Generic audio FIR filter with custom filter kernel",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
}
static void
......@@ -167,8 +162,7 @@ gst_audio_fir_filter_update_kernel (GstAudioFIRFilter * self, GValueArray * va)
}
static void
gst_audio_fir_filter_init (GstAudioFIRFilter * self,
GstAudioFIRFilterClass * g_class)
gst_audio_fir_filter_init (GstAudioFIRFilter * self)
{
GValue v = { 0, };
GValueArray *va;
......
......@@ -49,10 +49,6 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
" rate = (int) [ 1, MAX ], " \
" channels = (int) [ 1, MAX ]"
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_audio_fx_base_fir_filter_debug, "audiofxbasefirfilter", 0, \
"FIR filter base class");
/* Switch from time-domain to FFT convolution for kernels >= this */
#define FFT_THRESHOLD 32
......@@ -66,8 +62,9 @@ enum
#define DEFAULT_LOW_LATENCY FALSE
#define DEFAULT_DRAIN_ON_CHANGES TRUE
GST_BOILERPLATE_FULL (GstAudioFXBaseFIRFilter, gst_audio_fx_base_fir_filter,
GstAudioFilter, GST_TYPE_AUDIO_FILTER, DEBUG_INIT);
#define gst_audio_fx_base_fir_filter_parent_class parent_class
G_DEFINE_TYPE (GstAudioFXBaseFIRFilter, gst_audio_fx_base_fir_filter,
GST_TYPE_AUDIO_FILTER);
static GstFlowReturn gst_audio_fx_base_fir_filter_transform (GstBaseTransform *
base, GstBuffer * inbuf, GstBuffer * outbuf);
......@@ -76,8 +73,8 @@ static gboolean gst_audio_fx_base_fir_filter_stop (GstBaseTransform * base);
static gboolean gst_audio_fx_base_fir_filter_event (GstBaseTransform * base,
GstEvent * event);
static gboolean gst_audio_fx_base_fir_filter_transform_size (GstBaseTransform *
base, GstPadDirection direction, GstCaps * caps, guint size,
GstCaps * othercaps, guint * othersize);
base, GstPadDirection direction, GstCaps * caps, gsize size,
GstCaps * othercaps, gsize * othersize);
static gboolean gst_audio_fx_base_fir_filter_setup (GstAudioFilter * base,
GstRingBufferSpec * format);
......@@ -540,23 +537,16 @@ gst_audio_fx_base_fir_filter_get_property (GObject * object, guint prop_id,
}
}
static void