📄 cmchanoperations.c
字号:
cmElem* app=(cmElem*)emaGetInstance((EMAElement)cmiGetByControl((HCONTROL)ctrl));
H245Channel* channel=NULL;
int nesting;
if (!app) return RV_ERROR_UNKNOWN;
if (app->cmMyChannelEvent.cmEvChannelTransportCapInd != NULL)
{
hVal=app->hVal;
channel=getInChanByLCN((HCONTROL)ctrl,lcn);
if (emaLock((EMAElement)channel))
{
cmiCBEnter((HAPP)app, "cmEvChannelTransportCapInd: haChan=0x%p, hsChan=0x%p, (indication), nodeId=%d",
emaGetApplicationHandle((EMAElement)channel), channel, message);
nesting = emaPrepareForCallback((EMAElement)channel);
app->cmMyChannelEvent.cmEvChannelTransportCapInd(
(HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), (HCHAN)channel, message);
emaReturnFromCallback((EMAElement)channel, nesting);
cmiCBExit((HAPP)app, "cmEvChannelTransportCapInd.");
emaUnlock((EMAElement)channel);
}
}
return RV_TRUE;
}
RVAPI int RVCALLCONV
cmChannelOn(
IN HCHAN hsChan)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan);
H245Channel*channel=(H245Channel*)hsChan;
int message,nodeId;
cmElem*app=(cmElem*)hApp;
int ret = RV_ERROR_UNKNOWN;
if (!hApp)
return RV_ERROR_UNKNOWN;
cmiAPIEnter((HAPP)app, "cmChannelOn: hsChan=0x%p.", hsChan);
if (emaLock((EMAElement)hsChan))
{
if (channel->bOrigin)
{
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);
pvtAddBranch2(hVal,nodeId,__h245(type),__h245(logicalChannelActive));
ret = sendMessageH245(channel->hCtrl, message);
pvtDelete(hVal,message);
}
else
ret = RV_ERROR_UNKNOWN;
emaUnlock((EMAElement)hsChan);
}
cmiAPIExit((HAPP)app, "cmChannelOn: [%d].", ret);
return ret;
}
RVAPI int RVCALLCONV
cmChannelOff(
IN HCHAN hsChan)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan);
H245Channel*channel=(H245Channel*)hsChan;
int message,nodeId;
cmElem*app=(cmElem*)hApp;
int ret = RV_ERROR_UNKNOWN;
if (!hApp)
return RV_ERROR_UNKNOWN;
cmiAPIEnter((HAPP)app, "cmChannelOff: hsChan=0x%p.", hsChan);
if (emaLock((EMAElement)hsChan))
{
if (channel->bOrigin)
{
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);
pvtAddBranch2(hVal,nodeId,__h245(type),__h245(logicalChannelInactive));
ret = sendMessageH245(channel->hCtrl, message);
pvtDelete(hVal,message);
}
else
ret = RV_ERROR_UNKNOWN;
emaUnlock((EMAElement)hsChan);
}
cmiAPIExit((HAPP)app, "cmChannelOff: [%d].", ret);
return ret;
}
RVAPI int RVCALLCONV
cmChannelFlowControl(
IN HCHAN hsChan,
IN RvUint32 rate)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan);
H245Channel*channel=(H245Channel*)hsChan;
int message, nodeId, res = RV_ERROR_UNKNOWN;
cmElem*app=(cmElem*)hApp;
if (!hApp) return RV_ERROR_UNKNOWN;
cmiAPIEnter((HAPP)app, "cmChannelFlowControl: hsChan=0x%p, rate=%d.", hsChan, rate);
if (emaLock((EMAElement)hsChan))
{
HPVT hVal = app->hVal;
if (channel->bOrigin && !channel->bIsDuplex)
{
emaUnlock((EMAElement)hsChan);
cmiAPIExit((HAPP)app, "cmChannelFlowControl: [Invalid circumstances].");
return RV_ERROR_UNKNOWN;
}
message=pvtAddRoot(hVal,app->synProtH245,0,NULL);
nodeId=pvtAddBranch2(hVal,message, __h245(command),__h245(flowControlCommand));
pvtAdd(hVal,pvtAddBranch(hVal,nodeId,__h245(restriction)),__h245(maximumBitRate),(RvInt32)rate,NULL,NULL);
pvtAdd(hVal,pvtAddBranch(hVal,nodeId,__h245(scope)),__h245(logicalChannelNumber), (channel->bOrigin)?channel->reverseLogicalChannelNum:channel->myLogicalChannelNum,NULL,NULL);
res = sendMessageH245(channel->hCtrl, message);
pvtDelete(hVal,message);
emaUnlock((EMAElement)hsChan);
}
cmiAPIExit((HAPP)app, "cmChannelFlowControl=%d", res);
return res;
}
RVAPI int RVCALLCONV
cmChannelVideoFastUpdatePicture(
IN HCHAN hsChan)
{
return cmChannelSendMiscCommand(hsChan,cmVideoFastUpdatePicture);
}
RVAPI int RVCALLCONV
cmChannelVideoFastUpdateGOB(
IN HCHAN hsChan,
IN int firstGOB,
IN int numberOfGOBs)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan);
H245Channel*channel=(H245Channel*)hsChan;
int message, nodeId, id, res = RV_ERROR_UNKNOWN;
cmElem*app=(cmElem*)hApp;
if (!hApp) return RV_ERROR_UNKNOWN;
cmiAPIEnter((HAPP)app, "cmChannelVideoFastUpdateGOB: hsChan=0x%p, firstGOB=%d, numberOfGOBs=%d.",hsChan, firstGOB, numberOfGOBs);
if (emaLock((EMAElement)hsChan))
{
HPVT hVal = app->hVal;
message=pvtAddRoot(hVal,app->synProtH245,0,NULL);
nodeId=pvtAddBranch2(hVal,message, __h245(command),__h245(miscellaneousCommand));
pvtAdd(hVal,nodeId,__h245(logicalChannelNumber),channel->myLogicalChannelNum,NULL,NULL);
id=pvtAddBranch2(hVal,nodeId,__h245(type),__h245(videoFastUpdateGOB));
pvtAdd(app->hVal, id, __h245(firstGOB), firstGOB, NULL, NULL);
pvtAdd(app->hVal, id, __h245(numberOfGOBs), numberOfGOBs, NULL, NULL);
res = sendMessageH245(channel->hCtrl, message);
pvtDelete(hVal,message);
emaUnlock((EMAElement)hsChan);
}
cmiAPIExit((HAPP)app, "cmChannelVideoFastUpdateGOB=%d", res);
return res;
}
RVAPI int RVCALLCONV
cmChannelVideoFastUpdateMB(
IN HCHAN hsChan,
IN int firstGOB,
IN int firstMB,
IN int numberOfMBs)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan);
H245Channel*channel=(H245Channel*)hsChan;
int message, nodeId, id, res = RV_ERROR_UNKNOWN;
cmElem*app=(cmElem*)hApp;
if (!hApp) return RV_ERROR_UNKNOWN;
cmiAPIEnter(hApp, "cmChannelVideoFastUpdateMB: hsChan=0x%p, firstGOB=%d, firstMB=%d, numberOfMBs=%d.",
hsChan, firstGOB, firstMB, numberOfMBs);
if (emaLock((EMAElement)hsChan))
{
HPVT hVal = app->hVal;
message=pvtAddRoot(hVal,app->synProtH245,0,NULL);
nodeId=pvtAddBranch2(hVal,message, __h245(command),__h245(miscellaneousCommand));
pvtAdd(hVal,nodeId,__h245(logicalChannelNumber),channel->myLogicalChannelNum,NULL,NULL);
id=pvtAddBranch2(hVal,nodeId,__h245(type),__h245(videoFastUpdateMB));
pvtAdd(app->hVal, id, __h245(firstGOB), firstGOB, NULL, NULL);
pvtAdd(app->hVal, id, __h245(firstMB), firstMB, NULL, NULL);
pvtAdd(app->hVal, id, __h245(numberOfMBs), numberOfMBs, NULL, NULL);
res = sendMessageH245(channel->hCtrl, message);
pvtDelete(hVal,message);
emaUnlock((EMAElement)hsChan);
}
cmiAPIExit((HAPP)app, "cmChannelVideoFastUpdateMB=%d", res);
return res;
}
RVAPI int RVCALLCONV
cmChannelMaxSkew(
IN HCHAN hsChan1,
IN HCHAN hsChan2,
IN RvUint32 skew)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan1);
H245Channel* channel1=(H245Channel*)hsChan1;
H245Channel* channel2=(H245Channel*)hsChan2;
int message, nodeId, res = RV_ERROR_UNKNOWN;
cmElem*app=(cmElem*)hApp;
if (!hApp) return RV_ERROR_UNKNOWN;
cmiAPIEnter((HAPP)app, "cmChannelMaxSkew: hsChan1=0x%p, hsChan2=0x%p, skew=%d.", hsChan1, hsChan2, skew);
if (emaLock((EMAElement)hsChan1))
{
if (emaLock((EMAElement)hsChan2))
{
HPVT hVal = app->hVal;
if (!channel1->bOrigin || !channel2->bOrigin)
{
emaUnlock((EMAElement)hsChan2);
emaUnlock((EMAElement)hsChan1);
cmiAPIExit((HAPP)app, "cmChannelMaxSkew: [Invalid Circumstances].");
return RV_ERROR_UNKNOWN;
}
message=pvtAddRoot(hVal,app->synProtH245,0,NULL);
nodeId=pvtAddBranch2(hVal,message, __h245(indication),__h245(h2250MaximumSkewIndication));
pvtAdd(hVal,nodeId,__h245(logicalChannelNumber1),channel1->myLogicalChannelNum,NULL,NULL);
pvtAdd(hVal,nodeId,__h245(logicalChannelNumber2),channel2->myLogicalChannelNum,NULL,NULL);
pvtAdd(hVal,nodeId,__h245(maximumSkew),(RvInt32)skew,NULL,NULL);
res = sendMessageH245(channel1->hCtrl, message);
pvtDelete(hVal,message);
emaUnlock((EMAElement)hsChan2);
}
emaUnlock((EMAElement)hsChan1);
}
cmiAPIExit((HAPP)app, "cmChannelMaxSkew=%d", res);
return res;
}
/* temporal spatial trade off__________________________________________________________*/
RVAPI int RVCALLCONV
cmChannelTSTOCommand(
/* Send temporal spatial trade off command. Request the remote terminal to change
the tradeoff. */
IN HCHAN hsChan, /* incoming 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;
/* Maybe I need to check the remote terminal capabilities? */
cmiAPIEnter((HAPP)app, "cmChannelTSTOCommand: 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(command),__h245(miscellaneousCommand));
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, "cmChannelTSTOCommand=%d", res);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -