diff options
author | bertrand <bertrand@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-01-23 08:50:30 +0000 |
---|---|---|
committer | bertrand <bertrand@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-01-23 08:50:30 +0000 |
commit | d00d8ff8bfeba1d997d31646e74bfa1e5cbb5570 (patch) | |
tree | 3f4757ebd0012e7be501b2dc867e6c0f887b6f8a /libmpdemux | |
parent | fcc41f6043584f7d44c5a0e77f3ec3136a3efc33 (diff) | |
download | mpv-d00d8ff8bfeba1d997d31646e74bfa1e5cbb5570.tar.bz2 mpv-d00d8ff8bfeba1d997d31646e74bfa1e5cbb5570.tar.xz |
Added a turn around for badly configured web servers.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4313 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/asf_streaming.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/libmpdemux/asf_streaming.c b/libmpdemux/asf_streaming.c index 2fcc2b019f..de8cf7fe60 100644 --- a/libmpdemux/asf_streaming.c +++ b/libmpdemux/asf_streaming.c @@ -340,7 +340,18 @@ asf_http_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) { } int -asf_http_streaming_type(char *content_type, char *features) { +asf_header_check( HTTP_header_t *http_hdr ) { + ASF_obj_header_t *objh; + if( http_hdr==NULL ) return -1; + if( http_hdr->body==NULL || http_hdr->body_size<sizeof(ASF_obj_header_t) ) return -1; + + objh = (ASF_obj_header_t*)http_hdr->body; + if( ASF_LOAD_GUID_PREFIX(objh->guid)==0x75B22630 ) return 0; + return -1; +} + +int +asf_http_streaming_type(char *content_type, char *features, HTTP_header_t *http_hdr ) { if( content_type==NULL ) return ASF_Unknown_e; if( !strcasecmp(content_type, "application/octet-stream") ) { if( features==NULL ) { @@ -354,6 +365,18 @@ asf_http_streaming_type(char *content_type, char *features) { return ASF_Prerecorded_e; } } else { + // Ok in a perfect world, web servers should be well configured + // so we could used mime type to know the stream type, + // but guess what? All of them are not well configured. + // So we have to check for an asf header :(, but it works :p + if( asf_header_check( http_hdr )==0 ) { + printf("=====> ASF Plain text\n"); + return ASF_PlainText_e; + } else { + printf("=====> ASF Redirector\n"); + return ASF_Redirector_e; + } +/* if( (!strcasecmp(content_type, "audio/x-ms-wax")) || (!strcasecmp(content_type, "audio/x-ms-wma")) || (!strcasecmp(content_type, "video/x-ms-asf")) || @@ -370,6 +393,7 @@ asf_http_streaming_type(char *content_type, char *features) { printf("=====> ASF unknown content-type: %s\n", content_type ); return ASF_Unknown_e; } +*/ } return ASF_Unknown_e; } @@ -532,7 +556,7 @@ asf_http_parse_response( HTTP_header_t *http_hdr ) { pragma = http_get_next_field( http_hdr ); } - return asf_http_streaming_type( content_type, features ); + return asf_http_streaming_type( content_type, features, http_hdr ); } int @@ -624,9 +648,11 @@ asf_http_streaming_start( stream_t *stream ) { printf("No stream found\n"); return -1; } + asf_http_ctrl->request++; + done = 0; + } else { + done = 1; } - asf_http_ctrl->request++; - done = 0; } break; case ASF_Redirector_e: |