[Mplayer-cvslog] CVS: main/libmpdemux asf_streaming.c,1.45,1.46

Roberto Togni CVS syncmail at mplayerhq.hu
Sun Jun 6 16:53:05 CEST 2004


CVS change done by Roberto Togni CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv581

Modified Files:
	asf_streaming.c 
Log Message:
Use same order as WMP for mms protocols (MMSU, MMST, HTTP)
Patch by adland


Index: asf_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_streaming.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- asf_streaming.c	2 May 2004 16:22:32 -0000	1.45
+++ asf_streaming.c	6 Jun 2004 14:53:03 -0000	1.46
@@ -35,11 +35,6 @@
 int asf_mmst_streaming_start( stream_t *stream );
 
 
-// ASF streaming support several network protocol.
-// One use UDP, not known, yet!
-// Another is HTTP, this one is known.
-// So for now, we use the HTTP protocol.
-// 
 // We can try several protocol for asf streaming
 // * first the UDP protcol, if there is a firewall, UDP
 //   packets will not come back, so the mmsu will failed.
@@ -48,36 +43,38 @@
 //   through
 // * Then we can try HTTP.
 // 
-// Note: 	MMS/HTTP support is now a "well known" support protocol,
-// 		it has been tested for while, not like MMST support.
-// 		WMP sequence is MMSU then MMST and then HTTP.
-// 		In MPlayer case since HTTP support is more reliable,
-// 		we are doing HTTP first then we try MMST if HTTP fail.
+// Note: Using 	WMP sequence  MMSU then MMST and then HTTP.
+
 int
 asf_streaming_start( stream_t *stream, int *demuxer_type) {
 	char proto_s[10];
-	int fd = -1;
+	int protolen, fd = -1;
 	
 	strncpy( proto_s, stream->streaming_ctrl->url->protocol, 10 );
+    protolen=strlen(proto_s);
 
-	if( 	!strncasecmp( proto_s, "http", 4) || 
-		(!strncasecmp( proto_s, "mms", 3) && strncasecmp( proto_s, "mmst", 4)) || 
-		!strncasecmp( proto_s, "http_proxy", 10)
-		) {
-		mp_msg(MSGT_NETWORK,MSGL_V,"Trying ASF/HTTP...\n");
-		fd = asf_http_streaming_start( stream, demuxer_type );
-		if( fd>-1 ) return fd;
-		mp_msg(MSGT_NETWORK,MSGL_V,"  ===> ASF/HTTP failed\n");
-		if( fd==-2 ) return -1;
-	}
-	if( !strncasecmp( proto_s, "mms", 3) && strncasecmp( proto_s, "mmst", 4) ) {
+    // Is protocol even valid mms,mmsu,mmst,http,http_proxy?
+    if (!(
+        (protolen==4 && (!strcasecmp( proto_s, "mmst") || !strcasecmp (proto_s,"mmsu") ||
+        !strcasecmp( proto_s, "http"))) ||
+        (protolen==3 && !strcasecmp(proto_s,"mms")) ||
+        (protolen==10 && !strcasecmp(proto_s,"http_proxy"))
+        )) {
+        mp_msg(MSGT_NETWORK,MSGL_ERR,"Unknown protocol: %s\n", proto_s );
+        return -1;
+    }
+
+    // Is protocol mms or mmsu?
+    if ( protolen==3 || (protolen==4 &&  !strcasecmp( proto_s, "mmsu")) ) {
 		mp_msg(MSGT_NETWORK,MSGL_V,"Trying ASF/UDP...\n");
 		//fd = asf_mmsu_streaming_start( stream );
-		if( fd>-1 ) return fd;
+		if( fd>-1 ) return fd; //mmsu support is not implemented yet - using this code
 		mp_msg(MSGT_NETWORK,MSGL_V,"  ===> ASF/UDP failed\n");
 		if( fd==-2 ) return -1;
 	}
-	if( !strncasecmp( proto_s, "mms", 3) ) {
+
+    //Is protocol mms or mmst?
+    if (protolen==3 ||  (protolen==4 && !strcasecmp( proto_s, "mmst")) ) {
 		mp_msg(MSGT_NETWORK,MSGL_V,"Trying ASF/TCP...\n");
 		fd = asf_mmst_streaming_start( stream );
 		if( fd>-1 ) return fd;
@@ -85,10 +82,16 @@
 		if( fd==-2 ) return -1;
 	}
 
-        if (!strncasecmp( proto_s, "mms", 3) ||  !strncasecmp( proto_s, "http", 4) || !strncasecmp( proto_s, "mmst", 4) || !strncasecmp( proto_s, "http_proxy", 10) )
-        mp_msg(MSGT_NETWORK,MSGL_ERR,"Used protocol %s\n",proto_s );
-	else
-	mp_msg(MSGT_NETWORK,MSGL_ERR,"Unknown protocol: %s\n", proto_s );
+    //Is protocol http, http_proxy, or mms? 
+    if  (protolen==10 || protolen==3 || (protolen==4 && !strcasecmp(proto_s,"http")) ) {
+		mp_msg(MSGT_NETWORK,MSGL_V,"Trying ASF/HTTP...\n");
+		fd = asf_http_streaming_start( stream, demuxer_type );
+		if( fd>-1 ) return fd;
+		mp_msg(MSGT_NETWORK,MSGL_V,"  ===> ASF/HTTP failed\n");
+		if( fd==-2 ) return -1;
+	}
+
+    //everything failed
 	return -1;
 }
 




More information about the MPlayer-cvslog mailing list