Beispiel #1
0
      private static void WorkLoop()
      {
          Console.Clear();

          LogMessage($"Logging started {Assembly.GetEntryAssembly().GetName().Version}.");

          _analyser.InspectTeletext       = _options.DecodeTeletext;
          _analyser.InspectTsPackets      = !_options.SkipDecodeTransportStream;
          _analyser.SelectedProgramNumber = _options.ProgramNumber;
          _analyser.VerboseLogging        = _options.VerboseLogging;

          if (_options is StreamOptions streamOptions)
          {
              _analyser.HasRtpHeaders = !streamOptions.NoRtpHeaders;
              _analyser.Setup(streamOptions.AdapterAddress, streamOptions.SrtPort);
              _analyser.TsDecoder.TableChangeDetected += TsDecoder_TableChangeDetected;

              if (_analyser.InspectTeletext)
              {
                  _analyser.TeletextDecoder.Service.TeletextPageReady   += Service_TeletextPageReady;
                  _analyser.TeletextDecoder.Service.TeletextPageCleared += Service_TeletextPageCleared;
              }

              _srtReceiver.SetHostname(streamOptions.AdapterAddress);
              _srtReceiver.SetPort(streamOptions.SrtPort);
              _srtReceiver.OnDataReceived += SrtReceiverOnDataReceived;

              var ts = new ThreadStart(delegate
                {
                    SrtWorkerThread(_srtReceiver);
                });

              _receiverThread = new Thread(ts);

              _receiverThread.Start();
          }

          Console.Clear();

          while (!_pendingExit)
          {
              if (!_options.SuppressOutput)
              {
                  PrintConsoleFeedback();
              }

              Thread.Sleep(30);
          }

          LogMessage("Logging stopped.");
      }
Beispiel #2
0
        private static int Run(Options opts)
        {
            _srtRecvr.SetHostname(opts.InputAdapterAddress);
            _srtRecvr.SetPort(opts.SrtPort);
            _srtRecvr.OnDataReceived += SrtRecvr_OnDataReceived;

            Console.WriteLine($"About to attempt to bind for listening as SRT TARGET on {_srtRecvr.GetHostname()}:{_srtRecvr.GetPort()}");

            PrepareOutputUdpClient(opts.OutputAdapterAddress, opts.MulticastAddress, opts.MulticastPort);

            _running = true;

            while (_running)
            {
                _srtRecvr.Run();
                Console.WriteLine("\nConnection closed, resetting...");
                System.Threading.Thread.Sleep(100);
            }

            return(0);
        }