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
This commit is contained in:
rtognimp 2004-06-06 14:53:03 +00:00
parent 283c3fb6f2
commit c7d1f1733e
1 changed files with 31 additions and 28 deletions

View File

@ -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);
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 @@ 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;
}