⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swimodule.cpp

📁 基于NMS的video access 3.1编写的DEMO程序 实现2个功能 1) H324握手 2) VIDEO MAIL
💻 CPP
字号:
#include "swimodule.h"
#include "boardmodule.h"

CTAQUEUEHD TSwiModule::m_ctaqueuehd;
CTAHD TSwiModule::m_ctahd;
bool TSwiModule::m_bInited = false;

bool TSwiModule::Init()
{
	if(m_bInited)
			return true;

	CTA_EVENT event;
	if( 0 != ctaCreateQueue( NULL, 0, &m_ctaqueuehd))
		return false;
	if( 0!= ctaCreateContext(m_ctaqueuehd, 0, "swicontext",  &m_ctahd))
		return false;

	CTA_SERVICE_DESC  svcDescriptions[] = {{ { "SWI", "SWIMGR" }, {0},{0},{0} }};
	if( 0 != ctaOpenServices( m_ctahd, svcDescriptions, 1/*num*/))
		return false;

	ctaWaitEvent(m_ctaqueuehd, &event, CTA_WAIT_FOREVER/*forevenr*/);
	if((event.id != CTAEVN_OPEN_SERVICES_DONE) || (event.value != CTA_REASON_FINISHED))
		return false;

	m_bInited = true;
	return true;
}

bool TSwiModule::Connect(int board, int dspslot1, int dspslot2)
{
	if(!Init())
		return false;

	int dspstream, numtrunk;

	TBoardModule::GetBoardInfo( board, &dspstream, &numtrunk);
	
	SWIHD swihd;
	swiOpenSwitch(m_ctahd, "agsw", board, 0, &swihd);

	SWI_TERMINUS in, out;

	in.bus = MVIP95_LOCAL_BUS;
	in.stream = dspstream;
	in.timeslot = dspslot1;
	
	out.bus = MVIP95_LOCAL_BUS;
	out.stream = dspstream + 1;
	out.timeslot = dspslot2;

	swiMakeConnection(swihd, &in, &out, 1/*count*/ );

	in.stream++;
	out.stream--;
	swiMakeConnection(swihd, &out, &in, 1/*count*/);

	return true;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -