コード例 #1
0
 public bool StopRemoteBackplayByTime()
 {
     //停止回放
     SDK_ZLNetSDK.ZLNET_StopPlayBack(lPlayHandle);
     DebugRelevant.DebugLog(this, "ZLNET_StopPlayBack");
     lPlayHandle = 0;
     //登出设备
     SDK_ZLNetSDK.ZLNET_Logout(m_nDeviceID);
     DebugRelevant.DebugLog(this, "ZLNET_Logout");
     m_nDeviceID = 0;
     PicPlayMain.Refresh();
     BackplayStatus = VideoRemoteBackplayStatus.StandBy;
     return(false);
 }
コード例 #2
0
        public bool StartRemoteBackplayByTime(VideoRemotePlayByTimePara para)
        {
            if (lPlayHandle > 0)
            {
                SDK_ZLNetSDK.ZLNET_StopPlayBack(lPlayHandle);
                lPlayHandle = 0;
                PicPlayMain.Refresh();
            }

            VideoInfo  vInfo = para.CameraInfo.VideoInfo;
            CameraInfo cInfo = para.CameraInfo;

            if (CurrentVideoInfo != null &&
                CurrentVideoInfo.VideoServerIP == para.CameraInfo.VideoInfo.VideoServerIP &&
                CurrentVideoInfo.DVSConnectPort == para.CameraInfo.VideoInfo.DVSConnectPort &&
                m_nDeviceID > 0)
            {
                //表示与前一次预览是同一台视频 并且登陆成功 不在重复进行登陆操作
                CurrentVideoInfo  = vInfo;
                CurrentCameraInfo = cInfo;
                DebugRelevant.DebugLog(this, "相同设备,并且登陆成功,不重复登陆");
            }
            else
            {
                if (m_nDeviceID > 0)
                {
                    SDK_ZLNetSDK.ZLNET_Logout(m_nDeviceID);
                    DebugRelevant.DebugLog(this, "ZLNET_Logout");
                    m_nDeviceID = 0;
                }
                CurrentVideoInfo  = vInfo;
                CurrentCameraInfo = cInfo;
                //登陆设备
                int err = 0;
                SDK_ZLNetSDK.ZLNET_DEVICEINFO zlDevice = new SDK_ZLNetSDK.ZLNET_DEVICEINFO();
                m_nDeviceID = SDK_ZLNetSDK.ZLNET_LoginEx(CurrentVideoInfo.DVSAddress, Convert.ToUInt16(CurrentVideoInfo.DVSConnectPort), CurrentVideoInfo.UserName, CurrentVideoInfo.Password, 0, (IntPtr)0, ref zlDevice, ref err);
                if (m_nDeviceID == 0)
                {
                    DebugRelevant.DebugLog(this, "ZLNET_LoginEx Excepion,error:" + err);
                    return(false);
                }

                DebugRelevant.DebugLog(this, "ZLNET_LoginEx Sueecss");
            }

            //调用按照时间回放接口
            //ZLNET_PlayBackByTimeV3
            SDK_ZLNetSDK.ZLNET_PLAY_BY_TIME_PARAM sdkpara = new SDK_ZLNetSDK.ZLNET_PLAY_BY_TIME_PARAM
            {
                nChannel    = CurrentCameraInfo.Channel - 1,
                tmStart     = SDK_ZLNetSDK.ConvertToNetTime(para.StartPlayTime),
                tmEnd       = SDK_ZLNetSDK.ConvertToNetTime(para.EndPlayTime),
                hWnd        = IntPtrPlayMain,
                nStreamType = 2,
                nMediaFlag  = 0,
            };
            downLoadPosCallBack = new SDK_ZLNetSDK.fZLDownLoadPosCallBack(DownLoadPosCallBack);
            dataCallback        = new SDK_ZLNetSDK.fZLDataCallBack(DataCallback);
            IntPtr iPosUser = Marshal.StringToHGlobalAnsi("iPosUser");
            IntPtr iData    = Marshal.StringToHGlobalAnsi("iData");

            lPlayHandle = SDK_ZLNetSDK.ZLNET_PlayBackByTimeV3(m_nDeviceID, ref sdkpara, downLoadPosCallBack, iPosUser, dataCallback, iData);
            if (lPlayHandle == 0)
            {
                SDK_ZLNetSDK.ZLNET_Logout(m_nDeviceID);
                m_nDeviceID = 0;
                UInt32 erroe = SDK_ZLNetSDK.ZLNET_GetLastError();
                DebugRelevant.DebugLog(this, "ZLNET_PlayBackByTimeV3 Exception,error:" + erroe);
                return(false);
            }

            DebugRelevant.DebugLog(this, "ZLNET_PlayBackByTimeV3 Success");

            BackplayStatus = VideoRemoteBackplayStatus.RemoteBackplayByTimeStarted;
            //回放控制
            return(false);
        }