mirror of
https://github.com/mpromonet/v4l2rtspserver
synced 2024-11-03 23:15:56 +00:00
extract RTSP server createtion
This commit is contained in:
parent
85838ea6a2
commit
6ac72abd21
31
src/main.cpp
31
src/main.cpp
@ -49,6 +49,25 @@ void sighandler(int n)
|
||||
quit =1;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------
|
||||
// create RTSP server
|
||||
// -----------------------------------------
|
||||
RTSPServer* createRTSPServer(UsageEnvironment& env, unsigned short rtspPort, unsigned short rtspOverHTTPPort, int timeout)
|
||||
{
|
||||
UserAuthenticationDatabase* authDB = NULL;
|
||||
RTSPServer* rtspServer = RTSPServer::createNew(env, rtspPort, authDB, timeout);
|
||||
if (rtspServer != NULL)
|
||||
{
|
||||
// set http tunneling
|
||||
if (rtspOverHTTPPort)
|
||||
{
|
||||
rtspServer->setUpTunnelingOverHTTP(rtspOverHTTPPort);
|
||||
}
|
||||
}
|
||||
return rtspServer;
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
// add an RTSP session
|
||||
// -----------------------------------------
|
||||
@ -192,21 +211,13 @@ int main(int argc, char** argv)
|
||||
unsigned char ttl = 5;
|
||||
|
||||
// create RTSP server
|
||||
UserAuthenticationDatabase* authDB = NULL;
|
||||
RTSPServer* rtspServer = RTSPServer::createNew(*env, rtspPort, authDB, timeout);
|
||||
RTSPServer* rtspServer = createRTSPServer(*env, rtspPort, rtspOverHTTPPort, timeout);
|
||||
if (rtspServer == NULL)
|
||||
{
|
||||
LOG(ERROR) << "Failed to create RTSP server: " << env->getResultMsg();
|
||||
}
|
||||
else
|
||||
{
|
||||
// set http tunneling
|
||||
if (rtspOverHTTPPort)
|
||||
{
|
||||
rtspServer->setUpTunnelingOverHTTP(rtspOverHTTPPort);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
std::list<std::string>::iterator devIt;
|
||||
for ( devIt=devList.begin() ; devIt!=devList.end() ; ++devIt)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user