本文整理汇总了C++中QTSSModule类的典型用法代码示例。如果您正苦于以下问题:C++ QTSSModule类的具体用法?C++ QTSSModule怎么用?C++ QTSSModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QTSSModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Assert
void QTSServerInterface::SetValueComplete(UInt32 inAttrIndex, QTSSDictionaryMap* inMap,
UInt32 inValueIndex, void* inNewValue, UInt32 inNewValueLen)
{
if (inAttrIndex == qtssSvrState)
{
Assert(inNewValueLen == sizeof(QTSS_ServerState));
//
// Invoke the server state change role
QTSS_RoleParams theParams;
theParams.stateChangeParams.inNewState = *(QTSS_ServerState*)inNewValue;
static QTSS_ModuleState sStateChangeState = { NULL, 0, NULL, false };
if (OSThread::GetCurrent() == NULL)
OSThread::SetMainThreadData(&sStateChangeState);
else
OSThread::GetCurrent()->SetThreadData(&sStateChangeState);
UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kStateChangeRole);
{
for (UInt32 theCurrentModule = 0; theCurrentModule < numModules; theCurrentModule++)
{
QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kStateChangeRole, theCurrentModule);
(void)theModule->CallDispatch(QTSS_StateChange_Role, &theParams);
}
}
//
// Make sure to clear out the thread data
if (OSThread::GetCurrent() == NULL)
OSThread::SetMainThreadData(NULL);
else
OSThread::GetCurrent()->SetThreadData(NULL);
}
}
示例2: DoInitRole
void QTSServer::DoInitRole()
{
QTSS_RoleParams theInitParams;
theInitParams.initParams.inServer = this;
theInitParams.initParams.inPrefs = fSrvrPrefs;
theInitParams.initParams.inMessages = fSrvrMessages;
theInitParams.initParams.inErrorLogStream = &sErrorLogStream;
QTSS_ModuleState theModuleState;
theModuleState.curRole = QTSS_Initialize_Role;
theModuleState.curTask = NULL;
OSThread::SetMainThreadData(&theModuleState);
for (UInt32 x = 0; x < QTSServerInterface::GetNumModulesInRole(QTSSModule::kInitializeRole); x++)
{
QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kInitializeRole, x);
theInitParams.initParams.inModule = theModule;
theModuleState.curModule = theModule;
QTSS_Error theErr = theModule->CallDispatch(QTSS_Initialize_Role, &theInitParams);
if (theErr != QTSS_NoErr)
{
// If the module reports an error when initializing itself,
// delete the module and pretend it was never there.
QTSSModuleUtils::LogError(qtssWarningVerbosity, qtssMsgInitFailed, theErr,
theModule->GetValue(qtssModName)->Ptr);
sModuleQueue.Remove(theModule->GetQueueElem());
delete theModule;
}
}
OSThread::SetMainThreadData(NULL);
}
示例3: locker
SInt64 ReflectorSessionCheckTask::Run()
{
OSRefTable* reflectorSessionMap = QTSServerInterface::GetServer()->GetReflectorSessionMap();
OSMutexLocker locker(reflectorSessionMap->GetMutex());
SInt64 sNowTime = OS::Milliseconds();
for (OSRefHashTableIter theIter(reflectorSessionMap->GetHashTable()); !theIter.IsDone(); theIter.Next())
{
OSRef* theRef = theIter.GetCurrent();
ReflectorSession* theSession = (ReflectorSession*)theRef->GetObject();
SInt64 sCreateTime = theSession->GetInitTimeMS();
if( (theSession->GetNumOutputs() == 0) && (sNowTime-sCreateTime >= 20*1000) )
{
QTSS_RoleParams theParams;
theParams.easyFreeStreamParams.inStreamName = theSession->GetStreamName();
UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kEasyCMSFreeStreamRole);
for ( UInt32 currentModule=0;currentModule < numModules; currentModule++)
{
qtss_printf("没有客户端观看当前转发媒体\n");
QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kEasyCMSFreeStreamRole, currentModule);
(void)theModule->CallDispatch(Easy_CMSFreeStream_Role, &theParams);
}
}
}
return 30*1000;//30s
}
示例4: qtss_printf
void ReflectorSession::DelRedisLive()
{
QTSS_RoleParams theParams;
theParams.easyStreamInfoParams.inStreamName = fSessionName.Ptr;
theParams.easyStreamInfoParams.inChannel = fChannelNum;
theParams.easyStreamInfoParams.inAction = easyRedisActionDelete;
UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kRedisUpdateStreamInfoRole);
for (UInt32 currentModule = 0; currentModule < numModules; currentModule++)
{
qtss_printf("从redis中删除推流名称%s\n", fSourceID.Ptr);
QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kRedisUpdateStreamInfoRole, currentModule);
(void)theModule->CallDispatch(Easy_RedisUpdateStreamInfo_Role, &theParams);
}
}
示例5: QTSServerPrefs
Bool16 QTSServer::Initialize(XMLPrefsParser* inPrefsSource, PrefsSource* inMessagesSource, UInt16 inPortOverride, Bool16 createListeners)
{
fServerState = qtssFatalErrorState;
sPrefsSource = inPrefsSource;
sMessagesSource = inMessagesSource;
this->InitCallbacks();
fMediaSource = NULL;
//
// DICTIONARY INITIALIZATION
QTSSModule::Initialize();
QTSServerPrefs::Initialize();
QTSSMessages::Initialize();
QTSSFile::Initialize();
//
// STUB SERVER INITIALIZATION
//
// Construct stub versions of the prefs and messages dictionaries. We need
// both of these to initialize the server, but they have to be stubs because
// their QTSSDictionaryMaps will presumably be modified when modules get loaded.
fSrvrPrefs = new QTSServerPrefs(inPrefsSource, false); // First time, don't write changes to the prefs file
fSrvrMessages = new QTSSMessages(inMessagesSource);
QTSSModuleUtils::Initialize(fSrvrMessages, this, QTSServerInterface::GetErrorLogStream());
SetAssertLogger(this->GetErrorLogStream());// the error log stream is our assert logger
// Load ERROR LOG module only. This is good in case there is a startup error.
QTSSModule* theLoggingModule = new QTSSModule("QTSSErrorLogModule");
(void)theLoggingModule->SetupModule(&sCallbacks, &QTSSErrorLogModule_Main);
(void)AddModule(theLoggingModule);
this->BuildModuleRoleArrays();
//
// STARTUP TIME - record it
fStartupTime_UnixMilli = OS::Milliseconds();
fGMTOffset = OS::GetGMTOffset();
if ( fNumListeners == 0 )
{
if (createListeners)
QTSSModuleUtils::LogError(qtssWarningVerbosity, qtssMsgNoPortsSucceeded, 0);
}
fServerState = qtssStartingUpState;
return true;
}
示例6: stopPushStream
void EasyCMSSession::stopPushStream()
{
QTSS_RoleParams params;
QTSS_Error errCode = QTSS_NoErr;
UInt32 fCurrentModule = 0;
UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kStopStreamRole);
for (; fCurrentModule < numModules; ++fCurrentModule)
{
QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kStopStreamRole, fCurrentModule);
errCode = theModule->CallDispatch(Easy_StopStream_Role, ¶ms);
}
fCurrentModule = 0;
}
示例7: qtss_printf
SInt64 EasyCameraSource::Run()
{
QTSS_Error theErr = QTSS_NoErr;
EventFlags events = this->GetEvents();
if(events & Task::kTimeoutEvent)
{
//向设备获取快照数据
//unsigned char *sData = (unsigned char*)malloc(EASY_SNAP_BUFFER_SIZE);
unsigned char *sData = new unsigned char[EASY_SNAP_BUFFER_SIZE];
int snapBufLen = 0;
do{
//如果获取到摄像机快照数据,Base64编码/发送
if (!getSnapData(sData, EASY_SNAP_BUFFER_SIZE, &snapBufLen))
{
//未获取到数据
qtss_printf("EasyCameraSource::Run::GetSnapData() => Get Snap Data Fail \n");
theErr = QTSS_ValueNotFound;
break;
}
QTSS_RoleParams params;
params.postSnapParams.snapLen = snapBufLen;
params.postSnapParams.snapPtr = sData;
params.postSnapParams.snapType = EASY_SNAP_TYPE_JPEG;
UInt32 fCurrentModule = 0;
UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kPostSnapRole);
for (; fCurrentModule < numModules; fCurrentModule++)
{
qtss_printf("EasyCameraSource::Run::kPostSnapRole\n");
QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kPostSnapRole, fCurrentModule);
(void)theModule->CallDispatch(Easy_PostSnap_Role, ¶ms);
break;
}
break;
}while(0);
//free((void*)sData);
delete []sData;
sData = NULL;
fTimeoutTask->RefreshTimeout();
}
return 0;
}
示例8: Easy_StopHLSession
QTSS_Error QTSSCallbacks::Easy_StopHLSession(const char* inSessionName)
{
QTSS_RoleParams packetParams;
packetParams.easyHLSCloseParams.inStreamName = (char*)inSessionName;
UInt32 fCurrentModule = 0;
UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kEasyHLSCloseRole);
for (; fCurrentModule < numModules; fCurrentModule++)
{
QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kEasyHLSCloseRole, fCurrentModule);
(void)theModule->CallDispatch(Easy_HLSClose_Role, &packetParams);
return QTSS_NoErr;
}
return QTSS_RequestFailed;
}
示例9: sizeof
void QTSServer::DoInitRole()
{
QTSS_RoleParams theInitParams;
theInitParams.initParams.inServer = this;
theInitParams.initParams.inPrefs = fSrvrPrefs;
theInitParams.initParams.inMessages = fSrvrMessages;
theInitParams.initParams.inErrorLogStream = &sErrorLogStream;
QTSS_ModuleState theModuleState;
theModuleState.curRole = QTSS_Initialize_Role;
theModuleState.curTask = NULL;
OSThread::SetMainThreadData(&theModuleState);
//
// Add the OPTIONS method as the one method the server handles by default (it handles
// it internally). Modules that handle other RTSP methods will add
QTSS_RTSPMethod theOptionsMethod = qtssOptionsMethod;
(void)this->SetValue(qtssSvrHandledMethods, 0, &theOptionsMethod, sizeof(theOptionsMethod));
// For now just disable the SetParameter to be compatible with Real. It should really be removed only for clients that have problems with their SetParameter implementations like (Real Players).
// At the moment it isn't necesary to add the option.
// QTSS_RTSPMethod theSetParameterMethod = qtssSetParameterMethod;
// (void)this->SetValue(qtssSvrHandledMethods, 0, &theSetParameterMethod, sizeof(theSetParameterMethod));
for (UInt32 x = 0; x < QTSServerInterface::GetNumModulesInRole(QTSSModule::kInitializeRole); x++)
{
QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kInitializeRole, x);
theInitParams.initParams.inModule = theModule;
theModuleState.curModule = theModule;
QTSS_Error theErr = theModule->CallDispatch(QTSS_Initialize_Role, &theInitParams);
if (theErr != QTSS_NoErr)
{
// If the module reports an error when initializing itself,
// delete the module and pretend it was never there.
QTSSModuleUtils::LogError(qtssWarningVerbosity, qtssMsgInitFailed, theErr,
theModule->GetValue(qtssModName)->Ptr);
sModuleQueue.Remove(theModule->GetQueueElem());
delete theModule;
}
}
OSThread::SetMainThreadData(NULL);
}
示例10: Easy_ListRecordFiles
QTSS_Error QTSSCallbacks::Easy_ListRecordFiles(const char* inSessionName, const char* inBeginTime, const char* inEndTime, vector<string> *outRecordFiles)
{
QTSS_RoleParams packetParams;
packetParams.easyRecordListParams.inStreamName = (char*)inSessionName;
packetParams.easyRecordListParams.inBeginTime = (char*)inBeginTime;
packetParams.easyRecordListParams.inEndTime = (char*)inEndTime;
packetParams.easyRecordListParams.outRecords = outRecordFiles;
UInt32 fCurrentModule = 0;
UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kRecordListRole);
for (; fCurrentModule < numModules; fCurrentModule++)
{
QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kRecordListRole, fCurrentModule);
(void)theModule->CallDispatch(Easy_RecordList_Role, &packetParams);
return QTSS_NoErr;
}
return QTSS_RequestFailed;
}
示例11: SetSessionName
QTSS_Error ReflectorSession::SetSessionName()
{
if (fSourceID.Len > 0)
{
QTSS_RoleParams theParams;
theParams.easyStreamInfoParams.inStreamName = fSessionName.Ptr;
theParams.easyStreamInfoParams.inChannel = fChannelNum;
theParams.easyStreamInfoParams.inNumOutputs = fNumOutputs;
theParams.easyStreamInfoParams.inAction = easyRedisActionSet;
auto numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kRedisUpdateStreamInfoRole);
for (UInt32 currentModule = 0; currentModule < numModules; currentModule++)
{
QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kRedisUpdateStreamInfoRole, currentModule);
(void)theModule->CallDispatch(Easy_RedisUpdateStreamInfo_Role, &theParams);
}
}
return QTSS_NoErr;
}
示例12: Easy_StartHLSession
QTSS_Error QTSSCallbacks::Easy_StartHLSession(const char* inSessionName, const char* inURL, UInt32 inTimeout, char* outURL)
{
QTSS_RoleParams params;
params.easyHLSOpenParams.inStreamName = (char*)inSessionName;
params.easyHLSOpenParams.inRTSPUrl = (char*)inURL;
params.easyHLSOpenParams.inTimeout = inTimeout;
params.easyHLSOpenParams.outHLSUrl = outURL;
UInt32 fCurrentModule = 0;
UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kEasyHLSOpenRole);
for (; fCurrentModule < numModules; fCurrentModule++)
{
QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kEasyHLSOpenRole, fCurrentModule);
(void)theModule->CallDispatch(Easy_HLSOpen_Role, ¶ms);
return QTSS_NoErr;
}
return QTSS_RequestFailed;
}
示例13: QTSS_SetIdleRoleTimer
QTSS_Error QTSSCallbacks::QTSS_SetIdleRoleTimer(SInt64 inMsecToWait)
{
QTSS_ModuleState* theState = (QTSS_ModuleState*)OSThread::GetMainThreadData();
if (OSThread::GetCurrent() != NULL)
theState = (QTSS_ModuleState*)OSThread::GetCurrent()->GetThreadData();
// This may happen if this callback is occurring on module-created thread
if (theState == NULL)
return QTSS_RequestFailed;
if (theState->curModule == NULL)
return QTSS_RequestFailed;
QTSSModule* theModule = theState->curModule;
QTSS_ModuleState* thePrivateModuleState = theModule->GetModuleState();
thePrivateModuleState->idleTime = inMsecToWait;
theModule->Signal(Task::kUpdateEvent);
return QTSS_NoErr;
}
示例14: qtss_snprintf
void HTTPSessionInterface::UnRegDevSession()
{
if (fAuthenticated)
{
char msgStr[512];
qtss_snprintf(msgStr, sizeof(msgStr), "Device unregister,Device_serial[%s]\n", fDevice.serial_.c_str());
QTSServerInterface::LogError(qtssMessageVerbosity, msgStr);
QTSServerInterface::GetServer()->GetDeviceSessionMap()->UnRegister(fDevice.serial_);//add
//在redis上删除设备
//QTSServerInterface::GetServer()->RedisDelDevName(fDevice.serial_.c_str());
QTSS_RoleParams theParams;
theParams.StreamNameParams.inStreamName = (char *)(fDevice.serial_.c_str());
UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kDelDevNameRole);
for ( UInt32 currentModule=0;currentModule < numModules; currentModule++)
{
QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kDelDevNameRole, currentModule);
(void)theModule->CallDispatch(QTSS_DelDevName_Role, &theParams);
}
}
}
示例15: theIter
void QTSServer::BuildModuleRoleArrays()
{
OSQueueIter theIter(&sModuleQueue);
QTSSModule* theModule = NULL;
// Make sure these variables are cleaned out in case they've already been inited.
DestroyModuleRoleArrays();
// Loop through all the roles of all the modules, recording the number of
// modules in each role, and also recording which modules are doing what.
for (UInt32 x = 0; x < QTSSModule::kNumRoles; x++)
{
sNumModulesInRole[x] = 0;
for (theIter.Reset(); !theIter.IsDone(); theIter.Next())
{
theModule = (QTSSModule*)theIter.GetCurrent()->GetEnclosingObject();
if (theModule->RunsInRole(x))
sNumModulesInRole[x] += 1;
}
if (sNumModulesInRole[x] > 0)
{
UInt32 moduleIndex = 0;
sModuleArray[x] = new QTSSModule*[sNumModulesInRole[x] + 1];
for (theIter.Reset(); !theIter.IsDone(); theIter.Next())
{
theModule = (QTSSModule*)theIter.GetCurrent()->GetEnclosingObject();
if (theModule->RunsInRole(x))
{
sModuleArray[x][moduleIndex] = theModule;
moduleIndex++;
}
}
}
}
}