📄 cmchanoperations.c
字号:
return res;
}
RVAPI int RVCALLCONV
cmChannelTSTOIndication(
/* Send temporal spatial trade off indication. Indicates the current tradeoff value
of the local terminal. */
IN HCHAN hsChan, /* outgoing channel */
IN int tradeoffValue /* 0-31 */
)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan);
H245Channel*channel=(H245Channel*)hsChan;
int message, nodeId, res = RV_ERROR_UNKNOWN;
cmElem*app=(cmElem*)hApp;
if (!hsChan || tradeoffValue<0 || tradeoffValue>31) return RV_ERROR_UNKNOWN;
if (!hApp) return RV_ERROR_UNKNOWN;
cmiAPIEnter((HAPP)app, "cmChannelTSTOIndication: hsChan=0x%p, tradeoff=%d.", hsChan, tradeoffValue);
if (emaLock((EMAElement)hsChan))
{
HPVT hVal = app->hVal;
message=pvtAddRoot(hVal,app->synProtH245,0,NULL);
nodeId=pvtAddBranch2(hVal,message, __h245(indication),__h245(miscellaneousIndication));
pvtAdd(hVal,nodeId,__h245(logicalChannelNumber),channel->myLogicalChannelNum,NULL,NULL);
pvtAdd(hVal,pvtAddBranch(hVal,nodeId,__h245(type)),__h245(videoTemporalSpatialTradeOff),tradeoffValue,NULL,NULL);
res = sendMessageH245(channel->hCtrl, message);
pvtDelete(hVal,message);
emaUnlock((EMAElement)hsChan);
}
cmiAPIExit((HAPP)app, "cmChannelTSTOIndication=%d");
return res;
}
/* Media Loop_____________________________________________________________________________*/
RVAPI int RVCALLCONV
cmChannelMediaLoopRequest(
/* Request media loop on this channel */
IN HCHAN hsChan /* outgoing channel */
)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan);
H245Channel*channel=(H245Channel*)hsChan;
int message, nodeId;
int ret = RV_ERROR_UNKNOWN;
cmElem*app=(cmElem*)hApp;
if (!hsChan || !hApp) return RV_ERROR_UNKNOWN;
cmiAPIEnter((HAPP)app, "cmChannelMediaLoopRequest: hsChan=0x%p.", hsChan);
if (emaLock((EMAElement)hsChan))
{
if (channel->bOrigin)
{
HPVT hVal = app->hVal;
message=pvtAddRoot(hVal,app->synProtH245,0,NULL);
__pvtBuildByFieldIds(nodeId,hVal,message, {_h245(request) _h245(maintenanceLoopRequest) _h245(type) _h245(mediaLoop) LAST_TOKEN},
channel->myLogicalChannelNum,NULL);
ret = sendMessageH245(channel->hCtrl, message);
pvtDelete(hVal,message);
if (ret >= 0)
{
int timeout=10;
pvtGetChildValue(app->hVal,app->h245Conf,__h245(mediaLoopTimeout),&(timeout),NULL);
RvH323TimerCancel(cmGetTimersHandle(hApp),&channel->pMediaLoopTimer);
channel->pMediaLoopTimer=RvH323TimerStart(cmGetTimersHandle(hApp),channelML_TimeoutEventsHandler,(void*)channel,timeout*1000);
}
}
else
{
/* This operation is valid only for outgoing channels */
ret = RV_ERROR_BADPARAM;
}
emaUnlock((EMAElement)hsChan);
}
cmiAPIExit((HAPP)app, "cmChannelMediaLoopRequest: [%d].", ret);
return ret;
}
RVAPI int RVCALLCONV
cmChannelMediaLoopConfirm(
/* Confirm media loop request on this channel */
IN HCHAN hsChan /* incoming channel */
)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan);
H245Channel*channel=(H245Channel*)hsChan;
int message, nodeId, res = RV_ERROR_UNKNOWN;
cmElem*app=(cmElem*)hApp;
int nesting;
if (!hsChan || !hApp) return RV_ERROR_UNKNOWN;
cmiAPIEnter((HAPP)app, "cmChannelMediaLoopConfirm: hsChan=0x%p.", hsChan);
if (emaLock((EMAElement)hsChan))
{
HPVT hVal = app->hVal;
if (app->cmMyChannelEvent.cmEvChannelMediaLoopStatus)
{
cmiCBEnter((HAPP)app, "cmEvChannelMediaLoopStatus: haChan=0x%p, hsChan=0x%p, status=confirm.",(HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), channel);
nesting = emaPrepareForCallback((EMAElement)channel);
app->cmMyChannelEvent.cmEvChannelMediaLoopStatus((HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), (HCHAN)channel, cmMediaLoopConfirm);
emaReturnFromCallback((EMAElement)channel, nesting);
cmiCBExit((HAPP)app, "cmEvChannelMediaLoopStatus.");
}
if (!emaWasDeleted((EMAElement)channel))
{
message=pvtAddRoot(hVal,app->synProtH245,0,NULL);
__pvtBuildByFieldIds(nodeId,hVal,message, {_h245(response) _h245(maintenanceLoopAck) _h245(type) _h245(mediaLoop) LAST_TOKEN},
channel->myLogicalChannelNum,NULL);
res = sendMessageH245(channel->hCtrl, message);
pvtDelete(hVal,message);
}
emaUnlock((EMAElement)hsChan);
}
cmiAPIExit((HAPP)app, "cmChannelMediaLoopConfirm=%d", res);
return res;
}
RVAPI int RVCALLCONV
cmChannelMediaLoopReject(
/* Reject media loop request on this channel */
IN HCHAN hsChan /* incoming channel */
)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan);
H245Channel*channel=(H245Channel*)hsChan;
int message, nodeId, res = RV_ERROR_UNKNOWN;
cmElem*app=(cmElem*)hApp;
int nesting;
if (!hsChan || !hApp) return RV_ERROR_UNKNOWN;
cmiAPIEnter((HAPP)app, "cmChannelMediaLoopReject: hsChan=0x%p.", hsChan);
if (emaLock((EMAElement)hsChan))
{
HPVT hVal = app->hVal;
message=pvtAddRoot(hVal,app->synProtH245,0,NULL);
nodeId=pvtAddBranch2(hVal,message, __h245(response), __h245(maintenanceLoopReject));
pvtAdd(hVal,pvtAddBranch(hVal,nodeId,__h245(type)), __h245(mediaLoop),channel->myLogicalChannelNum,NULL,NULL);
pvtAddBranch2(hVal,nodeId,__h245(cause), __h245(canNotPerformLoop));
res = sendMessageH245(channel->hCtrl, message);
pvtDelete(hVal,message);
if (res >= 0)
{
cmiCBEnter((HAPP)app, "cmEvChannelMediaLoopStatus: haChan=0x%p, hsChan=0x%p, status=confirm.",(HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), channel);
nesting = emaPrepareForCallback((EMAElement)channel);
ifE(app->cmMyChannelEvent.cmEvChannelMediaLoopStatus)((HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), (HCHAN)channel, cmMediaLoopOff);
emaReturnFromCallback((EMAElement)channel, nesting);
cmiCBExit((HAPP)app, "cmEvChannelMediaLoopStatus.");
}
emaUnlock((EMAElement)hsChan);
}
cmiAPIExit((HAPP)app, "cmChannelMediaLoopReject=%d");
return res;
}
RVAPI int RVCALLCONV
cmCallMediaLoopOff(
/* Release all media loops in this call */
IN HCALL hsCall
)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsCall);
HCONTROL ctrl=cmiGetControl(hsCall);
int message, nodeId, res = RV_ERROR_UNKNOWN;
cmElem*app=(cmElem*)hApp;
H245Channel*channel;
void* ptr=NULL;
int nesting;
if (!hsCall || !hApp) return RV_ERROR_UNKNOWN;
cmiAPIEnter((HAPP)app, "cmCallMediaLoopOff: hsCall=0x%p.", hsCall);
if (emaLock((EMAElement)hsCall))
{
HPVT hVal = app->hVal;
message=pvtAddRoot(hVal,app->synProtH245,0,NULL);
nodeId=pvtAddBranch2(hVal,message, __h245(command), __h245(maintenanceLoopOffCommand));
res = sendMessageH245(ctrl, message);
pvtDelete(hVal,message);
if (res >= 0)
{
while((channel=getNextOutChan(ctrl, &ptr)))
{
cmiCBEnter((HAPP)app, "cmEvChannelMediaLoopStatus: haChan=0x%p, hsChan=0x%p, status=confirm.",(HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), channel);
nesting = emaPrepareForCallback((EMAElement)channel);
ifE(app->cmMyChannelEvent.cmEvChannelMediaLoopStatus)((HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), (HCHAN)channel, cmMediaLoopOff);
emaReturnFromCallback((EMAElement)channel, nesting);
cmiCBExit((HAPP)app, "cmEvChannelMediaLoopStatus.");
}
}
emaUnlock((EMAElement)hsCall);
}
cmiAPIExit((HAPP)app, "cmCallMediaLoopOff=%d", res);
return res;
}
RVAPI int RVCALLCONV
cmChannelSendMiscCommand(
IN HCHAN hsChan,
IN cmMiscellaneousCommand miscCommand)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan);
H245Channel*channel=(H245Channel*)hsChan;
int message, nodeId, res = RV_ERROR_UNKNOWN;
cmElem*app=(cmElem*)hApp;
int fieldId;
if (!hsChan || !hApp) return RV_ERROR_UNKNOWN;
cmiAPIEnter((HAPP)app, "cmChannelSendMiscCommand: hsChan=0x%p. command %d", hsChan,miscCommand);
if (emaLock((EMAElement)hsChan))
{
HPVT hVal = app->hVal;
switch(miscCommand)
{
case cmVideoFreezePicture: fieldId=__h245(videoFreezePicture); break;
case cmVideoSendSyncEveryGOB: fieldId=__h245(videoSendSyncEveryGOB); break;
case cmVideoSendSyncEveryGOBCancel: fieldId=__h245(videoSendSyncEveryGOBCancel);break;
case cmSwitchReceiveMediaOff: fieldId=__h245(switchReceiveMediaOff); break;
case cmSwitchReceiveMediaOn: fieldId=__h245(switchReceiveMediaOn); break;
case cmVideoFastUpdatePicture: fieldId=__h245(videoFastUpdatePicture); break;
default :
emaUnlock((EMAElement)hsChan);
cmiAPIExit((HAPP)app, "cmChannelSendMiscCommand: [Invalid Parameter]");
return RV_ERROR_UNKNOWN;
}
message=pvtAddRoot(hVal,app->synProtH245,0,NULL);
nodeId=pvtAddBranch2(hVal,message, __h245(command),__h245(miscellaneousCommand));
pvtAdd(hVal,nodeId,__h245(logicalChannelNumber),channel->myLogicalChannelNum,NULL,NULL);
pvtAddBranch2(hVal,nodeId,__h245(type),fieldId);
res = sendMessageH245(channel->hCtrl, message);
pvtDelete(hVal,message);
emaUnlock((EMAElement)hsChan);
}
cmiAPIExit((HAPP)app, "cmChannelSendMiscCommand=%d");
return res;
}
RVAPI int RVCALLCONV
cmChannelSendTransportCapInd(
IN HCHAN hsChan,
IN int transCapNodeId)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan);
H245Channel*channel=(H245Channel*)hsChan;
int message, nodeId, res = RV_ERROR_UNKNOWN;
cmElem*app=(cmElem*)hApp;
if (!hsChan || !hApp) return RV_ERROR_UNKNOWN;
cmiAPIEnter((HAPP)app, "cmChannelSendTransportCapInd: hsChan=0x%p Capability nodeId %d.", hsChan,transCapNodeId);
if (emaLock((EMAElement)hsChan))
{
HPVT hVal = app->hVal;
message=pvtAddRoot(hVal,app->synProtH245,0,NULL);
nodeId=pvtAddBranch2(hVal,message, __h245(indication),__h245(miscellaneousIndication));
pvtAdd(hVal,nodeId,__h245(logicalChannelNumber),channel->myLogicalChannelNum,NULL,NULL);
pvtMoveTree(app->hVal,pvtAddBranch2(hVal,nodeId,__h245(type),__h245(transportCapability)),transCapNodeId);
res = sendMessageH245(channel->hCtrl, message);
pvtDelete(hVal,message);
emaUnlock((EMAElement)hsChan);
}
cmiAPIExit((HAPP)app, "cmChannelSendTransportCapInd=%d", res);
return res;
}
#ifdef __cplusplus
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -