summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-07-21 10:18:29 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-07-21 10:18:29 +0000
commit42ffc6668a6ba8e6626b23222d3bbd240c804e0e (patch)
tree5551297ddcf37d418fe208d4a05bfc879537a98d /libmpdemux
parent2ee5c42565edb4334f4c8c076ce02fbef08a7ffa (diff)
downloadmpv-42ffc6668a6ba8e6626b23222d3bbd240c804e0e.tar.bz2
mpv-42ffc6668a6ba8e6626b23222d3bbd240c804e0e.tar.xz
reduced code complexity, and also made consistent with other parts
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12880 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/asf_streaming.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/libmpdemux/asf_streaming.c b/libmpdemux/asf_streaming.c
index efb89b543a..bbaa9c7482 100644
--- a/libmpdemux/asf_streaming.c
+++ b/libmpdemux/asf_streaming.c
@@ -47,22 +47,21 @@ int asf_mmst_streaming_start( stream_t *stream );
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 @@ asf_streaming_start( stream_t *stream, int *demuxer_type) {
}
//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 @@ asf_streaming_start( stream_t *stream, int *demuxer_type) {
}
//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;