Hi!
As the moodbar package was the only thing on my system still depending on gstreamer 0.10, I decided to try to port it to 1.0. I had very little previous C experience and none with GTK/gstreamer, but managed to get it working. There seems to be some minor differences to the 0.10 version somewhere, as the output files are not 1:1 when comparing with hex editor, but when comparing visually they look very similar. Attached is a patch against the 0.1.2 source. (Needs running autoconf before ./configure as configure.ac has been changed)
As the original source code link on https://userbase.kde.org/Amarok/Manual/Various/Moodbar is broken, latest entries in ChangeLog are 12 years ago and Amarok seems to be one of the few applications using the moodbar package, I thought this mailing list might be a fine next step trying to find out if something can be done to integrate the patch somewhere (might might also need hosting the moodbar source code in some stable place).
With best regards Tuomas Nurmi IRC: Mazoon @ Freenode
diff -BbaurdEZw moodbar-0.1.2/analyzer/main.c moodbar-0.1.3/analyzer/main.c --- moodbar-0.1.2/analyzer/main.c 2006-10-12 08:43:30.000000000 +0300 +++ moodbar-0.1.3/analyzer/main.c 2018-02-04 21:40:14.231040490 +0200 @@ -118,7 +118,6 @@ static void cb_newpad (GstElement *dec, GstPad *pad, - gboolean last, gpointer data) { GstCaps *caps; @@ -126,11 +125,10 @@ GstPad *audiopad; GstElement *audio = (GstElement *) data; - (void) last; /* Unused */ (void) dec; /* Unused */ /* Only link once */ - audiopad = gst_element_get_pad (audio, "sink"); + audiopad = gst_element_get_static_pad (audio, "sink"); if (GST_PAD_IS_LINKED (audiopad)) { g_object_unref (audiopad); @@ -138,7 +136,7 @@ } /* Check media type */ - caps = gst_pad_get_caps (pad); + caps = gst_pad_query_caps (pad, NULL); str = gst_caps_get_structure (caps, 0); if (!g_strrstr (gst_structure_get_name (str), "audio")) { @@ -208,7 +206,7 @@ /* Create audio output bin */ audio = gst_bin_new ("audiobin"); conv = make_element ("audioconvert", "aconv"); - audiopad = gst_element_get_pad (conv, "sink"); + audiopad = gst_element_get_static_pad (conv, "sink"); /* Create analyzer chain */ fft = make_element ("fftwspectrum", "fft"); @@ -226,7 +224,7 @@ gst_object_unref (audiopad); gst_bin_add (GST_BIN (pipeline), audio); - g_signal_connect (decoder, "new-decoded-pad", + g_signal_connect (decoder, "pad-added", G_CALLBACK (cb_newpad), audio); g_signal_connect (decoder, "unknown-type", G_CALLBACK (cb_cantdecode), loop); Vain hakemistossa moodbar-0.1.3: autom4te.cache diff -BbaurdEZw moodbar-0.1.2/ChangeLog moodbar-0.1.3/ChangeLog --- moodbar-0.1.2/ChangeLog 2006-10-12 08:43:30.000000000 +0300 +++ moodbar-0.1.3/ChangeLog 2018-02-04 19:40:31.511215542 +0200 @@ -1,3 +1,7 @@ +2018-02-04 Tuomas Nurmi <tuomas at norsumanageri dot org> + + * Ported to gstreamer 1.0 + 2006-09-18 Joe Rabinoff <bobqwatson at yahoo dot com> * configure.ac: Vain hakemistossa moodbar-0.1.2: configure diff -BbaurdEZw moodbar-0.1.2/configure.ac moodbar-0.1.3/configure.ac --- moodbar-0.1.2/configure.ac 2006-10-12 08:43:45.000000000 +0300 +++ moodbar-0.1.3/configure.ac 2018-02-02 21:02:07.000000000 +0200 @@ -1,16 +1,16 @@ AC_INIT dnl versions of gstreamer and plugins-base -GST_MAJORMINOR=0.10 -GST_REQUIRED=0.10.0 -GSTPB_REQUIRED=0.10.0 +GST_MAJORMINOR=1.0 +GST_REQUIRED=1.0.0 +GSTPB_REQUIRED=1.0.0 dnl the fourth (nano) number should be 0 for a release, 1 for CVS, dnl and 2... for a prerelease dnl when going to/from release please set the nano correctly ! dnl releases only do Wall, cvs and prerelease does Werror too -AS_VERSION(moodbar, GST_PLUGIN_VERSION, 0, 1, 2, 0, +AS_VERSION(moodbar, GST_PLUGIN_VERSION, 0, 1, 3, 0, GST_PLUGIN_CVS="no", GST_PLUGIN_CVS="yes") dnl AM_MAINTAINER_MODE provides the option to enable maintainer mode @@ -145,7 +145,7 @@ elif test "x${prefix}" = "x$HOME"; then plugindir="$HOME/.gstreamer-$GST_MAJORMINOR/plugins" else - plugindir=`pkg-config --variable=pluginsdir gstreamer-0.10` + plugindir=`pkg-config --variable=pluginsdir gstreamer-1.0` fi AC_SUBST(plugindir) Vain hakemistossa moodbar-0.1.2/.kdev4: moodbar-0.1.2.kdev4 Vain hakemistossa moodbar-0.1.3: koskue2.mood Vain hakemistossa moodbar-0.1.3: koskue3.mood Vain hakemistossa moodbar-0.1.3: moodbar-0.1.3.kdev4 diff -BbaurdEZw moodbar-0.1.2/plugin/gstfftwspectrum.c moodbar-0.1.3/plugin/gstfftwspectrum.c --- moodbar-0.1.2/plugin/gstfftwspectrum.c 2006-10-12 08:43:30.000000000 +0300 +++ moodbar-0.1.3/plugin/gstfftwspectrum.c 2018-02-04 21:42:42.060765153 +0200 @@ -89,20 +89,23 @@ ( SPECTRUM_FREQ_CAPS ) ); -GST_BOILERPLATE (GstFFTWSpectrum, gst_fftwspectrum, GstElement, - GST_TYPE_ELEMENT); +G_DEFINE_TYPE (GstFFTWSpectrum, gst_fftwspectrum, GST_TYPE_ELEMENT); static void gst_fftwspectrum_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void gst_fftwspectrum_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static gboolean gst_fftwspectrum_set_sink_caps (GstPad *pad, GstCaps *caps); -static gboolean gst_fftwspectrum_set_src_caps (GstPad *pad, GstCaps *caps); +static gboolean gst_fftwspectrum_event (GstPad *pad, GstObject *parent, GstEvent *event); +static gboolean gst_fftwspectrum_srcevent (GstPad *pad, GstObject *parent, GstEvent *event); +static gboolean gst_fftwspectrum_query (GstPad *pad,GstObject *parent,GstQuery *query); +static gboolean gst_fftwspectrum_srcquery (GstPad *pad,GstObject *parent,GstQuery *query); +static gboolean gst_fftwspectrum_set_sink_caps (GstPad *pad, GstObject *parent, GstCaps *caps); +static gboolean gst_fftwspectrum_set_src_caps (GstPad *pad, GstObject *parent, GstCaps *caps); static void gst_fftwspectrum_fixatecaps (GstPad *pad, GstCaps *caps); -static GstCaps *gst_fftwspectrum_getcaps (GstPad *pad); +static GstCaps *gst_fftwspectrum_getcaps (GstPad *pad, GstObject *parent); -static GstFlowReturn gst_fftwspectrum_chain (GstPad *pad, GstBuffer *buf); +static GstFlowReturn gst_fftwspectrum_chain (GstPad * pad, GstObject *parent, GstBuffer * buf); static GstStateChangeReturn gst_fftwspectrum_change_state (GstElement *element, GstStateChange transition); @@ -115,25 +118,6 @@ /***************************************************************/ -static void -gst_fftwspectrum_base_init (gpointer gclass) -{ - static GstElementDetails element_details = - { - "FFTW-based Fourier transform", - "Filter/Converter/Spectrum", - "Convert a raw audio stream into a frequency spectrum", - "Joe Rabinoff <bobqwat...@yahoo.com>" - }; - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_factory)); - gst_element_class_set_details (element_class, &element_details); -} - /* initialize the plugin's class */ static void gst_fftwspectrum_class_init (GstFFTWSpectrumClass * klass) @@ -138,12 +122,25 @@ static void gst_fftwspectrum_class_init (GstFFTWSpectrumClass * klass) { + GObjectClass *gobject_class; GstElementClass *gstelement_class; gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; + GstElementClass *element_class = GST_ELEMENT_CLASS (gstelement_class); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_factory)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_factory)); + gst_element_class_set_details_simple (element_class, + "FFTW-based Fourier transform", + "Filter/Converter/Spectrum", + "Convert a raw audio stream into a frequency spectrum", + "Joe Rabinoff <bobqwat...@yahoo.com>"); + gobject_class->set_property = gst_fftwspectrum_set_property; gobject_class->get_property = gst_fftwspectrum_get_property; @@ -172,30 +169,23 @@ * initialize structure */ static void -gst_fftwspectrum_init (GstFFTWSpectrum * conv, - GstFFTWSpectrumClass * gclass) +gst_fftwspectrum_init (GstFFTWSpectrum * conv) { GstElementClass *klass = GST_ELEMENT_GET_CLASS (conv); conv->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, "sink"), "sink"); - gst_pad_set_setcaps_function (conv->sinkpad, - GST_DEBUG_FUNCPTR (gst_fftwspectrum_set_sink_caps)); - gst_pad_set_getcaps_function (conv->sinkpad, - GST_DEBUG_FUNCPTR (gst_fftwspectrum_getcaps)); + gst_pad_set_event_function (conv->sinkpad, gst_fftwspectrum_event); + gst_pad_set_query_function (conv->sinkpad, gst_fftwspectrum_query); + gst_pad_set_chain_function (conv->sinkpad, GST_DEBUG_FUNCPTR (gst_fftwspectrum_chain)); - conv->srcpad = - gst_pad_new_from_template - (gst_element_class_get_pad_template (klass, "src"), "src"); - gst_pad_set_setcaps_function (conv->srcpad, - GST_DEBUG_FUNCPTR (gst_fftwspectrum_set_src_caps)); - gst_pad_set_getcaps_function (conv->srcpad, - GST_DEBUG_FUNCPTR (gst_fftwspectrum_getcaps)); - gst_pad_set_fixatecaps_function (conv->srcpad, - GST_DEBUG_FUNCPTR (gst_fftwspectrum_fixatecaps)); + conv->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, "src"), "src"); + + gst_pad_set_event_function (conv->srcpad, gst_fftwspectrum_srcevent); + gst_pad_set_query_function (conv->srcpad, gst_fftwspectrum_srcquery); gst_element_add_pad (GST_ELEMENT (conv), conv->sinkpad); @@ -294,7 +284,7 @@ GST_DEBUG ("Allocating data for size = %d and step = %d", conv->size, conv->step); - conv->fftw_in = (float *) fftwf_malloc (sizeof(float) * conv->size); + conv->fftw_in = (float *) fftwf_malloc (sizeof(gfloat) * conv->size); conv->fftw_out = (float *) fftwf_malloc (OUTPUT_SIZE (conv)); /* We use the simplest real-to-complex algorithm, which takes n real @@ -334,15 +324,16 @@ */ static gboolean -gst_fftwspectrum_set_sink_caps (GstPad * pad, GstCaps * caps) +gst_fftwspectrum_set_sink_caps (GstPad * pad, GstObject *parent, GstCaps * caps) { GstFFTWSpectrum *conv; GstCaps *srccaps, *newsrccaps; GstStructure *newstruct; gint rate; gboolean res; + gint size, step; - conv = GST_FFTWSPECTRUM (gst_pad_get_parent (pad)); + conv = GST_FFTWSPECTRUM (parent); srccaps = gst_pad_get_allowed_caps (conv->srcpad); newsrccaps = gst_caps_copy_nth (srccaps, 0); @@ -358,8 +349,8 @@ /* Fixate the source caps with the given rate */ gst_caps_set_simple (newsrccaps, "rate", G_TYPE_INT, rate, NULL); - gst_pad_fixate_caps (conv->srcpad, newsrccaps); conv->rate = rate; + gst_fftwspectrum_fixatecaps (conv->srcpad, newsrccaps); res = gst_pad_set_caps (conv->srcpad, newsrccaps); if (!res) conv->rate = 0; @@ -363,27 +354,32 @@ res = gst_pad_set_caps (conv->srcpad, newsrccaps); if (!res) conv->rate = 0; - gst_caps_unref (newsrccaps); - gst_object_unref (conv); return res; } static gboolean -gst_fftwspectrum_set_src_caps (GstPad * pad, GstCaps * caps) +gst_fftwspectrum_set_src_caps (GstPad * pad, GstObject *parent, GstCaps * caps) { GstFFTWSpectrum *conv; gboolean res = FALSE; GstStructure *newstruct; gint rate; + GstCaps *newsrccaps, *newcaps; - conv = GST_FFTWSPECTRUM (gst_pad_get_parent (pad)); + conv = GST_FFTWSPECTRUM (parent); newstruct = gst_caps_get_structure (caps, 0); if (!gst_structure_get_int (newstruct, "rate", &rate)) goto out; + newsrccaps = gst_pad_get_allowed_caps (conv->sinkpad); + newcaps = gst_caps_copy_nth (newsrccaps, 0); + gst_caps_unref (newsrccaps); + gst_fftwspectrum_fixatecaps (conv->srcpad, newcaps); + + /* Assume caps negotiation has already taken place */ if (rate == conv->rate) { @@ -408,7 +404,6 @@ } out: - gst_object_unref (conv); return res; } @@ -416,12 +411,12 @@ /* The only thing that can constrain the caps is the rate. */ static GstCaps * -gst_fftwspectrum_getcaps (GstPad *pad) +gst_fftwspectrum_getcaps (GstPad *pad, GstObject *parent) { GstFFTWSpectrum *conv; GstCaps *tmplcaps; - conv = GST_FFTWSPECTRUM (gst_pad_get_parent (pad)); + conv = GST_FFTWSPECTRUM (parent); tmplcaps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); if(conv->rate != 0) @@ -429,8 +424,7 @@ /* Assumes the template caps are simple */ gst_caps_set_simple (tmplcaps, "rate", G_TYPE_INT, conv->rate, NULL); } - - gst_object_unref (conv); + gst_fftwspectrum_fixatecaps(pad, tmplcaps); return tmplcaps; } @@ -481,6 +475,77 @@ gst_object_unref (conv); } +static gboolean +gst_fftwspectrum_event (GstPad *pad, GstObject *parent, GstEvent *event) +{ + if (GST_EVENT_TYPE (event) == GST_EVENT_CAPS) + { + GstCaps *caps; + gst_event_parse_caps (event, &caps); + gst_caps_ref(caps); + gst_fftwspectrum_set_sink_caps(pad, parent, caps); + gst_event_unref(event); + return TRUE; + } + return gst_pad_event_default(pad, parent, event); +} + +static gboolean +gst_fftwspectrum_srcevent (GstPad *pad, GstObject *parent, GstEvent *event) +{ + if (GST_EVENT_TYPE (event) == GST_EVENT_CAPS) + { + GstCaps *caps; + gst_event_parse_caps (event, &caps); + gst_fftwspectrum_set_src_caps(pad, parent, caps); + gst_event_unref(event); + return TRUE; + } + return gst_pad_event_default(pad, parent, event); +} + + +static gboolean gst_fftwspectrum_query (GstPad *pad,GstObject *parent,GstQuery *query) +{ + gint size, step; + if(GST_QUERY_TYPE(query) == GST_QUERY_CAPS) + { + GstCaps *caps=gst_fftwspectrum_getcaps(pad, parent); + gst_query_set_caps_result(query, caps); + + GstFFTWSpectrum *conv = GST_FFTWSPECTRUM (parent); + + GstStructure *newstruct; + + conv = GST_FFTWSPECTRUM (parent); + + newstruct = gst_caps_get_structure (caps, 0); + + if (!gst_structure_get_int (newstruct, "size", &size)) + return FALSE; + if (!gst_structure_get_int (newstruct, "step", &step)) + return FALSE; + conv->size = size; + conv->step = step; + + gst_caps_unref(caps); + + return TRUE; + } + return gst_pad_query_default(pad, parent, query); +} + +static gboolean gst_fftwspectrum_srcquery (GstPad *pad,GstObject *parent,GstQuery *query) +{ + if(GST_QUERY_TYPE(query) == GST_QUERY_CAPS) + { + GstCaps *caps=gst_fftwspectrum_getcaps(pad, parent); + gst_caps_ref(caps); + gst_query_set_caps_result(query, caps); + return TRUE; + } + return gst_pad_query_default(pad, parent, query); +} /***************************************************************/ /* Actual conversion */ @@ -493,6 +558,7 @@ { GstFFTWSpectrum *conv = GST_FFTWSPECTRUM (element); GstStateChangeReturn res; + GstCaps *srccaps; switch (transition) { @@ -511,7 +577,7 @@ break; } - res = parent_class->change_state (element, transition); + res = GST_ELEMENT_CLASS (gst_fftwspectrum_parent_class)->change_state (element, transition); switch (transition) { @@ -541,14 +607,17 @@ static void push_samples (GstFFTWSpectrum *conv, GstBuffer *buf) { - gint newsamples = GST_BUFFER_SIZE (buf) / sizeof (gfloat); + gint newsamples = gst_buffer_get_size (buf) / sizeof (gfloat); gint oldsamples = conv->numsamples; conv->numsamples += newsamples; conv->samples = g_realloc (conv->samples, conv->numsamples * sizeof (gfloat)); - memcpy (&conv->samples[oldsamples], GST_BUFFER_DATA (buf), - newsamples * sizeof (gfloat)); + GstMapInfo info; + gst_buffer_map(buf, &info, GST_MAP_READ); + memcpy (&conv->samples[oldsamples], info.data, + newsamples * sizeof (gfloat)); + gst_buffer_unmap(buf, &info); /* GST_LOG ("Added %d samples", newsamples); */ } @@ -561,7 +630,7 @@ gfloat *oldsamples = conv->samples; conv->numsamples -= toshift; - conv->samples = g_malloc (MAX (conv->numsamples, 1) * sizeof (float)); + conv->samples = g_malloc (MAX (conv->numsamples, 1) * sizeof (gfloat)); memcpy (conv->samples, &oldsamples[toshift], conv->numsamples * sizeof (gfloat)); g_free (oldsamples); @@ -582,34 +651,31 @@ * by conv->step. */ static GstFlowReturn -gst_fftwspectrum_chain (GstPad * pad, GstBuffer * buf) +gst_fftwspectrum_chain (GstPad * pad, GstObject *parent, GstBuffer * buf) { GstFFTWSpectrum *conv; GstBuffer *outbuf; GstFlowReturn res = GST_FLOW_OK; - conv = GST_FFTWSPECTRUM (gst_pad_get_parent (pad)); + conv = GST_FFTWSPECTRUM (parent); push_samples (conv, buf); - gst_buffer_unref (buf); while (conv->numsamples >= MAX (conv->size, conv->step)) { - res = gst_pad_alloc_buffer_and_set_caps - (conv->srcpad, conv->offset, OUTPUT_SIZE (conv), - GST_PAD_CAPS(conv->srcpad), &outbuf); - if (res != GST_FLOW_OK) - break; + //GstCaps *caps = gst_pad_get_current_caps(conv->srcpad); + outbuf=gst_buffer_new_allocate(NULL, OUTPUT_SIZE (conv), NULL); - GST_BUFFER_SIZE (outbuf) = OUTPUT_SIZE (conv); + gst_buffer_make_writable(outbuf); + gst_buffer_set_size(outbuf, OUTPUT_SIZE (conv)); GST_BUFFER_OFFSET (outbuf) = conv->offset; GST_BUFFER_OFFSET_END (outbuf) = conv->offset + conv->step; - GST_BUFFER_TIMESTAMP (outbuf) = conv->timestamp; + GST_BUFFER_PTS (outbuf) = conv->timestamp; GST_BUFFER_DURATION (outbuf) = gst_util_uint64_scale_int (GST_SECOND, conv->step, conv->rate); /* Do the Fourier transform */ - memcpy (conv->fftw_in, conv->samples, conv->size * sizeof (float)); + memcpy (conv->fftw_in, conv->samples, conv->size * sizeof (gfloat)); fftwf_execute (conv->fftw_plan); { /* Normalize */ gint i; @@ -617,7 +683,11 @@ for (i = 0; i < 2*(conv->size/2+1); ++i) conv->fftw_out[i] /= root; } - memcpy (GST_BUFFER_DATA (outbuf), conv->fftw_out, OUTPUT_SIZE (conv)); + + GstMapInfo info; + gst_buffer_map(outbuf, &info, GST_MAP_WRITE); + memcpy (info.data, conv->fftw_out, OUTPUT_SIZE (conv)); + gst_buffer_unmap(outbuf, &info); res = gst_pad_push (conv->srcpad, outbuf); @@ -627,7 +697,6 @@ break; } - gst_object_unref (conv); return res; } diff -BbaurdEZw moodbar-0.1.2/plugin/gstfftwunspectrum.c moodbar-0.1.3/plugin/gstfftwunspectrum.c --- moodbar-0.1.2/plugin/gstfftwunspectrum.c 2006-10-12 08:43:30.000000000 +0300 +++ moodbar-0.1.3/plugin/gstfftwunspectrum.c 2018-02-04 19:18:09.522180125 +0200 @@ -70,18 +70,20 @@ ( SPECTRUM_SIGNAL_CAPS ) ); -GST_BOILERPLATE (GstFFTWUnSpectrum, gst_fftwunspectrum, GstElement, - GST_TYPE_ELEMENT); +G_DEFINE_TYPE (GstFFTWUnSpectrum, gst_fftwunspectrum, GST_TYPE_ELEMENT); static void gst_fftwunspectrum_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void gst_fftwunspectrum_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static gboolean gst_fftwunspectrum_set_sink_caps (GstPad *pad, GstCaps *caps); +static gboolean gst_fftwunspectrum_event (GstPad *pad, GstObject *parent, GstEvent *event); +static gboolean gst_fftwunspectrum_query (GstPad *pad,GstObject *parent,GstQuery *query); +static gboolean gst_fftwunspectrum_srcquery (GstPad *pad,GstObject *parent,GstQuery *query); +static gboolean gst_fftwunspectrum_set_sink_caps (GstPad *pad, GstObject *parent, GstCaps *caps); static GstCaps *gst_fftwunspectrum_getcaps (GstPad *pad); -static GstFlowReturn gst_fftwunspectrum_chain (GstPad *pad, GstBuffer *buf); +static GstFlowReturn gst_fftwunspectrum_chain (GstPad * pad, GstObject *parent, GstBuffer * buf); static GstStateChangeReturn gst_fftwunspectrum_change_state (GstElement *element, GstStateChange transition); @@ -95,25 +97,6 @@ /***************************************************************/ -static void -gst_fftwunspectrum_base_init (gpointer gclass) -{ - static GstElementDetails element_details = - { - "FFTW-based Inverse Fourier transform", - "Filter/Converter/Spectrum", - "Convert a frequency spectrum stream into a raw audio stream", - "Joe Rabinoff <bobqwat...@yahoo.com>" - }; - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_factory)); - gst_element_class_set_details (element_class, &element_details); -} - /* initialize the plugin's class */ static void gst_fftwunspectrum_class_init (GstFFTWUnSpectrumClass * klass) @@ -124,6 +107,18 @@ gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; + GstElementClass *element_class = GST_ELEMENT_CLASS (gstelement_class); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_factory)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_factory)); + gst_element_class_set_details_simple (element_class, + "FFTW-based Inverse Fourier transform", + "Filter/Converter/Spectrum", + "Convert a frequency spectrum stream into a raw audio stream", + "Joe Rabinoff <bobqwat...@yahoo.com>"); + gobject_class->set_property = gst_fftwunspectrum_set_property; gobject_class->get_property = gst_fftwunspectrum_get_property; @@ -142,26 +137,23 @@ * initialize structure */ static void -gst_fftwunspectrum_init (GstFFTWUnSpectrum * conv, - GstFFTWUnSpectrumClass * gclass) +gst_fftwunspectrum_init (GstFFTWUnSpectrum * conv) { GstElementClass *klass = GST_ELEMENT_GET_CLASS (conv); conv->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, "sink"), "sink"); - gst_pad_set_setcaps_function (conv->sinkpad, - GST_DEBUG_FUNCPTR (gst_fftwunspectrum_set_sink_caps)); - gst_pad_set_getcaps_function (conv->sinkpad, - GST_DEBUG_FUNCPTR (gst_fftwunspectrum_getcaps)); + + gst_pad_set_query_function(conv->sinkpad, gst_fftwunspectrum_query); + gst_pad_set_event_function (conv->sinkpad, gst_fftwunspectrum_event); gst_pad_set_chain_function (conv->sinkpad, GST_DEBUG_FUNCPTR (gst_fftwunspectrum_chain)); conv->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, "src"), "src"); - gst_pad_set_getcaps_function (conv->srcpad, - GST_DEBUG_FUNCPTR (gst_fftwunspectrum_getcaps)); + gst_pad_set_query_function(conv->srcpad, gst_fftwunspectrum_srcquery); gst_element_add_pad (GST_ELEMENT (conv), conv->sinkpad); @@ -272,6 +264,43 @@ = (gfloat *) g_malloc (NUM_EXTRA_SAMPLES (conv) * sizeof (gfloat)); } +static gboolean +gst_fftwunspectrum_event (GstPad *pad, GstObject *parent, GstEvent *event) +{ + + if (GST_EVENT_TYPE (event) == GST_EVENT_CAPS) + { + GstCaps *caps; + gst_event_parse_caps (event, &caps); + gst_fftwunspectrum_set_sink_caps(pad, parent, caps); + gst_event_unref(event); + return TRUE; + } + + return gst_pad_event_default(pad, parent, event); +} + +static gboolean gst_fftwunspectrum_query (GstPad *pad,GstObject *parent,GstQuery *query) +{ + if(GST_QUERY_TYPE(query) == GST_QUERY_CAPS) + { + gst_query_set_caps_result(query, gst_fftwunspectrum_getcaps(pad)); + return TRUE; + } + + return gst_pad_query_default(pad, parent, query); +} + +static gboolean gst_fftwunspectrum_srcquery (GstPad *pad,GstObject *parent,GstQuery *query) +{ + if(GST_QUERY_TYPE(query) == GST_QUERY_CAPS) + { + gst_query_set_caps_result(query, gst_fftwunspectrum_getcaps(pad)); + return TRUE; + } + + return gst_pad_query_default(pad, parent, query); +} /***************************************************************/ /* Capabilities negotiation */ @@ -294,7 +323,7 @@ */ static gboolean -gst_fftwunspectrum_set_sink_caps (GstPad *pad, GstCaps *caps) +gst_fftwunspectrum_set_sink_caps (GstPad *pad, GstObject *parent, GstCaps *caps) { GstFFTWUnSpectrum *conv; GstCaps *srccaps, *newsrccaps; @@ -302,7 +331,7 @@ gint rate, size, step; gboolean res; - conv = GST_FFTWUNSPECTRUM (gst_pad_get_parent (pad)); + conv = GST_FFTWUNSPECTRUM (parent); srccaps = gst_pad_get_allowed_caps (conv->srcpad); newsrccaps = gst_caps_copy_nth (srccaps, 0); @@ -316,12 +345,12 @@ size < step) { gst_caps_unref (newsrccaps); - gst_object_unref (conv); return FALSE; } /* This gets rid of all ambiguity so should fixate */ gst_caps_set_simple (newsrccaps, "rate", G_TYPE_INT, rate, NULL); + gst_caps_set_simple (newsrccaps, "channels", G_TYPE_INT, 2, NULL); res = gst_pad_set_caps (conv->srcpad, newsrccaps); if (G_LIKELY (res)) @@ -340,7 +369,7 @@ } gst_caps_unref (newsrccaps); - gst_object_unref (conv); + //gst_object_unref (conv); return res; } @@ -393,7 +422,8 @@ break; } - res = parent_class->change_state (element, transition); + + res = GST_ELEMENT_CLASS (gst_fftwunspectrum_parent_class)->change_state (element, transition); switch (transition) { @@ -414,7 +444,7 @@ static GstFlowReturn -gst_fftwunspectrum_chain (GstPad * pad, GstBuffer * buf) +gst_fftwunspectrum_chain (GstPad * pad, GstObject *parent, GstBuffer * buf) { GstFFTWUnSpectrum *conv; GstBuffer *outbuf; @@ -423,23 +453,25 @@ conv = GST_FFTWUNSPECTRUM (gst_pad_get_parent (pad)); /* Pedantry */ - if (GST_BUFFER_SIZE (buf) != INPUT_SIZE (conv)) + if (gst_buffer_get_size (buf) != INPUT_SIZE (conv)) return GST_FLOW_ERROR; - res = gst_pad_alloc_buffer_and_set_caps - (conv->srcpad, GST_BUFFER_OFFSET (buf), conv->step * sizeof (gfloat), - GST_PAD_CAPS(conv->srcpad), &outbuf); - if (res != GST_FLOW_OK) - goto out; + outbuf=gst_buffer_new_allocate(NULL, INPUT_SIZE (conv), NULL); - GST_BUFFER_SIZE (outbuf) = conv->step * sizeof (gfloat); + + gst_buffer_set_size(outbuf,conv->step * sizeof (gfloat)); GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (buf); GST_BUFFER_OFFSET_END (outbuf) = GST_BUFFER_OFFSET_END (buf); - GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf); + GST_BUFFER_PTS (outbuf) = GST_BUFFER_PTS(outbuf); GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf); /* Do the Fourier transform */ - memcpy (conv->fftw_in, GST_BUFFER_DATA (buf), INPUT_SIZE (conv)); + + GstMapInfo info; + gst_buffer_map(buf, &info, GST_MAP_READ); + + memcpy (conv->fftw_in, info.data, INPUT_SIZE (conv)); + gst_buffer_unmap(buf, &info); fftwf_execute (conv->fftw_plan); { /* Normalize */ gint i; @@ -452,7 +484,9 @@ if (NUM_EXTRA_SAMPLES (conv) > 0) { gint i, num_others, extra = NUM_EXTRA_SAMPLES (conv); - gfloat *out = (gfloat *) GST_BUFFER_DATA (outbuf); + GstMapInfo binfo; + gst_buffer_map(outbuf, &binfo, GST_MAP_WRITE); + gfloat *out = binfo.data; gfloat start_weight, end_weight, weight, pct; /* Average the input data with the overlap. This code is kind @@ -518,17 +552,23 @@ memcpy (&conv->extra_samples[MAX (extra - conv->step, 0)], &conv->fftw_out[conv->size - MIN (extra, conv->step)], MIN (extra, conv->step) * sizeof (gfloat)); + + gst_buffer_unmap(outbuf, &binfo); } else /* conv->size == conv->step */ - memcpy (GST_BUFFER_DATA (outbuf), conv->fftw_out, - conv->size * sizeof (gfloat)); + { + + GstMapInfo binfo; + gst_buffer_map(outbuf, &binfo, GST_MAP_WRITE); + memcpy (binfo.data, conv->fftw_out, conv->size * sizeof (gfloat)); + gst_buffer_unmap(outbuf, &binfo); + } res = gst_pad_push (conv->srcpad, outbuf); out: gst_buffer_unref (buf); - gst_object_unref (conv); return res; } diff -BbaurdEZw moodbar-0.1.2/plugin/gstmoodbar.c moodbar-0.1.3/plugin/gstmoodbar.c --- moodbar-0.1.2/plugin/gstmoodbar.c 2006-10-12 08:43:30.000000000 +0300 +++ moodbar-0.1.3/plugin/gstmoodbar.c 2018-02-04 19:20:00.480701710 +0200 @@ -91,7 +91,7 @@ GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS - ( "video/x-raw-rgb, " + ( "video/x-raw, format=(string) RGB, " "bpp = (int) 24, " "depth = (int) 24, " "height = (int) [ 1, MAX ], " @@ -100,18 +100,17 @@ ) ); -GST_BOILERPLATE (GstMoodbar, gst_moodbar, GstElement, - GST_TYPE_ELEMENT); +G_DEFINE_TYPE (GstMoodbar, gst_moodbar, GST_TYPE_ELEMENT); static void gst_moodbar_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void gst_moodbar_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static gboolean gst_moodbar_set_sink_caps (GstPad *pad, GstCaps *caps); -static gboolean gst_moodbar_sink_event (GstPad *pad, GstEvent *event); +static gboolean gst_moodbar_set_sink_caps (GstPad *pad, GstObject *parent, GstCaps *caps); +static gboolean gst_moodbar_sink_event (GstPad *pad, GstObject *parent, GstEvent *event); -static GstFlowReturn gst_moodbar_chain (GstPad *pad, GstBuffer *buf); +static GstFlowReturn gst_moodbar_chain (GstPad *pad, GstObject *parent, GstBuffer *buf); static GstStateChangeReturn gst_moodbar_change_state (GstElement *element, GstStateChange transition); @@ -144,25 +143,6 @@ /***************************************************************/ -static void -gst_moodbar_base_init (gpointer gclass) -{ - static GstElementDetails element_details = - { - "Moodbar analyzer", - "Filter/Converter/Moodbar", - "Convert a spectrum into a stream of (uchar) rgb triples representing its \"mood\"", - "Joe Rabinoff <bobqwat...@yahoo.com>" - }; - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_factory)); - gst_element_class_set_details (element_class, &element_details); -} - /* initialize the plugin's class */ static void gst_moodbar_class_init (GstMoodbarClass * klass) @@ -173,6 +153,18 @@ gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; + GstElementClass *element_class = GST_ELEMENT_CLASS (gstelement_class); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_factory)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_factory)); + gst_element_class_set_details_simple (element_class, + "Moodbar analyzer", + "Filter/Converter/Moodbar", + "Convert a spectrum into a stream of (uchar) rgb triples representing its \"mood\"", + "Joe Rabinoff <bobqwat...@yahoo.com>" ); + gobject_class->set_property = gst_moodbar_set_property; gobject_class->get_property = gst_moodbar_get_property; @@ -196,15 +188,13 @@ * initialize structure */ static void -gst_moodbar_init (GstMoodbar *mood, GstMoodbarClass *gclass) +gst_moodbar_init (GstMoodbar *mood) { GstElementClass *klass = GST_ELEMENT_GET_CLASS (mood); mood->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, "sink"), "sink"); - gst_pad_set_setcaps_function (mood->sinkpad, - GST_DEBUG_FUNCPTR (gst_moodbar_set_sink_caps)); gst_pad_set_event_function (mood->sinkpad, GST_DEBUG_FUNCPTR (gst_moodbar_sink_event)); gst_pad_set_chain_function (mood->sinkpad, @@ -324,14 +314,14 @@ */ static gboolean -gst_moodbar_set_sink_caps (GstPad *pad, GstCaps *caps) +gst_moodbar_set_sink_caps (GstPad *pad, GstObject *parent, GstCaps *caps) { GstMoodbar *mood; GstStructure *newstruct; gint rate, size; gboolean res = FALSE; - mood = GST_MOODBAR (gst_pad_get_parent (pad)); + mood = GST_MOODBAR (parent); newstruct = gst_caps_get_structure (caps, 0); if (!gst_structure_get_int (newstruct, "rate", &rate) || @@ -345,14 +335,13 @@ calc_barkband_table (mood); out: - gst_object_unref (mood); return res; } static gboolean -gst_moodbar_sink_event (GstPad *pad, GstEvent *event) +gst_moodbar_sink_event (GstPad *pad, GstObject *parent, GstEvent *event) { GstMoodbar *mood; gboolean res = TRUE; @@ -356,12 +345,24 @@ { GstMoodbar *mood; gboolean res = TRUE; - mood = GST_MOODBAR (gst_pad_get_parent (pad)); if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) gst_moodbar_finish (mood); + if (GST_EVENT_TYPE (event) == GST_EVENT_CAPS) + { + GstCaps *caps; + gst_event_parse_caps (event, &caps); + + gst_caps_ref(caps); + gst_moodbar_set_sink_caps(pad, parent, caps); + gst_event_unref(event); + gst_object_unref (mood); + return TRUE; + } + + res = gst_pad_push_event (mood->srcpad, event); gst_object_unref (mood); @@ -397,7 +398,7 @@ break; } - res = parent_class->change_state (element, transition); + res = GST_ELEMENT_CLASS (gst_moodbar_parent_class)->change_state (element, transition); switch (transition) { @@ -457,21 +458,24 @@ * once we receive an EOS signal. */ static GstFlowReturn -gst_moodbar_chain (GstPad *pad, GstBuffer *buf) +gst_moodbar_chain (GstPad *pad, GstObject *parent, GstBuffer *buf) { - GstMoodbar *mood = GST_MOODBAR (gst_pad_get_parent (pad)); + GstMoodbar *mood = GST_MOODBAR (parent); guint i; gfloat amplitudes[24], rgb[3] = {0.f, 0.f, 0.f}; gfloat *out, real, imag; guint numfreqs = NUMFREQS (mood); - if (GST_BUFFER_SIZE (buf) != numfreqs * sizeof (gfloat) * 2) + if (gst_buffer_get_size (buf) != numfreqs * sizeof (gfloat) * 2) { gst_object_unref (mood); return GST_FLOW_ERROR; } - out = (gfloat *) GST_BUFFER_DATA (buf); + + GstMapInfo info; + gst_buffer_map(buf, &info, GST_MAP_READ); + out = (gfloat *) info.data; if (!allocate_another_frame (mood)) return GST_FLOW_ERROR; @@ -501,8 +505,9 @@ mood->g[mood->numframes] = rgb[1]; mood->b[mood->numframes] = rgb[2]; + gst_buffer_unmap(buf, &info); + gst_buffer_unref (buf); - gst_object_unref (mood); return GST_FLOW_OK; } @@ -612,7 +617,7 @@ if (mood->max_width == 0 || mood->numframes <= mood->max_width) - output_width = mood->numframes; + output_width = mood->numframes-1; else output_width = mood->max_width; @@ -626,7 +631,11 @@ return; /* Don't set the timestamp, duration, etc. since it's irrelevant */ GST_BUFFER_OFFSET (buf) = 0; - data = (guchar *) GST_BUFFER_DATA (buf); + + + GstMapInfo info; + gst_buffer_map(buf, &info, GST_MAP_READWRITE); + data = info.data; gfloat r, g, b; guint i, j, n; @@ -657,17 +666,16 @@ } { /* Now we (finally) know the width of the image we're pushing */ - GstCaps *caps = gst_caps_copy (gst_pad_get_caps (mood->srcpad)); + GstCaps *caps = gst_caps_copy (gst_pad_query_caps (mood->srcpad, NULL)); gboolean res; gst_caps_set_simple (caps, "width", G_TYPE_INT, output_width, NULL); gst_caps_set_simple (caps, "height", G_TYPE_INT, mood->height, NULL); res = gst_pad_set_caps (mood->srcpad, caps); - if (res) - gst_buffer_set_caps (buf, caps); gst_caps_unref (caps); if (!res) return; } + gst_buffer_unmap(buf, &info); gst_pad_push (mood->srcpad, buf); } diff -BbaurdEZw moodbar-0.1.2/plugin/gstspectrumeq.c moodbar-0.1.3/plugin/gstspectrumeq.c --- moodbar-0.1.2/plugin/gstspectrumeq.c 2006-10-12 08:43:30.000000000 +0300 +++ moodbar-0.1.3/plugin/gstspectrumeq.c 2018-02-04 18:58:17.359520225 +0200 @@ -79,17 +79,16 @@ ( SPECTRUM_FREQ_CAPS ) ); -GST_BOILERPLATE (GstSpectrumEq, gst_spectrumeq, GstBaseTransform, - GST_TYPE_BASE_TRANSFORM); +G_DEFINE_TYPE (GstSpectrumEq, gst_spectrumeq, GST_TYPE_BASE_TRANSFORM); -static void spectrumeq_set_property (GObject *object, guint prop_id, +static void gst_spectrumeq_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void spectrumeq_get_property (GObject *object, guint prop_id, +static void gst_spectrumeq_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static GstFlowReturn spectrumeq_transform_ip (GstBaseTransform *base, +static GstFlowReturn gst_spectrumeq_transform_ip (GstBaseTransform *base, GstBuffer *outbuf); -static gboolean spectrumeq_set_caps (GstBaseTransform *base, GstCaps *incaps, +static gboolean gst_spectrumeq_set_caps (GstBaseTransform *base, GstCaps *incaps, GstCaps *outcaps); @@ -176,10 +175,10 @@ /* GObject boilerplate stuff */ /***************************************************************/ -#define GST_TYPE_SPECTRUMEQ_PRESETS (spectrumeq_presets_get_type()) +#define GST_TYPE_SPECTRUMEQ_PRESETS (gst_spectrumeq_presets_get_type()) static GType -spectrumeq_presets_get_type (void) +gst_spectrumeq_presets_get_type (void) { static GType type = 0; static const GEnumValue presets[] = @@ -198,7 +197,7 @@ static void -spectrumeq_dispose (GObject *object) +gst_spectrumeq_dispose (GObject *object) { GstSpectrumEq *spec = GST_SPECTRUMEQ (object); @@ -208,27 +207,7 @@ spec->bands = NULL; spec->numbands = 0; - G_OBJECT_CLASS (parent_class)->dispose (object); -} - - -static void -gst_spectrumeq_base_init (gpointer g_class) -{ - static GstElementDetails spectrumeq_details = - { - "Multi-band Spectrum-space Equalizer", - "Filter/Effect/Audio", - "Scale amplitudes of bands of a spectrum", - "Joe Rabinoff <bobqwat...@yahoo.com>" - }; - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&spectrumeq_src_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&spectrumeq_sink_template)); - gst_element_class_set_details (element_class, &spectrumeq_details); + G_OBJECT_CLASS (gst_spectrumeq_parent_class)->dispose (object); } @@ -241,9 +220,21 @@ gobject_class = (GObjectClass *) klass; trans_class = (GstBaseTransformClass *) klass; - gobject_class->set_property = spectrumeq_set_property; - gobject_class->get_property = spectrumeq_get_property; - gobject_class->dispose = spectrumeq_dispose; + GstElementClass *element_class = GST_ELEMENT_CLASS (gobject_class); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&spectrumeq_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&spectrumeq_sink_template)); + gst_element_class_set_details_simple (element_class, + "Multi-band Spectrum-space Equalizer", + "Filter/Effect/Audio", + "Scale amplitudes of bands of a spectrum", + "Joe Rabinoff <bobqwat...@yahoo.com>"); + + gobject_class->set_property = gst_spectrumeq_set_property; + gobject_class->get_property = gst_spectrumeq_get_property; + gobject_class->dispose = gst_spectrumeq_dispose; g_object_class_install_property (gobject_class, ARG_EQUALIZER, g_param_spec_value_array ("equalizer", "Equalizer", @@ -258,21 +249,21 @@ GST_TYPE_SPECTRUMEQ_PRESETS, GST_SPECTRUM_PRESET_MED, G_PARAM_WRITABLE)); - trans_class->transform_ip = GST_DEBUG_FUNCPTR (spectrumeq_transform_ip); - trans_class->set_caps = GST_DEBUG_FUNCPTR (spectrumeq_set_caps); + trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_spectrumeq_transform_ip); + trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_spectrumeq_set_caps); trans_class->passthrough_on_same_caps = FALSE; } static void -gst_spectrumeq_init (GstSpectrumEq *spec, GstSpectrumEqClass *g_class) +gst_spectrumeq_init (GstSpectrumEq *spec) { GstBaseTransform *trans = GST_BASE_TRANSFORM (spec); /* Set these for clarity (they should be the defaults) */ - trans->passthrough = FALSE; - trans->always_in_place = TRUE; + gst_base_transform_set_passthrough(trans, FALSE); + gst_base_transform_set_in_place(trans, TRUE); /* By default there is only one band scaled at 1.0 */ spec->bands = (gfloat *) g_malloc (1 * sizeof (gfloat)); @@ -284,7 +275,7 @@ static void -spectrumeq_set_property (GObject *object, guint prop_id, const GValue *value, +gst_spectrumeq_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GstSpectrumEq *spec = GST_SPECTRUMEQ (object); @@ -361,7 +352,7 @@ static void -spectrumeq_get_property (GObject *object, guint prop_id, GValue *value, +gst_spectrumeq_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { GstSpectrumEq *spec = GST_SPECTRUMEQ (object); @@ -397,7 +388,7 @@ * transform_caps returns that the caps on both pads should be the same. */ static gboolean -spectrumeq_set_caps (GstBaseTransform *base, GstCaps *incaps, GstCaps *outcaps) +gst_spectrumeq_set_caps (GstBaseTransform *base, GstCaps *incaps, GstCaps *outcaps) { GstSpectrumEq *spec = GST_SPECTRUMEQ (base); GstStructure *s; @@ -426,17 +417,19 @@ /***************************************************************/ static GstFlowReturn -spectrumeq_transform_ip (GstBaseTransform *base, GstBuffer *outbuf) +gst_spectrumeq_transform_ip (GstBaseTransform *base, GstBuffer *outbuf) { GstSpectrumEq *spec = GST_SPECTRUMEQ (base); gfloat *data; guint i; /* Pedantry */ - if (GST_BUFFER_SIZE (outbuf) != spec->numfreqs * sizeof (gfloat) * 2) + if (gst_buffer_get_size (outbuf) != spec->numfreqs * sizeof (gfloat) * 2) return GST_FLOW_ERROR; - data = (gfloat *) GST_BUFFER_DATA (outbuf); + GstMapInfo info; + gst_buffer_map(outbuf, &info, GST_MAP_READWRITE); + data = info.data; for (i = 0; i < spec->numfreqs; ++i) { @@ -466,6 +459,7 @@ *(++data) *= scalefactor; } + gst_buffer_unmap(outbuf, &info); return GST_FLOW_OK; } diff -BbaurdEZw moodbar-0.1.2/plugin/spectrum.c moodbar-0.1.3/plugin/spectrum.c --- moodbar-0.1.2/plugin/spectrum.c 2006-10-12 08:43:30.000000000 +0300 +++ moodbar-0.1.3/plugin/spectrum.c 2018-01-26 20:56:31.000000000 +0200 @@ -74,7 +74,7 @@ */ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, - "moodbar", + moodbar, "Frequency analyzer and converter plugin", plugin_init, VERSION, "GPL", "Moodbar", "http://amarok.kde.org/wiki/Moodbar") diff -BbaurdEZw moodbar-0.1.2/plugin/spectrum.h moodbar-0.1.3/plugin/spectrum.h --- moodbar-0.1.2/plugin/spectrum.h 2006-10-12 08:43:30.000000000 +0300 +++ moodbar-0.1.3/plugin/spectrum.h 2018-02-04 19:29:14.356987806 +0200 @@ -18,12 +18,9 @@ /* Since fftwspectrum and fftwunspectrum are supposed to be * opposites, they'll be using the same caps: */ -#define SPECTRUM_SIGNAL_CAPS "audio/x-raw-float, " \ +#define SPECTRUM_SIGNAL_CAPS "audio/x-raw,format=(string) F32LE, " \ "rate = (int) [ 1, MAX ], " \ - "channels = (int) 1, " \ - "endianness = (int) BYTE_ORDER, " \ - "width = (int) 32, " \ - "signed = (boolean) true" + "channels = (int) 1" /* audio/x-spectrum-complex-float is an array of complex floats. A * complex float is just a pair (r, i) of a real float and an