[Mplayer-cvslog] CVS: main/libmpdemux asf_streaming.c,1.21,1.22
Bertrand Baudet
bertrand at mplayer.dev.hu
Wed Jan 23 09:50:33 CET 2002
Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv9621/libmpdemux
Modified Files:
asf_streaming.c
Log Message:
Added a turn around for badly configured web servers.
Index: asf_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_streaming.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- asf_streaming.c 20 Jan 2002 21:38:11 -0000 1.21
+++ asf_streaming.c 23 Jan 2002 08:50:30 -0000 1.22
@@ -340,7 +340,18 @@
}
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 @@
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 @@
printf("=====> ASF unknown content-type: %s\n", content_type );
return ASF_Unknown_e;
}
+*/
}
return ASF_Unknown_e;
}
@@ -532,7 +556,7 @@
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 @@
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:
More information about the MPlayer-cvslog
mailing list