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

📄 rvmdm.c

📁 h.248协议源码
💻 C
📖 第 1 页 / 共 5 页
字号:
	{name: rvMdmTermDestroyMediaStream_}
	{class: RvMdmTerm}
	{include: rvmdm.h}
	{description:
		{p: Close a media stream on a termination and release resources.}
	}
	{proto: RvBool rvMdmTermDestroyMediaStream_(RvMdmTerm* term,
												 RvMdmMediaStream* mediaStream,OUT RvMdmError* mdmError);}
	{params:
		{param: {n:term} {d:Termination.}}
		{param: {n:mediaStream} {d:user identifier of the media.}}
		{param: {n:mdmError} {d:(Optional) Use to set error information.}}
	}
	{returns: 
		rvFalse if fails.
	}
}
$*/
RvBool rvMdmTermDestroyMediaStream_(RvMdmTerm* term,RvMdmMediaStream* mediaStream,OUT RvMdmError* mdmError) {
	return term->termClass->destroyMediaF(term,mediaStream,mdmError);
}


/*$
{protected_function:
	{name: rvMdmTermGetStats_}
	{class: RvMdmTerm}
	{include: rvmdm.h}
	{description:
		{p: Get statistics from termination.}
	}
	{proto: void  rvMdmTermGetStats_(RvMdmTerm* term,RvMegacoStatisticsDescriptor* stats);}
	{params:
		{param: {n:term} {d:termination.}}
		{param: {n:stats} {d:Output termination statistics.}}
	}
}
$*/
void  rvMdmTermGetStats_(RvMdmTerm* term,RvMegacoStatisticsDescriptor* stats) {
	term->termClass->statisticsF(term,stats);
}

/*$
{protected_function:
	{name: rvMdmTermResetStats_}
	{class: RvMdmTerm}
	{include: rvmdm.h}
	{description:
		{p: Reset termination statistics.}
	}
	{proto: void  rvMdmTermResetStats_(RvMdmTerm* term);}
	{params:
		{param: {n:term} {d:termination.}}
	}
}
$*/
void  rvMdmTermResetStats_(RvMdmTerm* term) {
	term->termClass->resetStatsF(term);
}

/*$
{function:
	{name: rvMdmTermGetId}
	{class: RvMdmTerm}
	{include: rvmdm.h}
	{description:
		{p: Gets the termination id.}
	}
	{proto: const char* rvMdmTermGetId(RvMdmTerm* term);}
	{params:
		{param: {n:term} {d:A pointer to termination object.}}
	}
	{returns: 
		The termination id.
	}
	{notes:
		{note: 
			For a temporary termination inside the SelectTermination callback
			(type RV_MDMTERMTYPE_UNKNOWN) this will return a partial id or an empty string.
		}
	}
}
$*/
const char* rvMdmTermGetId(RvMdmTerm* term) {
	return term->xTermClbks->getIdF(term->xTerm);
}

/*$
{function:
	{name: rvMdmTermGetContext}
	{class: RvMdmTerm}
	{include: rvmdm.h}
	{description:
		{p: Gets the current active context of the termination.}
	}
	{proto: RvMdmContext* rvMdmTermGetContext(RvMdmTerm* term);}
	{params:
		{param: {n:term} {d:A pointer to termination object.}}
	}
	{returns: 
		The context or NULL if the termination is not in an active context.
		(TBD. Should the null context be returned? ).
	}
}
$*/
RvMdmContext* rvMdmTermGetContext(RvMdmTerm* term) {
	return rvMegacoTermGetContext((RvMegacoTerm*)term->xTerm);
}

/*$
{protected_function:
	{name: rvMdmTermConstruct_}
	{class: RvMdmTerm}
	{include: rvmdm.h}
	{description:
		{p: Constructs an abstract termination.}
	}
	{proto: void rvMdmTermConstruct_(RvMdmTerm* term,RvMdmTermClass* termClass,
									 RvMdmXTermClbks* xTermClbks,RvMdmXTerm* xTerm);}
	{params:
		{param: {n:term} {d:A pointer to termination object.}}
		{param: {n:termClass} {d:A pointer to termination class.}}
		{param: {n:xTermClbks} {d:A pointer to a table of callbacks set by the concrete manager.}}
		{param: {n:xTerm} {d:A pointer to the concrete termination.}}
	}
	{notes:
		{note: 
			Call from the function that register with the concrete termination manager.
		}
	}
}
$*/
void rvMdmTermConstruct_(RvMdmTerm* term,RvMdmTermClass* termClass,
						 RvMdmXTermClbks* xTermClbks,RvMdmXTerm* xTerm) {
	term->termClass = termClass;
	term->xTerm = xTerm;
	term->xTermClbks = xTermClbks;
}

/*$
{protected_function:
	{name: rvMdmTermDestruct_}
	{class: RvMdmTerm}
	{include: rvmdm.h}
	{description:
		{p: Destruct the object.}
	}
	{proto: void rvMdmTermDestruct_(RvMdmTerm* term);}
	{params:
		{param: {n:term} {d:A pointer to termination object.}}
	}

}
$*/
void rvMdmTermDestruct_(RvMdmTerm* term) {
}

/*$
{protected_function:
	{name: rvMdmTermGetXTerm_}
	{class: RvMdmTerm}
	{include: rvmdm.h}
	{description:
		{p: Return the concrete termination associated with the abtract termination.}
	}
	{proto: RvMdmXTerm * rvMdmTermGetXTerm_(RvMdmTerm* term);}
	{params:
		{param: {n:term} {d:A pointer to termination object.}}
	}
	{returns: 
		Returns the concrete termination.
	}
}
$*/
RvMdmXTerm * rvMdmTermGetXTerm_(RvMdmTerm* term) {
	return term->xTerm;
}

/*$
{protected_function:
	{name: rvMdmTermStartSignal_}
	{class: RvMdmTerm}
	{include: rvmdm.h}
	{description:
		{p: Start a signal in a termination.}
	}
	{proto: RvBool rvMdmTermStartSignal_(RvMdmTerm* term,RvMdmSignal * s,OUT RvMdmError* mdmError)}
	{params:
		{param: {n:term} {d:The termination.}}
		{param: {n:s} {d:The signal.}}
		{param: {n:mdmError} {d:(Optional) Use to set error information.}}
	}
	{returns: 
		Return "rvFalse" if it fails. In this case mdmError can be set. If is not set, a default error value will be assigned.
	}
}
$*/
RvBool rvMdmTermStartSignal_(RvMdmTerm* term,RvMdmSignal * s,OUT RvMdmError* mdmError) {
	return term->termClass->startSignalF(term,s,mdmError);
}

/*$
{protected_function:
	{name: rvMdmTermStopSignal_}
	{class: RvMdmTerm}
	{include: rvmdm.h}
	{description:
		{p: Stop a signal in a termination.}
	}
	{proto: RvBool rvMdmTermStopSignal_(RvMdmTerm* term,RvMdmSignal * s,OUT RvMdmError* mdmError);}
	{params:
		{param: {n:term} {d:The termination.}}
		{param: {n:s} {d:The signal.}}
		{param: {n:mdmError} {d:(Optional) Use to set error information.}}
	}
	{returns: 
		Return "rvFalse" if it fails. In this case mdmError can be set. If is not set, a default error value will be assigned.
	}
}
$*/
RvBool rvMdmTermStopSignal_(RvMdmTerm* term,RvMdmSignal * s,OUT RvMdmError* mdmError) {
	return term->termClass->stopSignalF(term,s,mdmError);
}

/*$
{protected_function:
	{name: rvMdmTermPlaySignal_}
	{class: RvMdmTerm}
	{include: rvmdm.h}
	{description:
		{p: Start a signal in a termination.}
	}
	{proto: RvBool rvMdmTermPlaySignal_(RvMdmTerm* term,RvMdmSignal * s,RvBool reportCompletion,OUT RvMdmError* mdmError)}
	{params:
		{param: {n:term} {d:The termination.}}
		{param: {n:s} {d:The signal.}}
		{param: {n:reportCompletion} 
			{d:If rvTrue, the application must call rvMdmTermSignalCompleted when the signal ends. 
			   Can be set only for signal of type RV_MEGACOSIGNAL_BRIEF. }}
		{param: {n:mdmError} {d:(Optional) Use to set error information.}}
	}
	{returns: 
		Return "rvFalse" if it fails. In this case mdmError can be set. If is not set, a default error value will be assigned.
	}
}
$*/
RvBool rvMdmTermPlaySignal_(RvMdmTerm* term,RvMdmSignal * s,RvBool reportCompletion,OUT RvMdmError* mdmError) {
	return term->termClass->playSignalF(term,s,reportCompletion,mdmError);	
}

/*$
{protected_function:
	{name: rvMdmTermSetRequestedMedia_}
	{class: RvMdmTerm}
	{include: rvmdm.h}
	{description:
		{p: Set the requested media information.}
	}
	{proto: void rvMdmTermSetRequestedMedia_(RvMdmTerm* term,const RvMegacoMediaDescriptor *  media);}
	{params:
		{param: {n:term} {d:The termination.}}
		{param: {n:media} {d:The media descriptor.}}
	}
	{notes:
		{note: 
			Call to set this field before calling the SelectTermination callback.
		}
	}
}
$*/
void rvMdmTermSetRequestedMedia_(RvMdmTerm* term,const RvMegacoMediaDescriptor *  media) {
	term->requestedMedia = media;
}


RvBool rvMdmTermClassIsPkgSupported_(RvMdmTermClass* termClass,const char* pkg) {
	size_t i;
	RvMegacoPackagesDescriptor* pkgs = &termClass->pkgsCaps;

	i = rvMegacoPackagesDescriptorGetNumPackages(pkgs);
	for(i=0;i<rvMegacoPackagesDescriptorGetNumPackages(pkgs);i++) {
		if(!rvStrIcmp(rvMegacoPackagesDescriptorGetPackageName(pkgs,i),pkg) )
			return rvTrue;
	}
	return rvFalse;
}

RvBool rvMdmTermIsPkgSupported_(RvMdmTerm* term,const char* pkg) {
	return rvMdmTermClassIsPkgSupported_(term->termClass,pkg);
}

RvMegacoPackagesDescriptor* rvMdmTermGetPackages_(RvMdmTerm* term) {
	return &term->termClass->pkgsCaps;
}

RvMegacoMediaDescriptor* rvMdmTermGetMediaCapabilites_(RvMdmTerm* term) {
	return &term->termClass->mediaCaps;
}

void rvMdmTermAddToContext_(RvMdmTerm* x,RvMdmContext* context) {
	x->termClass->addToContextF(x,context);
}

void rvMdmTermRemoveFromContext_(RvMdmTerm* x,RvMdmContext* context) {
	x->termClass->removeFromContextF(x,context);
}

void rvMdmTermMoveFromContext_(RvMdmTerm* x,RvMdmContext* context) {
	x->termClass->moveFromContextF(x,context);
}

void rvMdmTermClearDetectedEvents_(RvMdmTerm* x) {
	x->termClass->clearDetectEventF(x);
}

/*------------------------------------------------------------------------------*/
/* RvMdmTermMgr methods			                                                */
/*------------------------------------------------------------------------------*/
static RvBool defaultTermMgrConnect(RvMdmTermMgr* mgr,RvMdmTerm* source,RvMdmMediaStream* m1,RvMdmTerm* target,RvMdmMediaStream* m2,RvMdmStreamDirection direction,OUT RvMdmError* mdmError) {
	return rvFalse;
}
static RvBool defaultTermMgrDisconnect(RvMdmTermMgr* mgr,RvMdmTerm* source,RvMdmMediaStream* m1,RvMdmTerm* target,RvMdmMediaStream* m2,
										OUT RvMdmError* mdmError) {
	return rvFalse;
}

/*$
{protected_function:
	{name: rvMdmTermMgrConstruct_}
	{class: RvMdmTermMgr}
	{include: rvmdm.h}
	{description:
		{p: Common constructor for the termination manager.}
	}
	{proto: void rvMdmTermMgrConstruct_(RvMdmTermMgr* mgr,RvAlloc * a);}
	{params:
		{param: {n:term} {d:A pointer to termination manager object.}}
		{param: {n:a} {d:Allocator.}}
	}

}
$*/

static void defaultContextCreated(RvMdmTermMgr* mgr,RvMdmContext* context) {
	return;
}
static void defaultContextDeleted(RvMdmTermMgr* mgr,RvMdmContext* context) {
	return;
}

/*
{function:
	{name: rvMdmRegisterEvent}
	{class: RvMdmTermMgr}
	{include: rvmdm.h}
	{description:
		{p: Register event.}
	}
	{proto: static void rvMdmRegisterEvent(RvMdmPackage* pkg,const char* id);}
	{params:
		{param: {n:pkg} {d:A pointer to package class object.}}
		{param: {n:id} {d:A pointer to event name string.}}
	}
}
*/
static void rvMdmRegisterEvent(RvMdmPackage* pkg,const char* id) {
	RvMdmEventData event;

	rvMdmEventDataConstruct(&event,id);
	rvMdmPackageRegisterEvent(pkg,&event);
	rvMdmEventDataDestruct(&event);
}

/*
{function:
	{name: rvMdmRegisterSignal}
	{class: RvMdmTermMgr}
	{include: rvmdm.h}
	{description:
		{p: Register signal.}
	}
	{proto: static void rvMdmRegisterSignal(RvMdmPackage* pkg,const char* id,int timeout);}
	{params:
		{param: {n:pkg} {d:A pointer to package class object.}}
		{param: {n:id} {d:A pointer to event name string.}}
		{param: {n:timeout} {d:The signal timeout.}}
	}
}
*/
static void rvMdmRegisterSignal(RvMdmPackage* pkg,const char* id,int timeout) {
	RvMdmSignalData signal;
	RvMegacoSignalType type = RV_MEGACOSIGNAL_ONOFF;

	if(timeout>0)
		type = RV_MEGACOSIGNAL_TIMEOUT;
	else if (timeout<0)
		type = RV_MEGACOSIGNAL_BRIEF;


	/* Register the events*/
	rvMdmSignalDataConstruct(&signal,id,type);
	if(timeout>0)
		rvMdmSignalDataSetTimeout(&signal,timeout);
	rvMdmPackageRegisterSignal(pkg,&signal);
	rvMdmSignalDataDestruct(&signal);
}

/*
{function:
	{name: rvMdmRegisterPackages}
	{class: RvMdmTermMgr}
	{include: rvmdm.h}
	{description:
		{p: Register default packages.}
	}
	{proto: static void rvMdmRegisterPackages(RvMdmTermMgr* mgr);}
	{params:
		{param: {n:mgr} {d:A pointer to termination manager class object.}}
	}
}
*/
static void rvMdmRegisterPackages(RvMdmTermMgr* mgr) {
	RvMdmPackage* pkg;
	RvMdmDigitMapData dmData;
	RvMegacoParameterValue param;

	
	/* Register package al */
	/*---------------------*/
	pkg = rvMdmTermMgrCreatePackage(mgr,"al");

⌨️ 快捷键说明

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