Commit 706d6807 authored by Clément Stenac's avatar Clément Stenac

* Workaround for buggy IceCast servers who identify themselves as HTTP

and not ICY (who talked about RadioPI ?)
parent c31fd0b4
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* http.c: HTTP access plug-in * http.c: HTTP access plug-in
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: http.c,v 1.43 2003/08/02 19:30:35 bigben Exp $ * $Id: http.c,v 1.44 2003/09/10 13:39:29 zorglub Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -214,6 +214,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell ) ...@@ -214,6 +214,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
psz_parser += strlen("HTTP/1.x"); psz_parser += strlen("HTTP/1.x");
i_size -= strlen("HTTP/1.x"); i_size -= strlen("HTTP/1.x");
} }
else if( ( (size_t)i_size >= strlen("ICY") && else if( ( (size_t)i_size >= strlen("ICY") &&
!strncmp( psz_parser, "ICY", strlen("ICY") ) ) ) !strncmp( psz_parser, "ICY", strlen("ICY") ) ) )
...@@ -233,7 +234,18 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell ) ...@@ -233,7 +234,18 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
msg_Err( p_input, "invalid HTTP reply '%s'", psz_parser ); msg_Err( p_input, "invalid HTTP reply '%s'", psz_parser );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* Check for buggy Icecast servers */
if( strstr( psz_parser , "x-audiocast") )
{
i_protocol = ICY_PROTOCOL;
if( !p_input->psz_demux || !*p_input->psz_demux )
{
msg_Info( p_input, "ICY server found, mp3 demuxer selected" );
p_input->psz_demux = "mp3"; // FIXME strdup ?
}
}
/* Check the HTTP return code */ /* Check the HTTP return code */
i_code = atoi( (char*)psz_parser ); i_code = atoi( (char*)psz_parser );
msg_Dbg( p_input, "%s server replied: %i", msg_Dbg( p_input, "%s server replied: %i",
...@@ -719,7 +731,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -719,7 +731,8 @@ static int Open( vlc_object_t *p_this )
p_access_data->socket_desc.i_ttl = 0; p_access_data->socket_desc.i_ttl = 0;
snprintf( p_access_data->psz_buffer, MAX_QUERY_SIZE, snprintf( p_access_data->psz_buffer, MAX_QUERY_SIZE,
"GET http://%s:%d/%s HTTP/1.0\r\n", "GET http://%s:%d/%s HTTP/1.0\r\n" \
"Icy-Metadata:0\r\n",
psz_server_addr, i_server_port, psz_path ); psz_server_addr, i_server_port, psz_path );
} }
else else
...@@ -731,7 +744,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -731,7 +744,8 @@ static int Open( vlc_object_t *p_this )
p_access_data->socket_desc.i_ttl = 0; p_access_data->socket_desc.i_ttl = 0;
snprintf( p_access_data->psz_buffer, MAX_QUERY_SIZE, snprintf( p_access_data->psz_buffer, MAX_QUERY_SIZE,
"GET /%s HTTP/1.1\r\nHost: %s\r\n", "GET /%s HTTP/1.1\r\nHost: %s\r\n" \
"Icy-Metadata:0\r\n",
psz_path, psz_server_addr ); psz_path, psz_server_addr );
} }
p_access_data->psz_buffer[MAX_QUERY_SIZE - 1] = '\0'; p_access_data->psz_buffer[MAX_QUERY_SIZE - 1] = '\0';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment