summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorrtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-06-06 14:53:03 +0000
committerrtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-06-06 14:53:03 +0000
commitc7d1f1733e285184b5b818c75d397171acbb2276 (patch)
tree1dd050aaaa187292512c494bdb2ee9163483b2f0 /libmpdemux
parent283c3fb6f2098e7ccb2a02491c965eba31eced26 (diff)
downloadmpv-c7d1f1733e285184b5b818c75d397171acbb2276.tar.bz2
mpv-c7d1f1733e285184b5b818c75d397171acbb2276.tar.xz
Use same order as WMP for mms protocols (MMSU, MMST, HTTP)
Patch by adland git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12536 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/asf_streaming.c59
1 files changed, 31 insertions, 28 deletions
diff --git a/libmpdemux/asf_streaming.c b/libmpdemux/asf_streaming.c
index 7dff41a323..a9e9e945be 100644
--- a/libmpdemux/asf_streaming.c
+++ b/libmpdemux/asf_streaming.c
@@ -35,11 +35,6 @@ int asf_http_streaming_start( stream_t *stream, int *demuxer_type );
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 @@ int asf_mmst_streaming_start( stream_t *stream );
// 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);
+
+ // 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;
+ }
- 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 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 @@ asf_streaming_start( stream_t *stream, int *demuxer_type) {
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;
}