cmchanoperations.c
来自「基于h323协议的软phone」· C语言 代码 · 共 1,259 行 · 第 1/4 页
C
1,259 行
/***********************************************************************
Copyright (c) 2002 RADVISION Ltd.
************************************************************************
NOTICE:
This document contains information that is confidential and proprietary
to RADVISION Ltd.. No part of this document may be reproduced in any
form whatsoever without written prior approval by RADVISION Ltd..
RADVISION Ltd. reserve the right to revise this publication and make
changes without obligation to notify any person of such revisions or
changes.
***********************************************************************/
#include "rvinternal.h"
#include "rvh323timer.h"
#include "cmictrl.h"
#include "cmintr.h"
#include "cmConf.h"
#include "caputils.h"
#include "cmchan.h"
#include "h245.h"
#include "cmutils.h"
#include "cmChanGetByXXX.h"
#include "transpcap.h"
#include "cmdebprn.h"
#include "cmCrossReference.h"
#ifdef __cplusplus
extern "C" {
#endif
RvBool channelML_TimeoutEventsHandler(IN void* hsChan)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsChan);
H245Channel*channel=(H245Channel*)hsChan;
int message;
cmElem*app=(cmElem*)hApp;
int nesting;
if (!hApp)
return RV_FALSE;
if (emaLock((EMAElement)hsChan))
{
HPVT hVal = ((cmElem *)hApp)->hVal;
RvH323TimerClear(cmGetTimersHandle(hApp), &channel->pMediaLoopTimer);
message=pvtAddRoot(hVal,app->synProtH245,0,NULL);
pvtAddBranch2(hVal,message, __h245(command),__h245(maintenanceLoopOffCommand));
sendMessageH245(channel->hCtrl, message);
pvtDelete(hVal,message);
cmiCBEnter((HAPP)app, "cmEvChannelMediaLoopStatus: haChan=0x%p, hsChan=0x%p, status=reject.",(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);
}
return RV_FALSE;
}
int flowControlCommand(H245Control*ctrl, int message)
{
RvInt32 lcn;
HPVT hVal;
cmElem* app=(cmElem*)emaGetInstance((EMAElement)cmiGetByControl((HCONTROL)ctrl));
H245Channel* channel=NULL;
RvInt32 rate;
int nesting;
if (!app) return RV_ERROR_UNKNOWN;
if (app->cmMyChannelEvent.cmEvChannelNewRate != NULL)
{
hVal=app->hVal;
pvtGetChildValue2(hVal,message,__h245(scope),__h245(logicalChannelNumber),&lcn,NULL);
channel=getOutSubChanByLCN((HCONTROL)ctrl,lcn);
if (emaLock((EMAElement)channel))
{
pvtGetChildValue2(hVal,message,__h245(restriction),__h245(maximumBitRate),&rate,NULL);
cmiCBEnter((HAPP)app, "cmEvChannelNewRate: haCall=0x%p, hsCall=0x%p, rate=%d.", emaGetApplicationHandle((EMAElement)channel), channel, rate);
nesting = emaPrepareForCallback((EMAElement)channel);
app->cmMyChannelEvent.cmEvChannelNewRate(
(HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), (HCHAN)channel, (RvUint32)rate);
emaReturnFromCallback((EMAElement)channel, nesting);
cmiCBExit((HAPP)app, "cmEvChannelNewRate.");
emaUnlock((EMAElement)channel);
}
}
return RV_TRUE;
}
int maintenanceLoopRequest(H245Control *ctrl, int message)
{
RvInt32 lcn;
HPVT hVal;
cmElem* app=(cmElem*)emaGetInstance((EMAElement)cmiGetByControl((HCONTROL)ctrl));
H245Channel* channel=NULL;
int nesting;
if (!app) return RV_ERROR_UNKNOWN;
if (app->cmMyChannelEvent.cmEvChannelMediaLoopStatus != NULL)
{
hVal=app->hVal;
pvtGetChildValue2(hVal,message,__h245(type),__h245(mediaLoop),&lcn,NULL);
channel=getInChanByLCN((HCONTROL)ctrl,lcn);
if (emaLock((EMAElement)channel))
{
cmiCBEnter((HAPP)app, "cmEvChannelMediaLoopStatus: haChan=0x%p, hsChan=0x%p, status=request.",(HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), channel);
nesting = emaPrepareForCallback((EMAElement)channel);
app->cmMyChannelEvent.cmEvChannelMediaLoopStatus(
(HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), (HCHAN)channel, cmMediaLoopRequest);
emaReturnFromCallback((EMAElement)channel, nesting);
cmiCBExit((HAPP)app, "cmEvChannelMediaLoopStatus.");
emaUnlock((EMAElement)channel);
}
}
return RV_TRUE;
}
int maintenanceLoopAck(H245Control *ctrl, int message)
{
RvInt32 lcn;
HPVT hVal;
cmElem* app=(cmElem*)emaGetInstance((EMAElement)cmiGetByControl((HCONTROL)ctrl));
H245Channel* channel=NULL;
int nesting;
if (!app) return RV_ERROR_UNKNOWN;
hVal=app->hVal;
pvtGetChildValue2(hVal,message,__h245(type),__h245(mediaLoop),&lcn,NULL);
channel=getOutChanByLCN((HCONTROL)ctrl,lcn);
if (emaLock((EMAElement)channel))
{
RvH323TimerCancel(cmGetTimersHandle((HAPP)app), &channel->pMediaLoopTimer);
if (app->cmMyChannelEvent.cmEvChannelMediaLoopStatus != NULL)
{
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.");
}
emaUnlock((EMAElement)channel);
}
return RV_TRUE;
}
int maintenanceLoopReject(H245Control*ctrl, int message)
{
RvInt32 lcn;
HPVT hVal;
cmElem* app=(cmElem*)emaGetInstance((EMAElement)cmiGetByControl((HCONTROL)ctrl));
H245Channel* channel=NULL;
int nesting;
if (!app) return RV_ERROR_UNKNOWN;
hVal=app->hVal;
pvtGetChildValue2(hVal,message,__h245(type),__h245(mediaLoop),&lcn,NULL);
channel=getOutChanByLCN((HCONTROL)ctrl,lcn);
if (emaLock((EMAElement)channel))
{
RvH323TimerCancel(cmGetTimersHandle((HAPP)app), &channel->pMediaLoopTimer);
if (app->cmMyChannelEvent.cmEvChannelMediaLoopStatus != NULL)
{
cmiCBEnter((HAPP)app, "cmEvChannelMediaLoopStatus: haChan=0x%p, hsChan=0x%p, status=off.",(HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), channel);
nesting = emaPrepareForCallback((EMAElement)channel);
app->cmMyChannelEvent.cmEvChannelMediaLoopStatus(
(HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), (HCHAN)channel, cmMediaLoopOff);
emaReturnFromCallback((EMAElement)channel, nesting);
cmiCBExit((HAPP)app, "cmEvChannelMediaLoopStatus.");
}
emaUnlock((EMAElement)channel);
}
return RV_TRUE;
}
int maintenanceLoopOffCommand(H245Control*ctrl, int message)
{
cmElem* app=(cmElem*)emaGetInstance((EMAElement)cmiGetByControl((HCONTROL)ctrl));
void* ptr=NULL;
H245Channel* channel;
int nesting;
RV_UNUSED_ARG(message);
if (app->cmMyChannelEvent.cmEvChannelMediaLoopStatus != NULL)
{
while ((channel=getNextInChan((HCONTROL)ctrl,&ptr)))
{
if (emaLock((EMAElement)channel))
{
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, cmMediaLoopOff);
emaReturnFromCallback((EMAElement)channel, nesting);
cmiCBExit((HAPP)app, "cmEvChannelMediaLoopStatus.");
emaUnlock((EMAElement)channel);
}
}
}
return RV_TRUE;
}
int videoFreezePicture(H245Control* ctrl, int lcn)
{
cmElem* app=(cmElem*)emaGetInstance((EMAElement)cmiGetByControl((HCONTROL)ctrl));
H245Channel* channel=NULL;
HPVT hVal;
int nesting;
if (!app) return RV_ERROR_UNKNOWN;
if (app->cmMyChannelEvent.cmEvChannelMiscCommand != NULL)
{
hVal=app->hVal;
channel=getOutChanByLCN((HCONTROL)ctrl,lcn);
if (emaLock((EMAElement)channel))
{
cmiCBEnter((HAPP)app, "cmEvChannelMiscCommand: haChan=0x%p, hsChan=0x%p, type=%d", emaGetApplicationHandle((EMAElement)channel), channel, cmVideoFreezePicture);
nesting = emaPrepareForCallback((EMAElement)channel);
app->cmMyChannelEvent.cmEvChannelMiscCommand(
(HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), (HCHAN)channel, cmVideoFreezePicture);
emaReturnFromCallback((EMAElement)channel, nesting);
cmiCBExit((HAPP)app, "cmEvChannelMiscCommand.");
emaUnlock((EMAElement)channel);
}
}
return RV_TRUE;
}
int videoSendSyncEveryGOB(H245Control* ctrl, int lcn)
{
cmElem* app=(cmElem*)emaGetInstance((EMAElement)cmiGetByControl((HCONTROL)ctrl));
H245Channel* channel=NULL;
HPVT hVal;
int nesting;
if (!app) return RV_ERROR_UNKNOWN;
if (app->cmMyChannelEvent.cmEvChannelMiscCommand != NULL)
{
hVal=app->hVal;
channel=getOutChanByLCN((HCONTROL)ctrl,lcn);
if (emaLock((EMAElement)channel))
{
cmiCBEnter((HAPP)app, "cmEvChannelMiscCommand: haChan=0x%p, hsChan=0x%p, type=%d", emaGetApplicationHandle((EMAElement)channel), channel, cmVideoSendSyncEveryGOB);
nesting = emaPrepareForCallback((EMAElement)channel);
app->cmMyChannelEvent.cmEvChannelMiscCommand(
(HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), (HCHAN)channel, cmVideoSendSyncEveryGOB);
emaReturnFromCallback((EMAElement)channel, nesting);
cmiCBExit((HAPP)app, "cmEvChannelMiscCommand.");
emaUnlock((EMAElement)channel);
}
}
return RV_TRUE;
}
int videoSendSyncEveryGOBCancel(H245Control* ctrl, int lcn)
{
cmElem* app=(cmElem*)emaGetInstance((EMAElement)cmiGetByControl((HCONTROL)ctrl));
H245Channel* channel=NULL;
HPVT hVal;
int nesting;
if (!app) return RV_ERROR_UNKNOWN;
if (app->cmMyChannelEvent.cmEvChannelMiscCommand != NULL)
{
hVal=app->hVal;
channel=getOutChanByLCN((HCONTROL)ctrl,lcn);
if (emaLock((EMAElement)channel))
{
cmiCBEnter((HAPP)app, "cmEvChannelMiscCommand: haChan=0x%p, hsChan=0x%p, type=%d", emaGetApplicationHandle((EMAElement)channel), channel, cmVideoSendSyncEveryGOBCancel);
nesting = emaPrepareForCallback((EMAElement)channel);
app->cmMyChannelEvent.cmEvChannelMiscCommand(
(HAPPCHAN)emaGetApplicationHandle((EMAElement)channel), (HCHAN)channel, cmVideoSendSyncEveryGOBCancel);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?