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); }
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); }
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(); }