changeset 9904:afbbf103a662

Access-controlled RTSP sessions can now be played, if the user uses the "-user" and "-passwd" options.
author rsf
date Fri, 11 Apr 2003 02:35:01 +0000
parents 7d70e56f317a
children e34da62e30f1
files libmpdemux/demux_rtp.cpp
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_rtp.cpp	Thu Apr 10 15:07:59 2003 +0000
+++ b/libmpdemux/demux_rtp.cpp	Fri Apr 11 02:35:01 2003 +0000
@@ -94,6 +94,8 @@
   struct timeval firstSyncTime;
 };
 
+extern "C" char* network_username;
+extern "C" char* network_password;
 int rtspStreamOverTCP = 0; 
 
 extern "C" void demux_open_rtp(demuxer_t* demuxer) {
@@ -124,7 +126,15 @@
 	break;
       }
 
-      sdpDescription = rtspClient->describeURL(url);
+      // If we were given a user name (and optional password), then use them: 
+      if (network_username != NULL) {
+	char const* password
+	  = network_password == NULL ? "" : network_password;
+	sdpDescription
+	  = rtspClient->describeWithPassword(url, network_username, password);
+      } else {
+	sdpDescription = rtspClient->describeURL(url);
+      }
       if (sdpDescription == NULL) {
 	fprintf(stderr, "Failed to get a SDP description from URL \"%s\": %s\n",
 		url, env->getResultMsg());
@@ -306,6 +316,7 @@
   dp->len = dataLen;
   dp->pts = 0;
   bufferQueue->savePendingBuffer(dp);
+  return True;
 }
 
 static void teardownRTSPSession(RTPState* rtpState); // forward