[Mplayer-cvslog] CVS: main/libmpdemux network.c,1.79,1.80

Roberto Togni CVS rtognimp at mplayerhq.hu
Fri May 23 21:42:03 CEST 2003


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

Modified Files:
	network.c 
Log Message:
Recognize ra and rm extensions even with query strings,
eg: rstp://www.addr.com/file.rm?var=123
Based on an idea by Felix Buenemann



Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- network.c	3 May 2003 06:14:04 -0000	1.79
+++ network.c	23 May 2003 19:41:37 -0000	1.80
@@ -528,7 +528,7 @@
 int
 autodetectProtocol(streaming_ctrl_t *streaming_ctrl, int *fd_out, int *file_format) {
 	HTTP_header_t *http_hdr;
-	unsigned int i;
+	unsigned int i, j;
 	int fd=-1;
 	int redirect;
 	int auth_retry=0;
@@ -586,17 +586,28 @@
 			// Checking for Real rtsp://
 			// Extension based detection, should be replaced with something based on server answer
 			extension = NULL;
-			if( url->file!=NULL )
-				for( i=strlen(url->file) ; i>0 ; i-- )
+			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=(url->file)+i+1;
+						extension = calloc(j-i, 1);
+						for ( i++; i < j; i++)
+							extension[strlen(extension)]=url->file[i];
+						extension[strlen(extension)]=0;
 						break;
+					}
+				}
 			}
 			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