在RTSPSession中,创建 QTSS_RoleParams fRoleParams变量,该变量(联合体)用来赋值模块的角色参数.
在RTSPSession中,使用联合体中fRoleParams.rtspRequestParams来设置rtsp角色参数
调用模块方法:
(void)theModule->CallDispatch(QTSS_RTSPPreProcessor_Role, &fRoleParams);
模块的角色:
enum
{
//Global
QTSS_Register_Role = FOUR_CHARS_TO_INT('r', 'e', 'g', ' '), //reg //All modules get this once at startup
QTSS_Initialize_Role = FOUR_CHARS_TO_INT('i', 'n', 'i', 't'), //init //Gets called once, later on in the startup process
QTSS_Shutdown_Role = FOUR_CHARS_TO_INT('s', 'h', 'u', 't'), //shut //Gets called once at shutdown
QTSS_ErrorLog_Role = FOUR_CHARS_TO_INT('e', 'l', 'o', 'g'), //elog //This gets called when the server wants to log an error.
QTSS_RereadPrefs_Role = FOUR_CHARS_TO_INT('p', 'r', 'e', 'f'), //pref //This gets called when the server rereads preferences.
QTSS_StateChange_Role = FOUR_CHARS_TO_INT('s', 't', 'a', 't'), //stat //This gets called whenever the server changes state.
QTSS_Interval_Role = FOUR_CHARS_TO_INT('t', 'i', 'm', 'r'), //timr //This gets called whenever the module's interval timer times out calls.
//RTSP-specific
QTSS_RTSPFilter_Role = FOUR_CHARS_TO_INT('f', 'i', 'l', 't'), //filt //Filter all RTSP requests before the server parses them
QTSS_RTSPRoute_Role = FOUR_CHARS_TO_INT('r', 'o', 'u', 't'), //rout //Route all RTSP requests to the correct root folder.
QTSS_RTSPAuthenticate_Role = FOUR_CHARS_TO_INT('a', 't', 'h', 'n'), //athn //Authenticate the RTSP request username.
QTSS_RTSPAuthorize_Role = FOUR_CHARS_TO_INT('a', 'u', 't', 'h'), //auth //Authorize RTSP requests to proceed
QTSS_RTSPPreProcessor_Role = FOUR_CHARS_TO_INT('p', 'r', 'e', 'p'), //prep //Pre-process all RTSP requests before the server responds.
//Modules may opt to "steal" the request and return a client response.
QTSS_RTSPRequest_Role = FOUR_CHARS_TO_INT('r', 'e', 'q', 'u'), //requ //Process an RTSP request & send client response
QTSS_RTSPPostProcessor_Role = FOUR_CHARS_TO_INT('p', 'o', 's', 't'), //post //Post-process all RTSP requests
QTSS_RTSPSessionClosing_Role = FOUR_CHARS_TO_INT('s', 'e', 's', 'c'), //sesc //RTSP session is going away
QTSS_RTSPIncomingData_Role = FOUR_CHARS_TO_INT('i', 'c', 'm', 'd'), //icmd //Incoming interleaved RTP data on this RTSP connection
//RTP-specific
QTSS_RTPSendPackets_Role = FOUR_CHARS_TO_INT('s', 'e', 'n', 'd'), //send //Send RTP packets to the client
QTSS_ClientSessionClosing_Role = FOUR_CHARS_TO_INT('d', 'e', 's', 's'), //dess //Client session is going away
//RTCP-specific
QTSS_RTCPProcess_Role = FOUR_CHARS_TO_INT('r', 't', 'c', 'p'), //rtcp //Process all RTCP packets sent to the server
//File system roles
QTSS_OpenFilePreProcess_Role = FOUR_CHARS_TO_INT('o', 'p', 'p', 'r'), //oppr
QTSS_OpenFile_Role = FOUR_CHARS_TO_INT('o', 'p', 'f', 'l'), //opfl
QTSS_AdviseFile_Role = FOUR_CHARS_TO_INT('a', 'd', 'f', 'l'), //adfl
QTSS_ReadFile_Role = FOUR_CHARS_TO_INT('r', 'd', 'f', 'l'), //rdfl
QTSS_CloseFile_Role = FOUR_CHARS_TO_INT('c', 'l', 'f', 'l'), //clfl
QTSS_RequestEventFile_Role = FOUR_CHARS_TO_INT('r', 'e', 'f', 'l'), //refl
//EasyHLSModule
Easy_HLSOpen_Role = FOUR_CHARS_TO_INT('h', 'l', 's', 'o'), //hlso
Easy_HLSClose_Role = FOUR_CHARS_TO_INT('h', 'l', 's', 'c'), //hlsc
//EasyCMSModule
Easy_CMSFreeStream_Role = FOUR_CHARS_TO_INT('e', 'f', 's', 'r'), //efsr
//EasyRedisModule
Easy_RedisSetRTSPLoad_Role = FOUR_CHARS_TO_INT('c', 'r', 'n', 'r'), //crnr
Easy_RedisUpdateStreamInfo_Role = FOUR_CHARS_TO_INT('a', 'p', 'n', 'r'), //apnr
Easy_RedisTTL_Role = FOUR_CHARS_TO_INT('t', 't', 'l', 'r'), //ttlr
Easy_RedisGetAssociatedCMS_Role = FOUR_CHARS_TO_INT('g', 'a', 'c', 'r'), //gacr
Easy_RedisJudgeStreamID_Role = FOUR_CHARS_TO_INT('j', 's', 'i', 'r'), //jsir
//RESTful
Easy_GetDeviceStream_Role = FOUR_CHARS_TO_INT('g', 'd', 's', 'r'), //gdsr
Easy_LiveDeviceStream_Role = FOUR_CHARS_TO_INT('l', 'd', 's', 'r'), //ldsr
QTSS_RTSPRelayingData_Role = FOUR_CHARS_TO_INT('r', 'l', 'y', 'd'), //relay pull data
};
typedef UInt32 QTSS_Role;
typedef union
{
QTSS_Register_Params regParams;
QTSS_Initialize_Params initParams;
QTSS_ErrorLog_Params errorParams;
QTSS_StateChange_Params stateChangeParams;
QTSS_Filter_Params rtspFilterParams;
QTSS_IncomingData_Params rtspIncomingDataParams;
QTSS_StandardRTSP_Params rtspRouteParams;
QTSS_RTSPAuth_Params rtspAthnParams;
QTSS_StandardRTSP_Params rtspAuthParams;
QTSS_StandardRTSP_Params rtspPreProcessorParams;
QTSS_StandardRTSP_Params rtspRequestParams;
QTSS_StandardRTSP_Params rtspPostProcessorParams;
QTSS_RTSPSession_Params rtspSessionClosingParams;
QTSS_RTPSendPackets_Params rtpSendPacketsParams;
QTSS_ClientSessionClosing_Params clientSessionClosingParams;
QTSS_RTCPProcess_Params rtcpProcessParams;
QTSS_OpenFile_Params openFilePreProcessParams;
QTSS_OpenFile_Params openFileParams;
QTSS_AdviseFile_Params adviseFileParams;
QTSS_ReadFile_Params readFileParams;
QTSS_CloseFile_Params closeFileParams;
QTSS_RequestEventFile_Params reqEventFileParams;
Easy_StreamInfo_Params easyStreamInfoParams;
QTSS_GetAssociatedCMS_Params GetAssociatedCMSParams;
QTSS_JudgeStreamID_Params JudgeStreamIDParams;
Easy_GetDeviceStream_Params easyGetDeviceStreamParams;
QTSS_RelayingData_Params rtspRelayingDataParams;
} QTSS_RoleParams, *QTSS_RoleParamPtr;
typedef struct
{
QTSS_RTSPSessionObject inRTSPSession;
QTSS_RTSPRequestObject inRTSPRequest;
QTSS_RTSPHeaderObject inRTSPHeaders;
QTSS_ClientSessionObject inClientSession;
} QTSS_StandardRTSP_Params;