fixed a few problems with stream_UrlNew

parent 6a25256c
...@@ -199,7 +199,7 @@ VLC_EXPORT( void, stream_DemuxDelete,( stream_t *s ) ); ...@@ -199,7 +199,7 @@ VLC_EXPORT( void, stream_DemuxDelete,( stream_t *s ) );
#define stream_MemoryNew( a, b, c, d ) __stream_MemoryNew( VLC_OBJECT(a), b, c, d ) #define stream_MemoryNew( a, b, c, d ) __stream_MemoryNew( VLC_OBJECT(a), b, c, d )
VLC_EXPORT( stream_t *,__stream_MemoryNew, (vlc_object_t *p_obj, uint8_t *p_buffer, int64_t i_size, vlc_bool_t i_preserve_memory ) ); VLC_EXPORT( stream_t *,__stream_MemoryNew, (vlc_object_t *p_obj, uint8_t *p_buffer, int64_t i_size, vlc_bool_t i_preserve_memory ) );
#define stream_UrlNew( a, b ) __stream_UrlNew( VLC_OBJECT(a), b ) #define stream_UrlNew( a, b ) __stream_UrlNew( VLC_OBJECT(a), b )
VLC_EXPORT( stream_t *,__stream_UrlNew, (vlc_object_t *p_this, char *psz_url ) ); VLC_EXPORT( stream_t *,__stream_UrlNew, (vlc_object_t *p_this, const char *psz_url ) );
/** /**
* @} * @}
......
...@@ -188,33 +188,38 @@ static int ASeek( stream_t *s, int64_t i_pos ); ...@@ -188,33 +188,38 @@ static int ASeek( stream_t *s, int64_t i_pos );
/**************************************************************************** /****************************************************************************
* stream_AccessNew: create a stream from a access * stream_AccessNew: create a stream from a access
****************************************************************************/ ****************************************************************************/
stream_t *__stream_UrlNew( vlc_object_t *p_parent, char *psz_url ) stream_t *__stream_UrlNew( vlc_object_t *p_parent, const char *psz_url )
{ {
char *psz_access, *psz_demux, *psz_path; char *psz_access, *psz_demux, *psz_path, *psz_dup;
access_t *p_access; access_t *p_access;
stream_t *p_res; stream_t *p_res;
MRLSplit( p_parent, psz_url, &psz_access, &psz_demux, &psz_path ); psz_dup = strdup( psz_url );
MRLSplit( p_parent, psz_dup, &psz_access, &psz_demux, &psz_path );
/* Now try a real access */ /* Now try a real access */
p_access = access2_New( p_parent, psz_access, NULL, p_access = access2_New( p_parent, psz_access, NULL,
psz_path, VLC_TRUE ); psz_path, VLC_FALSE );
if( p_access == NULL ) if( p_access == NULL )
{ {
msg_Err( p_parent, "no suitable access module for `%s'", psz_url ); msg_Err( p_parent, "no suitable access module for `%s'", psz_url );
free( psz_dup );
return NULL; return NULL;
} }
p_res = stream_AccessNew( p_access, VLC_TRUE ); p_res = stream_AccessNew( p_access, VLC_TRUE );
if( p_res ) if( p_res )
{ {
p_res->pf_destroy = UStreamDestroy; p_res->pf_destroy = UStreamDestroy;
free( psz_dup );
return p_res; return p_res;
} }
else else
{ {
access2_Delete( p_access ); access2_Delete( p_access );
} }
free( psz_dup );
return NULL;
} }
stream_t *stream_AccessNew( access_t *p_access, vlc_bool_t b_quick ) stream_t *stream_AccessNew( access_t *p_access, vlc_bool_t b_quick )
......
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