Exemplo n.º 1
0
        public void DealVoipAuidoFrame(IntPtr ip, uint dwContextEnc)
        {
            FrameHeadrDec pFrmHdrDec = (FrameHeadrDec)Marshal.PtrToStructure(ip, typeof(FrameHeadrDec));

            if (pFrmHdrDec.data == IntPtr.Zero)
            {
                return;
            }
            PLAYFRAMEHDR hdr = new PLAYFRAMEHDR
            {
                m_byMediaType = pFrmHdrDec.mediaType,
                m_dwDataSize  = pFrmHdrDec.data_size,
                m_byFrameRate = 0,
                m_dwFrameID   = 0,
                m_dwTimeStamp = pFrmHdrDec.m_dwTimeStamp,
                union1        = new Anonymous_3d5d69df_3122_4137_83f1_a9b198afad7b
                {
                    m_tAudioParam = new Anonymous_0584d86c_3910_4038_bad0_69ed09db9a8d
                    {
                        m_byAudioMode = pFrmHdrDec.audio_mode,
                    }
                }
            };
            int Temp_int = Marshal.SizeOf(hdr);

            byte[] pD = new byte[pFrmHdrDec.data_size];
            Marshal.Copy(pFrmHdrDec.data, pD, 0, (int)pFrmHdrDec.data_size);
            byte[] pl    = PubMethod.StructToBytes(hdr);
            byte[] bytes = pl.Concat(pD).ToArray();
            uint   len   = Convert.ToUInt32(pFrmHdrDec.data_size + 40);
            bool   bol   = SDK_TLi.TLPlay_InputAudioData(m_hPlayPort, ref bytes[0], len);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查找远程文件
        /// </summary>
        /// <param name="vInfo"></param>
        /// <param name="para"></param>
        /// <returns></returns>

        public static VideoRemoteFileInfo[] FindRemoteFile1(VideoInfo vInfo, VideoRemotePlaySearchPara para)
        {
            VideoRemoteFileInfo[]       result     = new VideoRemoteFileInfo[3];
            SDK_TLi.NETDVR_devicenode_t deviceInfo = new SDK_TLi.NETDVR_devicenode_t();
            int Temp_intIndex = SDK_TLi.GetNodeIndexByDeviceID(vInfo.DVSUniqueCode);

            SDK_TLi.DeviceInfo devicenode = VideoEnvironment.VideoEnvironment_TL.devices[Temp_intIndex];
            SDK_TLi.NETDVR_fileSearchCondition_t fileSearch = new SDK_TLi.NETDVR_fileSearchCondition_t
            {
                chn        = 2,
                type       = (ushort)NETDVR_REC_INDEX_MASK.NETDVR_REC_INDEX_ALL,
                start_time = Convert.ToUInt32(CommonMethod.ConvertClass.DateTimeToUnixTimestamp(para.StartTime)),
                end_time   = (uint)((para.EndTime.ToUniversalTime().Ticks - 621355968000000000) / 10000000) + 86400,
                startID    = 1,
                max_return = 3
            };
            NETDVR_recFileSearchResult_t recFile = new NETDVR_recFileSearchResult_t();
            int intResult = SDK_TLi.NETDVR_recFilesSearch(devicenode.nHandle, ref fileSearch, ref recFile);
            NETDVR_recFileInfo_t fileInfo = (NETDVR_recFileInfo_t)Marshal.PtrToStructure(recFile.precInfo, typeof(NETDVR_recFileInfo_t));

            Console.WriteLine(fileInfo.channel_no + " - 文件名称:" + fileInfo.filename);
            while (fileInfo.pnext != IntPtr.Zero)
            {
                fileInfo = (NETDVR_recFileInfo_t)Marshal.PtrToStructure(fileInfo.pnext, typeof(NETDVR_recFileInfo_t));
                Console.WriteLine(fileInfo.channel_no + " - 文件名称:" + fileInfo.filename);
                result[0].FileName = fileInfo.filename;
            }
            return(result);
        }
Exemplo n.º 3
0
        public bool OpenVideoRecord()
        {
            bool bolResult = false;

            m_hPlayPort = 0;
            if (SDK_TLi.TLPlay_GetPort(ref m_hPlayPort))                                     //获取播放句柄
            {
                SDK_TLi.TLPlay_SetPlayMode(m_hPlayPort, TLPLAYMODE.TL_PLAY_FILE).ToString(); //设备播放模式
                SDK_TLi.TLPlay_OpenFile(m_hPlayPort, VideoRecordInfo.RecordPath);            //打开码流
            }
            return(bolResult);
        }
Exemplo n.º 4
0
 public bool PlayVideoRecord()
 {
     CommonMethod.Common.Delay_Millisecond(300);
     if (currentPlaybackState == Enum_VideoPlaybackState.Paused)
     {
         SDK_TLi.TLPlay_Pause(m_hPlayPort, false);
     }
     else
     {
         SDK_TLi.TLPlay_Play(m_hPlayPort, intptrPlayWnd);
     }
     currentPlaybackState = Enum_VideoPlaybackState.Playing;
     StartGetVideoRecordPost();
     return(true);
 }
Exemplo n.º 5
0
        public bool StartTlak(Enum_TalkModel talkModel)
        {
            bool bolResult = false;

            VideoEnvironment.VideoEnvironment_TL.TL_StartTalking(null);
            VideoEnvironment.VideoEnvironment_TL.TL_StartTalkingEvent += VideoEnvironment_TL_TL_StartTalkingEvent;
            if (CurrentTalkStatus != Enum_TalkStatus.Null)  //处于对讲中 先关闭
            {
                StopTalk();
            }
            int Temp_intIndex = SDK_TLi.GetNodeIndexByDeviceID(CurrentVideoInfo.DVSUniqueCode);

            if (Temp_intIndex == -1)
            {
                //刷新设备列表
                VideoEnvironment.VideoEnvironment_TL.RefreshDeviceList();
            }
            Temp_intIndex = SDK_TLi.GetNodeIndexByDeviceID(CurrentVideoInfo.DVSUniqueCode);
            if (Temp_intIndex == -1)
            {
                return(false);
            }
            d = VideoEnvironment.VideoEnvironment_TL.devices[Temp_intIndex];
            StartTalking(null);
            SDK_TLi.NETDVR_devicenode_t deviceInfo = new SDKInterface.SDK_TLi.NETDVR_devicenode_t();
            deviceInfo.device_ID       = d.devicenode.device_ID;
            deviceInfo.maxSubstreamNum = d.devicenode.maxSubstreamNum;
            SDK_TLi.NETDVR_createDVR_3g(ref d.nHandle, deviceInfo.device_ID, ref deviceInfo);
            SDK_TLi.TLPlay_GetPort(ref m_hPlayPort);
            SDK_TLi.TLPlay_SetPlayMode(m_hPlayPort, SDKInterface.SDK_TLi.TLPLAYMODE.TL_PLAY_POOL_STREAM);
            SDK_TLi.TLPlay_OpenStream(m_hPlayPort, 1 << 20);
            SDK_TLi.TLPlay_Play(m_hPlayPort, IntPtr.Zero);
            frameCallBack = new pDecFrameCallBack(DealVoipAuidoFrame);
            int ret = NETDVR_VOIPRegRcvCB(d.nHandle, 0, frameCallBack, Convert.ToUInt32(m_hPlayPort));

            ret = SDK_TLi.NETDVR_startVOIP(d.nHandle, 0);
            bool bol = SDK_TLi.TLPlay_PlaySound(m_hPlayPort);

            CurrentTalkStatus = (Enum_TalkStatus)(int)talkModel;
            return(bolResult);
        }
Exemplo n.º 6
0
        public void thrGetVideoRecordPos()
        {
            while (currentPlaybackState == Enum_VideoPlaybackState.Playing)
            {
                float pos = SDK_TLi.TLPlay_GetPlayPos(m_hPlayPort);
                if (pos > 1)
                {
                    continue;
                }
                //Console.WriteLine("TIME:" + DateTime.Now + "_" + pos.ToString());
                VideoRecordPos = pos;
                if (VideoRecordPos == 1)
                {
                    CloseVideoRecord();
                    OpenVideoRecord();
                    VideoRecordPos = 0;
                }

                Thread.Sleep(intValue);
            }
        }
Exemplo n.º 7
0
        public static void Main(string[] args)
        {
            SDK_TLi.NETDVR_cleanup();
            int ret = SDK_TLi.NETDVR_startup();

            Console.WriteLine(ret);
            nETDVR_AddrInfo_T = new NETDVR_addrInfo_t
            {
                ip   = IPToInt("192.168.2.18"),
                port = 10000
            };
            ret = SDK_TLi.NETDVR_createClient(ref nETDVR_AddrInfo_T);
            Console.WriteLine(ret);
            ser_LoginInfo      = new NETDVR_loginInfo_3g_t();
            ser_LoginInfo.name = "TLClient";
            ser_LoginInfo.user = "******";
            ser_LoginInfo.pass = "******";
            ret = SDK_TLi.NETDVR_loginServer_3g(ref ser_LoginInfo);
            Console.WriteLine(ret);
            //devices = GetDeviceList(1000);
            //TLVideoEnvironment = Enum_SDKState.SDK_Init;
            Console.ReadKey();
        }
Exemplo n.º 8
0
        /// <summary>
        /// 通立SDK初始化
        /// </summary>
        /// <returns></returns>
        public static bool TLVideoEnvironment_Init(string strServerIp, UInt16 intPort, string strUserName, string strPwd)
        {
            bool bolResult = false;

            NETDVR_startup();
            NETDVR_addrInfo_t nETDVR_AddrInfo_T = new NETDVR_addrInfo_t
            {
                ip   = IPToInt(strServerIp),
                port = intPort
            };

            SDK_TLi.NETDVR_createClient(ref nETDVR_AddrInfo_T);
            NETDVR_loginInfo_3g_t ser_LoginInfo = new NETDVR_loginInfo_3g_t();

            ser_LoginInfo.name = "TLClient";
            ser_LoginInfo.user = strUserName;
            ser_LoginInfo.pass = strPwd;
            NETDVR_login_resp_t respInfo = new NETDVR_login_resp_t();
            int ret = SDK_TLi.NETDVR_loginServer_3g(ref ser_LoginInfo, ref respInfo);

            RefreshDeviceList();
            TLVideoEnvironment = Enum_SDKState.SDK_Init;
            return(bolResult);
        }
Exemplo n.º 9
0
 public bool PauseVideoRecord()
 {
     SDK_TLi.TLPlay_Pause(m_hPlayPort, true);
     currentPlaybackState = Enum_VideoPlaybackState.Paused;
     return(true);
 }
Exemplo n.º 10
0
        public bool VideoPlay()
        {
            bool bolResult = false;

            SDKInterface.SDK_TLi.NETDVR_devicenode_t deviceInfo = new SDKInterface.SDK_TLi.NETDVR_devicenode_t();
            int Temp_intIndex = SDK_TLi.GetNodeIndexByDeviceID(CurrentVideoInfo.DVSUniqueCode);

            if (Temp_intIndex == -1)
            {
                //刷新设备列表
                VideoEnvironment.VideoEnvironment_TL.RefreshDeviceList();
            }
            Temp_intIndex = SDK_TLi.GetNodeIndexByDeviceID(CurrentVideoInfo.DVSUniqueCode);
            if (Temp_intIndex == -1)
            {
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.DeviceNotExist, EventContent = "设备不存在"
                });
                return(false);
            }
            d = VideoEnvironment.VideoEnvironment_TL.devices[Temp_intIndex];
            deviceInfo.device_ID       = d.devicenode.device_ID;
            deviceInfo.maxSubstreamNum = d.devicenode.maxSubstreamNum;
            deviceInfo.maxChnNum       = d.devicenode.maxChnNum;
            deviceInfo.maxAduioNum     = d.devicenode.maxAduioNum;
            SDKInterface.SDK_TLi.NETDVR_createDVR_3g(ref d.nHandle, deviceInfo.device_ID, ref deviceInfo);
            m_hPlayPort = 0;
            SDKInterface.SDK_TLi.TLPlay_GetPort(ref m_hPlayPort);
            SDKInterface.SDK_TLi.TLPlay_SetPlayMode(m_hPlayPort, SDKInterface.SDK_TLi.TLPLAYMODE.TL_PLAY_POOL_STREAM);
            SDKInterface.SDK_TLi.TLPlay_OpenStream(m_hPlayPort, 2 << 20);
            SDKInterface.SDK_TLi.TLPlay_Play(m_hPlayPort, PicPlayMain.Handle);
            VideoPlayState = Enum_VideoPlayState.Connecting;
            frameCallBack  = get_encframe;
            byte btyChannel = (byte)(CurrentCameraInfo.Channel - 1);
            int  ret        = NETDVR_openSubVideoReciever(d.nHandle, btyChannel, frameCallBack, 0);

            if ((int)NETDVR_RETURN_CODE.NETDVR_SUCCESS != ret)
            {
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.VideoPlayException, EventContent = "打开子码流接收异常"
                });
                NETDVR_closeSubVideoReciever(d.nHandle, btyChannel);
                return(false);
            }

            //decFrameCallBack = DealDecVideoFrame;
            //ret = NETDVR_createSubVideoDecoder(d.nHandle, btyChannel, decFrameCallBack, 0);
            ret = NETDVR_setSubDecoderFMT(d.nHandle, btyChannel, NETDVR_FMT_TYPE.NETDVR_FMT_YV12);
            if ((int)NETDVR_RETURN_CODE.NETDVR_SUCCESS != ret)
            {
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.VideoPlayException, EventContent = "设置解码格式异常"
                });
                NETDVR_destroySubVideoDecoder(d.nHandle, btyChannel);
                NETDVR_closeSubVideoReciever(d.nHandle, btyChannel);
                return(false);
            }
            ret = NETDVR_startSubVideoSend(d.nHandle, btyChannel);
            if ((int)NETDVR_RETURN_CODE.NETDVR_SUCCESS != ret)
            {
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.VideoPlayException, EventContent = "设置解码格式异常"
                });
                NETDVR_destroySubVideoDecoder(d.nHandle, btyChannel);
                NETDVR_closeSubVideoReciever(d.nHandle, btyChannel);
                return(false);
            }
            VideoPlayCallback(new VideoPlayCallbackValue {
                evType = Enum_VideoPlayEventType.VideoPlay
            });
            if (CurrentVideoPlaySet.VideoRecordEnable)
            {
                recFileNameCallBack = new pRecFilenameCallBack(FilenameCallBack);
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.StartVideoRecord
                });
                NETDVR_setSubRecordFileNameCB(d.nHandle, btyChannel, recFileNameCallBack, 0);
                NETDVR_startSubRecord(d.nHandle, btyChannel, CurrentVideoPlaySet.VideoRecordFilePath, 0);
            }
            return(bolResult);
        }