示例#1
0
        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?", "GStreamer", System.Windows.Forms.MessageBoxButtons.YesNo) == (int)System.Windows.Forms.DialogResult.Yes)
                    {
                        DownloadGStreamer();
                        if (!File.Exists(GStreamer.gstlaunch))
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }

            GStreamer.UdpPort = port;
            GStreamer.StartA("udpsrc port=" + port +
                             " buffer-size=300000 ! application/x-rtp ! rtph264depay ! avdec_h264 ! videoconvert ! video/x-raw,format=BGRA ! appsink name=outsink");
        }
示例#2
0
        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?",
                                        "GStreamer", System.Windows.Forms.MessageBoxButtons.YesNo) ==
                                    (int)System.Windows.Forms.DialogResult.Yes)
                                {
                                    DownloadGStreamer();
                                }
                            }
                        }

                        //slave to sender clock and Pipeline clock time
                        GStreamer.StartA("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 ! videoconvert ! video/x-raw,format=BGRA ! appsink name=outsink");

                        /*
                         * 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);
            }
        }