[Mplayer-cvslog] CVS: main/libmpdemux asf_streaming.c,1.48,1.49

Alex Beregszaszi syncmail at mplayerhq.hu
Wed Jul 21 12:18:32 CEST 2004


CVS change done by Alex Beregszaszi

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

Modified Files:
	asf_streaming.c 
Log Message:
reduced code complexity, and also made consistent with other parts

Index: asf_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_streaming.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- asf_streaming.c	21 Jul 2004 10:10:32 -0000	1.48
+++ asf_streaming.c	21 Jul 2004 10:18:29 -0000	1.49
@@ -47,22 +47,21 @@
 
 int
 asf_streaming_start( stream_t *stream, int *demuxer_type) {
-    char *proto_s = stream->streaming_ctrl->url->protocol;
-    int protolen = strlen(proto_s), fd = -1;
+    char *proto = stream->streaming_ctrl->url->protocol;
+    int fd = -1;
 
     // 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 );
+    if (!(!strncasecmp(proto, "mmst", 4) || !strncasecmp(proto, "mmsu", 4) ||
+	!strncasecmp(proto, "http_proxy", 10) || !strncasecmp(proto, "mms", 3) ||
+	!strncasecmp(proto, "http", 4)))
+    {
+        mp_msg(MSGT_NETWORK,MSGL_ERR,"Unknown protocol: %s\n", proto );
         return -1;
     }
 
     // Is protocol mms or mmsu?
-    if ( protolen==3 || (protolen==4 &&  !strcasecmp( proto_s, "mmsu")) ) {
+    if (!strncasecmp(proto, "mmsu", 4) || !strncasecmp(proto, "mms", 3))
+    {
 		mp_msg(MSGT_NETWORK,MSGL_V,"Trying ASF/UDP...\n");
 		//fd = asf_mmsu_streaming_start( stream );
 		if( fd>-1 ) return fd; //mmsu support is not implemented yet - using this code
@@ -71,7 +70,8 @@
 	}
 
     //Is protocol mms or mmst?
-    if (protolen==3 ||  (protolen==4 && !strcasecmp( proto_s, "mmst")) ) {
+    if (!strncasecmp(proto, "mmst", 4) || !strncasecmp(proto, "mms", 3))
+    {
 		mp_msg(MSGT_NETWORK,MSGL_V,"Trying ASF/TCP...\n");
 		fd = asf_mmst_streaming_start( stream );
 		if( fd>-1 ) return fd;
@@ -80,7 +80,9 @@
 	}
 
     //Is protocol http, http_proxy, or mms? 
-    if  (protolen==10 || protolen==3 || (protolen==4 && !strcasecmp(proto_s,"http")) ) {
+    if (!strncasecmp(proto, "http_proxy", 10) || !strncasecmp(proto, "http", 4) ||
+	!strncasecmp(proto, "mms", 3))
+    {
 		mp_msg(MSGT_NETWORK,MSGL_V,"Trying ASF/HTTP...\n");
 		fd = asf_http_streaming_start( stream, demuxer_type );
 		if( fd>-1 ) return fd;




More information about the MPlayer-cvslog mailing list