p_access->info.b_eof = VLC_FALSE;
p_access->info.i_title = 0;
p_access->info.i_seekpoint = 0;
+
p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
+ if( !p_sys )
+ return VLC_ENOMEM;
+
memset( p_sys, 0, sizeof( access_sys_t ) );
p_sys->i_proto= MMS_PROTO_HTTP;
p_sys->fd = -1;
free( psz_http_proxy );
}
}
+
if( *psz_proxy )
{
p_sys->b_proxy = VLC_TRUE;
if( p_sys->b_proxy )
{
- if( p_sys->proxy.psz_host == NULL || *p_sys->proxy.psz_host == '\0' )
+ if( ( p_sys->proxy.psz_host == NULL ) ||
+ ( *p_sys->proxy.psz_host == '\0' ) )
{
msg_Warn( p_access, "invalid proxy host" );
vlc_UrlClean( &p_sys->proxy );
free( p_sys );
return VLC_EGENERIC;
}
+
if( p_sys->proxy.i_port <= 0 )
p_sys->proxy.i_port = 80;
msg_Dbg( p_access, "Using http proxy %s:%d",
/* open a tcp connection */
vlc_UrlParse( &p_sys->url, p_access->psz_path, 0 );
- if( p_sys->url.psz_host == NULL || *p_sys->url.psz_host == '\0' )
+ if( ( p_sys->url.psz_host == NULL ) ||
+ ( *p_sys->url.psz_host == '\0' ) )
{
msg_Err( p_access, "invalid host" );
vlc_UrlClean( &p_sys->proxy );
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 = VLC_FALSE;
-#endif
*pb_bool = VLC_TRUE;
break;
i_int = (int)va_arg( args, int );
pb_bool = (vlc_bool_t *)va_arg( args, vlc_bool_t * );
- if( i_int < 0 || i_int > 127 )
+ if( (i_int < 0) || (i_int > 127) )
return VLC_EGENERIC;
*pb_bool = p_sys->asfh.stream[i_int].i_selected ? VLC_TRUE : VLC_FALSE;
break;
*****************************************************************************/
static int ReadRedirect( access_t *p_access, uint8_t *p, int i_len )
{
- return 0;
+ return VLC_SUCCESS;
}
/*****************************************************************************
size_t i_data = 0;
if( p_access->info.b_eof )
- return 0;
+ return VLC_SUCCESS;
while( i_data < (size_t) i_len )
{
- if( p_access->info.i_pos < p_sys->i_start + p_sys->i_header )
+ if( p_access->info.i_pos < (p_sys->i_start + p_sys->i_header) )
{
int i_offset = p_access->info.i_pos - p_sys->i_start;
- i_copy = __MIN( p_sys->i_header - i_offset, (int)((size_t)i_len - i_data) );
+ i_copy = __MIN( p_sys->i_header - i_offset,
+ (int)((size_t)i_len - i_data) );
memcpy( &p_buffer[i_data], &p_sys->p_header[i_offset], i_copy );
i_data += i_copy;
{
i_copy = __MIN( p_sys->i_packet_length - p_sys->i_packet_used,
i_len - i_data );
-
memcpy( &p_buffer[i_data],
&p_sys->p_packet[p_sys->i_packet_used],
i_copy );
{
i_copy = __MIN( p_sys->asfh.i_min_data_packet_size - p_sys->i_packet_used,
i_len - i_data );
-
memset( &p_buffer[i_data], 0, i_copy );
i_data += i_copy;
int i_ret = -1;
if( p_sys->b_broadcast )
{
- if( ck.i_type == 0x4524 && ck.i_sequence != 0 )
+ if( (ck.i_type == 0x4524) && (ck.i_sequence != 0) )
i_ret = Restart( p_access );
else if( ck.i_type == 0x4324 )
i_ret = Reset( p_access );
if( Describe( p_access, &psz_location ) )
{
msg_Err( p_access, "describe failed" );
- return -1;
+ return VLC_ENGENERIC;
}
/* */
if( Start( p_access, 0 ) )
{
msg_Err( p_access, "Start failed" );
- return -1;
+ return VLC_ENGENERIC;
}
- return 0;
+ return VLC_SUCCESS;
}
static int Reset( access_t *p_access )
{
/* Get the next header FIXME memory loss ? */
GetHeader( p_access );
if( p_sys->i_header <= 0 )
- return -1;
+ return VLC_ENGENERIC;
E_( asf_HeaderParse )( &p_sys->asfh,
p_sys->p_header, p_sys->i_header );
/* */
p_sys->i_packet_used = 0;
p_sys->i_packet_length = 0;
- return 0;
+ return VLC_SUCCESS;
}
static int OpenConnection( access_t *p_access )
net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
"GET http://%s:%d%s HTTP/1.0\r\n",
p_sys->url.psz_host, p_sys->url.i_port,
- ( p_sys->url.psz_path == NULL || *p_sys->url.psz_path == '\0' ) ? "/" : p_sys->url.psz_path );
+ ( (p_sys->url.psz_path == NULL) ||
+ (*p_sys->url.psz_path == '\0') ) ?
+ "/" : p_sys->url.psz_path );
/* Proxy Authentication */
if( p_sys->proxy.psz_username && *p_sys->proxy.psz_username )
net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
"GET %s HTTP/1.0\r\n"
"Host: %s:%d\r\n",
- ( p_sys->url.psz_path == NULL || *p_sys->url.psz_path == '\0' ) ? "/" : p_sys->url.psz_path,
+ ( (p_sys->url.psz_path == NULL) ||
+ (*p_sys->url.psz_path == '\0') ) ?
+ "/" : p_sys->url.psz_path,
p_sys->url.psz_host, p_sys->url.i_port );
}
return VLC_SUCCESS;
msg_Err( p_access, "failed to read answer" );
goto error;
}
+
if( strncmp( psz, "HTTP/1.", 7 ) )
{
msg_Err( p_access, "invalid HTTP reply '%s'", psz );
}
/* Handle the redirection */
- if( ( i_code == 301 || i_code == 302 ||
- i_code == 303 || i_code == 307 ) &&
+ if( ( (i_code == 301) || (i_code == 302) ||
+ (i_code == 303) || (i_code == 307) ) &&
psz_location && *psz_location )
{
msg_Dbg( p_access, "redirection to %s", psz_location );
goto error;
}
/* close this connection */
- net_Close( p_sys->fd ); p_sys->fd = -1;
+ net_Close( p_sys->fd );
+ p_sys->fd = -1;
/* *** parse header and get stream and their id *** */
/* get all streams properties,
/*****************************************************************************
- *
+ * Start stream
*****************************************************************************/
static int Start( access_t *p_access, off_t i_pos )
{
int i_streams = 0;
int i_streams_selected = 0;
int i;
- char *psz;
+ char *psz = NULL;
msg_Dbg( p_access, "starting stream" );
{
i_select = 0;
}
-
net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
"ffff:%d:%d ", i, i_select );
}
return VLC_EGENERIC;
}
- if( ( psz = net_Gets( VLC_OBJECT(p_access), p_sys->fd, NULL ) ) == NULL )
+ psz = net_Gets( VLC_OBJECT(p_access), p_sys->fd, NULL );
+ if( psz == NULL )
{
msg_Err( p_access, "cannot read data" );
return VLC_EGENERIC;
}
+
if( atoi( &psz[9] ) >= 400 )
{
msg_Err( p_access, "error: %s", psz );
}
/*****************************************************************************
- *
+ * closing stream
*****************************************************************************/
static void Stop( access_t *p_access )
{
}
/*****************************************************************************
- *
+ * get packet
*****************************************************************************/
static int GetPacket( access_t * p_access, chunk_t *p_ck )
{