Re: Moodbar ported to gstreamer-1.0

2018-02-22 Thread Tuomas Nurmi
Hi!

I uploaded Moodbar sources and the port to github, they're now available 
at https://github.com/Mazhoon/moodbar
Works for me at least, happy to hear if for someone else too (or if someone 
has any problems).

Best regards
Tuomas

IRC: Mazoon @ Freenode


Moodbar ported to gstreamer-1.0

2018-02-04 Thread Tuomas Nurmi


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.0 +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.0 +0300
+++ moodbar-0.1.3/ChangeLog	2018-02-04 19:40:31.511215542 +0200
@@ -1,3 +1,7 @@
+2018-02-04  Tuomas Nurmi 
+
+	* Ported to gstreamer 1.0
+
 2006-09-18  Joe Rabinoff  
 
 	* 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.0 +0300
+++ moodbar-0.1.3/configure.ac	2018-02-02 21:02:07.0 +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.0 +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 p