info: make the overlay iface work and activate playback

This commit is contained in:
Stefan Sauer 2010-10-18 10:31:43 +03:00
parent 2e24a0b565
commit 0fdfd4d0af

View File

@ -47,32 +47,43 @@ public class MediaInfo.Info : VBox
pb = ElementFactory.make ("playbin2", "player") as Pipeline; pb = ElementFactory.make ("playbin2", "player") as Pipeline;
Gst.Bus bus = pb.get_bus (); Gst.Bus bus = pb.get_bus ();
bus.add_signal_watch (); bus.set_sync_handler (bus.sync_signal_handler);
bus.message["element"].connect (on_element_message); bus.sync_message["element"].connect (on_element_sync_message);
} }
~Info ()
{
// stop previous playback
pb.set_state (State.NULL);
}
// public methods // public methods
public bool discover (string uri) public bool discover (string uri)
{ {
// TODO: stop previous playback (also need destructor) bool res = true;
// stop previous playback
pb.set_state (State.NULL);
this.uri.set_text (uri); this.uri.set_text (uri);
if (uri != null) {
//DiscovererInfo info = dc.discover_uri (uri, null);
//DiscovererInfo info = dc.discover_uri (uri, null); // play file
((GLib.Object)pb).set_property ("uri", uri);
pb.set_state (State.PLAYING);
// TODO: play file res = true;
//pb.uri = uri; }
//pb.set_state (State.PLAYING);
return (res);
return (true);
} }
// signal handlers // signal handlers
private void on_element_message (Gst.Bus bus, Message message) private void on_element_sync_message (Gst.Bus bus, Message message)
{ {
Structure structure = message.get_structure (); Structure structure = message.get_structure ();
if (structure.has_name ("prepare-xwindow-id")) if (structure.has_name ("prepare-xwindow-id"))