Example #1
0
        public void Dispose()
        {
            if (_hik != null)
            {
                _hik.StreamEvent -= onHikStream;
                _hik.Dispose();
                _hik = null;
            }

            if (_renderSource != null)
            {
                _renderSource.ImageSourceChanged -= onImageSource;
                _renderSource.Dispose();
                _renderSource = null;
            }

            if (_decoder != null)
            {
                _decoder.Dispose();
                _decoder = null;
            }

            if (_rtsp != null)
            {
                _rtsp.Dispose();
                _rtsp = null;
            }
        }
Example #2
0
 private void ReleaseRenderer()
 {
     if (this.render != null)
     {
         this.render.Dispose();
         this.render = null;
     }
 }
 void disposeRenderSource()
 {
     if (_renderSource != null)
     {
         _renderSource.ImageSourceChanged -= onImageSource;
         _renderSource.Dispose();
     }
     _renderSource = null;
     _width        = 0;
     _height       = 0;
 }
        public VideoDisplayViewModel()
        {
            VideoTransform   = new TransformParam();
            PropertyChanged += VideoDisplayViewModel_PropertyChanged;

            _frameBuffer.VideoFrameEvent += _frameBuffer_VideoFrameEvent;
            _frameBuffer.Start();

            _renderSource = new D3DImageSource();
            _renderSource.ImageSourceChanged += () => updateImageSource(_renderSource.ImageSource);

            UIService.SubscribeExitPoller(() => { Dispose(); return(false); });
        }
Example #5
0
        public HikPlayViewModel()
        {
            _ups              = new UnpackPS();
            _ups.Unpacked    += _ups_Unpacked;
            _upsnew           = new UnpackPSNew();
            _upsnew.Unpacked += _upsnew_Unpacked;

            _rtsp = new StreamRtspServer();
            //_socket = new StreamSocket();
            _renderSource = new D3DImageSource();
            _renderSource.ImageSourceChanged += onImageSource;
            //_hik = new HikStream("192.168.9.98", 8000, "admin", "12345", 1, false, IntPtr.Zero);
            _hik              = new HikStream("192.168.9.155", 8000, "admin", "admin12345", 1, false, IntPtr.Zero);
            _hik.StreamEvent += onHikStream;
            //_hik.RtpFrameEvent += onRtpFrame;
        }
Example #6
0
        //protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
        //{
        //    base.OnRenderSizeChanged(sizeInfo);
        //}

        #endregion

        #region 私有函数

        private void CreateRenderer(RenderType renderType)
        {
            this.ReleaseRenderer();
            switch (renderType)
            {
            case RenderType.D3D:
                this.render = new D3DImageSource();
                break;

            case RenderType.WriteBitmap:
                this.render = new WriteableBitmapSource();
                break;

            default:
                break;
            }
        }
        public RtspPlayViewModel()
        {
            _rtspServer   = new StreamRtspServer();
            _renderSource = new D3DImageSource();
            _renderSource.ImageSourceChanged += () => updateImageSource(_renderSource.ImageSource);

            //_rtsp = new RtspStream("rtsp://127.0.0.1/live/stream");
            //_rtsp = new RtspStream("rtsp://*****:*****@192.168.9.98/h264/ch1/main/av_stream");
            //_rtsp = new RtspStream("rtsp://*****:*****@192.168.9.155/h264/ch1/main/av_stream");
            _rtsp = new RtspStream(@"rtsp://*****:*****@192.168.9.155/axis-media/media.amp?streamprofile=Quality");

            _rtsp.HeaderEvent   += onHeader;
            _rtsp.StreamEvent   += onStreamEvent;
            _rtsp.RtpFrameEvent += onRtpFrame;
            if (_rtsp.Header != null)
            {
                onHeader(_rtsp.Header);
            }
            //_writer = new FileWriter(@"d:\rtsp.txt");
        }
        public void Dispose()
        {
            if (_rtsp != null)
            {
                _rtsp.HeaderEvent -= onHeader;
                _rtsp.StreamEvent -= onStreamEvent;
                _rtsp.Dispose();
            }
            _rtsp = null;
            if (_renderSource != null)
            {
                _renderSource.Dispose();
            }
            _renderSource = null;
            _writer?.Dispose();
            _writer = null;

            _rtspServer?.Dispose();
            _rtspServer = null;
        }
 public VideoDisplayManager(VideoCacheManager cache, ITimeProcess playProcess)
 {
     _replayProcess                 = playProcess;
     _replayProcess.JumpEvent      += onJump;
     _replayProcess.FastTimesEvent += onFastTimes;
     _replayProcess.AddCache(_guid);
     _render = new D3DImageSource();
     _render.ImageSourceChanged += render_ImageSourceChanged;
     _decoder = new VideoStreamDecoder();
     _decoder.VideoFrameEvent += onVideoFrame;
     _cache = cache;
     _cache.PropertyChanged += _cache_PropertyChanged;
     _disposeEvent.Reset();
     new Thread(run)
     {
         IsBackground = true
     }.Start();
     onJump();
     onFastTimes();
 }
 private void initRenderSource()
 {
     _renderSource = new D3DImageSource();
     _renderSource.ImageSourceChanged += onImageSource;
 }