Skip to content

Commit

Permalink
Remove rRTSPServer.c unused
Browse files Browse the repository at this point in the history
  • Loading branch information
roleoroleo committed Apr 26, 2020
1 parent 31d3c3a commit 8305f4b
Showing 1 changed file with 0 additions and 166 deletions.
166 changes: 0 additions & 166 deletions src/rRTSPServer/rRTSPServer.patch
Original file line number Diff line number Diff line change
Expand Up @@ -31,169 +31,3 @@ diff -Naur live.ori/liveMedia/H264or5VideoStreamFramer.cpp live/liveMedia/H264or
}

H264or5VideoStreamFramer::~H264or5VideoStreamFramer() {
diff -Naur live.ori/rRTSPServer.cpp live/rRTSPServer.cpp
--- live.ori/rRTSPServer.cpp 1970-01-01 01:00:00.000000000 +0100
+++ live/rRTSPServer.cpp 2020-04-08 19:11:20.000000000 +0200
@@ -0,0 +1,162 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+// Copyright (c) 1996-2019, Live Networks, Inc. All rights reserved
+// A test program that demonstrates how to stream - via unicast RTP
+// - various kinds of file on demand, using a built-in RTSP server.
+// main program
+
+#include "liveMedia.hh"
+#include "BasicUsageEnvironment.hh"
+
+UsageEnvironment* env;
+
+// To make the second and subsequent client for each stream reuse the same
+// input stream as the first client (rather than playing the file from the
+// start for each client), change the following "False" to "True":
+Boolean reuseFirstSource = True;
+
+// To stream *only* MPEG-1 or 2 video "I" frames
+// (e.g., to reduce network bandwidth),
+// change the following "False" to "True":
+Boolean iFramesOnly = False;
+
+static void announceStream(RTSPServer* rtspServer, ServerMediaSession* sms,
+ char const* streamName, char const* inputFileName); // fwd
+
+int main(int argc, char** argv) {
+
+ char *str;
+ int res = 0;
+ int port = 554;
+ int nm;
+ char user[65];
+ char pwd[65];
+
+ str = getenv("RRTSP_RES");
+ if (str && sscanf (str, "%i", &nm) == 1 && nm >= 0) {
+ if ((nm >= 0) && (nm <=2)) {
+ res = nm;
+ }
+ }
+
+ str = getenv("RRTSP_PORT");
+ if (str && sscanf (str, "%i", &nm) == 1 && nm >= 0) {
+ port = nm;
+ }
+
+ memset(user, 0, sizeof(user));
+ str = getenv("RRTSP_USER");
+ if ((str != NULL) && (strlen(str) < sizeof(user))) {
+ strcpy(user, str);
+ }
+
+ memset(pwd, 0, sizeof(pwd));
+ str = getenv("RRTSP_PWD");
+ if ((str != NULL) && (strlen(str) < sizeof(pwd))) {
+ strcpy(pwd, str);
+ }
+
+ // Begin by setting up our usage environment:
+ TaskScheduler* scheduler = BasicTaskScheduler::createNew();
+ env = BasicUsageEnvironment::createNew(*scheduler);
+
+ UserAuthenticationDatabase* authDB = NULL;
+
+ if ((user[0] != '\0') && (pwd[0] != '\0')) {
+ // To implement client access control to the RTSP server, do the following:
+ authDB = new UserAuthenticationDatabase;
+ authDB->addUserRecord(user, pwd);
+ // Repeat the above with each <username>, <password> that you wish to allow
+ // access to the server.
+ }
+
+ // Create the RTSP server:
+ RTSPServer* rtspServer = RTSPServer::createNew(*env, port, authDB);
+ if (rtspServer == NULL) {
+ *env << "Failed to create RTSP server: " << env->getResultMsg() << "\n";
+ exit(1);
+ }
+
+ char const* descriptionString
+ = "Session streamed by \"rRTSPServer\"";
+
+ // Set up each of the possible streams that can be served by the
+ // RTSP server. Each such stream is implemented using a
+ // "ServerMediaSession" object, plus one or more
+ // "ServerMediaSubsession" objects for each audio/video substream.
+
+ // A H.264 video elementary stream:
+ if (res == 0)
+ {
+ char const* streamName = "ch0_0.h264";
+ char const* inputFileName = "stdin";
+
+ // First, make sure that the RTPSinks' buffers will be large enough to handle the huge size of DV frames (as big as 288000).
+ OutPacketBuffer::maxSize = 300000;
+
+ ServerMediaSession* sms_high
+ = ServerMediaSession::createNew(*env, streamName, streamName,
+ descriptionString);
+ sms_high->addSubsession(H264VideoFileServerMediaSubsession
+ ::createNew(*env, inputFileName, reuseFirstSource));
+ rtspServer->addServerMediaSession(sms_high);
+
+ announceStream(rtspServer, sms_high, streamName, inputFileName);
+ }
+
+ // A H.264 video elementary stream:
+ if (res == 1)
+ {
+ char const* streamName = "ch0_1.h264";
+ char const* inputFileName = "stdin";
+
+ // First, make sure that the RTPSinks' buffers will be large enough to handle the huge size of DV frames (as big as 288000).
+ OutPacketBuffer::maxSize = 300000;
+
+ ServerMediaSession* sms_low
+ = ServerMediaSession::createNew(*env, streamName, streamName,
+ descriptionString);
+ sms_low->addSubsession(H264VideoFileServerMediaSubsession
+ ::createNew(*env, inputFileName, reuseFirstSource));
+ rtspServer->addServerMediaSession(sms_low);
+
+ announceStream(rtspServer, sms_low, streamName, inputFileName);
+ }
+
+ // Also, attempt to create a HTTP server for RTSP-over-HTTP tunneling.
+ // Try first with the default HTTP port (80), and then with the alternative HTTP
+ // port numbers (8000 and 8080).
+/*
+ if (rtspServer->setUpTunnelingOverHTTP(80) || rtspServer->setUpTunnelingOverHTTP(8000) || rtspServer->setUpTunnelingOverHTTP(8080)) {
+ *env << "\n(We use port " << rtspServer->httpServerPortNum() << " for optional RTSP-over-HTTP tunneling.)\n";
+ } else {
+ *env << "\n(RTSP-over-HTTP tunneling is not available.)\n";
+ }
+*/
+ env->taskScheduler().doEventLoop(); // does not return
+
+ return 0; // only to prevent compiler warning
+}
+
+static void announceStream(RTSPServer* rtspServer, ServerMediaSession* sms,
+ char const* streamName, char const* inputFileName) {
+ char* url = rtspServer->rtspURL(sms);
+ UsageEnvironment& env = rtspServer->envir();
+ env << "\n\"" << streamName << "\" stream, from the file \""
+ << inputFileName << "\"\n";
+ env << "Play this stream using the URL \"" << url << "\"\n";
+ delete[] url;
+}

0 comments on commit 8305f4b

Please sign in to comment.