Example #1
0
        protected override bool StartCore()
        {
            if (!OfficalAPI.NET_DVR_Init())
            {
                this.Info("摄像机运行环境创建失败, 错误代码" + OfficalAPI.NET_DVR_GetLastError());
                return(false);
            }


            this.Info("摄像机运行环境创建成功");
            Trace.WriteLine("xianshi");

            //OfficalAPI.NET_DVR_SetConnectTime(3000, 1);
            //OfficalAPI.NET_DVR_SetReconnect(500, 0);
            //                     OfficalAPI.NET_DVR_SetRecvTimeOut(3000);

            Trace.WriteLine("xianshi2");
            return(true);
        }
Example #2
0
        public void StartPlayBack(DateTime beginTime, DateTime endTime, IntPtr hwnd)
        {
            NetDvrTime begin = new NetDvrTime
            {
                Year   = (uint)beginTime.Year,
                Month  = (uint)beginTime.Month,
                Day    = (uint)beginTime.Day,
                Hour   = (uint)beginTime.Hour,
                Minute = (uint)beginTime.Minute
            };

            NetDvrTime end = new NetDvrTime
            {
                Year   = (uint)endTime.Year,
                Month  = (uint)endTime.Month,
                Day    = (uint)endTime.Day,
                Hour   = (uint)endTime.Hour,
                Minute = (uint)endTime.Minute
            };


            //按时间播放
            NetDvrVodPara vod = new NetDvrVodPara();

            vod.Size = (uint)Marshal.SizeOf(vod);
            //vod.struIDInfo.dwSize = Marshal.SizeOf(NET_DVR_STREAM_INFO);
            vod.struIDInfo.Channel = 33;            //按录像机网口32+i计算
            vod.HWnd      = hwnd;
            vod.BeginTime = begin;
            vod.EndTime   = end;


            _playHandle = OfficalAPI.NET_DVR_PlayBackByTime(_userId, 33, ref begin, ref end, hwnd);
            //playHandle = OfficalAPI.NET_DVR_PlayBackByTime_V40(_userId, ref vod);

            Trace.WriteLine($"playHandle   {_playHandle}");
            var error = OfficalAPI.NET_DVR_GetLastError();

            Trace.WriteLine($"error   {error}");
        }
 private void WarnDvrSdkFailWithReason(string operation)
 {
     this.WarnFail(operation + OfficalAPI.NET_DVR_GetLastError());
 }