static void Main(string[] args) { RtspServer s = new RtspServer(8554); s.StartListen(); // Wait for user to terminate programme Console.WriteLine("Press ENTER to exit"); String dummy = Console.ReadLine(); s.StopListen(); }
static void Main(string[] args) { _logger.Info("Starting"); RtspServer monServeur = new RtspServer(8554); monServeur.StartListen(); RTSPDispatcher.Instance.StartQueue(); while (Console.ReadLine() != "q") { } monServeur.StopListen(); RTSPDispatcher.Instance.StopQueue(); }
private void mLaunchButton_Click(object sender, RoutedEventArgs e) { if (mLaunchButton.Content == "Stop") { if (s != null) { s.StopListen(); } s = null; if (mISession != null) { mISession.closeSession(); mLaunchButton.Content = "Launch"; } mISession = null; return; } string lxmldoc = ""; mCaptureManager.getCollectionOfSinks(ref lxmldoc); XmlDocument doc = new XmlDocument(); doc.LoadXml(lxmldoc); var lSinkNode = doc.SelectSingleNode("SinkFactories/SinkFactory[@GUID='{3D64C48E-EDA4-4EE1-8436-58B64DD7CF13}']"); if (lSinkNode == null) { return; } var lContainerNode = lSinkNode.SelectSingleNode("Value.ValueParts/ValuePart[1]"); if (lContainerNode == null) { return; } var lReadMode = setContainerFormat(lContainerNode); var lSinkControl = mCaptureManager.createSinkControl(); ISampleGrabberCallbackSinkFactory lSampleGrabberCallbackSinkFactory = null; lSinkControl.createSinkFactory( lReadMode, out lSampleGrabberCallbackSinkFactory); int lIndexCount = 120; var lVideoStreamSourceNode = createVideoStream(lSampleGrabberCallbackSinkFactory, lIndexCount++); var lAudioStreamSourceNode = createAudioStream(lSampleGrabberCallbackSinkFactory, lIndexCount++); List <object> lSourceMediaNodeList = new List <object>(); List <Tuple <RtspServer.StreamType, int, string> > streams = new List <Tuple <RtspServer.StreamType, int, string> >(); if (lVideoStreamSourceNode.Item1 != null) { lSourceMediaNodeList.Add(lVideoStreamSourceNode.Item1); streams.Add(Tuple.Create <RtspServer.StreamType, int, string>(lVideoStreamSourceNode.Item2, lVideoStreamSourceNode.Item3, lVideoStreamSourceNode.Item4)); } if (lAudioStreamSourceNode.Item1 != null) { lSourceMediaNodeList.Add(lAudioStreamSourceNode.Item1); streams.Add(Tuple.Create <RtspServer.StreamType, int, string>(lAudioStreamSourceNode.Item2, lAudioStreamSourceNode.Item3, "")); } var lSessionControl = mCaptureManager.createSessionControl(); if (lSessionControl == null) { return; } mISession = lSessionControl.createSession( lSourceMediaNodeList.ToArray()); if (mISession == null) { return; } mISession.registerUpdateStateDelegate(UpdateStateDelegate); mISession.startSession(0, Guid.Empty); mLaunchButton.Content = "Stop"; startServer(streams); }