private void PlayBack_e_EagleModeChange(UCVideo video)
        {
            int tag = Convert.ToInt32(video.Tag);

            if (m_PlayBackPort >= 0)
            {
                PlayCtrl.PLAYM4SRMODELMODE struParam = new PlayCtrl.PLAYM4SRMODELMODE();
                struParam.emTextureMode  = (uint)PlayCtrl.PLAYM4SRTEXTUREMODE.PLAYM4_TEXTURE_DOUBLE;
                struParam.ulDisplayType  = PlayCtrl.PLAYM4_MODEL_SOLID;
                struParam.nTransformMode = 0;
                struParam.emModelType    = (uint)PlayCtrl.PLAYM4SRMODELTYPE.PLAYM4_MODELTYPE_EAGLE_EYE;
                struParam.bModelMode     = video.IsQJVideo; // true是碗装,false是块状
                int    dwSize       = Marshal.SizeOf(struParam);
                IntPtr ptrDeviceCfg = Marshal.AllocHGlobal(dwSize);
                Marshal.StructureToPtr(struParam, ptrDeviceCfg, false);
                if (!PlayCtrl.PlayM4_SR_SetConfig(m_PlayBackPort, PlayCtrl.CFG_DISPLAY_MODEL_MODE, ptrDeviceCfg))
                {
                    Marshal.FreeHGlobal(ptrDeviceCfg);
                }
            }
        }
Example #2
0
        private void RealDataCallBack(Int32 lRealHandler, UInt32 dwDataType, ref byte pBuffer, UInt32 dwBufSize, IntPtr pUser)
        {
            try
            {
                int lRealHandle = 0;
                if (dicRealHandlerChannel.ContainsKey(lRealHandler))
                {
                    lRealHandle = dicRealHandlerChannel[lRealHandler] % StartDChan;
                }
                else
                {
                    return;
                }
                //int lRealHandle = lRealHandler % CameraCount;
                uint dwErr = 0;
                switch (dwDataType)
                {
                case CHCNetSDK.NET_DVR_SYSHEAD:
                    if (m_Channel[lRealHandle] != -1)
                    {
                        return;
                    }
                    if (m_Channel[lRealHandle] == -1)
                    {
                        if (!PlayCtrl.PlayM4_GetPort(ref m_Channel[lRealHandle]))
                        {
                            //dwErr = PlayCtrl.PlayM4_GetLastError(m_Channel);
                        }
                        //m_Channel[lRealHandle] = lRealHandle;
                        uint version = PlayCtrl.PlayM4_GetSdkVersion();
                    }
                    if (dwBufSize > 0)
                    {
                        if (!PlayCtrl.PlayM4_SetStreamOpenMode(m_Channel[lRealHandle], m_StreamPlayMode))      //设置实时流播放模式
                        {
                            dwErr = PlayCtrl.PlayM4_GetLastError(m_Channel[lRealHandle]);
                            break;
                        }

                        if (!PlayCtrl.PlayM4_OpenStream(m_Channel[lRealHandle], ref pBuffer, dwBufSize, 15 * 1024 * 1024))     //打开流接口
                        {
                            dwErr = PlayCtrl.PlayM4_GetLastError(m_Channel[lRealHandle]);
                            break;
                        }

                        if (!PlayCtrl.PlayM4_SetDisplayBuf(m_Channel[lRealHandle], 6))
                        {
                            dwErr = PlayCtrl.PlayM4_GetLastError(m_Channel[lRealHandle]);
                            break;
                        }

                        //if (!PlayCtrl.PlayM4_SetDecodeEngineEx(m_Channel[lRealHandle], PlayCtrl.HARD_DECODE_ENGINE))
                        //{
                        //    dwErr = PlayCtrl.PlayM4_GetLastError(m_Channel[lRealHandle]);
                        //    break;
                        //}
                        if (CheckEagleEyeStream(dicRealHandlerChannel[lRealHandler]))    //小鹰眼码流的特殊处理
                        {
                            if (!PlayCtrl.PlayM4_SetDecodeEngineEx(m_Channel[lRealHandle], PlayCtrl.HARD_DECODE_ENGINE))
                            {
                                break;
                            }
                            //UCVideo video= listVideo.Find(p => Convert.ToInt32(p.Tag) == lRealHandle);
                            PlayCtrl.PLAYM4SRMODELMODE struParam = new PlayCtrl.PLAYM4SRMODELMODE();
                            struParam.emTextureMode  = (uint)PlayCtrl.PLAYM4SRTEXTUREMODE.PLAYM4_TEXTURE_DOUBLE;
                            struParam.ulDisplayType  = PlayCtrl.PLAYM4_MODEL_SOLID;
                            struParam.nTransformMode = 0;
                            struParam.emModelType    = (uint)PlayCtrl.PLAYM4SRMODELTYPE.PLAYM4_MODELTYPE_EAGLE_EYE;
                            struParam.bModelMode     = true; // true是碗装,false是块状
                            int    dwSize       = Marshal.SizeOf(struParam);
                            IntPtr ptrDeviceCfg = Marshal.AllocHGlobal(dwSize);
                            Marshal.StructureToPtr(struParam, ptrDeviceCfg, false);
                            if (!PlayCtrl.PlayM4_SR_SetConfig(m_Channel[lRealHandle], PlayCtrl.CFG_DISPLAY_MODEL_MODE, ptrDeviceCfg))
                            {
                                Marshal.FreeHGlobal(ptrDeviceCfg);
                                break;
                            }
                            Marshal.FreeHGlobal(ptrDeviceCfg);
                        }

                        if (!PlayCtrl.PlayM4_Play(m_Channel[lRealHandle], m_ptrRealHandle[lRealHandle]))     //播放开始
                        {
                            break;
                        }
                    }
                    break;

                case CHCNetSDK.NET_DVR_STREAMDATA:
                    if (dwBufSize > 0 && m_Channel[lRealHandle] != -1)
                    {
                        for (int i = 0; i < 4000; i++)
                        {
                            if (!PlayCtrl.PlayM4_InputData(m_Channel[lRealHandle], ref pBuffer, dwBufSize))
                            {
                                dwErr = PlayCtrl.PlayM4_GetLastError(m_Channel[lRealHandle]);
                                if (dwErr == PlayCtrl.PLAYM4_BUF_OVER)
                                {
                                    continue;
                                }
                                else
                                {
                                    return;
                                }
                            }
                            else
                            {
                                return;
                            }
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            { }
        }
Example #3
0
        private void video_e_EagleModeChange(UCVideo video)
        {
            int tag = Convert.ToInt32(video.Tag);

            if (m_Channel[tag] >= 0)
            {
                PlayCtrl.PLAYM4SRMODELMODE struParam = new PlayCtrl.PLAYM4SRMODELMODE();
                struParam.emTextureMode  = (uint)PlayCtrl.PLAYM4SRTEXTUREMODE.PLAYM4_TEXTURE_DOUBLE;
                struParam.ulDisplayType  = PlayCtrl.PLAYM4_MODEL_SOLID;
                struParam.nTransformMode = 0;
                struParam.emModelType    = (uint)PlayCtrl.PLAYM4SRMODELTYPE.PLAYM4_MODELTYPE_EAGLE_EYE;
                struParam.bModelMode     = video.IsQJVideo; // true是碗装,false是块状
                int    dwSize       = Marshal.SizeOf(struParam);
                IntPtr ptrDeviceCfg = Marshal.AllocHGlobal(dwSize);
                Marshal.StructureToPtr(struParam, ptrDeviceCfg, false);
                if (!PlayCtrl.PlayM4_SR_SetConfig(m_Channel[tag], PlayCtrl.CFG_DISPLAY_MODEL_MODE, ptrDeviceCfg))
                {
                    Marshal.FreeHGlobal(ptrDeviceCfg);
                }
            }

            //if (tag >= 0)
            //{
            //    //先关闭预览
            //    if (m_Channel[tag] != -1)
            //    {
            //        if (!PlayCtrl.PlayM4_FEC_Disable(m_Channel[tag]))
            //        {
            //            iLastErr = PlayCtrl.PlayM4_GetLastError(m_Channel[tag]);
            //        }
            //        if (!PlayCtrl.PlayM4_Stop(m_Channel[tag]))
            //        {
            //            iLastErr = PlayCtrl.PlayM4_GetLastError(m_Channel[tag]);
            //        }
            //        if (!PlayCtrl.PlayM4_CloseStream(m_Channel[tag]))
            //        {
            //            iLastErr = PlayCtrl.PlayM4_GetLastError(m_Channel[tag]);
            //        }
            //        if (!PlayCtrl.PlayM4_CloseFile(m_Channel[tag]))
            //        {
            //            iLastErr = PlayCtrl.PlayM4_GetLastError(m_Channel[tag]);
            //        }
            //        if (!PlayCtrl.PlayM4_FreePort(m_Channel[tag]))
            //        {
            //            iLastErr = PlayCtrl.PlayM4_GetLastError(m_Channel[tag]);
            //        }
            //        m_Channel[tag] = -1;
            //    }
            //    if (m_lRealHandle[tag] >= 0)
            //    {
            //        bool isok= CHCNetSDK.NET_DVR_StopRealPlay(m_lRealHandle[tag]);
            //        m_lRealHandle[tag] = -1;
            //        m_RealDataCallBack[tag] = null;
            //    }
            //    IsEagleQJ = video.IsQJVideo;
            //    //重新打开预览
            //    int channel = tag + StartDChan;
            //    CHCNetSDK.NET_DVR_PREVIEWINFO lpPreviewInfo = new CHCNetSDK.NET_DVR_PREVIEWINFO();
            //    //lpPreviewInfo.hPlayWnd = RealPlayWnd.Pic.Handle;//预览窗口 利用回调播放库显示视频
            //    lpPreviewInfo.lChannel = channel;//预te览的设备通道
            //    //if(QJChannel!=null && QJChannel.Contains((channel%StartDChan+1).ToString()))
            //    //    lpPreviewInfo.dwStreamType = 0;//码流类型:0-主码流,1-子码流,2-码流3,3-码流4,以此类推
            //    //else
            //    //    lpPreviewInfo.dwStreamType = 1;
            //    lpPreviewInfo.dwStreamType = 0;  //初始预览用子码流  放大的时候用主码流
            //    lpPreviewInfo.dwLinkMode = 0;//连接方式:0- TCP方式,1- UDP方式,2- 多播方式,3- RTP方式,4-RTP/RTSP,5-RSTP/HTTP
            //    lpPreviewInfo.bBlocked = true; //0- 非阻塞取流,1- 阻塞取流
            //    video.HikPreViewInfo = lpPreviewInfo;
            //    video.LUserID = m_lUserID;

            //    m_RealDataCallBack[tag] = new CHCNetSDK.REALDATACALLBACK(RealDataCallBack);//预览实时流回调函数
            //    IsCallBack = true;
            //    IntPtr pUser = new IntPtr();//用户数据

            //    //打开预览 Start live view
            //    m_lRealHandle[tag] = CHCNetSDK.NET_DVR_RealPlay_V40(m_lUserID, ref lpPreviewInfo, m_RealDataCallBack[tag], pUser);
            //    video.VideoHandle = m_lRealHandle[tag];

            //    //if (!dicPreviewInfo.ContainsKey(tag))
            //    //    dicPreviewInfo.Add(tag, lpPreviewInfo);  //预览视频信息
            //    if (m_lRealHandle[tag] < 0)
            //    {//预览失败
            //    }
            //    else
            //    {//预览成功
            //    }
            //}
        }