Ejemplo n.º 1
0
        public CCTV1Adapter(string host, string infoServiceBaseUri)
        {
            _baseUri       = infoServiceBaseUri;
            _globalSync    = new StaticInfoSynchronizer <CCTVGlobalInfo>(_baseUri, "CCTVGlobal", TimeSpan.FromSeconds(5));
            _staticSync    = new StaticInfoSynchronizer <CCTVStaticInfo>(_baseUri, "CCTVStatic", TimeSpan.FromSeconds(5));
            _dynamicSync   = new StaticInfoSynchronizer <CCTVDynamicInfo>(_baseUri, "CCTVDynamic", TimeSpan.FromSeconds(5));
            _hierarchySync = new StaticInfoSynchronizer <HierarchyInfo>(_baseUri, "CCTVHierarchy.Default", TimeSpan.FromSeconds(5));
            _onlineSync    = new StaticInfoSynchronizer <OnlineStatus>(_baseUri, "CCTVOnlineStatus", TimeSpan.FromSeconds(5));
            _videoPosSync  = new StaticInfoSynchronizer <VideoPosition>(_baseUri, "VideoPosition", TimeSpan.FromSeconds(5));
            _videoBufSync  = new StaticInfoSynchronizer <VideoBuffering>(_baseUri, "VideoBuffering", TimeSpan.FromHours(1));

            _globalInfo = new CCTVGlobalInfo()
            {
                CCTV1Host = host,
            };
            _globalSync.ReplaceAll((new CCTVGlobalInfo[] { _globalInfo }).ToDictionary(x => "Default"));

            _info = new CCTVInfo(host);
            _thumbnailProducer = new ThumbnailProducer(_info);
            _thumbnailProducer.ThumbnailEvent += _thumbnailProducer_ThumbnailEvent;

            _info.ConnectedEvent      += _info_ConnectedEvent;
            _info.DisconnectedEvent   += _info_DisconnectedEvent;
            _info.AuthenticationEvent += _info_AuthenticationEvent;
            _info.NodeTreeEvent       += _info_NodeTreeEvent;
            _info.RealtimeInfoEvent   += _info_RealtimeInfoEvent;
            _info.Start();

            var bufferInfo = VideoBufferingInfoProvider.Instance.GetVideoBufferingInfo();

            _videoBufSync.ReplaceAll(bufferInfo.ToDictionary(x => getKey(x)));
        }
Ejemplo n.º 2
0
 private void updateCCTVInfo()
 {
     if (_cctvInfo != null)
     {
         _cctvInfo.Stop();
     }
     _cctvInfo = null;
     if (_trackVideoForm != null)
     {
         _trackVideoForm.Dispose();
     }
     _trackVideoForm = null;
     if (_config == null)
     {
         return;
     }
     if (DataEligibleDetection.IsEffectIp(_config.Ip))
     {
         _cctvInfo                    = new CCTVInfo(_config.Ip);
         _cctvInfo.UserName           = _config.User;
         _cctvInfo.Password           = _config.Pass;
         _cctvInfo.NodeTreeEvent     += _cctvInfo_NodeTreeEvent;
         _cctvInfo.RealtimeInfoEvent += _cctvInfo_RealtimeInfoEvent;
         _cctvInfo.Start();
         _trackVideoForm = new TrackVideoForm(null, _cctvInfo, _config.Bandwidth, _adjustment);
     }
     else
     {
         MessageBox.Show("CCTV配置单Ip配置错误!");
     }
 }
Ejemplo n.º 3
0
        public ThumbnailProducer(CCTVInfo info)
        {
            _info = info;
            _info.NodeTreeEvent += Info_NodeTreeEvent;

            _disposeEvent.Reset();
            _thread = new Thread(run);
            _thread.Start();
        }
Ejemplo n.º 4
0
 public TrackVideoForm(Form owner, CCTVInfo info, int bandwidth, TrackAdjustment adjustment)
 {
     InitializeComponent();
     Owner              = owner;
     _info              = info;
     _bandwidth         = bandwidth;
     _adjustment        = adjustment;
     this.StartPosition = FormStartPosition.CenterScreen;
 }
Ejemplo n.º 5
0
        private void checkVideoInfo()
        {
            CCTVInfo info = _info;

            if (info != _lastInfo)
            {
                if (_lastInfo != null)
                {
                    _lastInfo.SwitchStatusEvent -= info_SwitchStatusEvent;
                }
                _lastInfo = info;

                info.SwitchStatusEvent += info_SwitchStatusEvent;
            }
        }
Ejemplo n.º 6
0
 private void onGlobalInfoUpdate(IEnumerable <CCTVGlobalInfo> values, IEnumerable <string> keysUpdated)
 {
     _globalInfo = GetGlobalInfo();
     if (_globalInfo != null)
     {
         if (CCTV1Info == null || CCTV1Info.ServerHost != _globalInfo.CCTV1Host)
         {
             if (CCTV1Info != null)
             {
                 CCTV1Info.Stop();
             }
             CCTV1Info = new CCTVInfo(_globalInfo.CCTV1Host);
             CCTV1Info.Start();
         }
     }
 }
Ejemplo n.º 7
0
        private void onGlobalInfoUpdate(IEnumerable <string> keysUpdated)
        {
            CCTVGlobalInfo gi = ClientHub.GetGlobalInfo();

            if (gi != null)
            {
                if (CCTV1Info == null || CCTV1Info.ServerHost != gi.CCTV1Host)
                {
                    if (CCTV1Info != null)
                    {
                        CCTV1Info.Stop();
                    }
                    CCTV1Info = new CCTVInfo(gi.CCTV1Host);
                    CCTV1Info.Start();
                    if (_control != null)
                    {
                        _control.CCTV1Info = this.CCTV1Info;
                    }
                }
            }
        }
Ejemplo n.º 8
0
        internal CCTV1VideoSource(CCTVDefaultInfoSync clientHub, CCTVInfo info, string videoId, string url)
        {
            _clientHub = clientHub;
            VideoId    = videoId;
            Url        = url;

            ulong id     = 0;
            int   stream = 1;

            if (getCctv1UrlInfo(Url, out id, out stream))
            {
                //_flashback = VideoFlashbackManager.Instance.GetChannel(videoId);

                _video = new CCTVVideo(info, id, getStreamBandwidth(stream));
                _video.VideoStreamEvent  += video_VideoStreamEvent;
                _video.FFMPEGFormatEvent += video_FFMPEGFormatEvent;
                _video.FFMPEGFrameEvent  += _video_FFMPEGFrameEvent;
                _video.UniviewDataEvent  += _video_UniviewDataEvent;
                _video.VideoLevelEvent   += video_VideoLevelEvent;
            }
        }
Ejemplo n.º 9
0
        private CCTVInfo getCCTVInfo()
        {
            if (_autoGenHub)
            {
                _clientHub.UpdateDefault(CCTVInfoType.GlobalInfo);
            }
            CCTVGlobalInfo gInfo = _clientHub.GetGlobalInfo();

            if (gInfo != null)
            {
                if (_cctvInfo == null || _cctvInfo.ServerHost != gInfo.CCTV1Host)
                {
                    if (_cctvInfo != null)
                    {
                        _cctvInfo.Stop();
                    }
                    _cctvInfo = new CCTVInfo(gInfo.CCTV1Host);
                    _cctvInfo.Start();
                }
            }
            return(_cctvInfo);
        }
Ejemplo n.º 10
0
 public CCTV1CameraControl(string videoId, CCTVInfo info)
     : this(ToCCTV1Id(videoId), info)
 {
 }
Ejemplo n.º 11
0
 public CCTV1CameraControl(ulong videoId, CCTVInfo info)
 {
     _videoId = videoId;
     _info    = info;
 }
Ejemplo n.º 12
0
 public CameraControlManager(CCTVDefaultInfoSync infoSync, CCTVInfo cctv1Info)
 {
     _infoSync       = infoSync;
     CCTV1Info       = cctv1Info;
     _cameraControls = new Dictionary <string, ICameraControl>();
 }