[indent=4] /* Build with valac --pkg gtk+-2.0 --pkg gdk-x11-2.0 --pkg gstreamer-0.10 --pkg gstreamer-interfaces-0.10 yourfile.gs */ uses Gtk Gst class VideoSample : Window drawing_area : DrawingArea pipeline : Pipeline src : Element sink : Element init create_widgets () setup_gst_pipeline () def private create_widgets () var vbox = new VBox (false, 0) this.drawing_area = new DrawingArea () this.drawing_area.set_size_request (300, 150) vbox.pack_start (this.drawing_area, true, true, 0)
using Gst; public class StreamPlayer { private MainLoop loop = new MainLoop (null, false); private void foreach_tag (Gst.TagList list, string tag) { switch (tag) { case "title": string tag_string; list.get_string (tag, out tag_string); stdout.printf ("tag: %s = %s\n", tag, tag_string); break; default: break; } } private bool bus_callback (Gst.Bus bus, Gst.Message message) { switch (message.type) { case MessageType.ERROR: GLib.Error err
/* valac --pkg gtk+-2.0 --pkg gstreamer-interfaces-0.10 --pkg gdk-x11-2.0 videosample.vala */ using Gtk; using Gst; public class VideoSample : Window { private DrawingArea drawing_area; private Pipeline pipeline; private Element src; private Element sink; construct { create_widgets (); setup_gst_pipeline (); } private void create_widgets () { var vbox = new VBox (false, 0); this.drawing_area = new DrawingArea (); this.drawing_area.set_size_request (300, 150); vbox.pack_start (this.drawing_area
using Gst; public void main (string[] args) { Element src; Element sink; Pipeline pipeline; // Initializing GStreamer Gst.init (ref args); // Creating pipeline and elements // NOTE: The return type of the pipeline construction method is Element, // not Pipeline, so we have to cast pipeline = (Pipeline) new Pipeline ("test"); src = ElementFactory.make ("audiotestsrc", "my_src"); sink = ElementFactory.make ("autoaudiosink", "my_sink"); // Adding elements to pipeline pipeline.add_many (src, sink); // Linking source t