public static void Run(string[] args)
        {
            Gst.Application.Init(ref args);

            // Print usage map
            Console.WriteLine(
                @"USAGE: Choose one of the following option, then press enter:
 'P' to toggle between pause and play
 'S' to increase playback speed, 's' to decrease playback speed
 'D' to toggle playback direction
 'N' to move to next frame (in current direction, better in PAUSE)
 'Q' to quit
");
//            _data.Pipeline = Gst.Parse.Launch("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm");
//            _data.Pipeline = Gst.Parse.Launch("playbin uri=http://download.blender.org/durian/trailer/sintel_trailer-1080p.mp4");
            _data.Pipeline = Gst.Parse.Launch("playbin uri=file:///U:/Video/test.mp4");

            // Add a keyboard watch so we get notified of keystrokes
            GLib.IOChannel ioStdin;
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                ioStdin = new GLib.IOChannel(0); // stdin = 0, stdout = 1, stderr = 2
            }
            else
            {
                ioStdin = null; // ?? how ??
            }
            ioStdin.AddWatch(0, GLib.IOCondition.In, HandleKeyboard);

            //Start playing
            var ret = _data.Pipeline.SetState(State.Playing);

            if (ret == StateChangeReturn.Failure)
            {
                "Unable to set the pipeline to the playing state".PrintErr();
                _data.Pipeline.Dispose();
                return;
            }

            _data.Playing = true;
            _data.Rate    = 1.0;

            // Create a GLib Main Loop and set it to run
            _data.Loop = new MainLoop();
            _data.Loop.Run();

            ioStdin.Dispose();
            _data.Pipeline.SetState(State.Null);
            if (_data.VideoSink != null)
            {
                _data.VideoSink.Dispose();
            }
            _data.Pipeline.Dispose();
        }
Example #2
0
		static bool ReadStdout (IOChannel source, IOCondition condition)
		{
			if ((condition & IOCondition.In) == IOCondition.In) {
				string txt;
				if (source.ReadToEnd (out txt) == IOStatus.Normal)
					Console.WriteLine ("[AsyncWithPipesTest output] " + txt);
			}
			if ((condition & IOCondition.Hup) == IOCondition.Hup) {
				source.Dispose ();
				ml.Quit ();
				return true;
			}
			return true;
		}
Example #3
0
		static void AsyncWithPipesTest ()
		{
			Console.WriteLine ("AsyncWithPipesTest:");
			try {
				Process proc;
				int stdin = Process.IgnorePipe;
				int stdout = Process.RequestPipe;
				int stderr = Process.IgnorePipe;
				GLib.Process.SpawnAsyncWithPipes (null, new string[] {"pwd"}, null, SpawnFlags.SearchPath, null, out proc, ref stdin, ref stdout, ref stderr);
				channel = new IOChannel (stdout);
				channel.AddWatch (0, IOCondition.In | IOCondition.Hup, new IOFunc (ReadStdout));
			} catch (Exception e) {
				Console.WriteLine ("Exception in SpawnSync: " + e);
			}
			Console.WriteLine ("returning");
		}