Exemplo n.º 1
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.º 2
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.º 3
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);
        }