コード例 #1
0
        public static void Run(string[] args)
        {
            GLib.ExceptionManager.UnhandledException += ExceptionManager_UnhandledException;

            string uri = "http://download.blender.org/durian/trailer/sintel_trailer-1080p.mp4";

// Missing GError ?
            uri = "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
            if (args.Length > 1)
            {
                uri = args[0];
            }

            Gst.Application.Init(ref args);
            Console.WriteLine($"Discovering {uri}");

            Discoverer = new Discoverer(5 * Gst.Constants.SECOND);
            if (Discoverer == null)
            {
                Console.WriteLine("Error creating discoverer ");
                return;
            }

            // Connect to the interesting signals
            Discoverer.Discovered += OnDiscoveredCb;
            Discoverer.Finished   += OnFinishedCb;

            // Start the discoverer process (nothing to do yet)
            Discoverer.Start();

            //Add a request to process asynchronously the URI passed through the command line
            if (!Discoverer.DiscoverUriAsync(uri))
            {
                $"Failed to start discovering {uri}".PrintErr();
                return;
            }

            // Create a GLib Main Loop and set it to run, so we can wait for the signals
            MainLoop = new GLib.MainLoop();
            MainLoop.Run();

            Discoverer.Stop();
            Console.ReadLine();
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            var uri = "http://download.blender.org/durian/trailer/sintel_trailer-1080p.mp4";

            // if a URI was provided, use it instead of the default one
            if (args.Length > 1)
            {
                uri = args[0];
            }

            // Initialize GStreamer
            Gst.Application.Init(ref args);

            Console.WriteLine("Discovering '{0}'", uri);

            // Instantiate the Discoverer
            Discoverer = new Discoverer(5L * Gst.Constants.SECOND);

            // Connect to the interesting signals
            Discoverer.Discovered += HandleDiscovered;
            Discoverer.Finished   += (sender, e) => {
                Console.WriteLine("Finished discovering");
                MainLoop.Quit();
            };

            // Start the discoverer process (nothing to do yet)
            Discoverer.Start();

            // Add a request to process asynchronously the URI passed through the command line
            if (!Discoverer.DiscoverUriAsync(uri))
            {
                Console.WriteLine("Failed to start discovering URI '{0}'", uri);
                return;
            }

            // Create a GLib Main Loop and set it to run, so we can wait for the signals
            MainLoop = new GLib.MainLoop();
            MainLoop.Run();

            // Stop the discoverer process
            Discoverer.Stop();
        }