port some more elements to 0.11

This commit is contained in:
Wim Taymans 2011-04-25 12:49:36 +02:00
parent a1894ed363
commit 237ca1631f
20 changed files with 401 additions and 475 deletions

View file

@ -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;

View file

@ -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_element_class_set_details_simple (element_class, "Alpha color filter",
GST_DEBUG_CATEGORY_INIT (alpha_color_debug, "alphacolor", 0,
"ARGB<->AYUV colorspace conversion preserving the alpha channels");
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);

View file

@ -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 */
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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
gst_audio_fx_base_fir_filter_base_init (gpointer g_class)
{
GstCaps *caps;
caps = gst_caps_from_string (ALLOWED_CAPS);
gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (g_class),
caps);
gst_caps_unref (caps);
}
static void
gst_audio_fx_base_fir_filter_class_init (GstAudioFXBaseFIRFilterClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
GstAudioFilterClass *filter_class = (GstAudioFilterClass *) klass;
GstCaps *caps;
GST_DEBUG_CATEGORY_INIT (gst_audio_fx_base_fir_filter_debug,
"audiofxbasefirfilter", 0, "FIR filter base class");
gobject_class->dispose = gst_audio_fx_base_fir_filter_dispose;
gobject_class->set_property = gst_audio_fx_base_fir_filter_set_property;
@ -593,6 +583,11 @@ gst_audio_fx_base_fir_filter_class_init (GstAudioFXBaseFIRFilterClass * klass)
DEFAULT_DRAIN_ON_CHANGES,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
caps = gst_caps_from_string (ALLOWED_CAPS);
gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (klass),
caps);
gst_caps_unref (caps);
trans_class->transform =
GST_DEBUG_FUNCPTR (gst_audio_fx_base_fir_filter_transform);
trans_class->start = GST_DEBUG_FUNCPTR (gst_audio_fx_base_fir_filter_start);
@ -604,8 +599,7 @@ gst_audio_fx_base_fir_filter_class_init (GstAudioFXBaseFIRFilterClass * klass)
}
static void
gst_audio_fx_base_fir_filter_init (GstAudioFXBaseFIRFilter * self,
GstAudioFXBaseFIRFilterClass * g_class)
gst_audio_fx_base_fir_filter_init (GstAudioFXBaseFIRFilter * self)
{
self->kernel = NULL;
self->buffer = NULL;
@ -634,7 +628,8 @@ gst_audio_fx_base_fir_filter_push_residue (GstAudioFXBaseFIRFilter * self)
gint channels = GST_AUDIO_FILTER_CAST (self)->format.channels;
gint width = GST_AUDIO_FILTER_CAST (self)->format.width / 8;
gint outsize, outsamples;
guint8 *in, *out;
guint8 *in, *out, *data;
gsize size;
if (channels == 0 || rate == 0 || self->nsamples_in == 0) {
self->buffer_fill = 0;
@ -684,15 +679,16 @@ gst_audio_fx_base_fir_filter_push_residue (GstAudioFXBaseFIRFilter * self)
/* Convolve the residue with zeros to get the actual remaining data */
in = g_new0 (guint8, outsize);
self->nsamples_out +=
self->process (self, in, GST_BUFFER_DATA (outbuf), outsamples);
data = gst_buffer_map (outbuf, &size, NULL, GST_MAP_READWRITE);
self->nsamples_out += self->process (self, in, data, outsamples);
gst_buffer_unmap (outbuf, data, size);
g_free (in);
} else {
guint gensamples = 0;
guint8 *data;
outbuf = gst_buffer_new_and_alloc (outsize);
data = GST_BUFFER_DATA (outbuf);
data = gst_buffer_map (outbuf, &size, NULL, GST_MAP_READWRITE);
while (gensamples < outsamples) {
guint step_insamples = self->block_length - self->buffer_fill;
@ -710,6 +706,8 @@ gst_audio_fx_base_fir_filter_push_residue (GstAudioFXBaseFIRFilter * self)
g_free (out);
}
self->nsamples_out += gensamples;
gst_buffer_unmap (outbuf, data, size);
}
/* Set timestamp, offset, etc from the values we
@ -734,7 +732,8 @@ gst_audio_fx_base_fir_filter_push_residue (GstAudioFXBaseFIRFilter * self)
GST_DEBUG_OBJECT (self, "Pushing residue buffer of size %d with timestamp: %"
GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %"
G_GUINT64_FORMAT ", offset_end: %" G_GUINT64_FORMAT ", nsamples_out: %d",
GST_BUFFER_SIZE (outbuf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
gst_buffer_get_size (outbuf),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)), GST_BUFFER_OFFSET (outbuf),
GST_BUFFER_OFFSET_END (outbuf), outsamples);
@ -778,8 +777,8 @@ gst_audio_fx_base_fir_filter_setup (GstAudioFilter * base,
static gboolean
gst_audio_fx_base_fir_filter_transform_size (GstBaseTransform * base,
GstPadDirection direction, GstCaps * caps, guint size, GstCaps * othercaps,
guint * othersize)
GstPadDirection direction, GstCaps * caps, gsize size, GstCaps * othercaps,
gsize * othersize)
{
GstAudioFXBaseFIRFilter *self = GST_AUDIO_FX_BASE_FIR_FILTER (base);
guint blocklen;
@ -817,8 +816,10 @@ gst_audio_fx_base_fir_filter_transform (GstBaseTransform * base,
gint channels = GST_AUDIO_FILTER_CAST (self)->format.channels;
gint rate = GST_AUDIO_FILTER_CAST (self)->format.rate;
gint width = GST_AUDIO_FILTER_CAST (self)->format.width / 8;
guint input_samples = (GST_BUFFER_SIZE (inbuf) / width) / channels;
guint output_samples = (GST_BUFFER_SIZE (outbuf) / width) / channels;
guint8 *indata, *outdata;
gsize insize, outsize;
guint input_samples;
guint output_samples;
guint generated_samples;
guint64 output_offset;
gint64 diff = 0;
@ -871,11 +872,18 @@ gst_audio_fx_base_fir_filter_transform (GstBaseTransform * base,
self->start_off = GST_BUFFER_OFFSET (inbuf);
}
indata = gst_buffer_map (inbuf, &insize, NULL, GST_MAP_READ);
outdata = gst_buffer_map (outbuf, &outsize, NULL, GST_MAP_WRITE);
input_samples = (insize / width) / channels;
output_samples = (outsize / width) / channels;
self->nsamples_in += input_samples;
generated_samples =
self->process (self, GST_BUFFER_DATA (inbuf), GST_BUFFER_DATA (outbuf),
input_samples);
generated_samples = self->process (self, indata, outdata, input_samples);
gst_buffer_unmap (inbuf, indata, insize);
gst_buffer_unmap (outbuf, outdata, outsize);
g_assert (generated_samples <= output_samples);
self->nsamples_out += generated_samples;
@ -891,9 +899,9 @@ gst_audio_fx_base_fir_filter_transform (GstBaseTransform * base,
gint64 tmp = diff;
diff = generated_samples - diff;
generated_samples = tmp;
GST_BUFFER_DATA (outbuf) += diff * width * channels;
}
GST_BUFFER_SIZE (outbuf) = generated_samples * width * channels;
gst_buffer_resize (outbuf, diff * width * channels,
generated_samples * width * channels);
output_offset = self->nsamples_out - self->latency - generated_samples;
GST_BUFFER_TIMESTAMP (outbuf) =
@ -913,7 +921,8 @@ gst_audio_fx_base_fir_filter_transform (GstBaseTransform * base,
GST_DEBUG_OBJECT (self, "Pushing buffer of size %d with timestamp: %"
GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %"
G_GUINT64_FORMAT ", offset_end: %" G_GUINT64_FORMAT ", nsamples_out: %d",
GST_BUFFER_SIZE (outbuf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
gst_buffer_get_size (outbuf),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)), GST_BUFFER_OFFSET (outbuf),
GST_BUFFER_OFFSET_END (outbuf), generated_samples);

View file

@ -42,12 +42,9 @@ 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_iir_filter_debug, "audiofxbaseiirfilter", 0, "Audio IIR Filter Base Class");
GST_BOILERPLATE_FULL (GstAudioFXBaseIIRFilter,
gst_audio_fx_base_iir_filter, GstAudioFilter, GST_TYPE_AUDIO_FILTER,
DEBUG_INIT);
#define gst_audio_fx_base_iir_filter_parent_class parent_class
G_DEFINE_TYPE (GstAudioFXBaseIIRFilter,
gst_audio_fx_base_iir_filter, GST_TYPE_AUDIO_FILTER);
static gboolean gst_audio_fx_base_iir_filter_setup (GstAudioFilter * filter,
GstRingBufferSpec * format);
@ -63,17 +60,6 @@ static void process_32 (GstAudioFXBaseIIRFilter * filter,
/* GObject vmethod implementations */
static void
gst_audio_fx_base_iir_filter_base_init (gpointer klass)
{
GstCaps *caps;
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_fx_base_iir_filter_dispose (GObject * object)
{
@ -112,9 +98,18 @@ gst_audio_fx_base_iir_filter_class_init (GstAudioFXBaseIIRFilterClass * klass)
GObjectClass *gobject_class = (GObjectClass *) klass;
GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
GstAudioFilterClass *filter_class = (GstAudioFilterClass *) klass;
GstCaps *caps;
GST_DEBUG_CATEGORY_INIT (gst_audio_fx_base_iir_filter_debug,
"audiofxbaseiirfilter", 0, "Audio IIR Filter Base Class");
gobject_class->dispose = gst_audio_fx_base_iir_filter_dispose;
caps = gst_caps_from_string (ALLOWED_CAPS);
gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (klass),
caps);
gst_caps_unref (caps);
filter_class->setup = GST_DEBUG_FUNCPTR (gst_audio_fx_base_iir_filter_setup);
trans_class->transform_ip =
@ -123,8 +118,7 @@ gst_audio_fx_base_iir_filter_class_init (GstAudioFXBaseIIRFilterClass * klass)
}
static void
gst_audio_fx_base_iir_filter_init (GstAudioFXBaseIIRFilter * filter,
GstAudioFXBaseIIRFilterClass * klass)
gst_audio_fx_base_iir_filter_init (GstAudioFXBaseIIRFilter * filter)
{
gst_base_transform_set_in_place (GST_BASE_TRANSFORM (filter), TRUE);
@ -357,6 +351,8 @@ gst_audio_fx_base_iir_filter_transform_ip (GstBaseTransform * base,
GstAudioFXBaseIIRFilter *filter = GST_AUDIO_FX_BASE_IIR_FILTER (base);
guint num_samples;
GstClockTime timestamp, stream_time;
guint8 *data;
gsize size;
timestamp = GST_BUFFER_TIMESTAMP (buf);
stream_time =
@ -368,15 +364,17 @@ gst_audio_fx_base_iir_filter_transform_ip (GstBaseTransform * base,
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))
return GST_FLOW_OK;
g_return_val_if_fail (filter->a != NULL, GST_FLOW_ERROR);
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;
}

View file

@ -71,12 +71,9 @@ enum
static guint gst_audio_iir_filter_signals[LAST_SIGNAL] = { 0, };
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_audio_iir_filter_debug, "audioiirfilter", 0, \
"Generic audio IIR filter plugin");
GST_BOILERPLATE_FULL (GstAudioIIRFilter, gst_audio_iir_filter, GstAudioFilter,
GST_TYPE_AUDIO_FX_BASE_IIR_FILTER, DEBUG_INIT);
#define gst_audio_iir_filter_parent_class parent_class
G_DEFINE_TYPE (GstAudioIIRFilter, gst_audio_iir_filter,
GST_TYPE_AUDIO_FX_BASE_IIR_FILTER);
static void gst_audio_iir_filter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -87,24 +84,16 @@ static void gst_audio_iir_filter_finalize (GObject * object);
static gboolean gst_audio_iir_filter_setup (GstAudioFilter * base,
GstRingBufferSpec * format);
/* Element class */
static void
gst_audio_iir_filter_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"Audio IIR filter", "Filter/Effect/Audio",
"Generic audio IIR filter with custom filter kernel",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
}
static void
gst_audio_iir_filter_class_init (GstAudioIIRFilterClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstAudioFilterClass *filter_class = (GstAudioFilterClass *) klass;
GST_DEBUG_CATEGORY_INIT (gst_audio_iir_filter_debug, "audioiirfilter", 0,
"Generic audio IIR filter plugin");
gobject_class->set_property = gst_audio_iir_filter_set_property;
gobject_class->get_property = gst_audio_iir_filter_get_property;
gobject_class->finalize = gst_audio_iir_filter_finalize;
@ -139,6 +128,11 @@ gst_audio_iir_filter_class_init (GstAudioIIRFilterClass * klass)
g_signal_new ("rate-changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstAudioIIRFilterClass, rate_changed),
NULL, NULL, gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
gst_element_class_set_details_simple (gstelement_class,
"Audio IIR filter", "Filter/Effect/Audio",
"Generic audio IIR filter with custom filter kernel",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
}
static void
@ -184,8 +178,7 @@ gst_audio_iir_filter_update_coefficients (GstAudioIIRFilter * self,
}
static void
gst_audio_iir_filter_init (GstAudioIIRFilter * self,
GstAudioIIRFilterClass * g_class)
gst_audio_iir_filter_init (GstAudioIIRFilter * self)
{
GValue v = { 0, };
GValueArray *a, *b;

View file

@ -78,11 +78,7 @@ enum
" rate=(int)[1,MAX]," \
" channels=(int)[1,MAX]"
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_audio_invert_debug, "audioinvert", 0, "audioinvert element");
GST_BOILERPLATE_FULL (GstAudioInvert, gst_audio_invert, GstAudioFilter,
GST_TYPE_AUDIO_FILTER, DEBUG_INIT);
G_DEFINE_TYPE (GstAudioInvert, gst_audio_invert, GST_TYPE_AUDIO_FILTER);
static void gst_audio_invert_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -101,29 +97,19 @@ static void gst_audio_invert_transform_float (GstAudioInvert * filter,
/* GObject vmethod implementations */
static void
gst_audio_invert_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstCaps *caps;
gst_element_class_set_details_simple (element_class, "Audio inversion",
"Filter/Effect/Audio",
"Swaps upper and lower half of audio samples",
"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_invert_class_init (GstAudioInvertClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstCaps *caps;
GST_DEBUG_CATEGORY_INIT (gst_audio_invert_debug, "audioinvert", 0,
"audioinvert element");
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = gst_audio_invert_set_property;
gobject_class->get_property = gst_audio_invert_get_property;
@ -133,6 +119,16 @@ gst_audio_invert_class_init (GstAudioInvertClass * klass)
0.0,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class, "Audio inversion",
"Filter/Effect/Audio",
"Swaps upper and lower half of audio samples",
"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_invert_setup);
GST_BASE_TRANSFORM_CLASS (klass)->transform_ip =
@ -140,7 +136,7 @@ gst_audio_invert_class_init (GstAudioInvertClass * klass)
}
static void
gst_audio_invert_init (GstAudioInvert * filter, GstAudioInvertClass * klass)
gst_audio_invert_init (GstAudioInvert * filter)
{
filter->degree = 0.0;
gst_base_transform_set_in_place (GST_BASE_TRANSFORM (filter), TRUE);
@ -236,6 +232,8 @@ gst_audio_invert_transform_ip (GstBaseTransform * base, GstBuffer * buf)
GstAudioInvert *filter = GST_AUDIO_INVERT (base);
guint num_samples;
GstClockTime timestamp, stream_time;
guint8 *data;
gsize size;
timestamp = GST_BUFFER_TIMESTAMP (buf);
stream_time =
@ -247,14 +245,16 @@ gst_audio_invert_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;
}

View file

@ -85,11 +85,7 @@ enum
" rate=(int)[1,MAX]," \
" channels=(int)[1,MAX]"
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_audio_karaoke_debug, "audiokaraoke", 0, "audiokaraoke element");
GST_BOILERPLATE_FULL (GstAudioKaraoke, gst_audio_karaoke, GstAudioFilter,
GST_TYPE_AUDIO_FILTER, DEBUG_INIT);
G_DEFINE_TYPE (GstAudioKaraoke, gst_audio_karaoke, GST_TYPE_AUDIO_FILTER);
static void gst_audio_karaoke_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -108,28 +104,19 @@ static void gst_audio_karaoke_transform_float (GstAudioKaraoke * filter,
/* GObject vmethod implementations */
static void
gst_audio_karaoke_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstCaps *caps;
gst_element_class_set_details_simple (element_class, "AudioKaraoke",
"Filter/Effect/Audio",
"Removes voice from sound", "Wim Taymans <wim.taymans@gmail.com>");
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_karaoke_class_init (GstAudioKaraokeClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstCaps *caps;
GST_DEBUG_CATEGORY_INIT (gst_audio_karaoke_debug, "audiokaraoke", 0,
"audiokaraoke element");
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = gst_audio_karaoke_set_property;
gobject_class->get_property = gst_audio_karaoke_get_property;
@ -153,6 +140,15 @@ gst_audio_karaoke_class_init (GstAudioKaraokeClass * klass)
"The Frequency width of the filter", 0.0, 100.0, DEFAULT_FILTER_WIDTH,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class, "AudioKaraoke",
"Filter/Effect/Audio",
"Removes voice from sound", "Wim Taymans <wim.taymans@gmail.com>");
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_karaoke_setup);
GST_BASE_TRANSFORM_CLASS (klass)->transform_ip =
@ -160,7 +156,7 @@ gst_audio_karaoke_class_init (GstAudioKaraokeClass * klass)
}
static void
gst_audio_karaoke_init (GstAudioKaraoke * filter, GstAudioKaraokeClass * klass)
gst_audio_karaoke_init (GstAudioKaraoke * filter)
{
gst_base_transform_set_in_place (GST_BASE_TRANSFORM (filter), TRUE);
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM (filter), TRUE);
@ -339,6 +335,8 @@ gst_audio_karaoke_transform_ip (GstBaseTransform * base, GstBuffer * buf)
GstAudioKaraoke *filter = GST_AUDIO_KARAOKE (base);
guint num_samples;
GstClockTime timestamp, stream_time;
guint8 *data;
gsize size;
timestamp = GST_BUFFER_TIMESTAMP (buf);
stream_time =
@ -350,14 +348,16 @@ gst_audio_karaoke_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;
}

View file

@ -117,11 +117,7 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
"width = (int) 16, " "depth = (int) 16, " "signed = (boolean) true")
);
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_audio_panorama_debug, "audiopanorama", 0, "audiopanorama element");
GST_BOILERPLATE_FULL (GstAudioPanorama, gst_audio_panorama, GstBaseTransform,
GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
G_DEFINE_TYPE (GstAudioPanorama, gst_audio_panorama, GST_TYPE_BASE_TRANSFORM);
static void gst_audio_panorama_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -179,27 +175,18 @@ static GstAudioPanoramaProcessFunc panorama_process_functions[2][2][2] = {
/* GObject vmethod implementations */
static void
gst_audio_panorama_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_template));
gst_element_class_set_details_simple (element_class, "Stereo positioning",
"Filter/Effect/Audio",
"Positions audio streams in the stereo panorama",
"Stefan Kost <ensonic@users.sf.net>");
}
static void
gst_audio_panorama_class_init (GstAudioPanoramaClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GST_DEBUG_CATEGORY_INIT (gst_audio_panorama_debug, "audiopanorama", 0,
"audiopanorama element");
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = gst_audio_panorama_set_property;
gobject_class->get_property = gst_audio_panorama_get_property;
@ -224,6 +211,16 @@ gst_audio_panorama_class_init (GstAudioPanoramaClass * klass)
GST_TYPE_AUDIO_PANORAMA_METHOD, METHOD_PSYCHOACOUSTIC,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class, "Stereo positioning",
"Filter/Effect/Audio",
"Positions audio streams in the stereo panorama",
"Stefan Kost <ensonic@users.sf.net>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&src_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sink_template));
GST_BASE_TRANSFORM_CLASS (klass)->get_unit_size =
GST_DEBUG_FUNCPTR (gst_audio_panorama_get_unit_size);
GST_BASE_TRANSFORM_CLASS (klass)->transform_caps =
@ -235,8 +232,7 @@ gst_audio_panorama_class_init (GstAudioPanoramaClass * klass)
}
static void
gst_audio_panorama_init (GstAudioPanorama * filter,
GstAudioPanoramaClass * klass)
gst_audio_panorama_init (GstAudioPanorama * filter)
{
filter->panorama = 0;
@ -655,8 +651,9 @@ gst_audio_panorama_transform (GstBaseTransform * base, GstBuffer * inbuf,
GstBuffer * outbuf)
{
GstAudioPanorama *filter = GST_AUDIO_PANORAMA (base);
guint num_samples = GST_BUFFER_SIZE (outbuf) / (2 * filter->width);
GstClockTime timestamp, stream_time;
guint8 *indata, *outdata;
gsize insize, outsize;
timestamp = GST_BUFFER_TIMESTAMP (inbuf);
stream_time =
@ -668,14 +665,20 @@ gst_audio_panorama_transform (GstBaseTransform * base, GstBuffer * inbuf,
if (GST_CLOCK_TIME_IS_VALID (stream_time))
gst_object_sync_values (G_OBJECT (filter), stream_time);
indata = gst_buffer_map (inbuf, &insize, NULL, GST_MAP_READ);
outdata = gst_buffer_map (outbuf, &outsize, NULL, GST_MAP_WRITE);
if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP))) {
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
memset (GST_BUFFER_DATA (outbuf), 0, GST_BUFFER_SIZE (outbuf));
return GST_FLOW_OK;
memset (outdata, 0, outsize);
} else {
guint num_samples = outsize / (2 * filter->width);
filter->process (filter, indata, outdata, num_samples);
}
filter->process (filter, GST_BUFFER_DATA (inbuf),
GST_BUFFER_DATA (outbuf), num_samples);
gst_buffer_unmap (inbuf, indata, insize);
gst_buffer_unmap (outbuf, outdata, outsize);
return GST_FLOW_OK;
}

View file

@ -138,12 +138,9 @@ gst_gst_audio_wsincband_window_get_type (void)
return gtype;
}
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_gst_audio_wsincband_debug, "audiowsincband", 0, \
"Band-pass and Band-reject Windowed sinc filter plugin");
GST_BOILERPLATE_FULL (GstAudioWSincBand, gst_audio_wsincband, GstAudioFilter,
GST_TYPE_AUDIO_FX_BASE_FIR_FILTER, DEBUG_INIT);
#define gst_audio_wsincband_parent_class parent_class
G_DEFINE_TYPE (GstAudioWSincBand, gst_audio_wsincband,
GST_TYPE_AUDIO_FX_BASE_FIR_FILTER);
static void gst_audio_wsincband_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -157,27 +154,16 @@ static gboolean gst_audio_wsincband_setup (GstAudioFilter * base,
#define POW2(x) (x)*(x)
/* Element class */
static void
gst_audio_wsincband_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"Band pass & band reject filter", "Filter/Effect/Audio",
"Band pass and band reject windowed sinc filter",
"Thomas Vander Stichele <thomas at apestaart dot org>, "
"Steven W. Smith, "
"Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>, "
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
}
static void
gst_audio_wsincband_class_init (GstAudioWSincBandClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstAudioFilterClass *filter_class = (GstAudioFilterClass *) klass;
GST_DEBUG_CATEGORY_INIT (gst_gst_audio_wsincband_debug, "audiowsincband", 0,
"Band-pass and Band-reject Windowed sinc filter plugin");
gobject_class->set_property = gst_audio_wsincband_set_property;
gobject_class->get_property = gst_audio_wsincband_get_property;
gobject_class->finalize = gst_audio_wsincband_finalize;
@ -210,12 +196,19 @@ gst_audio_wsincband_class_init (GstAudioWSincBandClass * klass)
WINDOW_HAMMING,
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",
"Band pass and band reject windowed sinc filter",
"Thomas Vander Stichele <thomas at apestaart dot org>, "
"Steven W. Smith, "
"Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>, "
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
filter_class->setup = GST_DEBUG_FUNCPTR (gst_audio_wsincband_setup);
}
static void
gst_audio_wsincband_init (GstAudioWSincBand * self,
GstAudioWSincBandClass * g_class)
gst_audio_wsincband_init (GstAudioWSincBand * self)
{
self->kernel_length = 101;
self->lower_frequency = 0.0;

View file

@ -137,12 +137,9 @@ gst_audio_wsinclimit_window_get_type (void)
return gtype;
}
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_audio_wsinclimit_debug, "audiowsinclimit", 0, \
"Low-pass and High-pass Windowed sinc filter plugin");
GST_BOILERPLATE_FULL (GstAudioWSincLimit, gst_audio_wsinclimit, GstAudioFilter,
GST_TYPE_AUDIO_FX_BASE_FIR_FILTER, DEBUG_INIT);
#define gst_audio_wsinclimit_parent_class parent_class
G_DEFINE_TYPE (GstAudioWSincLimit, gst_audio_wsinclimit,
GST_TYPE_AUDIO_FX_BASE_FIR_FILTER);
static void gst_audio_wsinclimit_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -156,28 +153,16 @@ static gboolean gst_audio_wsinclimit_setup (GstAudioFilter * base,
#define POW2(x) (x)*(x)
/* Element class */
static void
gst_audio_wsinclimit_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"Low pass & high pass filter", "Filter/Effect/Audio",
"Low pass and high pass windowed sinc filter",
"Thomas Vander Stichele <thomas at apestaart dot org>, "
"Steven W. Smith, "
"Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>, "
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
}
static void
gst_audio_wsinclimit_class_init (GstAudioWSincLimitClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstAudioFilterClass *filter_class = (GstAudioFilterClass *) klass;
GST_DEBUG_CATEGORY_INIT (gst_audio_wsinclimit_debug, "audiowsinclimit", 0,
"Low-pass and High-pass Windowed sinc filter plugin");
gobject_class->set_property = gst_audio_wsinclimit_set_property;
gobject_class->get_property = gst_audio_wsinclimit_get_property;
gobject_class->finalize = gst_audio_wsinclimit_finalize;
@ -206,12 +191,19 @@ gst_audio_wsinclimit_class_init (GstAudioWSincLimitClass * klass)
WINDOW_HAMMING,
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",
"Low pass and high pass windowed sinc filter",
"Thomas Vander Stichele <thomas at apestaart dot org>, "
"Steven W. Smith, "
"Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>, "
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
filter_class->setup = GST_DEBUG_FUNCPTR (gst_audio_wsinclimit_setup);
}
static void
gst_audio_wsinclimit_init (GstAudioWSincLimit * self,
GstAudioWSincLimitClass * g_class)
gst_audio_wsinclimit_init (GstAudioWSincLimit * self)
{
self->mode = MODE_LOW_PASS;
self->window = WINDOW_HAMMING;

View file

@ -130,27 +130,13 @@ static void gst_gamma_before_transform (GstBaseTransform * transform,
static void gst_gamma_calculate_tables (GstGamma * gamma);
GST_BOILERPLATE (GstGamma, gst_gamma, GstVideoFilter, GST_TYPE_VIDEO_FILTER);
static void
gst_gamma_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class, "Video gamma correction",
"Filter/Effect/Video",
"Adjusts gamma on a video stream", "Arwed v. Merkatz <v.merkatz@gmx.net");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_gamma_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_gamma_src_template));
}
G_DEFINE_TYPE (GstGamma, gst_gamma, GST_TYPE_VIDEO_FILTER);
static void
gst_gamma_class_init (GstGammaClass * g_class)
{
GObjectClass *gobject_class = (GObjectClass *) g_class;
GstElementClass *gstelement_class = (GstElementClass *) g_class;
GstBaseTransformClass *trans_class = (GstBaseTransformClass *) g_class;
GST_DEBUG_CATEGORY_INIT (gamma_debug, "gamma", 0, "gamma");
@ -163,6 +149,15 @@ gst_gamma_class_init (GstGammaClass * g_class)
0.01, 10, DEFAULT_PROP_GAMMA,
GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
gst_element_class_set_details_simple (gstelement_class,
"Video gamma correction", "Filter/Effect/Video",
"Adjusts gamma on a video stream", "Arwed v. Merkatz <v.merkatz@gmx.net");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_gamma_sink_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_gamma_src_template));
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_gamma_set_caps);
trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_gamma_transform_ip);
trans_class->before_transform =
@ -170,7 +165,7 @@ gst_gamma_class_init (GstGammaClass * g_class)
}
static void
gst_gamma_init (GstGamma * gamma, GstGammaClass * g_class)
gst_gamma_init (GstGamma * gamma)
{
/* properties */
gamma->gamma = DEFAULT_PROP_GAMMA;

View file

@ -121,28 +121,13 @@ static void gst_video_balance_set_property (GObject * object, guint prop_id,
static void gst_video_balance_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void
_do_init (GType video_balance_type)
{
static const GInterfaceInfo iface_info = {
(GInterfaceInitFunc) gst_video_balance_interface_init,
NULL,
NULL,
};
static const GInterfaceInfo colorbalance_info = {
(GInterfaceInitFunc) gst_video_balance_colorbalance_init,
NULL,
NULL,
};
g_type_add_interface_static (video_balance_type,
GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
g_type_add_interface_static (video_balance_type, GST_TYPE_COLOR_BALANCE,
&colorbalance_info);
}
GST_BOILERPLATE_FULL (GstVideoBalance, gst_video_balance, GstVideoFilter,
GST_TYPE_VIDEO_FILTER, _do_init);
#define gst_video_balance_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVideoBalance, gst_video_balance,
GST_TYPE_VIDEO_FILTER,
G_IMPLEMENT_INTERFACE (GST_TYPE_IMPLEMENTS_INTERFACE,
gst_video_balance_interface_init);
G_IMPLEMENT_INTERFACE (GST_TYPE_COLOR_BALANCE,
gst_video_balance_colorbalance_init));
/*
* look-up tables (LUT).
@ -525,22 +510,6 @@ not_negotiated:
return GST_FLOW_NOT_NEGOTIATED;
}
static void
gst_video_balance_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class, "Video balance",
"Filter/Effect/Video",
"Adjusts brightness, contrast, hue, saturation on a video stream",
"David Schleef <ds@schleef.org>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_video_balance_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_video_balance_src_template));
}
static void
gst_video_balance_finalize (GObject * object)
{
@ -568,6 +537,7 @@ static void
gst_video_balance_class_init (GstVideoBalanceClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
GST_DEBUG_CATEGORY_INIT (videobalance_debug, "videobalance", 0,
@ -593,6 +563,16 @@ gst_video_balance_class_init (GstVideoBalanceClass * klass)
DEFAULT_PROP_SATURATION,
GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class, "Video balance",
"Filter/Effect/Video",
"Adjusts brightness, contrast, hue, saturation on a video stream",
"David Schleef <ds@schleef.org>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_video_balance_sink_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_video_balance_src_template));
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_balance_set_caps);
trans_class->transform_ip =
GST_DEBUG_FUNCPTR (gst_video_balance_transform_ip);
@ -601,8 +581,7 @@ gst_video_balance_class_init (GstVideoBalanceClass * klass)
}
static void
gst_video_balance_init (GstVideoBalance * videobalance,
GstVideoBalanceClass * klass)
gst_video_balance_init (GstVideoBalance * videobalance)
{
const gchar *channels[4] = { "HUE", "SATURATION",
"BRIGHTNESS", "CONTRAST"

View file

@ -130,8 +130,8 @@ gst_video_flip_method_get_type (void)
return video_flip_method_type;
}
GST_BOILERPLATE (GstVideoFlip, gst_video_flip, GstVideoFilter,
GST_TYPE_VIDEO_FILTER);
#define gst_video_flip_parent_class parent_class
G_DEFINE_TYPE (GstVideoFlip, gst_video_flip, GST_TYPE_VIDEO_FILTER);
static GstCaps *
gst_video_flip_transform_caps (GstBaseTransform * trans,
@ -1046,25 +1046,11 @@ gst_video_flip_get_property (GObject * object, guint prop_id, GValue * value,
}
}
static void
gst_video_flip_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class, "Video flipper",
"Filter/Effect/Video",
"Flips and rotates video", "David Schleef <ds@schleef.org>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_video_flip_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_video_flip_src_template));
}
static void
gst_video_flip_class_init (GstVideoFlipClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
GST_DEBUG_CATEGORY_INIT (video_flip_debug, "videoflip", 0, "videoflip");
@ -1077,6 +1063,15 @@ gst_video_flip_class_init (GstVideoFlipClass * klass)
GST_TYPE_VIDEO_FLIP_METHOD, PROP_METHOD_DEFAULT,
GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class, "Video flipper",
"Filter/Effect/Video",
"Flips and rotates video", "David Schleef <ds@schleef.org>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_video_flip_sink_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_video_flip_src_template));
trans_class->transform_caps =
GST_DEBUG_FUNCPTR (gst_video_flip_transform_caps);
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_flip_set_caps);
@ -1088,7 +1083,7 @@ gst_video_flip_class_init (GstVideoFlipClass * klass)
}
static void
gst_video_flip_init (GstVideoFlip * videoflip, GstVideoFlipClass * klass)
gst_video_flip_init (GstVideoFlip * videoflip)
{
videoflip->method = PROP_METHOD_DEFAULT;
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (videoflip), TRUE);