public static void Main(string[] args) { // Initialize GStreamer Application.Init (ref args); // Build the pipeline Pipeline = Parse.Launch ("playbin uri=http://download.blender.org/durian/trailer/sintel_trailer-1080p.mp4"); var bus = Pipeline.Bus; // Start playing var ret = Pipeline.SetState (State.Playing); if (ret == StateChangeReturn.Failure) { Console.WriteLine ("Unable to set the pipeline to the playing state."); return; } else if (ret == StateChangeReturn.NoPreroll) { IsLive = true; } MainLoop = new GLib.MainLoop (); bus.AddSignalWatch (); bus.Message += HandleMessage; MainLoop.Run (); // Free resources Pipeline.SetState (State.Null); }
public void TestBufferOwnership () { MyTransformIp.Register (); Pipeline pipeline = new Pipeline (); Element src = ElementFactory.Make ("fakesrc"); src["num-buffers"] = 10; Element transform = new MyTransformIp (); Element sink = ElementFactory.Make ("fakesink"); pipeline.Add (src, transform, sink); Element.Link (src, transform, sink); Gst.GLib.MainLoop loop = new Gst.GLib.MainLoop (); pipeline.Bus.AddWatch (delegate (Bus bus, Message message) { switch (message.Type) { case MessageType.Error: Enum err; string msg; message.ParseError (out err, out msg); Assert.Fail (String.Format ("Error message: {0}", msg)); loop.Quit (); break; case MessageType.Eos: loop.Quit (); break; } return true; }); pipeline.SetState (State.Playing); loop.Run (); pipeline.SetState (State.Null); }
public static void Main(string[] args) { // Initialize GStreamer Application.Init (ref args); GtkSharp.GstreamerSharp.ObjectManager.Initialize (); // Print usage map Console.WriteLine ("USAGE: Choose one of the following options, then press enter:"); Console.WriteLine (" 'C' to increase contrast, 'c' to decrease contrast"); Console.WriteLine (" 'B' to increase brightness, 'b' to decrease brightness"); Console.WriteLine (" 'H' to increase hue, 'h' to decrease hue"); Console.WriteLine (" 'S' to increase saturation, 's' to decrease saturation"); Console.WriteLine (" 'Q' to quit"); // Build the pipeline Pipeline = Parse.Launch ("playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm"); // Add a keyboard watch so we get notified of keystrokes // Start playing var ret = Pipeline.SetState (State.Playing); if (ret == StateChangeReturn.Failure) { Console.WriteLine ("Unable to set the pipeline to the playing state."); return; } PrintCurrentValues (); // Create a GLib Main Loop and set it to run MainLoop = new GLib.MainLoop (); GLib.Timeout.Add (50, HandleKeyboard); MainLoop.Run (); // Free resources Pipeline.SetState (State.Null); }
public static void Main(string[] args) { Loop = new GLib.MainLoop(); Application.Init(ref args); element = Gst.Parse.ParseLaunch("playbin uri=http://ftp.nluug.nl/ftp/graphics/blender/apricot/trailer/Sintel_Trailer1.1080p.DivX_Plus_HD.mkv"); element.Bus.AddSignalWatch(); element.Bus.Message += Handle; element.SetState(State.Playing); Loop.Run(); }
static uint Video = (1 << 0); // We want video output #endregion Fields #region Methods public static void Main(string[] args) { // Initialize GStreamer Application.Init (ref args); // Create the elements Playbin = ElementFactory.Make ("playbin", "playbin"); if (Playbin == null) { Console.WriteLine ("Not all elements could be created."); return; } // Set the URI to play Playbin ["uri"] = "http://docs.gstreamer.com/media/sintel_trailer-480p.ogv"; // Set the subtitle URI to play and some font description Playbin ["suburi"] = "http://docs.gstreamer.com/media/sintel_trailer_gr.srt"; Playbin ["subtitle-font-desc"] = "Sans, 18"; // Set flags to show Audio and Video and Subtitles var flags = (uint)Playbin ["flags"]; flags |= Audio | Video | Text; Playbin ["flags"] = flags; // Add a bus watch, so we get notified when a message arrives var bus = Playbin.Bus; bus.AddSignalWatch (); bus.Message += HandleMessage; // Start playing var ret = Playbin.SetState (State.Playing); if (ret == StateChangeReturn.Failure) { Console.WriteLine ("Unable to set the pipeline to the playing state."); return; } // Add a keyboard watch so we get notified of keystrokes GLib.Idle.Add (HandleKeyboard); MainLoop = new GLib.MainLoop (); MainLoop.Run (); // Free resources Playbin.SetState (State.Null); }
static uint Video = (1 << 0); // We want video output #endregion Fields #region Methods public static void Main(string[] args) { // Initialize GStreamer Application.Init (ref args); // Create the elements Playbin = ElementFactory.Make ("playbin", "playbin"); if (Playbin == null) { Console.WriteLine ("Not all elements could be created."); return; } // Set the URI to play Playbin ["uri"] = "http://docs.gstreamer.com/media/sintel_cropped_multilingual.webm"; // Set flags to show Audio and Video but ignore Subtitles var flags = (uint)Playbin ["flags"]; flags |= Audio | Video; flags &= ~Text; Playbin ["flags"] = flags; // Set connection speed. This will affect some internal decisions of playbin2 Playbin ["connection-speed"] = 56; // Add a bus watch, so we get notified when a message arrives var bus = Playbin.Bus; bus.AddSignalWatch (); bus.Message += HandleMessage; // Start playing var ret = Playbin.SetState (State.Playing); if (ret == StateChangeReturn.Failure) { Console.WriteLine ("Unable to set the pipeline to the playing state."); return; } // Add a keyboard watch so we get notified of keystrokes GLib.Idle.Add (HandleKeyboard); MainLoop = new GLib.MainLoop (); MainLoop.Run (); // Free resources Playbin.SetState (State.Null); }
static uint PlayFlagDownload = (1 << 7); // Enable progressive download (on selected formats) #endregion Fields #region Methods public static void Main(string[] args) { // Initialize GStreamer Application.Init (ref args); BufferingLevel = 100; // Build the pipeline Pipeline = Parse.Launch ("playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm"); var bus = Pipeline.Bus; // Set the download flag var flags = (uint)Pipeline ["flags"]; flags |= PlayFlagDownload; Pipeline ["flags"] = flags; // Uncomment this line to limit the amount of downloaded data // g_object_set (pipeline, "ring-buffer-max-size", (guint64)4000000, NULL); // Start playing var ret = Pipeline.SetState (State.Playing); if (ret == StateChangeReturn.Failure) { Console.WriteLine ("Unable to set the pipeline to the playing state."); return; } else if (ret == StateChangeReturn.NoPreroll) { IsLive = true; } MainLoop = new GLib.MainLoop (); bus.AddSignalWatch (); bus.Message += HandleMessage; Pipeline.Connect ("deep-notify::temp-location", GotLocation); // Register a function that GLib will call every second GLib.Timeout.AddSeconds (1, RefreshUI); MainLoop.Run (); // Free resources Pipeline.SetState (State.Null); }
static void Main (string[] args) { Gst.Application.Init (); TransformSample.Register (); Pipeline pipeline = new Pipeline (); Element videotestsrc = ElementFactory.Make ("videotestsrc"); Element transform = new TransformSample (); Element ffmpegcolorspace = ElementFactory.Make ("ffmpegcolorspace"); Element videosink = ElementFactory.Make ("autovideosink"); pipeline.Add (videotestsrc, transform, ffmpegcolorspace, videosink); Element.Link (videotestsrc, transform, ffmpegcolorspace, videosink); Gst.GLib.MainLoop loop = new Gst.GLib.MainLoop (); pipeline.Bus.AddSignalWatch(); pipeline.Bus.Message += delegate (object sender, MessageArgs margs) { Message message = margs.Message; switch (message.Type) { case MessageType.Error: Enum err; string msg; message.ParseError (out err, out msg); System.Console.WriteLine (String.Format ("Error message: {0}", msg)); loop.Quit (); break; case MessageType.Eos: loop.Quit (); break; } }; pipeline.SetState (State.Playing); loop.Run (); pipeline.SetState (State.Null); }
static void play_uri(string uri) { Gst.Element _pipeline; Gst.Bus _bus; _loop = new Gst.GLib.MainLoop(); //_filesrc = Gst.ElementFactory.MakeFromUri(URIType.Src, uri, "disk_source"); _pipeline = Gst.ElementFactory.Make("playbin2", null); ((Gst.BasePlugins.PlayBin2)_pipeline).Uri = uri; _bus = ((Gst.Pipeline)_pipeline).Bus; _bus.AddWatch(new Gst.BusFunc(bus_call)); _bus.Dispose(); _pipeline.SetState(Gst.State.Playing); _loop.Run(); _pipeline.SetState(State.Null); _pipeline.Dispose(); }
public void TestBusCallback (bool use_AddWatch) { pipeline = new Pipeline(); Assert.IsNotNull (pipeline, "Could not create pipeline"); Element src = ElementFactory.Make ("fakesrc"); Assert.IsNotNull (src, "Could not create fakesrc"); Element sink = ElementFactory.Make ("fakesink"); Assert.IsNotNull (sink, "Could not create fakesink"); Bin bin = (Bin) pipeline; bin.Add (src, sink); Assert.IsTrue (src.Link (sink), "Could not link between src and sink"); if (use_AddWatch) pipeline.Bus.AddWatch (new BusFunc (MessageReceived)); else { pipeline.Bus.AddSignalWatch(); pipeline.Bus.Message += delegate (object o, MessageArgs args) { MessageReceived (null, args.Message); }; } Assert.AreEqual (pipeline.SetState (State.Playing), StateChangeReturn.Async); loop = new Gst.GLib.MainLoop(); loop.Run(); Assert.AreEqual (pipeline.SetState (State.Null), StateChangeReturn.Success); State current, pending; Assert.AreEqual (pipeline.GetState (out current, out pending, Clock.TimeNone), StateChangeReturn.Success); Assert.AreEqual (current, State.Null, "state is not NULL but " + current); }
public static void Main(string[] argv) { if (argv.Length < 1) { Console.WriteLine ("Usage: ChromaPrintTest.exe <audio file>"); return; } Application.Init (); Loop = new GLib.MainLoop(); var reader = new AcoustIDReader ("TP95csTg"); reader.GetID (argv [0], (id, list) => { Console.WriteLine ("Track ID: " + id); foreach (Recording rec in list) { Console.WriteLine ("========================="); Console.WriteLine ("Recording ID: " + rec.ID); Console.WriteLine ("Title: " + rec.Title); Console.WriteLine ("Artists: "); foreach (Artist artist in rec.Artists) { Console.WriteLine ("\t * {0} (ID: {1})", artist.Name, artist.ID); } Console.WriteLine("Release Groups: "); foreach (ReleaseGroup release_group in rec.ReleaseGroups) { string sec_types = ""; if (release_group.SecondaryTypes.Count == 0) { sec_types = "no secondary types"; } else { foreach (string t in release_group.SecondaryTypes) { sec_types += t + ", "; } sec_types = sec_types.Remove (sec_types.Length - 2); } Console.WriteLine ("\t * {0} (Type: {1} /{3}/, ID: {2})", release_group.Title, release_group.Type, release_group.ID, sec_types); } } Loop.Quit (); }); Loop.Run(); }
public static void Run () { MySrc.Register (); MySink.Register (); MySrc mysrc = Gst.ElementFactory.Make ("mysrc") as MySrc; MySink mysink = Gst.ElementFactory.Make ("mysink") as MySink; Gst.Pipeline pipeline = new Pipeline ("pipeline"); pipeline.Add (mysrc, mysink); Assert.IsTrue (mysrc.Link (mysink)); loop = new MainLoop (); pipeline.Bus.AddWatch (new BusFunc (BusCb)); pipeline.SetState (Gst.State.Playing); loop.Run (); pipeline.SetState (Gst.State.Null); }