#include <BasicUsageEnvironment.hh>#include "DynamicRTSPServer.hh"#include "version.hh"Include dependency graph for live555MediaServer.cpp:

Go to the source code of this file.
Functions | |
| int | main (int argc, char **argv) |
| int main | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 24 of file live555MediaServer.cpp.
References UserAuthenticationDatabase::addUserRecord(), DynamicRTSPServer::createNew(), BasicUsageEnvironment::createNew(), BasicTaskScheduler::createNew(), TaskScheduler::doEventLoop(), env, exit, UsageEnvironment::getResultMsg(), RTSPServer::httpServerPortNum(), LIVEMEDIA_LIBRARY_VERSION_STRING, MEDIA_SERVER_VERSION_STRING, NULL, rtspServer, rtspServerPortNum, RTSPServer::rtspURLPrefix(), RTSPServer::setUpTunnelingOverHTTP(), and UsageEnvironment::taskScheduler().
00024 { 00025 // Begin by setting up our usage environment: 00026 TaskScheduler* scheduler = BasicTaskScheduler::createNew(); 00027 UsageEnvironment* env = BasicUsageEnvironment::createNew(*scheduler); 00028 00029 UserAuthenticationDatabase* authDB = NULL; 00030 #ifdef ACCESS_CONTROL 00031 // To implement client access control to the RTSP server, do the following: 00032 authDB = new UserAuthenticationDatabase; 00033 authDB->addUserRecord("username1", "password1"); // replace these with real strings 00034 // Repeat the above with each <username>, <password> that you wish to allow 00035 // access to the server. 00036 #endif 00037 00038 // Create the RTSP server. Try first with the default port number (554), 00039 // and then with the alternative port number (8554): 00040 RTSPServer* rtspServer; 00041 portNumBits rtspServerPortNum = 554; 00042 rtspServer = DynamicRTSPServer::createNew(*env, rtspServerPortNum, authDB); 00043 if (rtspServer == NULL) { 00044 rtspServerPortNum = 8554; 00045 rtspServer = DynamicRTSPServer::createNew(*env, rtspServerPortNum, authDB); 00046 } 00047 if (rtspServer == NULL) { 00048 *env << "Failed to create RTSP server: " << env->getResultMsg() << "\n"; 00049 exit(1); 00050 } 00051 00052 *env << "LIVE555 Media Server\n"; 00053 *env << "\tversion " << MEDIA_SERVER_VERSION_STRING 00054 << " (LIVE555 Streaming Media library version " 00055 << LIVEMEDIA_LIBRARY_VERSION_STRING << ").\n"; 00056 00057 char* urlPrefix = rtspServer->rtspURLPrefix(); 00058 *env << "Play streams from this server using the URL\n\t" 00059 << urlPrefix << "<filename>\nwhere <filename> is a file present in the current directory.\n"; 00060 *env << "Each file's type is inferred from its name suffix:\n"; 00061 *env << "\t\".264\" => a H.264 Video Elementary Stream file\n"; 00062 *env << "\t\".aac\" => an AAC Audio (ADTS format) file\n"; 00063 *env << "\t\".ac3\" => an AC-3 Audio file\n"; 00064 *env << "\t\".amr\" => an AMR Audio file\n"; 00065 *env << "\t\".dv\" => a DV Video file\n"; 00066 *env << "\t\".m4e\" => a MPEG-4 Video Elementary Stream file\n"; 00067 *env << "\t\".mkv\" => a Matroska audio+video+(optional)subtitles file\n"; 00068 *env << "\t\".mp3\" => a MPEG-1 or 2 Audio file\n"; 00069 *env << "\t\".mpg\" => a MPEG-1 or 2 Program Stream (audio+video) file\n"; 00070 *env << "\t\".ts\" => a MPEG Transport Stream file\n"; 00071 *env << "\t\t(a \".tsx\" index file - if present - provides server 'trick play' support)\n"; 00072 *env << "\t\".vob\" => a VOB (MPEG-2 video with AC-3 audio) file\n"; 00073 *env << "\t\".wav\" => a WAV Audio file\n"; 00074 *env << "\t\".webm\" => a WebM audio(Vorbis)+video(VP8) file\n"; 00075 *env << "See http://www.live555.com/mediaServer/ for additional documentation.\n"; 00076 00077 // Also, attempt to create a HTTP server for RTSP-over-HTTP tunneling. 00078 // Try first with the default HTTP port (80), and then with the alternative HTTP 00079 // port numbers (8000 and 8080). 00080 00081 if (rtspServer->setUpTunnelingOverHTTP(80) || rtspServer->setUpTunnelingOverHTTP(8000) || rtspServer->setUpTunnelingOverHTTP(8080)) { 00082 *env << "(We use port " << rtspServer->httpServerPortNum() << " for optional RTSP-over-HTTP tunneling, or for HTTP live streaming (for indexed Transport Stream files only).)\n"; 00083 } else { 00084 *env << "(RTSP-over-HTTP tunneling is not available.)\n"; 00085 } 00086 00087 env->taskScheduler().doEventLoop(); // does not return 00088 00089 return 0; // only to prevent compiler warning 00090 }
1.5.2