The following C++ functions show how to create a RTSP Server using the high level functions in IltmmRTSPServer.
/* Ask the LEAD RTSP Sink filter to create a ILMRTSPServer interface and add one user to it */ILMRTSPSecurity *CreateRTSPSecurity(){ILMRTSPSecurity *pSecurity;HRESULT hr = CoCreateInstance(CLSID_LMRTSPSecurity, NULL, CLSCTX_INPROC_SERVER, IID_ILMRTSPSecurity, (void **)&pSecurity);if(FAILED(hr))return NULL;// use Digest authenticationpSecurity->put_AuthenticationRequired(LMRTSPAuthenticationType_Digest);// note that since I created the interface as an inproc server, I can pass wide char as BSTR instead of allocating them with SysAllocStringpSecurity->put_RealmName(L"My RTSP Server");// add one user with a passwordpSecurity->AddUser(L"user1", L"pass1", NULL);return pSecurity;}/* Create a RTSP Server with an optional file containing the conversion settings. Pass NULL for defaultConvertSettings if youdon't have a settings file */HRESULT TestRTSPServer(BSTR defaultConvertSettings, long flags){IltmmRTSPServer *pServer = NULL;HRESULT hr = CoCreateInstance(CLSID_ltmmRTSPServer, NULL, CLSCTX_INPROC_SERVER, IID_IltmmRTSPServer, (void **)&pServer);if(FAILED(hr) || pServer == NULL)return hr;// add one source folder. You can pass wide char string for BSTR since the server is created as an inproc serverpServer->put_SourceFolder(0, L"c:\\RTSPSourceFolder");pServer->put_LiveLatency(-1, 0.2); // use 0.2 sec live latency// create and assign as security the interface with Digest authentication and one authenticated userILMRTSPSecurity *pSecurity = CreateRTSPSecurity();if(pSecurity){pServer->put_Security(-1, pSecurity);pSecurity->Release();}if(defaultConvertSettings)pServer->LoadSettingsFromFile(-1, defaultConvertSettings, flags);// make the server listen on the local loopback addresspServer->put_TargetAddress(L"127.0.0.1");// listen on the default RTSP port (554). Change this value if you already have a RTSP server running on this porthr = pServer->StartServer(ltmmRTSP_DefaultPort);if(SUCCEEDED(hr)){// the server will be running while the message box is runningMessageBoxA(NULL, "Press OK to stop the server", "RTSP Server is running!", MB_OK);pServer->StopServer(ltmmRTSP_DefaultPort);pServer->Release();}return hr;}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
