rotrevrep

GStreamer gtksink sample

Sep 23rd, 2015
599
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 0.69 KB | None | 0 0
  1. public static void main (string[] args) {
  2.     X.init_threads();
  3.     Gst.init (ref args);
  4.     Gtk.init (ref args);
  5.    
  6.     var sink = Gst.ElementFactory.make ("gtksink", "sink");
  7.     var playbin = Gst.ElementFactory.make ("playbin", "bin");
  8.     playbin["video-sink"] = sink;
  9.     playbin["uri"] = "http://www.nicolas-hoffmann.net/animations/Cavernae_Terragen2.mp4";
  10.     Gtk.Widget area;
  11.     sink.get ("widget", out area);
  12.     var win = new Gtk.Window();
  13.     var bar = new Gtk.HeaderBar();
  14.     bar.title = "Test";
  15.     bar.show_close_button = true;
  16.     win.set_titlebar (bar);
  17.     win.add (area);
  18.     win.realize.connect (() => {
  19.         playbin.set_state (Gst.State.PLAYING);
  20.     });
  21.     win.set_size_request (400, 300);
  22.     win.show_all();
  23.     Gtk.main();
  24. }
Add Comment
Please, Sign In to add comment