Ejemplo n.º 1
0
        public static void Stop()
        {
            try
            {
                if (client != null)
                {
                    client.Close();
                }
                client = null;
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }

            try
            {
                if (tcpclient != null)
                {
                    tcpclient.Close();
                }
                tcpclient = null;
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }

            try
            {
                GStreamer.Stop(gst);
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }
Ejemplo n.º 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);
            }
        }