Advertisement
yannick-inizan

video_test.vala

Apr 15th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 0.86 KB | None | 0 0
  1. using My;
  2. using My.Media;
  3. using Gtk;
  4. using Gst;
  5. using Gst.Video;
  6.  
  7. static Window win;
  8.  
  9. public static void main(string[] args){
  10.     Gtk.init(ref args);
  11.     Gst.init(ref args);
  12.     Youtube yt = new Youtube("http://www.youtube.com/watch?v=1aUb6mn8IoM");
  13.     if(yt.urls.size <1)return;
  14.     Element e = ElementFactory.make("playbin",null);
  15.     e.set("uri",yt.urls.get(0));
  16.     e.bus.add_watch(0,cb);
  17.     win = new Window();
  18.     win.destroy.connect(Gtk.main_quit);
  19.     win.show_all();
  20.     e.set_state(Gst.State.PLAYING);
  21.     Gtk.main();
  22. }
  23.  
  24. static bool cb(Gst.Bus bus, Gst.Message message){
  25.     if(message.get_structure() == null)return true;
  26.     if(message.get_structure().get_name() == null)return true;
  27.     if(message.get_structure().get_name() == "prepare-window-handle"){
  28.         (message.src as Gst.Video.Overlay).set_window_handle((uint*)Gdk.X11Window.get_xid(win.get_window()));
  29.     }
  30.     return true;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement