Exemple #1
0
        public SysDvrRTSPServer(bool videoSupport, bool audioSupport, bool localOnly, int port)
        {
            SysDVRVideoRTSPTarget v = null;
            SysDVRAudioRTSPTarget a = null;

            if (videoSupport)
            {
                v = new SysDVRVideoRTSPTarget();
            }
            if (audioSupport)
            {
                a = new SysDVRAudioRTSPTarget();
            }

            Video  = v;
            Audio  = a;
            server = new RtspServer(port, v, a, localOnly);
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RTSPServer"/> class.
        /// </summary>
        /// <param name="aPortNumber">A numero port.</param>
        public RtspServer(int portNumber, SysDVRVideoRTSPTarget video_source, SysDVRAudioRTSPTarget audio_source, bool localOnly = false)
        {
            if (portNumber < System.Net.IPEndPoint.MinPort || portNumber > System.Net.IPEndPoint.MaxPort)
            {
                throw new ArgumentOutOfRangeException("aPortNumber", portNumber, "Port number must be between System.Net.IPEndPoint.MinPort and System.Net.IPEndPoint.MaxPort");
            }
            Contract.EndContractBlock();

            this.video_source = video_source;
            this.audio_source = audio_source;

            if (video_source != null)
            {
                video_source.DataAvailable += SysDVR_ReceivedVideoFrame;
            }
            if (audio_source != null)
            {
                audio_source.DataAvailable += SysDVR_ReceivedAudioData;
            }

            this.portNumber = portNumber;
            //RtspUtils.RegisterUri();
            _RTSPServerListener = new TcpListener(localOnly ? IPAddress.Loopback : IPAddress.Any, portNumber);
        }