Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Renderer : Gst.PlayerVideoRenderer, GLib.Object {
- Gst.Element glimagesink;
- construct {
- glimagesink = Gst.ElementFactory.make ("glimagesink", null);
- }
- public uint* window_handle {
- set {
- (glimagesink as Gst.Video.Overlay).set_window_handle (value);
- }
- }
- public Gst.Element create_video_sink (Gst.Player player) {
- return glimagesink;
- }
- }
- public static void main (string[] args) {
- X.init_threads();
- Gtk.init (ref args);
- Gst.init (ref args);
- var window = new Gtk.Window();
- var bar = new Gtk.HeaderBar();
- bar.show_close_button = true;
- bar.title = "Test GStreamer";
- window.set_titlebar (bar);
- var area = new Gtk.DrawingArea();
- var renderer = new Renderer();
- window.destroy.connect (Gtk.main_quit);
- var player = new Gst.Player (renderer, null);
- area.realize.connect (() => {
- renderer.window_handle = (uint*)(area.get_window() as Gdk.X11.Window).get_xid();
- player.play();
- });
- window.add (area);
- player.media_info_updated.connect (info => {
- print ("info : %s\n", info.get_title());
- });
- player.uri = "http://docs.gstreamer.com/media/sintel_trailer-480p.webm";
- window.set_size_request (400, 300);
- window.show_all();
- Gtk.main();
- }
- // valac sample.vala --pkg gtk+-3.0 --pkg gdk-x11-3.0 --pkg gstreamer-video-1.0 --pkg gstreamer-player-1.0
Add Comment
Please, Sign In to add comment