/// <summary>
        /// 打开音频通道_独占
        /// </summary>
        /// <returns></returns>
        public bool CloseSound()
        {
            bool bolResult = false;

            SDK_ZLNetSDK.ZLCloseSound(this, null);
            return(bolResult);
        }
        /// <summary>
        /// 智诺视频关闭
        /// </summary>
        /// <returns></returns>
        public bool VideoClose()
        {
            bool bolResult = false;

            if (m_nPlayHandle != 0)
            {
                if (SoundState == Enum_VideoPlaySoundState.SoundOpen)
                {
                    //关闭音频
                    CloseSound();
                }
                SDK_ZLNetSDK.ZLNET_StopSaveRealData(m_nPlayHandle);
                VideoRecordStatus = false;
                SDK_ZLNetSDK.ZLNET_StopRealPlayEx(m_nPlayHandle);
            }
            if (m_nDeviceID != 0)
            {
                SDK_ZLNetSDK.ZLNET_Logout(m_nDeviceID);
            }
            VideoPlayState = Enum_VideoPlayState.NotInPlayState;
            VideoPlayCallback(new VideoPlayCallbackValue {
                evType = Enum_VideoPlayEventType.VideoClose
            });
            return(bolResult);
        }
Example #3
0
        /// <summary>
        /// 智诺视频SDK初始化
        /// </summary>
        /// <returns></returns>
        public static Enum_SDKState ZLVideoSDK_Init()
        {
            ZLDisConnect = new SDK_ZLNetSDK.fZLDisConnect(OnDisconnect);
            IntPtr lpUser = IntPtr.Zero;

            SDK_ZLNetSDK.ZLNET_Init(ZLDisConnect, lpUser);
            ZLVideoSDKState = Enum_SDKState.SDK_Init;
            return(ZLVideoSDKState);
        }
        /// <summary>
        /// 打开音频通道_独占
        /// </summary>
        /// <returns></returns>
        public bool OpenSound()
        {
            bool bolResult = false;

            //实际测试,打开声音通道程序并不会关闭之前的声音通道,手动关闭,确认仅有一个通在播放
            SDK_ZLNetSDK.ZLCloseSound(this, null);
            if (SDK_ZLNetSDK.ZLNET_OpenSound(m_nPlayHandle))
            {
                SoundState = Enum_VideoPlaySoundState.SoundOpen;
                bolResult  = true;
            }
            return(bolResult);
        }
 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);
 }
        /// <summary>
        /// 智诺视频播放
        /// </summary>
        /// <returns></returns>
        public bool VideoPlay()
        {
            bool bolResult = false;
            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)
            {
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.LoginSuccess
                });
                if (CurrentVideoPlaySet.PlayStream == Enum_VideoStream.MainStream)
                {
                    m_nPlayHandle = SDK_ZLNetSDK.ZLNET_RealPlayEx(m_nDeviceID, CurrentCameraInfo.Channel - 1, intptrPlayMain, SDK_ZLNetSDK.ZLNET_REALPLAYTYPE.ZLNET_RType_Realplay);
                    videoStream   = Enum_VideoStream.MainStream;
                }
                else
                {
                    //子码流
                    m_nPlayHandle = SDK_ZLNetSDK.ZLNET_RealPlayEx(m_nDeviceID, CurrentCameraInfo.Channel - 1, intptrPlayMain, SDK_ZLNetSDK.ZLNET_REALPLAYTYPE.ZLNET_RType_Realplay_1);
                    videoStream   = Enum_VideoStream.SubStream;
                }

                if (CurrentVideoPlaySet.VideoMonitorEnable)
                {
                    OpenSound();
                }
                if (CurrentVideoPlaySet.VideoRecordEnable)  //录像使能
                {
                    string Temp_strVideoRecord = GetLocalSavePath(CurrentVideoPlaySet.VideoRecordFilePath, CurrentVideoPlaySet.VideoRecordFileName);
                    SDK_ZLNetSDK.ZLNET_SaveRealData(m_nPlayHandle, Temp_strVideoRecord);
                    VideoRecordStatus = true;
                }
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.VideoPlay
                });
                VideoPlayState = Enum_VideoPlayState.InPlayState;
            }
            else
            {
                VideoPlayState = Enum_VideoPlayState.NotInPlayState;
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.DevLoginException
                });
            }
            return(bolResult);
        }
Example #7
0
 /// <summary>
 /// 智诺视频SDK释放
 /// </summary>
 /// <returns></returns>
 public static Enum_SDKState ZLVideoSDK_Release()
 {
     ZLVideoSDKState = Enum_SDKState.SDK_Release;
     SDK_ZLNetSDK.ZLNET_Cleanup();
     return(ZLVideoSDKState);
 }
        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);
        }