[Mplayer-cvslog] CVS: main/libmpdemux network.c,1.87,1.88

Roberto Togni CVS rtognimp at mplayerhq.hu
Sun Nov 23 14:32:16 CET 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv18973

Modified Files:
	network.c 
Log Message:
Add detection of Real rtsp when there are queries in url.
Patch by rgselk <rgselknospam(at)yahoo(dot)com>


Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- network.c	22 Oct 2003 17:54:32 -0000	1.87
+++ network.c	23 Nov 2003 13:31:44 -0000	1.88
@@ -571,7 +571,7 @@
 int
 autodetectProtocol(streaming_ctrl_t *streaming_ctrl, int *fd_out, int *file_format) {
 	HTTP_header_t *http_hdr;
-	unsigned int i, j;
+	unsigned int i;
 	int fd=-1;
 	int redirect;
 	int auth_retry=0;
@@ -628,29 +628,15 @@
 		if( !strcasecmp(url->protocol, "rtsp") ) {
 			// Checking for Real rtsp://
 			// Extension based detection, should be replaced with something based on server answer
-			extension = NULL;
-			if( url->file!=NULL ) {
-				j = strlen(url->file);
-				for( i=j; i>0 ; i-- ) {
-					if( url->file[i]=='?' )
-						j = i;
-					if( url->file[i]=='.' ) {
-						extension = calloc(j-i, 1);
-						for ( i++; i < j; i++)
-							extension[strlen(extension)]=url->file[i];
-						extension[strlen(extension)]=0;
-						break;
+			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;
 					}
 				}
 			}
-			if (extension != NULL && (!strcasecmp(extension, "rm")
-			    || !strcasecmp(extension, "ra"))) {
-				*file_format = DEMUXER_TYPE_REAL;
-				free(extension);
-				return 0;
-			}
-			if (extension != NULL)
-				free(extension);
 			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;



More information about the MPlayer-cvslog mailing list