changeset 12206:d572c605f665

Try Real rtsp, then live.com on every rtsp stream (remove extension based selection)
author rtognimp
date Wed, 14 Apr 2004 20:45:26 +0000
parents 3eab916cdaa3
children 3c148bdd86d9
files libmpdemux/network.c libmpdemux/realrtsp/rtsp_session.c
diffstat 2 files changed, 15 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/network.c	Wed Apr 14 16:03:13 2004 +0000
+++ b/libmpdemux/network.c	Wed Apr 14 20:45:26 2004 +0000
@@ -685,25 +685,10 @@
 		
 		// Checking for RTSP
 		if( !strcasecmp(url->protocol, "rtsp") ) {
-			// Checking for Real rtsp://
-			// Extension based detection, should be replaced with something based on server answer
-			if( url->file!= NULL ) {
-				char *p;
-				for( p = url->file; p[0]; p++ ) {
-					if( p[0] == '.' && tolower(p[1]) == 'r' && (tolower(p[2]) == 'm' || tolower(p[2]) == 'a') && (!p[3] || p[3] == '?' || p[3] == '&') ) {
-						*file_format = DEMUXER_TYPE_REAL;
-						return 0;
-					}
-				}
-			}
-			mp_msg(MSGT_NETWORK,MSGL_INFO,"Not a Realmedia rtsp url. Trying standard rtsp protocol.\n");
-#ifdef STREAMING_LIVE_DOT_COM
-			*file_format = DEMUXER_TYPE_RTP;
+			// Try Real rtsp:// first (it's always built in)
+			// If it fails, try live.com (if compiled in)
+			*file_format = DEMUXER_TYPE_REAL;
 			return 0;
-#else
-			mp_msg(MSGT_NETWORK,MSGL_ERR,"RTSP support requires the \"LIVE.COM Streaming Media\" libraries!\n");
-			return -1;
-#endif
 		// Checking for SIP
 		} else if( !strcasecmp(url->protocol, "sip") ) {
 #ifdef STREAMING_LIVE_DOT_COM
@@ -1217,10 +1202,20 @@
 	if( (!strcasecmp( stream->streaming_ctrl->url->protocol, "rtsp")) &&
 			(*demuxer_type == DEMUXER_TYPE_REAL)) {
 		stream->fd = -1;
-		ret = realrtsp_streaming_start( stream );
+		if ((ret = realrtsp_streaming_start( stream )) < 0) {
+		    mp_msg(MSGT_NETWORK,MSGL_INFO,"Not a Realmedia rtsp url. Trying standard rtsp protocol.\n");
+#ifdef STREAMING_LIVE_DOT_COM
+		    *demuxer_type =  DEMUXER_TYPE_RTP;
+		    goto try_livedotcom;
+#else
+		    mp_msg(MSGT_NETWORK,MSGL_ERR,"RTSP support requires the \"LIVE.COM Streaming Media\" libraries!\n");
+		    return -1;
+#endif
+		}
 	} else
 
 	// For connection-oriented streams, we can usually determine the streaming type.
+try_livedotcom:
 	switch( *demuxer_type ) {
 		case DEMUXER_TYPE_ASF:
 			// Send the appropriate HTTP request
--- a/libmpdemux/realrtsp/rtsp_session.c	Wed Apr 14 16:03:13 2004 +0000
+++ b/libmpdemux/realrtsp/rtsp_session.c	Wed Apr 14 20:45:26 2004 +0000
@@ -137,7 +137,7 @@
     
   } else
   {
-    printf("rtsp_session: rtsp server type is '%s' instead of Real. Please report.\n",server);
+    printf("rtsp_session: Not a Real server. Server type is '%s'.\n",server);
     rtsp_close(rtsp_session->s);
     free(server);
     free(rtsp_session);