/// <summary> /// Starts the listen. /// </summary> public void StartListen() { if (!_RTSPServerListener.Server.Connected) { _RTSPServerListener = new TcpListener(IPAddress.Any, 8554); } _RTSPServerListener.Start(); _Stopping = new ManualResetEvent(false); _ListenTread = new Thread(new ThreadStart(AcceptConnection)); _ListenTread.Start(); // Initialise the H264 encoder h264_encoder = new SimpleH264Encoder(h264_width, h264_height, h264_fps); //h264_encoder = new TinyH264Encoder(); // hard coded to 192x128 ////-------------------------------------------- //// Start the VideoSource video_sourceT = new TestCard(h264_width, h264_height, h264_fps); video_sourceT.ReceivedYUVFrame += video_source_ReceivedYUVFrame; ////-------------------------------------------- ////--------------------------------------------------------- //videoSourceR = new VideoFileReader(); //videoSourceR.Open("rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa"); //video_sourceT = new TestCard(videoSourceR.ReadVideoFrame().Width, videoSourceR.ReadVideoFrame().Height, h264_fps); //video_sourceT.ReceivedYUVFrame += //video_source_ReceivedYUVFrame(new uint(), videoSourceR.ReadVideoFrame().Width, videoSourceR.ReadVideoFrame().Height, (byte[])new ImageConverter().ConvertTo(videoSourceR.ReadVideoFrame(), typeof(byte[])) ); //-------------------------------------------------------- // Start the VideoSource //video_source = new VideoFileSource("rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa"); //video_source.Start(); //video_source.Stop(); ////video_source = new VideoFileSource("rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa"); ////video_source.Start(); ////video_source_ReceivedYUVFrame(System.TimeSpan.FromMilliseconds, video_source.GetDescription<DataGridViewColumnHeadersHeightSizeMode>, video_source.Save()); //foreach (RTSPConnection connection in rtsp_list.ToArray()) //{ // int video_channel = connection.video_transport_reply.Interleaved.First; // connection.listener.BeginSendData(video_channel,video_source.Save(), new AsyncCallback(connection.listener.EndSendData), new object()); //} }
/// <summary> /// Starts the listen. /// </summary> public async System.Threading.Tasks.Task StartListenAsync() { _RTSPServerListener.Start(); _Stopping = new ManualResetEvent(false); _ListenTread = new Thread(new ThreadStart(AcceptConnection)); _ListenTread.Start(); // Initialise the H264 encoder // TODO move after Wmfplayer get first bitmap h264_encoder = new SimpleH264Encoder(h264_width, h264_height, h264_fps); //h264_encoder = new TinyH264Encoder(); // hard coded to 192x128 // Start the VideoSource //video_source = new TestCard(h264_width, h264_height, h264_fps); //video_source.ReceivedYUVFrame += video_source_ReceivedYUVFrame; // video 2 NvrDemo nvr1 = new NvrDemo("http://172.16.26.96:8080/", "admin", "123456", 3, "12312"); nvr1.ReceivedYUVFrame += video_source_ReceivedYUVFrame; var playbackTask = nvr1.PlaybackAsync(); SpinWait.SpinUntil(() => nvr1.IsStarted); await nvr1.SetCurrentTimeAsync(DateTime.Parse("2019-04-15 11:30")); await nvr1.SetPlayModeAsync(NvrDemo.PlayModeAction.Forward, 1); await nvr1.StartPlayAsync(); await playbackTask; //video 3 //TestJpegH264 testJpeg = new TestJpegH264(); //testJpeg.ReceivedYUVFrame += video_source_ReceivedYUVFrame; //testJpeg.Start(); //video 4 //TODO move after rtsp request //IntPtr wmfPtr = new IntPtr(123123); //WmfPlayer wmfPlayer = new WmfPlayer(wmfPtr); //wmfPlayer.ReceivedYUVFrame += video_source_ReceivedYUVFrame; //await wmfPlayer.OpenVideoAsync("172.16.26.96", 8080, "admin", "123456", DateTime.Parse("2019-04-19 04:33"), 1, "1"); //await wmfPlayer.OpenVideoAsync("172.16.26.96", 8080, "admin", "123456", new DateTime(1970, 1, 1), 1, "1"); }
/// <summary> /// Starts the listen. /// </summary> public void StartListen() { _RTSPServerListener.Start(); _Stopping = new ManualResetEvent(false); _ListenTread = new Thread(new ThreadStart(AcceptConnection)); _ListenTread.Start(); // Initialise the H264 encoder h264_encoder = new SimpleH264Encoder(h264_width, h264_height, h264_fps); // Start the VideoSource video_source = new TestCard(h264_width, h264_height, h264_fps); video_source.ReceivedYUVFrame += video_source_ReceivedYUVFrame; }