예제 #1
0
        void ISDK.StartPlay(IntPtr handle)
        {
            NET_SDK_CLIENTINFO clientInfo = new NET_SDK_CLIENTINFO();

            clientInfo.hPlayWnd   = handle;            //预览窗口
            clientInfo.lChannel   = VideoInfo.Channel; // 通道号,从0开始
            clientInfo.streamType = 0;                 // 数据流类型,类型有两种NET_SDK_MAIN_STREAM和NET_SDK_SUB_STREAM
            //LIVE_DATA_CALLBACK fLiveDataCallBack = new DVRSDK.LIVE_DATA_CALLBACK(LiveDataCallBack);
            LIVE_DATA_CALLBACK fLiveDataCallBack = null;
            IntPtr             pUser             = IntPtr.Zero;

            realHandle = SHCFNetSDK.NET_SDK_LivePlay(loginUserId, ref clientInfo, fLiveDataCallBack, pUser);
            if (realHandle == -1)
            {
                throw new Exception("[上海诚丰]播放失败:" + GetErrorMessage());
            }
        }
        public bool Init(CameraData _cameraData)
        {
            cameraData = _cameraData;
            server.start(Convert.ToInt32(cameraData.Code));
            disConnect = new fDisConnect(DisConnectEvent);
            DHClient.DHInit(disConnect, IntPtr.Zero);
            DHClient.DHSetEncoding((int)LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置
            pLoginID = DHClient.DHLogin(cameraData.IP, (ushort)cameraData.Port, cameraData.UserName, cameraData.Pwd, out deviceInfo, out error);
            // cameraData.control.Text = pLoginID + "";
            if (pLoginID != 0)
            {
                // (cameraData.control as UserControl).Text = pLoginID.ToString();
                pPlayBackHandle = new int[deviceInfo.byChanNum];
                //画面按钮有效性控制
                pRealPlayHandle = null;
                //for (int i = 0; i < deviceInfo.byChanNum; i++)
                //{
                //    cmbChannelSelect.Items.Add(i.ToString());
                //    //cmbChannelSelect.Items.Add((i+1).ToString());
                //}
                NET_SDK_CLIENTINFO lsc = new NET_SDK_CLIENTINFO();

                lsc.lChannel   = deviceInfo.byChanNum;                                   //预览的通道
                lsc.streamType = 1;                                                      // 码流
                lsc.hPlayWnd   = cameraData.Handle;                                      //pictureBox.Handle
                lLiveHandle    = (IntPtr)DHClient.DHRealPlay(pLoginID, 0, lsc.hPlayWnd); //ID 通道 ,Picture句柄

                IntPtr userdata = (IntPtr)Convert.ToInt32(_cameraData.Code);


                DHClient.DHSetRealDataCallBack((int)lLiveHandle, fd, userdata);
                //  DHPlay.PLAY_OpenStream(tongdao, IntPtr.Zero, 0, (UInt32)900 * 1024);
                //播放的部分
                //bool b2 = DHPlay.DHPlayControl(PLAY_COMMAND.OpenStream, tongdao, IntPtr.Zero, 0, 900 * 1024);
                //DHPlay.DHSetStreamOpenMode(tongdao, PLAY_MODE.STREAME_FILE);
                //DHPlay.DHPlayControl(0, tongdao, _cameraData.control.Handle);
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
 public static extern Int32 NET_SDK_RealPlay(int iUserLogID, ref NET_SDK_CLIENTINFO lpDVRClientInfo);
예제 #4
0
        public bool Init(CameraData _cameraData)
        {
            cameraData = _cameraData;
            server.start(Convert.ToInt32(cameraData.Code));
            disConnect = new fDisConnect(DisConnectEvent);
            DHClient.DHInit(disConnect, IntPtr.Zero);
            DHClient.DHSetEncoding((int)LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置
            pLoginID = DHClient.DHLogin(cameraData.IP, (ushort)cameraData.Port, cameraData.UserName, cameraData.Pwd, out deviceInfo, out error);
            // cameraData.control.Text = pLoginID + "";
            if (pLoginID != 0)
            {
                // (cameraData.control as UserControl).Text = pLoginID.ToString();
                pPlayBackHandle = new int[deviceInfo.byChanNum];
                //画面按钮有效性控制
                pRealPlayHandle = null;
                //for (int i = 0; i < deviceInfo.byChanNum; i++)
                //{
                //    cmbChannelSelect.Items.Add(i.ToString());
                //    //cmbChannelSelect.Items.Add((i+1).ToString());
                //}
                NET_SDK_CLIENTINFO lsc = new NET_SDK_CLIENTINFO();

                lsc.lChannel = deviceInfo.byChanNum; //预览的通道
                lsc.streamType = 1;// 码流
                lsc.hPlayWnd = cameraData.Handle;//pictureBox.Handle
                lLiveHandle = (IntPtr)DHClient.DHRealPlay(pLoginID, 0, lsc.hPlayWnd);//ID 通道 ,Picture句柄
                
                IntPtr userdata = (IntPtr)Convert.ToInt32(_cameraData.Code);


                DHClient.DHSetRealDataCallBack((int)lLiveHandle, fd, userdata);
                //  DHPlay.PLAY_OpenStream(tongdao, IntPtr.Zero, 0, (UInt32)900 * 1024);
                //播放的部分
                //bool b2 = DHPlay.DHPlayControl(PLAY_COMMAND.OpenStream, tongdao, IntPtr.Zero, 0, 900 * 1024);
                //DHPlay.DHSetStreamOpenMode(tongdao, PLAY_MODE.STREAME_FILE);
                //DHPlay.DHPlayControl(0, tongdao, _cameraData.control.Handle);
                return true;
            }
            else
            {
                return false;
            }
        }