// 拼装客户端抓拍通用返回xml
IVS_INT32 OCXCapturePictureXMLProcess::LocalCaptureBuildXMLGeneric(LONG iEventCode, ULONG iWndID, const IVS_CHAR* pFileName, CXml &xml)
{
// 	CHECK_POINTER(pFileName, IVS_OPERATE_MEMORY_ERROR); // 可以为空
	IVS_DEBUG_TRACE("");
	char buf[IVS_FILE_NAME_LEN + 1] = {0};

	CHECK_SUCCESS(xml.AddDeclaration("1.0","UTF-8",""));
	CHECK_SUCCESS(xml.AddElem("Content"));
	CHECK_SUCCESS(xml.AddChildElem("WndID"));
	xml.IntoElem();
	(void)_itoa_s((int)iWndID, buf, 10);//lint !e713
	CHECK_SUCCESS(xml.SetElemValue(buf));
	
	CHECK_SUCCESS(xml.AddElem("EventID"));
	(void)_itoa_s(iEventCode, buf, 10);
	CHECK_SUCCESS(xml.SetElemValue(buf));
	
	if (NULL != pFileName)
	{
		CHECK_SUCCESS(xml.AddElem("FileName"));
		CHECK_SUCCESS(xml.SetElemValue(pFileName));
	}

	xml.OutOfElem();
	return IVS_SUCCEED;
}
Ejemplo n.º 2
0
// 新增设备组
 IVS_INT32 CDeviceGroupMgr::AddDeviceGroup( const IVS_DEV_GROUP* pDevGroupInfo,IVS_UINT32* uiDevGroupID)const
 {
     CHECK_POINTER(uiDevGroupID, IVS_OPERATE_MEMORY_ERROR);
	 IVS_DEBUG_TRACE("");

     CXml xmlTemp;
     IVS_INT32 iRet = CDeviceMgrXMLProcess::AddDeviceGroupGetXML(pDevGroupInfo, xmlTemp);
     if (IVS_SUCCEED != iRet)
     {
         BP_RUN_LOG_ERR(iRet, "Add Device GroupGetXML fail", "NA");
         return iRet;
     }

	 IVS_CHAR cDomainCode[IVS_DOMAIN_CODE_LEN + 1] = {0};
	 if (!CToolsHelp::Memcpy(cDomainCode, IVS_DOMAIN_CODE_LEN, pDevGroupInfo->cDomainCode, IVS_DOMAIN_CODE_LEN))
	 {
		 BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Memcpy(cDomainCode, IVS_DOMAIN_CODE_LEN, pDevGroupInfo->cDomainCode, IVS_DOMAIN_CODE_LEN) fail", "NA");
		 return IVS_ALLOC_MEMORY_ERROR;
	 }

	 iRet = CXmlProcess::GetCommSendMgr(xmlTemp, m_pUserMgr, NSS_ADD_DEV_GROUP_REQ, BUILSTRING, cDomainCode);
     if (IVS_SUCCEED != iRet)
     {           
         BP_RUN_LOG_ERR(iRet, "Get Comm BuildRet fail", "NA");
		 return iRet;
     }
	 iRet = CDeviceMgrXMLProcess::AddDeviceGroupParseXML(xmlTemp,uiDevGroupID);

	 return iRet;
 }
Ejemplo n.º 3
0
// 查询设备组备注信息
IVS_INT32 CDeviceGroupMgr::GetDevGroupRemark(const IVS_CHAR* pDomainCode, IVS_UINT32 uiDevGroupID, IVS_CHAR* pDevGroupRemark, IVS_UINT32 uiRemarkLen)const
{
	CHECK_POINTER(pDomainCode, IVS_OPERATE_MEMORY_ERROR);
	CHECK_POINTER(pDevGroupRemark, IVS_OPERATE_MEMORY_ERROR);
	IVS_DEBUG_TRACE("");

	CXml xmlReq;
	IVS_INT32 iRet = CDeviceMgrXMLProcess::GetDevGroupRemarkGetXML(pDomainCode, uiDevGroupID, xmlReq);
	if (IVS_SUCCEED != iRet)
	{
		BP_RUN_LOG_ERR(iRet, "Get DevGroupRemark GetXML fail", "NA");
		return iRet;
	}

	iRet = CXmlProcess::GetCommSendMgr(xmlReq, m_pUserMgr, NSS_GET_DEV_GROUP_REMARK_REQ, BUILSTRING, pDomainCode);
	if (IVS_SUCCEED != iRet)
	{
		BP_RUN_LOG_ERR(iRet, "Get DevGroup CommSendMgr fail", "NA");
		return iRet;
	}
	
	iRet = CDeviceMgrXMLProcess::GetDevGroupRemarkParseXML(pDevGroupRemark, xmlReq, uiRemarkLen);

	return iRet;
}
//开始实况
IVS_INT32 CRealPlayMgr::StartRealPlay(IVS_REALPLAY_PARAM* pRealplayPara, const IVS_CHAR* pCameraCode, HWND hWnd, IVS_ULONG* pHandle)
{
	IVS_DEBUG_TRACE("");

    if (NULL == pRealplayPara || NULL == pHandle)
    {
		BP_RUN_LOG_ERR(IVS_PARA_INVALID,"Start Real Play", "Para Invalid");
        return IVS_PARA_INVALID;
    }

	IVS_INT32 iRet = IVS_FAIL;
	IVS_ULONG ulHandle = SDK_INVALID_HANDLE;
    
	//初始化realplay对象;
	CRealPlay *pRealPlay = GetFreeRealPlayEx(ulHandle);
	if (NULL != pRealPlay)
	{
		iRet = pRealPlay->StartRealPlay(pRealplayPara, pCameraCode, hWnd);
		if (IVS_SUCCEED != iRet)
		{
			FreeRealPlayEx(ulHandle);
		}
        else
        {
            *pHandle = ulHandle;
        }
	}
	else
	{
		iRet = IVS_SDK_ERR_FINDVIDEOHANDLE_FAILED;
	}

    return iRet;
}
// 设置平台录像码流回放速度
int CTPPlayChannel::SetPlayBackSpeedByIP(IVS_FLOAT fSpeed)
{
	IVS_DEBUG_TRACE("Speed: %f", fSpeed);

	RTSP_SESSION_STATUS state = RTSP_CLIENT_GetStatus(m_iRtspHandle);
	if (RTSP_SESSION_STATUS_PLAYING == state ||
		RTSP_SESSION_STATUS_READY   == state)
	{
		float fSendScale = fSpeed;
		(void)CToolsHelp::GetSendScale(SERVICE_TYPE_PLAYBACK, fSpeed, fSendScale);
		MEDIA_RANGE_S stMdieaRange;
		memset(&stMdieaRange, 0x0, sizeof(MEDIA_RANGE_S));
		stMdieaRange.enRangeType = RANGE_TYPE_NPT;
		stMdieaRange.MediaBeginOffset = OFFSET_CUR;

		IVS_INT32 iRet = RTSP_CLIENT_SendPlayMsg(m_iRtspHandle, m_strURL.c_str(), (double)fSendScale, &stMdieaRange, RTSP_CLIENT_TIMEOUT);
		if (IVS_SUCCEED != iRet)
		{  
			(void)RTSP_CLIENT_SendTeardownMsg(m_iRtspHandle, m_strURL.c_str(), 1);
			(void)RTSP_CLIENT_FreeHandle(m_iRtspHandle);
			BP_RUN_LOG_ERR(iRet, "Set PlayBack Speed", "Send Play Message failed.");
			return IVS_PLAYER_RET_RTSP_SEND_PLAY_FAIL;
		}
		m_fRTSPSpeed = fSendScale;
		
        BP_RUN_LOG_INF("Set PlayBack Speed", "m_fRTSPSpeed:[%f], fSpeed:[%f].", m_fRTSPSpeed, fSpeed);
		return IVS_SUCCEED;
	}

	BP_RUN_LOG_ERR(IVS_FAIL, "Set PlayBack Speed", "fSpeed:[%f], RTSP Session Status: %d", fSpeed, state);
	return IVS_FAIL;
}
//获取通道号(如果失败返回-1);
IVS_UINT32 CRealPlayMgr::GetPlayerChannelByHandle(IVS_ULONG ulHandle)
{
	IVS_DEBUG_TRACE("");
	IVS_UINT32 uiChannel = SDK_INVALID_HANDLE;

	(void)VOS_MutexLock(m_pHanleRealPlayMutex);
	CRealPlay *pRealPlay = NULL;
	HandleRealPlayMapIter realplayIter;

	//查找空闲对象;
	for (realplayIter = m_HanleRealPlayMap.begin(); realplayIter != m_HanleRealPlayMap.end(); realplayIter++)
	{
		if (realplayIter->first == ulHandle)
		{
            pRealPlay = dynamic_cast<CRealPlay*>(realplayIter->second);//lint !e611
			if (NULL != pRealPlay)
			{
				uiChannel = pRealPlay->GetPlayerChannel();
			}
			break;
		}
	}
	(void)VOS_MutexUnlock(m_pHanleRealPlayMutex);

	return uiChannel;
}
//开始实况(YUV流);
IVS_INT32 CRealPlayMgr::StartRealPlayCBFrame(IVS_REALPLAY_PARAM* pRealplayPara, const IVS_CHAR* pCameraCode, RealPlayCallBackFrame fRealPlayCallBackFrame, void* pUserData, IVS_ULONG* pHandle )
{
	IVS_DEBUG_TRACE("");
	CHECK_POINTER(pHandle, IVS_PARA_INVALID);

	IVS_INT32 iRet = IVS_FAIL;
	IVS_ULONG ulHandle = SDK_INVALID_HANDLE;
	CRealPlay *pRealPlay = GetFreeRealPlay(ulHandle);
	if (NULL != pRealPlay)
	{
		iRet = pRealPlay->StartRealPlayCBFrame(pRealplayPara, pCameraCode, fRealPlayCallBackFrame, pUserData);
		if (IVS_SUCCEED != iRet)
		{
			FreeRealPlay(ulHandle);
			//pRealPlay->RetSet();
		}
        else
        {
            *pHandle = ulHandle;
        }
	}
	else
	{
		iRet = IVS_SDK_ERR_FINDVIDEOHANDLE_FAILED;
	}

    return iRet;
}
Ejemplo n.º 8
0
//开始播放视频
IVS_INT32 CTelepresenceMgr::StartRealPlayByIPEx(const std::string& strCameraCode,
												const IVS_REALPLAY_PARAM&  RealplayParam,
												const IVS_MEDIA_ADDR& stMediaAddrDst,
												IVS_MEDIA_ADDR& stMediaAddrSrc,
												IVS_ULONG& ulHandle)
{
	IVS_DEBUG_TRACE("");

	if(0==strCameraCode.length())
	{
		BP_RUN_LOG_ERR(IVS_PARA_INVALID, "Start RealPlay ByIP", "Camera Code Invalid.");
		return IVS_PARA_INVALID;
	}

	//modify by zwx211831, Date:20140813, UDP协议下音频端口不能为0,TCP可以为0
	if(IP_V4!=stMediaAddrDst.stIP.uiIPType 
		|| (0==stMediaAddrDst.uiAudioPort && (PROTOCOL_RTP_OVER_UDP == (IVS_PROTOCOL_TYPE)RealplayParam.uiProtocolType)
		|| PROTOCOL_UDP == (IVS_PROTOCOL_TYPE)RealplayParam.uiProtocolType)
		|| 0==stMediaAddrDst.uiVideoPort
		)
	{
		BP_RUN_LOG_ERR(IVS_PARA_INVALID, "Start RealPlay ByIP", "Media Addr Invalid.");
		return IVS_PARA_INVALID;
	}

	CTPPlayChannel* pPlayChannel = GetPlayChannel(ulHandle, TRUE);
	if(NULL==pPlayChannel)
	{
		BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Start RealPlay ByIP", "Create Play Channel Failed");
		return IVS_ALLOC_MEMORY_ERROR;
	}
	pPlayChannel->SetTPMgr(this);
	ulHandle = (IVS_ULONG)pPlayChannel;

	IVS_MEDIA_PARA stMediaPara;
	memset(&stMediaPara, 0, sizeof(IVS_MEDIA_PARA));
	stMediaPara.ProtocolType = (IVS_PROTOCOL_TYPE)RealplayParam.uiProtocolType;
	stMediaPara.StreamType = (IVS_STREAM_TYPE)RealplayParam.uiStreamType;
	stMediaPara.TransMode = (IVS_MEDIA_TRANS_MODE)RealplayParam.bDirectFirst;
	stMediaPara.BroadCastType = (IVS_BROADCAST_TYPE)RealplayParam.bMultiCast;
	stMediaPara.VideoDecType = VIDEO_DEC_H264;
	stMediaPara.AudioDecType = AUDIO_DEC_G711A;
	IVS_INT32 iRet = pPlayChannel->SetMediaParam(&stMediaPara);
	if(IVS_SUCCEED!=iRet)
	{
		BP_RUN_LOG_ERR(iRet, "Start RealPlay ByIP", "Set Media Param Failed");
		RemovePlayChannel(ulHandle);
		ulHandle = 0;
		return iRet;
	}
	iRet = pPlayChannel->StartRealPlayByIP(strCameraCode, stMediaAddrDst, stMediaAddrSrc);
	if(IVS_SUCCEED!=iRet)
	{
		RemovePlayChannel(ulHandle);
		ulHandle = 0;
	}
	BP_DBG_LOG("CTelepresenceMgr::StartRealPlayByIPEx, Handle: %lu", ulHandle);
	return iRet;
}
//停止实况及录像回放
IVS_INT32 CTPPlayChannel::StopPlayByIP()
{
	IVS_DEBUG_TRACE("");
	//关闭rtsp
	(void)RTSP_CLIENT_SendTeardownMsg(m_iRtspHandle, m_strURL.c_str(), 1);
	(void)RTSP_CLIENT_FreeHandle(m_iRtspHandle); 
	m_iRtspHandle = 0;
	m_strURL = "";
	return IVS_SUCCEED;
}
Ejemplo n.º 10
0
// 增加角色
IVS_INT32 CRoleMgr::AddRole(const IVS_ROLE_INFO* pRoleInfo, IVS_UINT32* puiRoleID)
{
    //空校验
    CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
    CHECK_POINTER(pRoleInfo, IVS_PARA_INVALID);

    IVS_DEBUG_TRACE("");

    IVS_INT32 iRet = IVS_FAIL;
    CXml xmlReq;
    std::string strDomainCode;
    // 防止域编码达到临界值无结束符“\0” modify by xiongfeng
    char cDomainCodeTmp[IVS_DOMAIN_CODE_LEN + 1] = {0};
    (void)CToolsHelp::Memcpy(cDomainCodeTmp, IVS_DOMAIN_CODE_LEN, pRoleInfo->cDomainCode, IVS_DOMAIN_CODE_LEN);
    strDomainCode = cDomainCodeTmp;
    if (strDomainCode.empty())
    {
        m_UserMgr->GetDomainCode(strDomainCode);
    }

    CUserInfoMgrXMLProcess::GetRoleXML(strDomainCode.c_str(), pRoleInfo, xmlReq);
    IVS_UINT32 xmlLen = 0;
    const IVS_CHAR* pReq = xmlReq.GetXMLStream(xmlLen);
    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

    // 构造带域的请求消息,并发送
    CSendNssMsgInfo sendNssMsgInfo;
    sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
    sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
    sendNssMsgInfo.SetReqID(NSS_ADD_ROLE_REQ);
    sendNssMsgInfo.SetReqData(pReq);
    sendNssMsgInfo.SetDomainCode(strDomainCode);
    //发送请求
    std::string strRsp;
    IVS_INT32 iNeedRedirect = IVS_FAIL;
    iRet = m_UserMgr->SendCmd(sendNssMsgInfo,strRsp,iNeedRedirect);
    if(IVS_SUCCEED != iRet)
    {
        BP_RUN_LOG_ERR(iRet, "Add Role","SendCmd to SMU Return Failed");
        return  iRet;
    }

    //CHECK_POINTER(strRsp.c_str(), IVS_OPERATE_MEMORY_ERROR);
    CXml xmlRsp;
    if(!xmlRsp.Parse(strRsp.c_str()))
    {
        BP_RUN_LOG_ERR(IVS_XML_INVALID, "Add Role", "xml parsing error");

        return IVS_XML_INVALID;
    }
    iRet = CUserInfoMgrXMLProcess::AddRoleParseXML(xmlRsp, puiRoleID);

    return iRet;
}
Ejemplo n.º 11
0
//设置平台录像码流回放速度
IVS_INT32 CTelepresenceMgr::SetPlayBackSpeedByIP(IVS_ULONG ulHandle, IVS_FLOAT fSpeed)
{
	IVS_DEBUG_TRACE("Handle: %lu, Speed: %f", ulHandle, fSpeed);
	CTPPlayChannel* pPlayChannel = GetPlayChannel(ulHandle);
	if(NULL==pPlayChannel)
	{
		BP_RUN_LOG_ERR(IVS_SDK_ERR_FINDVIDEOHANDLE_FAILED, "Set Platform PlayBack Speed", "Handle Invalid.");
		return IVS_SDK_ERR_FINDVIDEOHANDLE_FAILED;
	}
	return pPlayChannel->SetPlayBackSpeedByIP(fSpeed);
}
Ejemplo n.º 12
0
//查询MU的资源预算是否达到上限及当前摄像机视频流是否被引用
IVS_INT32 CMediaXMLProcess::VideoNumAndResourceGetXML(const std::string& strCameraCode, CXml &xml)
{
	IVS_DEBUG_TRACE("");
	(void)xml.AddDeclaration("1.0", "UTF-8", "");
	(void)xml.AddElem("Content");
	(void)xml.AddChildElem("CameraCode");
	(void)(xml.IntoElem());
	(void)xml.SetElemValue(strCameraCode.c_str());
	xml.OutOfElem();
	return IVS_SUCCEED;
}
Ejemplo n.º 13
0
//设置平台录像码流回放时间
IVS_INT32 CTelepresenceMgr::SetPlayBackTimeByIP(IVS_ULONG ulHandle, IVS_UINT32 uiTime)
{
	IVS_DEBUG_TRACE("Handle: %lu, Time: %d", ulHandle, uiTime);
	CTPPlayChannel* pPlayChannel = GetPlayChannel(ulHandle);
	if(NULL==pPlayChannel)
	{
		BP_RUN_LOG_ERR(IVS_SDK_ERR_FINDVIDEOHANDLE_FAILED, "Set PlayBack Time ByIP", "Handle Invalid.");
		return IVS_SDK_ERR_FINDVIDEOHANDLE_FAILED;
	}
	return pPlayChannel->SetPlayBackTimeByIP(uiTime);
}
Ejemplo n.º 14
0
//恢复平台录像回放
IVS_INT32 CTelepresenceMgr::PlatformPlayBackResumeByIP(IVS_ULONG ulHandle)
{
	IVS_DEBUG_TRACE("Handle: %lu", ulHandle);
	CTPPlayChannel* pPlayChannel = GetPlayChannel(ulHandle);
	if(NULL==pPlayChannel)
	{
		BP_RUN_LOG_ERR(IVS_SDK_ERR_FINDVIDEOHANDLE_FAILED, "Resume Platform PlayBack", "Handle Invalid.");
		return IVS_SDK_ERR_FINDVIDEOHANDLE_FAILED;
	}
	return pPlayChannel->PlatformPlayBackResumeByIP();
}
Ejemplo n.º 15
0
// 通知流缓冲区状态
IVS_INT32 CPlayback::NotifyStreamBufferState(IVS_INT32 iBufferState)
{
    IVS_DEBUG_TRACE("");
    // 用户暂停时,不做处理
    if (m_bPaused)
    {
        BP_DBG_LOG("----------In pause state, m_bPaused = true");
        return IVS_SUCCEED;
    }

    return CMediaBase::NotifyStreamBufferState(iBufferState);
}
// 构建去选中图形消息XML
IVS_INT32 COCXDrawXMLProcess::UnSelectGraphicGetXML(CString &xmlToCU)
{
	IVS_DEBUG_TRACE("");
	CXml xmlGraphics;
	unsigned int uiLen = 0;

	CHECK_SUCCESS(xmlGraphics.AddDeclaration("1.0","UTF-8",""));
	CHECK_SUCCESS(xmlGraphics.AddElem("Content"));
	xmlToCU = xmlGraphics.GetXMLStream(uiLen);

	return IVS_SUCCEED;
}
Ejemplo n.º 17
0
// 查询角色列表
IVS_INT32 CRoleMgr::GetRoleList(const IVS_CHAR* pDomainCode, const IVS_INDEX_RANGE* pIndexRange, IVS_ROLE_INFO_LIST* pRoleInfoList, IVS_UINT32 /*uiBufferSize*/)
{
    CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
    CHECK_POINTER(pIndexRange, IVS_PARA_INVALID);
    CHECK_POINTER(pRoleInfoList, IVS_PARA_INVALID);
    IVS_DEBUG_TRACE("");

    std::string strDomainCode;
    if ( NULL == pDomainCode || '\0' == pDomainCode[0])
    {
        m_UserMgr->GetDomainCode(strDomainCode);
    }
    else
    {
        strDomainCode = pDomainCode;
    }

    //构造请求xml
    IVS_INT32 iRet = IVS_FAIL;
    CXml xmlReq;
    CUserInfoMgrXMLProcess::CommDomainCodeXml(strDomainCode.c_str(), xmlReq);
    unsigned int xmlLen = 0;
    const IVS_CHAR* pReq = xmlReq.GetXMLStream(xmlLen);
    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

    // 构造带域的请求消息,并发送
    CSendNssMsgInfo sendNssMsgInfo;
    sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
    sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
    sendNssMsgInfo.SetReqID(NSS_GET_ROLE_LIST_REQ);
    sendNssMsgInfo.SetReqData(pReq);
    sendNssMsgInfo.SetDomainCode(strDomainCode);
    std::string strpRsp;
    IVS_INT32 iNeedRedirect = IVS_FAIL;
    iRet = m_UserMgr->SendCmd(sendNssMsgInfo,strpRsp,iNeedRedirect);
    if(IVS_SUCCEED != iRet)
    {
        BP_RUN_LOG_ERR(iRet, "Get Main DeviceList fail","SendCmd to SMU Return Failed");
        return  iRet;
    }

    //CHECK_POINTER(strpRsp.c_str(), IVS_XML_INVALID);
    CXml xmlRsp;
    if(!xmlRsp.Parse(strpRsp.c_str()))
    {
        BP_RUN_LOG_ERR(IVS_XML_INVALID, "Get Role List", "xml parsing error");
        return IVS_XML_INVALID;
    }
    iRet = CUserInfoMgrXMLProcess::GetRoleListParseXML(xmlRsp, pRoleInfoList);

    return iRet;
}
Ejemplo n.º 18
0
//开始播放视频
IVS_INT32 CTelepresenceMgr::StartRealPlayByIP(const std::string& strCameraCode,
												const IVS_MEDIA_ADDR& stMediaAddrDst,
												IVS_MEDIA_ADDR& stMediaAddrSrc,
												IVS_ULONG& ulHandle)
{
	IVS_DEBUG_TRACE("");

	if(0==strCameraCode.length())
	{
		BP_RUN_LOG_ERR(IVS_PARA_INVALID, "TP Start Play", "Camera Code Invalid.");
		return IVS_PARA_INVALID;
	}
	if(IP_V4!=stMediaAddrDst.stIP.uiIPType || 0==stMediaAddrDst.uiAudioPort
		|| 0==stMediaAddrDst.uiVideoPort)
	{
		BP_RUN_LOG_ERR(IVS_PARA_INVALID, "TP Start Play", "Media Addr Invalid.");
		return IVS_PARA_INVALID;
	}

	CTPPlayChannel* pPlayChannel = GetPlayChannel(ulHandle, TRUE);
	if(NULL==pPlayChannel)
	{
		BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "TP Start Play", "Create Play Channel Failed");
		return IVS_ALLOC_MEMORY_ERROR;
	}
	pPlayChannel->SetTPMgr(this);
	ulHandle = (IVS_ULONG)pPlayChannel;
	IVS_MEDIA_PARA stMediaPara;
	memset(&stMediaPara, 0, sizeof(stMediaPara));
	stMediaPara.ProtocolType = PROTOCOL_RTP_OVER_UDP;
	stMediaPara.StreamType = STREAM_TYPE_MAIN;
	stMediaPara.TransMode = MEDIA_TRANS;
	stMediaPara.BroadCastType = BROADCAST_UNICAST;
	stMediaPara.VideoDecType = VIDEO_DEC_H264;
	stMediaPara.AudioDecType = AUDIO_DEC_G711A;
	IVS_INT32 iRet = pPlayChannel->SetMediaParam(&stMediaPara);
	if(IVS_SUCCEED!=iRet)
	{
		BP_RUN_LOG_ERR(iRet, "TP Start Play", "Set Media Param Failed");
		RemovePlayChannel(ulHandle);
		ulHandle = 0;
		return iRet;
	}
	iRet = pPlayChannel->StartRealPlayByIP(strCameraCode, stMediaAddrDst, stMediaAddrSrc);
	if(IVS_SUCCEED!=iRet)
	{
		RemovePlayChannel(ulHandle);
		ulHandle = 0;
	}
	BP_DBG_LOG("CTelepresenceMgr::StartRealPlayByIP, Handle: %lu", ulHandle);
	return iRet;
}
//暂停平台录像回放
IVS_INT32 CTPPlayChannel::PlatformPlayBackPauseByIP(IVS_VOID)
{
	IVS_DEBUG_TRACE("");
	//暂停rtsp
	IVS_INT32 iRet = RTSP_CLIENT_SendPauseMsg(m_iRtspHandle, m_strURL.c_str(), RTSP_CLIENT_TIMEOUT);
	if (IVS_SUCCEED != iRet)
	{
		BP_RUN_LOG_ERR(iRet,"Play Back Pause", "RTSP client send pause play fail.");
		return IVS_PLAYER_RET_RTSP_SEND_PAUSE_FAIL;
	}

	return IVS_SUCCEED;
}
Ejemplo n.º 20
0
IVS_VOID CTelepresenceMgr::RemovePlayChannel(IVS_ULONG ulHandle)
{
	IVS_DEBUG_TRACE("");
	CLockGuard autoLock(m_pChannelMapMutex);
	CTPPlayChannel* pPlayChannel = NULL;
	TP_PLAY_CHANNEL_MAP::iterator ite = m_channelMap.find(ulHandle);
	if(ite!=m_channelMap.end())
	{
		pPlayChannel = dynamic_cast<CTPPlayChannel*>(ite->second);//lint !e611
		IVS_DELETE(pPlayChannel);
		m_channelMap.erase(ite);
	}
}
Ejemplo n.º 21
0
/*
 * StopLocalPlayBack
 * 停止本地文件回放
 */
int CPlayback::StopLocalPlayBack()
{
    IVS_DEBUG_TRACE("");
    if (m_ulPlayerChannel)
    {
        IVS_PLAY_StopPlay(m_ulPlayerChannel);
        IVS_PLAY_FreeChannel(m_ulPlayerChannel);
        m_ulPlayerChannel = NULL;

        RetSet();
    }
    return IVS_SUCCEED;
}
Ejemplo n.º 22
0
//停止播放
IVS_INT32 CTelepresenceMgr::StopPlayByIP(IVS_ULONG ulHandle)
{
	IVS_DEBUG_TRACE("");
	CTPPlayChannel* pPlayChannel = GetPlayChannel(ulHandle);
	if(NULL==pPlayChannel)
	{
		BP_RUN_LOG_ERR(IVS_PARA_INVALID, "Stop Play", "Handle Invalid.");
		return IVS_PARA_INVALID;
	}
	IVS_INT32 iRet = pPlayChannel->StopPlayByIP();
	RemovePlayChannel(ulHandle);
	return iRet;
}
Ejemplo n.º 23
0
// 根据用户ID获取角色详细信息
IVS_INT32 CRoleMgr::GetRoleInfoByUserID(const IVS_CHAR* pDomainCode, IVS_UINT32 uiUserID, IVS_ROLE_INFO* pRoleInfo)
{
    CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
    CHECK_POINTER(pRoleInfo, IVS_PARA_INVALID);
    IVS_DEBUG_TRACE("");

    std::string sDomainCode;
    if(NULL == pDomainCode)
    {
        m_UserMgr->GetDomainCode(sDomainCode);
    }
    else
    {
        sDomainCode = pDomainCode;
    }

    IVS_INT32 iRet = IVS_FAIL;
    CXml xmlReq;
    CUserInfoMgrXMLProcess::GetUserInfoGetXML(sDomainCode.c_str(), uiUserID, xmlReq);
    unsigned int xmlLen = 0;
    const IVS_CHAR* pReq = xmlReq.GetXMLStream(xmlLen);
    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

    // 构造带域的请求消息,并发送
    CSendNssMsgInfo sendNssMsgInfo;
    sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
    sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
    sendNssMsgInfo.SetReqID(NSS_GET_USER_ROLE_REQ);
    sendNssMsgInfo.SetReqData(pReq);
    sendNssMsgInfo.SetDomainCode(sDomainCode);
    std::string strpRsp;
    IVS_INT32 iNeedRedirect = IVS_FAIL;
    iRet = m_UserMgr->SendCmd(sendNssMsgInfo,strpRsp,iNeedRedirect);
    if(IVS_SUCCEED != iRet)
    {
        BP_RUN_LOG_ERR(iRet, "Get Role Info By UserID","SendCmd to SMU Return Failed");
        return  iRet;
    }

    //CHECK_POINTER(strpRsp.c_str(), IVS_OPERATE_MEMORY_ERROR);

    CXml xmlRsp;
    if(!xmlRsp.Parse(strpRsp.c_str()))
    {
        BP_RUN_LOG_ERR(IVS_XML_INVALID, "Get RoleInfo By UserID", "xml parsing error");
        return IVS_XML_INVALID;
    }
    iRet = CUserInfoMgrXMLProcess::GetRoleInfoParseXML(xmlRsp, pRoleInfo); 

    return iRet;
}
IVS_INT32 CTPPlayChannel::GetRealPlayURL(const std::string& strCamera, const IVS_MEDIA_ADDR& stMediaAddrDst, ST_MEDIA_RSP& stMediaRsp)
{
	CHECK_POINTER(m_pTPMgr, IVS_OPERATE_MEMORY_ERROR);
	IVS_DEBUG_TRACE("");

	//解析摄像头Code
	std::string strCameraCode;
	std::string strDomainCode;
	IVS_INT32 iRet = CToolsHelp::SplitCameraDomainCode(strCamera.c_str(), strCameraCode, strDomainCode);
	if(IVS_SUCCEED!=iRet)
	{
		BP_RUN_LOG_ERR(iRet, "TP Get RealPlay URL", "SplitCameraCode failed, CameraCode=%s", strCamera.c_str()); 
		return iRet;
	}

	//TODO : szDstPort无实际作用,传一个固定值;打包协议类型szDstPP入参结构体未定义
	ST_URL_MEDIA_INFO stUrlMediaInfo;
	memset(&stUrlMediaInfo, 0, sizeof(ST_URL_MEDIA_INFO));
	bool bSucc = CToolsHelp::Strncpy(stUrlMediaInfo.szSrcCode, sizeof(stUrlMediaInfo.szSrcCode), strCameraCode.c_str(), strCameraCode.length());
	CHECK_SUCCESS_RET(bSucc, IVS_ALLOC_MEMORY_ERROR);

	bSucc = CToolsHelp::Strncpy(stUrlMediaInfo.cDomainCode, sizeof(stUrlMediaInfo.cDomainCode), strDomainCode.c_str(), strDomainCode.length());
	CHECK_SUCCESS_RET(bSucc, IVS_ALLOC_MEMORY_ERROR);

	bSucc = CToolsHelp::Strncpy(stUrlMediaInfo.szDstCode,sizeof(stUrlMediaInfo.szDstCode), "01",strlen("01"));
	CHECK_SUCCESS_RET(bSucc, IVS_ALLOC_MEMORY_ERROR);

	stUrlMediaInfo.ServiceType = SERVICE_TYPE_REALVIDEO;
	stUrlMediaInfo.MediaPara.StreamType = m_stuMediaParam.StreamType;
	stUrlMediaInfo.MediaPara.ProtocolType = m_stuMediaParam.ProtocolType;
	stUrlMediaInfo.MediaPara.TransMode = m_stuMediaParam.TransMode;
	stUrlMediaInfo.MediaPara.BroadCastType = m_stuMediaParam.BroadCastType;
	stUrlMediaInfo.MediaPara.VideoDecType = m_stuMediaParam.VideoDecType;
	stUrlMediaInfo.MediaPara.AudioDecType = m_stuMediaParam.AudioDecType;
	stUrlMediaInfo.PackProtocolType = PACK_PROTOCOL_ES;

	bSucc = CToolsHelp::Strncpy(stUrlMediaInfo.szDstIP,sizeof(stUrlMediaInfo.szDstIP), stMediaAddrDst.stIP.cIP, strnlen(stMediaAddrDst.stIP.cIP, IVS_IP_LEN));
	CHECK_SUCCESS_RET(bSucc, IVS_ALLOC_MEMORY_ERROR);

	std::string strPort = CToolsHelp::Int2Str(static_cast<int>(stMediaAddrDst.uiVideoPort));
	bSucc = CToolsHelp::Strncpy(stUrlMediaInfo.szDstPort,sizeof(stUrlMediaInfo.szDstPort),  strPort.c_str() ,strPort.length());
	CHECK_SUCCESS_RET(bSucc, IVS_ALLOC_MEMORY_ERROR);

	stUrlMediaInfo.iClientType = CLIENT_TYPE_PCG;

	bSucc = CToolsHelp::Strncpy(stUrlMediaInfo.szEncryAlgorithm,sizeof(stUrlMediaInfo.szEncryAlgorithm), "0000000000",strlen("0000000000"));
	CHECK_SUCCESS_RET(bSucc, IVS_ALLOC_MEMORY_ERROR);

	iRet = m_pTPMgr->GetURL(CToolsHelp::GetSCCHead().c_str(), stUrlMediaInfo, stMediaRsp);
	return iRet;
}
//获取空闲的realplay对象;
CRealPlay *CRealPlayMgr::GetFreeRealPlay(IVS_ULONG& ulHandle)
{
	IVS_DEBUG_TRACE("");
	(void)VOS_MutexLock(m_pHanleRealPlayMutex);
	CRealPlay *pRealPlay = NULL;
	HandleRealPlayMapIter realplayIter = m_HanleRealPlayMap.begin();
    HandleRealPlayMapIter realplayIterEnd = m_HanleRealPlayMap.end();

	//查找空闲对象;
	for (; realplayIter != realplayIterEnd; realplayIter++)
	{
        pRealPlay = dynamic_cast<CRealPlay*>(realplayIter->second);//lint !e611
		if (NULL != pRealPlay)
		{
			if (pRealPlay->GetStatus() == MEDIA_STATUS_FREE)
			{
				break;
			}
		}
		pRealPlay = NULL;
	}

	if (NULL != pRealPlay)
	{
		m_HanleRealPlayMap.erase(realplayIter);
	}
	else
	{
		pRealPlay = IVS_NEW((CRealPlay*&)pRealPlay);
		if (NULL == pRealPlay)
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get Free RealPlay", "create real play error");
			(void)VOS_MutexUnlock(m_pHanleRealPlayMutex);
			return NULL;
		}
	}

	//初始化realplay对象;
	pRealPlay->SetUserMgr(m_pUserMgr);
	pRealPlay->SetStatus(MEDIA_STATUS_BUSY);

	//插入列表;
    ulHandle = (unsigned long)pRealPlay;
	(void)m_HanleRealPlayMap.insert(std::make_pair(ulHandle, pRealPlay));

	pRealPlay->SetHandle(ulHandle);

	(void)VOS_MutexUnlock(m_pHanleRealPlayMutex);
	return pRealPlay;
}
Ejemplo n.º 26
0
// 获取用户权限信息
IVS_INT32 CRoleMgr::GetOperationRightGroup(const IVS_CHAR* pDomainCode, IVS_OPERATION_RIGHT_GROUP_LIST* pRightGroupList)
{
    CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
    IVS_DEBUG_TRACE("");

    std::string strDomainCode;
    if(NULL == pDomainCode || '\0' == pDomainCode[0])
    {
        m_UserMgr->GetDomainCode(strDomainCode);
    }
    else
    {
        strDomainCode = pDomainCode;
    }

    IVS_INT32 iRet = IVS_FAIL;
    CXml xmlReq;
    CUserInfoMgrXMLProcess::CommDomainCodeXml(strDomainCode.c_str(), xmlReq);
    unsigned int xmlLen = 0;
    const IVS_CHAR* pReq = xmlReq.GetXMLStream(xmlLen);
    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

    // 构造带域的请求消息,并发送
    CSendNssMsgInfo sendNssMsgInfo;
    sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
    sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
    sendNssMsgInfo.SetReqID(NSS_GET_ALL_OP_REQ);
    sendNssMsgInfo.SetReqData(pReq);
    sendNssMsgInfo.SetDomainCode(strDomainCode);
    std::string sRsp;
    IVS_INT32 iNeedRedirect = IVS_FAIL;
    iRet = m_UserMgr->SendCmd(sendNssMsgInfo,sRsp,iNeedRedirect);
    if(IVS_SUCCEED != iRet)
    {
        BP_RUN_LOG_ERR(iRet, "Get Operation Right Group","SendCmd to SMU Return Failed");
        return  iRet;
    }

    //CHECK_POINTER(sRsp.c_str(), IVS_OPERATE_MEMORY_ERROR);

    CXml xmlRsp;
    if(!xmlRsp.Parse(sRsp.c_str()))
    {
        BP_RUN_LOG_ERR(IVS_XML_INVALID, "Get Operation Right Group", "xml parsing error");
        return IVS_XML_INVALID;
    }
    iRet = CUserInfoMgrXMLProcess::GetOperationRightGroupParseXML(xmlRsp, pRightGroupList); 

    return iRet;
}
// 构建获取图形失败的XML
IVS_INT32 COCXDrawXMLProcess::GetGraphicsGetErrXML(IVS_INT32 iResultCode, CXml& xmlGraphics)
{
	char val[64] = {0};
	IVS_DEBUG_TRACE("iResultCode: %d", iResultCode);

	CHECK_SUCCESS(xmlGraphics.AddDeclaration("1.0","UTF-8",""));
	CHECK_SUCCESS(xmlGraphics.AddElem("Content"));
	CHECK_SUCCESS(xmlGraphics.AddChildElem("ResultCode"));
	CHECK_SUCCESS(xmlGraphics.IntoElem());
	SET_ELEMENT_LONG(iResultCode, val, xmlGraphics);
	xmlGraphics.OutOfElem();

	return IVS_SUCCEED;

}
Ejemplo n.º 28
0
 //获取平台录像计划;
 IVS_INT32 CRecordPlanMgr::GetRecordPlan(const char* pCameraCode,IVS_UINT32 uiRecordMethod,
	 IVS_RECORD_PLAN* pRecordPlan)
 {
	 CHECK_POINTER(pCameraCode, IVS_PARA_INVALID);
	 CHECK_POINTER(pRecordPlan, IVS_PARA_INVALID);
	 CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
	 IVS_DEBUG_TRACE("");
	 //数据结构拼装XML并转换为const IVS_CHAR *
	 CXml xmlReq;
	 IVS_INT32 iRet = CRecordXMLProcess::GetRecordPlanGetXML(pCameraCode, uiRecordMethod, xmlReq);

	 unsigned int xmlLen = 0;
	 const IVS_CHAR * pReqPlan = xmlReq.GetXMLStream(xmlLen);
	 CHECK_POINTER(pReqPlan, IVS_OPERATE_MEMORY_ERROR);

	 IVS_CHAR chDevCode[IVS_DEV_CODE_LEN+1];
	 memset(chDevCode, 0, sizeof(chDevCode));

	 IVS_CHAR chDomaCode[IVS_DOMAIN_CODE_LEN+1];
	 memset(chDomaCode, 0, sizeof(chDomaCode));

	 (IVS_VOID)CXmlProcess::ParseDevCode(pCameraCode, chDevCode, chDomaCode);
	 //发送nss协议
	 CSendNssMsgInfo sendNssMsgInfo;	
	 sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
	 sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
	 sendNssMsgInfo.SetReqID(NSS_GET_RECORD_PLAN_REQ);
	 sendNssMsgInfo.SetReqData(pReqPlan); 
	 sendNssMsgInfo.SetCameraCode(chDevCode);
	 sendNssMsgInfo.SetDomainCode(chDomaCode);

	 std::string strpRsp;
	 IVS_INT32 iNeedRedirect = IVS_FAIL;
	 iRet = m_UserMgr->SendCmd(sendNssMsgInfo,strpRsp,iNeedRedirect);
	 if(IVS_SUCCEED != iRet)
	 {
		 BP_RUN_LOG_INF("Get Platform Record Plan", "ok", "Get Platform RecordPlan Success.pResultList size is 0.");
		 return iRet;
	 }

	 // 将xml转化成结构体返回
	 CXml xmlRsp;
	 (void)xmlRsp.Parse(strpRsp.c_str());
	 IVS_INT32 iParseRSPRet = CRecordXMLProcess::GetRecordPlanParseRSP(pRecordPlan,xmlRsp);

	 BP_RUN_LOG_INF("Get Record Plan", "ok", "msg have Parsed");
	 return iRet;
 }//lint !e1762 !e818 !e529
Ejemplo n.º 29
0
//停止平台录像回放
int CPlayback::StopPlatformPlayBack()
{
    IVS_DEBUG_TRACE("");
    CLockGuard lock(m_pMediaMutex);

    int iRet = CMediaBase::StopPlay();

    //重置参数
    RetSet();
    if (iRet != IVS_SUCCEED)
    {
        BP_RUN_LOG_ERR(iRet,"Stop Platform Play Back", "call MediaBase::StopPlay failed.");
        iRet = IVS_FAIL;
    }
    return iRet;
}
//获取音量
IVS_INT32 CRealPlayMgr::GetVolume(unsigned int uiPlayHandle, unsigned int* puiVolumeValue)
{	
	IVS_DEBUG_TRACE("");
    IVS_INT32 iRet = IVS_FAIL;

    CRealPlay *pRealPlay = dynamic_cast<CRealPlay *>(GetMediaBase(uiPlayHandle));
    if (NULL != pRealPlay)
    {
        iRet = pRealPlay->GetVolume(puiVolumeValue);
    }
    else
    {
        iRet = IVS_SDK_ERR_FINDVIDEOHANDLE_FAILED;
    }

    return iRet;
}