00001 /********** 00002 This library is free software; you can redistribute it and/or modify it under 00003 the terms of the GNU Lesser General Public License as published by the 00004 Free Software Foundation; either version 2.1 of the License, or (at your 00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) 00006 00007 This library is distributed in the hope that it will be useful, but WITHOUT 00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00009 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 00010 more details. 00011 00012 You should have received a copy of the GNU Lesser General Public License 00013 along with this library; if not, write to the Free Software Foundation, Inc., 00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00015 **********/ 00016 // Copyright (c) 1996-2013, Live Networks, Inc. All rights reserved 00017 // LIVE555 Media Server 00018 // main program 00019 00020 #include <BasicUsageEnvironment.hh> 00021 #include "DynamicRTSPServer.hh" 00022 #include "version.hh" 00023 00024 int main(int argc, char** argv) { 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