/*****************************************************************************
* http.c: HTTP input module
*****************************************************************************
- * Copyright (C) 2001-2004 VideoLAN
+ * Copyright (C) 2001-2005 VideoLAN
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
p_sys->i_remaining = 0;
/* Parse URI */
- ParseURL( p_sys, p_access->psz_path );
+ if( vlc_UrlIsNotEncoded( p_access->psz_path ) )
+ {
+ psz = vlc_UrlEncode( p_access->psz_path );
+ if( psz == NULL )
+ {
+ free( p_sys );
+ return VLC_ENOMEM;
+ }
+
+ ParseURL( p_sys, psz );
+ free( psz );
+ }
+ else
+ ParseURL( p_sys, p_access->psz_path );
+
if( p_sys->url.psz_host == NULL || *p_sys->url.psz_host == '\0' )
{
msg_Warn( p_access, "invalid host" );
if( !strcmp( p_sys->psz_protocol, "ICY" ) || p_sys->b_icecast )
{
- if( p_sys->psz_mime && ( !strcasecmp( p_sys->psz_mime, "video/nsv" ) ||
- !strcasecmp( p_sys->psz_mime, "video/nsa") ) )
- p_access->psz_demux = strdup( "nsv" );
- else if( p_sys->psz_mime &&
- ( !strcasecmp( p_sys->psz_mime, "audio/aac" ) ||
- !strcasecmp( p_sys->psz_mime, "audio/aacp" ) ) )
- p_access->psz_demux = strdup( "m4a" );
- else if( p_sys->psz_mime && !strcasecmp( p_sys->psz_mime, "audio/mpeg" ) )
- p_access->psz_demux = strdup( "mp3" );
- else /* assume mp3, though this is definetly not certain */
- p_access->psz_demux = strdup( "mp3" );
-
- msg_Info( p_access, "Raw-audio server found, %s demuxer selected",
- p_access->psz_demux );
-
-#if 0 /* Doesn't work really well because of the pre-buffering in shoutcast
- * servers (the buffer content will be sent as fast as possible). */
- p_sys->b_pace_control = VLC_FALSE;
+ if( p_sys->psz_mime && strcasecmp( p_sys->psz_mime, "application/ogg" ) )
+ {
+ if( !strcasecmp( p_sys->psz_mime, "video/nsv" ) ||
+ !strcasecmp( p_sys->psz_mime, "video/nsa" ) )
+ p_access->psz_demux = strdup( "nsv" );
+ else if( !strcasecmp( p_sys->psz_mime, "audio/aac" ) ||
+ !strcasecmp( p_sys->psz_mime, "audio/aacp" ) )
+ p_access->psz_demux = strdup( "m4a" );
+ else if( !strcasecmp( p_sys->psz_mime, "audio/mpeg" ) )
+ p_access->psz_demux = strdup( "mp3" );
+
+ msg_Info( p_access, "Raw-audio server found, %s demuxer selected",
+ p_access->psz_demux );
+
+#if 0 /* Doesn't work really well because of the pre-buffering in
+ * shoutcast servers (the buffer content will be sent as fast as
+ * possible). */
+ p_sys->b_pace_control = VLC_FALSE;
#endif
+ }
+ else if( !p_sys->psz_mime )
+ {
+ /* Shoutcast */
+ p_access->psz_demux = strdup( "mp3" );
+ }
+ /* else probably Ogg Vorbis */
+ }
+ else if( !strcasecmp( p_access->psz_access, "unsv" ) &&
+ p_sys->psz_mime &&
+ !strcasecmp( p_sys->psz_mime, "misc/ultravox" ) )
+ {
+ /* Grrrr! detect ultravox server and force NSV demuxer */
+ p_access->psz_demux = strdup( "nsv" );
}
if( p_sys->b_reconnect ) msg_Dbg( p_access, "auto re-connect enabled" );
if( i_read != buffer[0] * 16 )
return VLC_EGENERIC;
- psz_meta[buffer[0]*16 + 1] = '\0'; /* Just in case */
+ psz_meta[buffer[0]*16] = '\0'; /* Just in case */
msg_Dbg( p_access, "icy-meta=%s", psz_meta );
case ACCESS_CAN_PAUSE:
case ACCESS_CAN_CONTROL_PACE:
pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
+
+#if 0 /* Disable for now until we have a clock synchro algo
+ * which works with something else than MPEG over UDP */
*pb_bool = p_sys->b_pace_control;
+#endif
+ *pb_bool = VLC_TRUE;
break;
/* */
msg_Dbg( p_access, "GET META %s %s %s",
p_sys->psz_icy_name, p_sys->psz_icy_genre, p_sys->psz_icy_title );
if( p_sys->psz_icy_name )
- vlc_meta_Add( *pp_meta, VLC_META_DESCRIPTION,
+ vlc_meta_Add( *pp_meta, VLC_META_TITLE,
p_sys->psz_icy_name );
if( p_sys->psz_icy_genre )
vlc_meta_Add( *pp_meta, VLC_META_GENRE,
p_sys->psz_icy_genre );
if( p_sys->psz_icy_title )
- vlc_meta_Add( *pp_meta, VLC_META_TITLE,
+ vlc_meta_Add( *pp_meta, VLC_META_NOW_PLAYING,
p_sys->psz_icy_title );
break;
return VLC_EGENERIC;
}
- p_sys->p_tls = tls_ClientCreate( VLC_OBJECT(p_access), NULL, p_sys->fd );
+ p_sys->p_tls = tls_ClientCreate( VLC_OBJECT(p_access), p_sys->fd, NULL );
if( p_sys->p_tls == NULL )
{
msg_Err( p_access, "cannot establish HTTP/SSL session" );
p_sys->psz_passwd ? p_sys->psz_passwd : "" );
b64 = vlc_b64_encode( buf );
+ free( buf );
net_Printf( VLC_OBJECT(p_access), p_sys->fd, pvs,
"Authorization: Basic %s\r\n", b64 );