private void but8_Click(object sender, EventArgs e)
        {
            GStreamer.StopAll();

            string ipaddr = "192.168.43.1";

            if (Settings.Instance["herelinkip"] != null)
            {
                ipaddr = Settings.Instance["herelinkip"].ToString();
            }

            InputBox.Show("herelink ip", "Enter herelink ip address", ref ipaddr);

            Settings.Instance["herelinkip"] = ipaddr;

            string url = String.Format(
                "rtspsrc location=rtsp://{0}:8554/fpv_stream1 latency=1 udp-reconnect=1 timeout=0 do-retransmission=false ! application/x-rtp ! decodebin3 ! queue max-size-buffers=1 leaky=2 ! videoconvert ! video/x-raw,format=BGRx ! appsink name=outsink",
                ipaddr);

            GStreamer.LookForGstreamer();

            if (!File.Exists(GStreamer.gstlaunch))
            {
                GStreamerUI.DownloadGStreamer();

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

            GStreamer.StartA(url);
        }
Exemplo n.º 2
0
        /// <summary>
        /// overriding the OnCLosing is a bit cleaner than handling the event, since it
        /// is this object.
        ///
        /// This happens before FormClosed
        /// </summary>
        /// <param name="e"></param>
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            // speed up tile saving on exit
            GMap.NET.GMaps.Instance.CacheOnIdleRead  = false;
            GMap.NET.GMaps.Instance.BoostCacheEngine = true;

            log.Info("MainV2_FormClosing");

            Settings.Instance["MainHeight"]    = this.Height.ToString();
            Settings.Instance["MainWidth"]     = this.Width.ToString();
            Settings.Instance["MainMaximised"] = this.WindowState.ToString();

            Settings.Instance["MainLocX"] = this.Location.X.ToString();
            Settings.Instance["MainLocY"] = this.Location.Y.ToString();

            // close bases connection
            try
            {
                MainV2.comPort.logreadmode = false;
                //if (logfile != null)
                //    logfile.Close();

                //if (rawlogfile != null)
                //    rawlogfile.Close();

                //logfile = null;
                //rawlogfile = null;
            }
            catch
            {
            }

            // close all connections

            Utilities.adsb.Stop();

            GStreamer.StopAll();

            log.Info("closing vlcrender");
            try
            {
                while (vlcrender.store.Count > 0)
                {
                    vlcrender.store[0].Stop();
                }
            }
            catch
            {
            }

            log.Info("closing httpthread");

            // if we are waiting on a socket we need to force an abort
            httpserver.Stop();

            log.Info("sorting tlogs");
            //try
            //{
            //    System.Threading.ThreadPool.QueueUserWorkItem((WaitCallback)delegate
            //    {
            //        try
            //        {
            //            aeromagtec.Log.LogSort.SortLogs(Directory.GetFiles(Settings.Instance.LogDir, "*.tlog"));
            //        }
            //        catch
            //        {
            //        }
            //    }
            //        );
            //}
            //catch
            //{
            //}

            log.Info("closing MyView");

            // close all tabs
            //MyView.Dispose();

            log.Info("closing fd");
            try
            {
                FlightData.Dispose();
            }
            catch
            {
            }
            log.Info("closing fp");
            //try
            //{
            //    FlightPlanner.Dispose();
            //}
            //catch
            //{
            //}
            //log.Info("closing sim");
            //try
            //{
            //    Simulation.Dispose();
            //}
            //catch
            //{
            //}

            //try
            //{
            //    if (comPort.BaseStream.IsOpen)
            //        comPort.Close();
            //}
            //catch
            //{
            //} // i get alot of these errors, the port is still open, but not valid - user has unpluged usb

            // save config
            //SaveConfig();

            //Console.WriteLine(httpthread.IsAlive);

            log.Info("MainV2_FormClosing done");

            if (MONO)
            {
                this.Dispose();
            }
        }