private static void clientdata(IAsyncResult ar)
        {
            var client = ((UdpClient)ar.AsyncState);

            if (client == null || client.Client == null)
            {
                return;
            }

            var port = ((IPEndPoint)client.Client.LocalEndPoint).Port;

            if (client != null)
            {
                client.Close();
            }

            if (!File.Exists(GStreamer.gstlaunch))
            {
                var gstpath = GStreamer.LookForGstreamer();

                if (File.Exists(gstpath))
                {
                    GStreamer.gstlaunch = gstpath;
                }
                else
                {
                    if (CustomMessageBox.Show("A video stream has been detected, but gstreamer has not been configured/installed.\nDo you want to install/config it now? It will download in the background.", "GStreamer", System.Windows.Forms.MessageBoxButtons.YesNo) == (int)System.Windows.Forms.DialogResult.Yes)
                    {
                        //CustomMessageBox.Show("Please download gstreamer 1.9.2 from [link;HERE;https://gstreamer.freedesktop.org/data/pkg/windows/1.9.2/gstreamer-1.0-x86-1.9.2.msi]\n And install it using the 'COMPLETE' option");

                        GStreamer.DownloadGStreamer();

                        GStreamer.gstlaunch = GStreamer.LookForGstreamer();
                        if (!File.Exists(GStreamer.gstlaunch))
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }

            GStreamer.UdpPort = port;
            gst = GStreamer.Start();
        }
Exemple #2
0
        public static void DownloadGStreamer()
        {
            ProgressReporterDialogue prd = new ProgressReporterDialogue();

            ThemeManager.ApplyThemeTo(prd);
            prd.DoWork += sender =>
            {
                GStreamer.DownloadGStreamer(((i, s) =>
                {
                    prd.UpdateProgressAndStatus(i, s);
                    if (prd.doWorkArgs.CancelRequested)
                    {
                        throw new Exception("User Request");
                    }
                }));
            };
            prd.RunBackgroundOperationAsync();

            GStreamer.gstlaunch = GStreamer.LookForGstreamer();
        }
        private static void skyviper(object state)
        {
            try
            {
                if (Ping("192.168.99.1"))
                {
                    log.Info("Detected a SkyViper IP");

                    bool skyviper = false;

                    // skyviper rtsp
                    try
                    {
                        var rtspclient = new TcpClient("192.168.99.1", 554);
                        rtspclient.Close();
                        skyviper = true;
                    } catch { }

                    // skyviper video
                    try
                    {
                        var test = new WebClient().DownloadString("http://192.168.99.1/");
                        if (test.Contains("SkyViper"))
                        {
                            skyviper = true;
                        }
                    } catch { }

                    if (skyviper)
                    {
                        log.Info("Detected a SkyViper");

                        if (!File.Exists(GStreamer.gstlaunch))
                        {
                            GStreamer.gstlaunch = GStreamer.LookForGstreamer();

                            if (GStreamer.gstlaunch == "")
                            {
                                if (CustomMessageBox.Show(
                                        "A video stream has been detected, but gstreamer has not been configured/installed.\nDo you want to install/config it now? It will download in the background.",
                                        "GStreamer", System.Windows.Forms.MessageBoxButtons.YesNo) ==
                                    (int)System.Windows.Forms.DialogResult.Yes)
                                {
                                    GStreamer.DownloadGStreamer();

                                    GStreamer.gstlaunch = GStreamer.LookForGstreamer();
                                }
                            }
                        }

                        //slave to sender clock and Pipeline clock time
                        gst = GStreamer.Start("rtspsrc location=rtsp://192.168.99.1/media/stream2 debug=false buffer-mode=1 latency=100 ntp-time-source=3 ! application/x-rtp ! rtph264depay ! avdec_h264 ! queue leaky=2 ! jpegenc ");

                        /*
                         * string url = "http://192.168.99.1/ajax/video.mjpg";
                         *
                         * Settings.Instance["mjpeg_url"] = url;
                         *
                         * CaptureMJPEG.Stop();
                         *
                         * CaptureMJPEG.URL = url;
                         *
                         * CaptureMJPEG.OnNewImage += FlightData.instance.CaptureMJPEG_OnNewImage;
                         *
                         * CaptureMJPEG.runAsync();
                         */
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }