I've written the small vala program below, and I don't know how to manipulate the GLib.Value types, see the code below :
using Gst; void application_message(Gst.Bus bus, Gst.Message msg) { var s = msg.get_structure(); if(s == null) return; string msgtype = s.get_name(); if(msgtype != "level") return; GLib.Value rms = s.get_value("rms"); GLib.Value st = s.get_value("stream-time"); // according to the doc here : http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-level.html // "rms" is apparently a "GValueArray of gdouble" // and // "st" is a GstClockTime, which is a "typedef guint64 GstClockTime" // I want to create a string representation of the two, ex: // 72374237490234, [0.234234,0,424234234,0.423423423,0.5345345, ...] // and I'm clueless as to how to do the conversions or typecasts... } void main (string[] args) { Gst.init (ref args); try { var pipeline = Gst.parse_launch( "pulsesrc device=\"alsa_input.usb-046d_08c9_674634A4-02-U0x46d0x8c9.analog-mono\" ! " + "level name=wavelevel interval=10000000 ! " + "wavenc ! filesink location=audioz.wav" ); var bus = pipeline.get_bus(); bus.add_signal_watch(); bus.message.connect(application_message); // Set pipeline state to PLAYING pipeline.set_state (State.PLAYING); // Creating and starting a GLib main loop new MainLoop ().run (); } catch(Error e) { print("%s\n", e.message); } }
UPDATE :
THe doc for GLib.Value is here : http://www.valadoc.org/#!api=gobject-2.0/GLib.Value
calling strdup_contents() is somewhat satisfactory, but I'd like to manipulate the array in rms,
printl(rms.type().name()) tells me that it's a GstValueList, so I'd thing that I should cast it to this : http://www.valadoc.org/#!api=gstreamer-1.0/Gst.ValueList but vala seems to know nothing of the type Gst.ValueList...