summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authoratmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-04-27 20:42:02 +0000
committeratmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-04-27 20:42:02 +0000
commit26c34c0862cce6f8754f8c08150319f508bebc63 (patch)
tree81c53a8e74cd7470ddcb1465dff8d1231012e59c /libmpdemux
parent89345ecadffc999ada340d19f18153884fed7d5f (diff)
downloadmpv-26c34c0862cce6f8754f8c08150319f508bebc63.tar.bz2
mpv-26c34c0862cce6f8754f8c08150319f508bebc63.tar.xz
Add some info prints to ICY code and handle return codes ICY specific, also avoid printing
content length in http if no Content-Length field in header. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5869 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/network.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/libmpdemux/network.c b/libmpdemux/network.c
index 5efb007496..1cf50f8524 100644
--- a/libmpdemux/network.c
+++ b/libmpdemux/network.c
@@ -416,17 +416,45 @@ extension=NULL;
// Check if the response is an ICY status_code reason_phrase
if( !strcasecmp(http_hdr->protocol, "ICY") ) {
- // Ok, we have detected an mp3 streaming
- *file_format = DEMUXER_TYPE_AUDIO;
+ switch( http_hdr->status_code ) {
+ case 200: { // OK
+ char *field_data = NULL;
+ // note: I skip icy-notice1 and 2, as they contain html <BR>
+ // and are IMHO useless info ::atmos
+ if( (field_data = http_get_field(http_hdr, "icy-name")) != NULL )
+ printf("Name : %s\n", field_data); field_data = NULL;
+ if( (field_data = http_get_field(http_hdr, "icy-genre")) != NULL )
+ printf("Genre : %s\n", field_data); field_data = NULL;
+ if( (field_data = http_get_field(http_hdr, "icy-url")) != NULL )
+ printf("Website: %s\n", field_data); field_data = NULL;
+ // XXX: does this really mean public server? ::atmos
+ if( (field_data = http_get_field(http_hdr, "icy-pub")) != NULL )
+ printf("Public : %s\n", atoi(field_data)?"yes":"no"); field_data = NULL;
+ if( (field_data = http_get_field(http_hdr, "icy-br")) != NULL )
+ printf("Bitrate: %skbit/s\n", field_data); field_data = NULL;
+ // Ok, we have detected an mp3 stream
+ *file_format = DEMUXER_TYPE_AUDIO;
+ return 0;
+ }
+ case 404: // Resource Not Found
+ printf("Error: ICY-Server couldn't find requested stream, skipping!\n");
+ return -1;
+ default:
+ printf("Error: unhandled ICY-Errorcode, contact MPlayer developers!\n");
+ return -1;
+ }
}
-
+
+ // Assume standard http if not ICY
switch( http_hdr->status_code ) {
case 200: // OK
// Look if we can use the Content-Type
content_type = http_get_field( http_hdr, "Content-Type" );
if( content_type!=NULL ) {
+ char *content_length = NULL;
printf("Content-Type: [%s]\n", content_type );
- printf("Content-Length: [%s]\n", http_get_field(http_hdr, "Content-Length") );
+ if( (content_length = http_get_field(http_hdr, "Content-Length")) != NULL)
+ printf("Content-Length: [%s]\n", http_get_field(http_hdr, "Content-Length"));
// Check in the mime type table for a demuxer type
for( i=0 ; i<(sizeof(mime_type_table)/sizeof(mime_type_table[0])) ; i++ ) {
if( !strcasecmp( content_type, mime_type_table[i].mime_type ) ) {