[SCM] liblivemedia/master: Imported Upstream version 2010.10.06

xtophe-guest at users.alioth.debian.org xtophe-guest at users.alioth.debian.org
Mon Oct 11 22:47:47 UTC 2010


The following commit has been merged in the master branch:
commit 2ac43e38094777baa50cea2abd9413dcedb39ed5
Author: Christophe Mutricy <xtophe at videolan.org>
Date:   Mon Oct 11 22:11:02 2010 +0100

    Imported Upstream version 2010.10.06

diff --git a/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh b/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh
index ee65613..8a41ddf 100644
--- a/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh
+++ b/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh
@@ -4,7 +4,7 @@
 #ifndef _BASICUSAGEENVIRONMENT_VERSION_HH
 #define _BASICUSAGEENVIRONMENT_VERSION_HH
 
-#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_STRING	"2010.09.25"
-#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_INT		1285372800
+#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_STRING	"2010.10.06"
+#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_INT		1286323200
 
 #endif
diff --git a/UsageEnvironment/include/UsageEnvironment_version.hh b/UsageEnvironment/include/UsageEnvironment_version.hh
index cfd2ef4..222fdbe 100644
--- a/UsageEnvironment/include/UsageEnvironment_version.hh
+++ b/UsageEnvironment/include/UsageEnvironment_version.hh
@@ -4,7 +4,7 @@
 #ifndef _USAGEENVIRONMENT_VERSION_HH
 #define _USAGEENVIRONMENT_VERSION_HH
 
-#define USAGEENVIRONMENT_LIBRARY_VERSION_STRING	"2010.09.25"
-#define USAGEENVIRONMENT_LIBRARY_VERSION_INT		1285372800
+#define USAGEENVIRONMENT_LIBRARY_VERSION_STRING	"2010.10.06"
+#define USAGEENVIRONMENT_LIBRARY_VERSION_INT		1286323200
 
 #endif
diff --git a/groupsock/GroupsockHelper.cpp b/groupsock/GroupsockHelper.cpp
index 5fe49e3..2da0583 100644
--- a/groupsock/GroupsockHelper.cpp
+++ b/groupsock/GroupsockHelper.cpp
@@ -633,12 +633,16 @@ char const* timestampString() {
 #if !defined(_WIN32_WCE)
   static char timeString[9]; // holds hh:mm:ss plus trailing '\0'
   char const* ctimeResult = ctime((time_t*)&tvNow.tv_sec);
-  char const* from = &ctimeResult[11];
-  int i;
-  for (i = 0; i < 8; ++i) {
-    timeString[i] = from[i];
+  if (ctimeResult == NULL) {
+    sprintf(timeString, "??:??:??");
+  } else {
+    char const* from = &ctimeResult[11];
+    int i;
+    for (i = 0; i < 8; ++i) {
+      timeString[i] = from[i];
+    }
+    timeString[i] = '\0';
   }
-  timeString[i] = '\0';
 #else
   // WinCE apparently doesn't have "ctime()", so instead, construct
   // a timestamp string just using the integer and fractional parts
diff --git a/groupsock/include/groupsock_version.hh b/groupsock/include/groupsock_version.hh
index 286bd29..94216e3 100644
--- a/groupsock/include/groupsock_version.hh
+++ b/groupsock/include/groupsock_version.hh
@@ -4,7 +4,7 @@
 #ifndef _GROUPSOCK_VERSION_HH
 #define _GROUPSOCK_VERSION_HH
 
-#define GROUPSOCK_LIBRARY_VERSION_STRING	"2010.09.25"
-#define GROUPSOCK_LIBRARY_VERSION_INT		1285372800
+#define GROUPSOCK_LIBRARY_VERSION_STRING	"2010.10.06"
+#define GROUPSOCK_LIBRARY_VERSION_INT		1286323200
 
 #endif
diff --git a/liveMedia/Makefile.tail b/liveMedia/Makefile.tail
index ad685f2..d91664f 100644
--- a/liveMedia/Makefile.tail
+++ b/liveMedia/Makefile.tail
@@ -33,7 +33,7 @@ RTP_INTERFACE_OBJS = RTPInterface.$(OBJ)
 RTP_OBJS = $(RTP_SOURCE_OBJS) $(RTP_SINK_OBJS) $(RTP_INTERFACE_OBJS)
 
 RTCP_OBJS = RTCP.$(OBJ) rtcp_from_spec.$(OBJ)
-RTSP_OBJS = RTSPServer.$(OBJ) RTSPOverHTTPServer.$(OBJ) RTSPClient.$(OBJ) RTSPCommon.$(OBJ)
+RTSP_OBJS = RTSPServer.$(OBJ) RTSPClient.$(OBJ) RTSPCommon.$(OBJ)
 SIP_OBJS = SIPClient.$(OBJ)
 
 SESSION_OBJS = MediaSession.$(OBJ) ServerMediaSession.$(OBJ) PassiveServerMediaSubsession.$(OBJ) OnDemandServerMediaSubsession.$(OBJ) FileServerMediaSubsession.$(OBJ) MPEG4VideoFileServerMediaSubsession.$(OBJ) H263plusVideoFileServerMediaSubsession.$(OBJ) WAVAudioFileServerMediaSubsession.$(OBJ) AMRAudioFileServerMediaSubsession.$(OBJ) MP3AudioFileServerMediaSubsession.$(OBJ) MPEG1or2VideoFileServerMediaSubsession.$(OBJ) MPEG1or2FileServerDemux.$(OBJ) MPEG1or2DemuxedServerMediaSubsession.$(OBJ) MPEG2TransportFileServerMediaSubsession.$(OBJ) ADTSAudioFileServerMediaSubsession.$(OBJ) DVVideoFileServerMediaSubsession.$(OBJ)
@@ -238,8 +238,6 @@ rtcp_from_spec.$(C):	rtcp_from_spec.h
 RTSPServer.$(CPP):	include/RTSPServer.hh include/RTSPCommon.hh
 include/RTSPServer.hh:		include/ServerMediaSession.hh include/DigestAuthentication.hh include/RTSPCommon.hh
 include/ServerMediaSession.hh:	include/Media.hh include/RTPInterface.hh
-RTSPOverHTTPServer.$(CPP):	include/RTSPOverHTTPServer.hh include/RTSPCommon.hh
-include/RTSPOverHTTPServer.hh:	include/Media.hh
 RTSPClient.$(CPP):	include/RTSPClient.hh  include/RTSPCommon.hh include/Base64.hh include/Locale.hh our_md5.h
 include/RTSPClient.hh:		include/MediaSession.hh include/DigestAuthentication.hh
 RTSPCommon.$(CPP):	include/RTSPCommon.hh include/Locale.hh
@@ -296,7 +294,7 @@ include/liveMedia.hh:: include/MPEG1or2AudioRTPSink.hh include/MP3ADURTPSink.hh
 
 include/liveMedia.hh::	include/MPEG2TransportStreamFromPESSource.hh include/MPEG2TransportStreamFromESSource.hh include/MPEG2TransportStreamFramer.hh include/ADTSAudioFileSource.hh include/H261VideoRTPSource.hh include/H263plusVideoRTPSource.hh include/H264VideoRTPSource.hh include/MP3HTTPSource.hh include/MP3ADU.hh include/MP3ADUinterleaving.hh include/MP3Transcoder.hh include/MPEG1or2DemuxedElementaryStream.hh include/MPEG1or2AudioStreamFramer.hh include/MPEG1or2VideoStreamDiscreteFramer.hh include/MPEG4VideoStreamDiscreteFramer.hh include/H263plusVideoStreamFramer.hh include/AC3AudioStreamFramer.hh include/AC3AudioRTPSource.hh include/AC3AudioRTPSink.hh include/MPEG4GenericRTPSink.hh include/DeviceSource.hh include/AudioInputDevice.hh include/WAVAudioFileSource.hh
 
-include/liveMedia.hh:: include/RTSPServer.hh include/RTSPOverHTTPServer.hh include/RTSPClient.hh include/SIPClient.hh include/QuickTimeFileSink.hh include/QuickTimeGenericRTPSource.hh include/AVIFileSink.hh include/PassiveServerMediaSubsession.hh include/MPEG4VideoFileServerMediaSubsession.hh include/WAVAudioFileServerMediaSubsession.hh include/AMRAudioFileServerMediaSubsession.hh include/AMRAudioFileSource.hh include/AMRAudioRTPSink.hh include/MP3AudioFileServerMediaSubsession.hh include/MPEG1or2VideoFileServerMediaSubsession.hh include/MPEG1or2FileServerDemux.hh include/MPEG2TransportFileServerMediaSubsession.hh include/H263plusVideoFileServerMediaSubsession.hh include/ADTSAudioFileServerMediaSubsession.hh include/DVVideoFileServerMediaSubsession.hh include/DarwinInjector.hh
+include/liveMedia.hh:: include/RTSPServer.hh include/RTSPClient.hh include/SIPClient.hh include/QuickTimeFileSink.hh include/QuickTimeGenericRTPSource.hh include/AVIFileSink.hh include/PassiveServerMediaSubsession.hh include/MPEG4VideoFileServerMediaSubsession.hh include/WAVAudioFileServerMediaSubsession.hh include/AMRAudioFileServerMediaSubsession.hh include/AMRAudioFileSource.hh include/AMRAudioRTPSink.hh include/MP3AudioFileServerMediaSubsession.hh include/MPEG1or2VideoFileServerMediaSubsession.hh include/MPEG1or2FileServerDemux.hh include/MPEG2TransportFileServerMediaSubsession.hh include/H263plusVideoFileServerMediaSubsession.hh include/ADTSAudioFileServerMediaSubsession.hh include/DVVideoFileServerMediaSubsession.hh include/DarwinInjector.hh
 
 clean:
 	-rm -rf *.$(OBJ) $(ALL) core *.core *~ include/*~
diff --git a/liveMedia/RTSPClient.cpp b/liveMedia/RTSPClient.cpp
index f1f03b1..ace8457 100644
--- a/liveMedia/RTSPClient.cpp
+++ b/liveMedia/RTSPClient.cpp
@@ -804,16 +804,13 @@ void RTSPClient::handleRequestError(RequestRecord* request) {
 }
 
 Boolean RTSPClient
-::parseResponseCode(char const* line, unsigned& responseCode, char const*& responseString, Boolean& responseIsHTTP) {
-  responseIsHTTP = False; // by default
-  if (sscanf(line, "RTSP/%*s%u", &responseCode) != 1) {
-    if (sscanf(line, "HTTP/%*s%u", &responseCode) != 1) return False;
-    responseIsHTTP = True;
-    // Note: We check for HTTP responses as well as RTSP responses, both in order to setup RTSP-over-HTTP tunneling,
-    // and so that we get back a meaningful error if the client tried to mistakenly send a RTSP command to a HTTP-only server.
-  }
+::parseResponseCode(char const* line, unsigned& responseCode, char const*& responseString) {
+  if (sscanf(line, "RTSP/%*s%u", &responseCode) != 1 &&
+      sscanf(line, "HTTP/%*s%u", &responseCode) != 1) return False;
+  // Note: We check for HTTP responses as well as RTSP responses, both in order to setup RTSP-over-HTTP tunneling,
+  // and so that we get back a meaningful error if the client tried to mistakenly send a RTSP command to a HTTP-only server.
 
-  // Use everything after the RTSP/* as the response string:
+  // Use everything after the RTSP/* (or HTTP/*) as the response string:
   responseString = line;
   while (responseString[0] != '\0' && responseString[0] != ' '  && responseString[0] != '\t') ++responseString;
   while (responseString[0] != '\0' && (responseString[0] == ' '  || responseString[0] == '\t')) ++responseString; // skip whitespace
@@ -1221,6 +1218,8 @@ void RTSPClient::responseHandlerForHTTP_GET(RTSPClient* rtspClient, int response
 void RTSPClient::responseHandlerForHTTP_GET1(int responseCode, char* responseString) {
   RequestRecord* request;
   do {
+    if (responseCode != 0) break; // The HTTP "GET" failed.
+
     // Having successfully set up (using the HTTP "GET" command) the server->client link, set up a second TCP connection
     // (to the same server & port as before) for the client->server link.  All future output will be to this new socket.
     fOutputSocketNum = setupStreamSocket(envir(), 0);
@@ -1394,7 +1393,6 @@ void RTSPClient::handleResponseBytes(int newBytesRead) {
   char* headerDataCopy;
   unsigned responseCode = 200;
   char const* responseStr = NULL;
-  Boolean responseIsHTTP = False;
   RequestRecord* foundRequest = NULL;
   char const* sessionParamsStr = NULL;
   char const* transportParamsStr = NULL;
@@ -1413,7 +1411,7 @@ void RTSPClient::handleResponseBytes(int newBytesRead) {
 
     char* lineStart = headerDataCopy;
     char* nextLineStart = getLine(lineStart);
-    if (!parseResponseCode(lineStart, responseCode, responseStr, responseIsHTTP)) {
+    if (!parseResponseCode(lineStart, responseCode, responseStr)) {
       // This does not appear to be a RTSP response; perhaps it's a RTSP request instead?
       handleIncomingRequest();
       break; // we're done with this data
@@ -1482,8 +1480,8 @@ void RTSPClient::handleResponseBytes(int newBytesRead) {
     }
     if (!reachedEndOfHeaders) break; // an error occurred
 
-    if (foundRequest == NULL && responseIsHTTP) {
-      // Hack: HTTP responses don't have a "CSeq:" header, so if we got a HTTP response, assume it's for our most recent request:
+    if (foundRequest == NULL) {
+      // Hack: The response didn't have a "CSeq:" header; assume it's for our most recent request:
       foundRequest = fRequestsAwaitingResponse.dequeue();
     }
 
diff --git a/liveMedia/RTSPOverHTTPServer.cpp b/liveMedia/RTSPOverHTTPServer.cpp
deleted file mode 100644
index e9ff30c..0000000
--- a/liveMedia/RTSPOverHTTPServer.cpp
+++ /dev/null
@@ -1,379 +0,0 @@
-/**********
-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 2.1 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
-**********/
-// "liveMedia"
-// Copyright (c) 1996-2010 Live Networks, Inc.  All rights reserved.
-// A simple HTTP server that acts solely to implement RTSP-over-HTTP tunneling
-// (to a separate RTSP server), as described in
-// http://developer.apple.com/documentation/QuickTime/QTSS/Concepts/chapter_2_section_14.html
-// Implementation
-
-#include "RTSPOverHTTPServer.hh"
-#include "RTSPCommon.hh"
-#include <GroupsockHelper.hh>
-
-#include <string.h>
-#if defined(__WIN32__) || defined(_WIN32) || defined(_QNX4)
-#define snprintf _snprintf
-#else
-#include <signal.h>
-#define USE_SIGNALS 1
-#endif
-
-
-#define DEBUG 1 //#####@@@@@
-///////// RTSPOverHTTPServer implementation //////////
-
-#define HTTP_PARAM_STRING_MAX 100
-
-RTSPOverHTTPServer*
-RTSPOverHTTPServer::createNew(UsageEnvironment& env, Port ourHTTPPort,
-			      Port rtspServerPort, char const* rtspServerHostName) {
-  int ourSocket = -1;
-
-  do {
-    ourSocket = setUpOurSocket(env, ourHTTPPort);
-    if (ourSocket == -1) break;
-
-    return new RTSPOverHTTPServer(env, ourSocket, rtspServerPort, rtspServerHostName);
-  } while (0);
-
-  if (ourSocket != -1) ::closeSocket(ourSocket);
-  return NULL;
-}
-
-#define LISTEN_BACKLOG_SIZE 20
-
-int RTSPOverHTTPServer::setUpOurSocket(UsageEnvironment& env, Port& ourPort) {
-  int ourSocket = -1;
-
-  do {
-    NoReuse dummy; // Don't use this socket if there's already a local server using it
-
-    ourSocket = setupStreamSocket(env, ourPort);
-    if (ourSocket < 0) break;
-
-    // Make sure we have a big send buffer:
-    if (!increaseSendBufferTo(env, ourSocket, 50*1024)) break;
-
-    // Allow multiple simultaneous connections:
-    if (listen(ourSocket, LISTEN_BACKLOG_SIZE) < 0) {
-      env.setResultErrMsg("listen() failed: ");
-      break;
-    }
-
-    if (ourPort.num() == 0) {
-      // bind() will have chosen a port for us; return it also:
-      if (!getSourcePort(env, ourSocket, ourPort)) break;
-    }
-
-    return ourSocket;
-  } while (0);
-
-  if (ourSocket != -1) ::closeSocket(ourSocket);
-  return -1;
-}
-
-RTSPOverHTTPServer
-::RTSPOverHTTPServer(UsageEnvironment& env, int ourSocket,
-		     Port rtspServerPort, char const* rtspServerHostName)
-  : Medium(env),
-    fServerSocket(ourSocket),
-    fRTSPServerPort(rtspServerPort), fRTSPServerHostName(strDup(rtspServerHostName)) {
-#ifdef USE_SIGNALS
-  // Ignore the SIGPIPE signal, so that clients on the same host that are killed
-  // don't also kill us:
-  signal(SIGPIPE, SIG_IGN);
-#endif
-
-  // Arrange to handle connections from others:
-  env.taskScheduler().turnOnBackgroundReadHandling(fServerSocket,
-	   (TaskScheduler::BackgroundHandlerProc*)&incomingConnectionHandler,
-						   this);
-}
-
-RTSPOverHTTPServer::~RTSPOverHTTPServer() {
-  delete[] fRTSPServerHostName;
-}
-
-void RTSPOverHTTPServer::incomingConnectionHandler(void* instance, int /*mask*/) {
-  RTSPOverHTTPServer* server = (RTSPOverHTTPServer*)instance;
-  server->incomingConnectionHandler1();
-}
-
-void RTSPOverHTTPServer::incomingConnectionHandler1() {
-  struct sockaddr_in clientAddr;
-  SOCKLEN_T clientAddrLen = sizeof clientAddr;
-  int clientSocket = accept(fServerSocket, (struct sockaddr*)&clientAddr,
-                            &clientAddrLen);
-  if (clientSocket < 0) {
-    int err = envir().getErrno();
-    if (err != EWOULDBLOCK) {
-      envir().setResultErrMsg("accept() failed: ");
-    }
-    return;
-  }
-  makeSocketNonBlocking(clientSocket);
-  increaseSendBufferTo(envir(), clientSocket, 50*1024);
-#if defined(DEBUG) || defined(DEBUG_CONNECTIONS)
-  fprintf(stderr, "accept()ed connection from %s\n", our_inet_ntoa(clientAddr.sin_addr));
-#endif
-
-  // Create a new object for handling this HTTP connection:
-  new HTTPClientConnection(*this, clientSocket);
-}
-
-
-////////// HTTPClientConnection implementation /////////
-
-RTSPOverHTTPServer::HTTPClientConnection
-::HTTPClientConnection(RTSPOverHTTPServer& ourServer, int clientSocket)
-  : fOurServer(ourServer), fClientSocket(clientSocket), fSessionIsActive(True) {
-  // Arrange to handle incoming requests:
-  resetRequestBuffer();
-  envir().taskScheduler().turnOnBackgroundReadHandling(fClientSocket,
-	       (TaskScheduler::BackgroundHandlerProc*)&incomingRequestHandler, this);
-}
-
-RTSPOverHTTPServer::HTTPClientConnection
-::~HTTPClientConnection() {
-  // Turn off background read handling:
-  envir().taskScheduler().turnOffBackgroundReadHandling(fClientSocket);
-
-  ::closeSocket(fClientSocket);
-}
-
-void RTSPOverHTTPServer::HTTPClientConnection
-::incomingRequestHandler(void* instance, int /*mask*/) {
-  HTTPClientConnection* connection = (HTTPClientConnection*)instance;
-  connection->incomingRequestHandler1();
-}
-
-void RTSPOverHTTPServer::HTTPClientConnection::incomingRequestHandler1() {
-  struct sockaddr_in dummy; // 'from' address, meaningless in this case
-  Boolean endOfMsg = False;
-  unsigned char* ptr = &fRequestBuffer[fRequestBytesAlreadySeen];
-
-  int bytesRead = readSocket(envir(), fClientSocket,
-                             ptr, fRequestBufferBytesLeft, dummy);
-  if (bytesRead <= 0 || (unsigned)bytesRead >= fRequestBufferBytesLeft) {
-    // Either the client socket has died, or the request was too big for us.
-    // Terminate this connection:
-#ifdef DEBUG
-    fprintf(stderr, "HTTPClientConnection[%p]::incomingRequestHandler1() read %d bytes (of %d); terminating connection!\n", this, bytesRead, fRequestBufferBytesLeft);
-#endif
-    delete this;
-    return;
-  }
-#ifdef DEBUG
-  ptr[bytesRead] = '\0';
-  fprintf(stderr, "HTTPClientConnection[%p]::incomingRequestHandler1() read %d bytes:%s\n",
-	  this, bytesRead, ptr);
-#endif
-
-  // Look for the end of the message: <CR><LF><CR><LF>
-  unsigned char *tmpPtr = ptr;
-  if (fRequestBytesAlreadySeen > 0) --tmpPtr;
-  // in case the last read ended with a <CR>
-  while (tmpPtr < &ptr[bytesRead-1]) {
-    if (*tmpPtr == '\r' && *(tmpPtr+1) == '\n') {
-      if (tmpPtr - fLastCRLF == 2) { // This is it:
-        endOfMsg = 1;
-        break;
-      }
-      fLastCRLF = tmpPtr;
-    }
-    ++tmpPtr;
-  }
-
-  fRequestBufferBytesLeft -= bytesRead;
-  fRequestBytesAlreadySeen += bytesRead;
-
-  if (!endOfMsg) return; // subsequent reads will be needed to complete the request
-
-  // Parse the request string to get the (few) parameters that we care about,
-  // then handle the command:
-  fRequestBuffer[fRequestBytesAlreadySeen] = '\0';
-  char cmdName[HTTP_PARAM_STRING_MAX];
-  char sessionCookie[HTTP_PARAM_STRING_MAX];
-  char acceptStr[HTTP_PARAM_STRING_MAX];
-  char contentTypeStr[HTTP_PARAM_STRING_MAX];
-  if (!parseHTTPRequestString(cmdName, sizeof cmdName,
-			  sessionCookie, sizeof sessionCookie,
-			  acceptStr, sizeof acceptStr,
-			  contentTypeStr, sizeof contentTypeStr)) {
-#ifdef DEBUG
-    fprintf(stderr, "parseHTTPRTSPRequestString() failed!\n");
-#endif
-    handleCmd_bad();
-  } else {
-#ifdef DEBUG
-    fprintf(stderr, "parseHTTPRTSPRequestString() returned cmdName \"%s\", sessionCookie \"%s\", acceptStr \"%s\", contentTypeStr \"%s\"\n", cmdName, sessionCookie, acceptStr, contentTypeStr);
-#endif
-#if 0
-    if (strcmp(cmdName, "OPTIONS") == 0) {
-      handleCmd_OPTIONS(cseq);
-    } else if (strcmp(cmdName, "DESCRIBE") == 0) {
-      handleCmd_DESCRIBE(cseq, urlSuffix, (char const*)fRequestBuffer);
-    } else if (strcmp(cmdName, "SETUP") == 0) {
-      handleCmd_SETUP(cseq, urlPreSuffix, urlSuffix, (char const*)fRequestBuffer);
-    } else if (strcmp(cmdName, "TEARDOWN") == 0
-               || strcmp(cmdName, "PLAY") == 0
-               || strcmp(cmdName, "PAUSE") == 0
-               || strcmp(cmdName, "GET_PARAMETER") == 0
-               || strcmp(cmdName, "SET_PARAMETER") == 0) {
-      handleCmd_withinSession(cmdName, urlPreSuffix, urlSuffix, cseq,
-                              (char const*)fRequestBuffer);
-    } else {
-      handleCmd_notSupported(cseq);
-    }
-#endif
-  }
-
-#ifdef DEBUG
-  fprintf(stderr, "sending response: %s", fResponseBuffer);
-#endif
-  send(fClientSocket, (char const*)fResponseBuffer, strlen((char*)fResponseBuffer), 0);
-
-  resetRequestBuffer(); // to prepare for any subsequent request
-  if (!fSessionIsActive) delete this;
-}
-
-void RTSPOverHTTPServer::HTTPClientConnection::resetRequestBuffer() {
-  fRequestBytesAlreadySeen = 0;
-  fRequestBufferBytesLeft = sizeof fRequestBuffer;
-  fLastCRLF = &fRequestBuffer[-3]; // hack
-}
-
-Boolean RTSPOverHTTPServer::HTTPClientConnection::
-parseHTTPRequestString(char* resultCmdName,
-		   unsigned resultCmdNameMaxSize,
-		   char* sessionCookie,
-		   unsigned sessionCookieMaxSize,
-		   char* acceptStr,
-		   unsigned acceptStrMaxSize,
-		   char* contentTypeStr,
-		   unsigned contentTypeStrMaxSize) {
-  return False; //#####@@@@@
-#if 0
-  // This parser is currently rather dumb; it should be made smarter #####
-
-  // Read everything up to the first space as the command name:
-  Boolean parseSucceeded = False;
-  unsigned i;
-  for (i = 0; i < resultCmdNameMaxSize-1 && i < reqStrSize; ++i) {
-    char c = reqStr[i];
-    if (c == ' ' || c == '\t') {
-      parseSucceeded = True;
-      break;
-    }
-
-    resultCmdName[i] = c;
-  }
-  resultCmdName[i] = '\0';
-  if (!parseSucceeded) return False;
-
-  // Skip over the prefix of any "rtsp://" or "rtsp:/" URL that follows:
-  unsigned j = i+1;
-  while (j < reqStrSize && (reqStr[j] == ' ' || reqStr[j] == '\t')) ++j; // skip over any additional white space
-   for (j = i+1; j < reqStrSize-8; ++j) {
-     if ((reqStr[j] == 'r' || reqStr[j] == 'R')
-	 && (reqStr[j+1] == 't' || reqStr[j+1] == 'T')
-	 && (reqStr[j+2] == 's' || reqStr[j+2] == 'S')
-	 && (reqStr[j+3] == 'p' || reqStr[j+3] == 'P')
-	 && reqStr[j+4] == ':' && reqStr[j+5] == '/') {
-       j += 6;
-       if (reqStr[j] == '/') {
-	 // This is a "rtsp://" URL; skip over the host:port part that follows:
-	 ++j;
-	 while (j < reqStrSize && reqStr[j] != '/' && reqStr[j] != ' ') ++j;
-       } else {
-	 // This is a "rtsp:/" URL; back up to the "/":
-	 --j;
-       }
-       i = j;
-       break;
-     }
-   }
-
- // Look for the URL suffix (before the following "RTSP/"):
- parseSucceeded = False;
- for (unsigned k = i+1; k < reqStrSize-5; ++k) {
-   if (reqStr[k] == 'R' && reqStr[k+1] == 'T' &&
-       reqStr[k+2] == 'S' && reqStr[k+3] == 'P' && reqStr[k+4] == '/') {
-     while (--k >= i && reqStr[k] == ' ') {} // go back over all spaces before "RTSP/"
-      unsigned k1 = k;
-      while (k1 > i && reqStr[k1] != '/' && reqStr[k1] != ' ') --k1;
-      // the URL suffix comes from [k1+1,k]
-
-      // Copy "resultURLSuffix":
-      if (k - k1 + 1 > resultURLSuffixMaxSize) return False; // there's no room
-      unsigned n = 0, k2 = k1+1;
-      while (k2 <= k) resultURLSuffix[n++] = reqStr[k2++];
-      resultURLSuffix[n] = '\0';
-
-      // Also look for the URL 'pre-suffix' before this:
-      unsigned k3 = --k1;
-      while (k3 > i && reqStr[k3] != '/' && reqStr[k3] != ' ') --k3;
-      // the URL pre-suffix comes from [k3+1,k1]
-
-      // Copy "resultURLPreSuffix":
-      if (k1 - k3 + 1 > resultURLPreSuffixMaxSize) return False; // there's no room
-      n = 0; k2 = k3+1;
-      while (k2 <= k1) resultURLPreSuffix[n++] = reqStr[k2++];
-      resultURLPreSuffix[n] = '\0';
-
-      i = k + 7; // to go past " RTSP/"
-      parseSucceeded = True;
-      break;
-    }
-  }
-  if (!parseSucceeded) return False;
-
-  // Look for "CSeq:", skip whitespace,
-  // then read everything up to the next \r or \n as 'CSeq':
-  parseSucceeded = False;
-  for (j = i; j < reqStrSize-5; ++j) {
-    if (reqStr[j] == 'C' && reqStr[j+1] == 'S' && reqStr[j+2] == 'e' &&
-        reqStr[j+3] == 'q' && reqStr[j+4] == ':') {
-      j += 5;
-      unsigned n;
-      while (j < reqStrSize && (reqStr[j] ==  ' ' || reqStr[j] == '\t')) ++j;
-      for (n = 0; n < resultCSeqMaxSize-1 && j < reqStrSize; ++n,++j) {
-        char c = reqStr[j];
-        if (c == '\r' || c == '\n') {
-          parseSucceeded = True;
-          break;
-        }
-
-        resultCSeq[n] = c;
-      }
-      resultCSeq[n] = '\0';
-      break;
-    }
-  }
-  if (!parseSucceeded) return False;
-
-  return True;
-#endif
-}
-
-static char const* allowedCommandNames = "GET, PUT";
-
-void RTSPOverHTTPServer::HTTPClientConnection::handleCmd_bad() {
-  snprintf((char*)fResponseBuffer, sizeof fResponseBuffer,
-           "HTTP/1.1 400 Bad Request\r\nAllow: %s\r\n\r\n",
-           allowedCommandNames);
-}
diff --git a/liveMedia/RTSPServer.cpp b/liveMedia/RTSPServer.cpp
index 4dde484..aea5055 100644
--- a/liveMedia/RTSPServer.cpp
+++ b/liveMedia/RTSPServer.cpp
@@ -247,8 +247,7 @@ void RTSPServer::incomingConnectionHandler1() {
 ////////// RTSPServer::RTSPClientSession implementation //////////
 
 RTSPServer::RTSPClientSession
-::RTSPClientSession(RTSPServer& ourServer, unsigned sessionId,
-	      int clientSocket, struct sockaddr_in clientAddr)
+::RTSPClientSession(RTSPServer& ourServer, unsigned sessionId, int clientSocket, struct sockaddr_in clientAddr)
   : fOurServer(ourServer), fOurSessionId(sessionId),
     fOurServerMediaSession(NULL),
     fClientSocket(clientSocket), fClientAddr(clientAddr),
@@ -363,8 +362,7 @@ void RTSPServer::RTSPClientSession::handleRequestBytes(int newBytesRead) {
 
   if (!endOfMsg) return; // subsequent reads will be needed to complete the request
 
-  // Parse the request string into command name and 'CSeq',
-  // then handle the command:
+  // Parse the request string into command name and 'CSeq', then handle the command:
   fRequestBuffer[fRequestBytesAlreadySeen] = '\0';
   char cmdName[RTSP_PARAM_STRING_MAX];
   char urlPreSuffix[RTSP_PARAM_STRING_MAX];
diff --git a/liveMedia/include/RTSPClient.hh b/liveMedia/include/RTSPClient.hh
index 2b685fe..7d187f0 100644
--- a/liveMedia/include/RTSPClient.hh
+++ b/liveMedia/include/RTSPClient.hh
@@ -222,7 +222,7 @@ private:
   char* createAuthenticatorString(char const* cmd, char const* url);
   unsigned sendRequest(RequestRecord* request);
   void handleRequestError(RequestRecord* request);
-  Boolean parseResponseCode(char const* line, unsigned& responseCode, char const*& responseString, Boolean& responseIsHTTP);
+  Boolean parseResponseCode(char const* line, unsigned& responseCode, char const*& responseString);
   void handleIncomingRequest();
   static Boolean checkForHeader(char const* line, char const* headerName, unsigned headerNameLength, char const*& headerParams);
   Boolean parseTransportParams(char const* paramsStr,
diff --git a/liveMedia/include/RTSPOverHTTPServer.hh b/liveMedia/include/RTSPOverHTTPServer.hh
deleted file mode 100644
index aaa272e..0000000
--- a/liveMedia/include/RTSPOverHTTPServer.hh
+++ /dev/null
@@ -1,131 +0,0 @@
-/**********
-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 2.1 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
-**********/
-// "liveMedia"
-// Copyright (c) 1996-2010 Live Networks, Inc.  All rights reserved.
-// A simple HTTP server that acts solely to implement RTSP-over-HTTP tunneling
-// (to a separate RTSP server), as described in
-// http://developer.apple.com/documentation/QuickTime/QTSS/Concepts/chapter_2_section_14.html
-// C++ header
-
-#ifndef _RTSP_OVER_HTTP_SERVER_HH
-#define _RTSP_OVER_HTTP_SERVER_HH
-
-#include "Media.hh"
-#include "NetInterface.hh"
-
-#define HTTP_BUFFER_SIZE 10000 // for incoming requests, and outgoing responses
-
-class RTSPOverHTTPServer: public Medium {
-public:
-  static RTSPOverHTTPServer* createNew(UsageEnvironment& env, Port ourHTTPPort = 80,
-				       Port rtspServerPort = 554,
-				       char const* rtspServerHostName = "localhost");
-
-protected:
-  RTSPOverHTTPServer(UsageEnvironment& env, int ourSocket,
-		     Port rtspServerPort, char const* rtspServerHostName);
-      // called only by createNew();
-  virtual ~RTSPOverHTTPServer();
-
-  static int setUpOurSocket(UsageEnvironment& env, Port& ourPort);
-
-private:
-  static void incomingConnectionHandler(void*, int /*mask*/);
-  void incomingConnectionHandler1();
-
-  // The state of each individual connection handled by a HTTP server:
-  class HTTPClientConnection {
-  public:
-    HTTPClientConnection(RTSPOverHTTPServer& ourServer, int clientSocket);
-    virtual ~HTTPClientConnection();
-  private:
-    static void incomingRequestHandler(void*, int /*mask*/);
-    void incomingRequestHandler1();
-    UsageEnvironment& envir() { return fOurServer.envir(); }
-    void resetRequestBuffer();
-    Boolean parseHTTPRequestString(char* resultCmdName,
-				   unsigned resultCmdNameMaxSize,
-				   char* sessionCookie,
-				   unsigned sessionCookieMaxSize,
-				   char* acceptStr,
-				   unsigned acceptStrMaxSize,
-				   char* contentTypeStr,
-				   unsigned contentTypeStrMaxSize);
-    void handleCmd_bad();
-#if 0 //#####@@@@@
-    void handleCmd_notSupported(char const* cseq);
-    void handleCmd_notFound(char const* cseq);
-    void handleCmd_unsupportedTransport(char const* cseq);
-    void handleCmd_OPTIONS(char const* cseq);
-    void handleCmd_DESCRIBE(char const* cseq, char const* urlSuffix,
-			    char const* fullRequestStr);
-    void handleCmd_SETUP(char const* cseq,
-			 char const* urlPreSuffix, char const* urlSuffix,
-			 char const* fullRequestStr);
-    void handleCmd_withinSession(char const* cmdName,
-				 char const* urlPreSuffix, char const* urlSuffix,
-				 char const* cseq, char const* fullRequestStr);
-    void handleCmd_TEARDOWN(ServerMediaSubsession* subsession,
-			    char const* cseq);
-    void handleCmd_PLAY(ServerMediaSubsession* subsession,
-			char const* cseq, char const* fullRequestStr);
-    void handleCmd_PAUSE(ServerMediaSubsession* subsession,
-			 char const* cseq);
-    void handleCmd_GET_PARAMETER(ServerMediaSubsession* subsession,
-				 char const* cseq, char const* fullRequestStr);
-    Boolean authenticationOK(char const* cmdName, char const* cseq,
-			     char const* fullRequestStr);
-    void noteLiveness();
-    Boolean isMulticast() const { return fIsMulticast; }
-    static void noteClientLiveness(HTTPClientConnection* clientConnection);
-    static void livenessTimeoutTask(HTTPClientConnection* clientConnection);
-#endif
-
-  private:
-    RTSPOverHTTPServer& fOurServer;
-#if 0 //#####@@@@@
-    unsigned fOurSessionId;
-    ServerMediaSession* fOurServerMediaSession;
-#endif
-    int fClientSocket;
-#if 0 //#####@@@@@
-    struct sockaddr_in fClientAddr;
-    TaskToken fLivenessCheckTask;
-#endif
-    unsigned char fRequestBuffer[HTTP_BUFFER_SIZE];
-    unsigned fRequestBytesAlreadySeen, fRequestBufferBytesLeft;
-    unsigned char* fLastCRLF;
-    unsigned char fResponseBuffer[HTTP_BUFFER_SIZE];
-    Boolean fSessionIsActive;
-#if 0 //#####@@@@@
-    Authenticator fCurrentAuthenticator; // used if access control is needed
-    unsigned char fTCPStreamIdCount; // used for (optional) RTP/TCP
-    unsigned fNumStreamStates;
-    struct streamState {
-      ServerMediaSubsession* subsession;
-      void* streamToken;
-    } * fStreamStates;
-#endif
-  };
-
-private:
-  friend class RTSPOverHTTPTunnel;
-  int fServerSocket;
-  Port fRTSPServerPort;
-  char* fRTSPServerHostName;
-};
-
-#endif
diff --git a/liveMedia/include/liveMedia.hh b/liveMedia/include/liveMedia.hh
index 78a19f8..120b2b6 100644
--- a/liveMedia/include/liveMedia.hh
+++ b/liveMedia/include/liveMedia.hh
@@ -82,7 +82,6 @@ along with this library; if not, write to the Free Software Foundation, Inc.,
 #include "AudioInputDevice.hh"
 #include "WAVAudioFileSource.hh"
 #include "RTSPServer.hh"
-#include "RTSPOverHTTPServer.hh"
 #include "RTSPClient.hh"
 #include "SIPClient.hh"
 #include "QuickTimeFileSink.hh"
diff --git a/liveMedia/include/liveMedia_version.hh b/liveMedia/include/liveMedia_version.hh
index 4fa44aa..ed2595a 100644
--- a/liveMedia/include/liveMedia_version.hh
+++ b/liveMedia/include/liveMedia_version.hh
@@ -4,7 +4,7 @@
 #ifndef _LIVEMEDIA_VERSION_HH
 #define _LIVEMEDIA_VERSION_HH
 
-#define LIVEMEDIA_LIBRARY_VERSION_STRING	"2010.09.25"
-#define LIVEMEDIA_LIBRARY_VERSION_INT		1285372800
+#define LIVEMEDIA_LIBRARY_VERSION_STRING	"2010.10.06"
+#define LIVEMEDIA_LIBRARY_VERSION_INT		1286323200
 
 #endif
diff --git a/mediaServer/live555MediaServer.cpp b/mediaServer/live555MediaServer.cpp
index 09bbffe..227de2a 100644
--- a/mediaServer/live555MediaServer.cpp
+++ b/mediaServer/live555MediaServer.cpp
@@ -19,7 +19,6 @@ along with this library; if not, write to the Free Software Foundation, Inc.,
 
 #include <BasicUsageEnvironment.hh>
 #include "DynamicRTSPServer.hh"
-#include "RTSPOverHTTPServer.hh"
 #include "version.hh"
 
 int main(int argc, char** argv) {
@@ -70,24 +69,6 @@ int main(int argc, char** argv) {
   *env << "\t\".wav\" => a WAV Audio file\n";
   *env << "See http://www.live555.com/mediaServer/ for additional documentation.\n";
 
-#if 0 // RTSP-over-HTTP tunneling is not yet working
-  // 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 number (8000).
-  RTSPOverHTTPServer* rtspOverHTTPServer;
-  portNumBits httpServerPortNum = 80;
-  rtspOverHTTPServer = RTSPOverHTTPServer::createNew(*env, httpServerPortNum, rtspServerPortNum);
-  if (rtspOverHTTPServer == NULL) {
-    httpServerPortNum = 8000;
-    rtspOverHTTPServer = RTSPOverHTTPServer::createNew(*env, httpServerPortNum, rtspServerPortNum);
-  }
-  if (rtspOverHTTPServer == NULL) {
-    *env << "(No server for RTSP-over-HTTP tunneling was created.)\n";
-  } else {
-    *env << "(We use port " << httpServerPortNum << " for RTSP-over-HTTP tunneling.)\n";
-  }
-#endif
-
   env->taskScheduler().doEventLoop(); // does not return
 
   return 0; // only to prevent compiler warning

-- 
liblivemedia packaging



More information about the pkg-multimedia-commits mailing list