struct vod_sys_t
{
- char *psz_rtsp_url;
+ char *psz_rtsp_path;
/* */
vlc_thread_t thread;
psz_url = var_InheritString( p_vod, "rtsp-host" );
if( psz_url == NULL )
- p_sys->psz_rtsp_url = strdup( "/" );
+ p_sys->psz_rtsp_path = strdup( "/" );
else
- if( !( strlen( psz_url ) > 0 && psz_url[strlen( psz_url ) - 1] == '/' ) )
{
- if( asprintf( &p_sys->psz_rtsp_url, "%s/", psz_url ) == -1 )
- {
- p_sys->psz_rtsp_url = NULL;
- free( psz_url );
- goto error;
- }
- free( psz_url );
+ vlc_url_t url;
+ vlc_UrlParse( &url, psz_url, 0 );
+ free( psz_url );
+
+ if( url.psz_path == NULL )
+ p_sys->psz_rtsp_path = strdup( "/" );
+ else
+ if( !( strlen( url.psz_path ) > 0
+ && url.psz_path[strlen( url.psz_path ) - 1] == '/' ) )
+ {
+ if( asprintf( &p_sys->psz_rtsp_path, "%s/", url.psz_path ) == -1 )
+ {
+ p_sys->psz_rtsp_path = NULL;
+ vlc_UrlClean( &url );
+ goto error;
+ }
+ }
+ else
+ p_sys->psz_rtsp_path = strdup( url.psz_path );
+
+ vlc_UrlClean( &url );
}
- else
- p_sys->psz_rtsp_url = psz_url;
p_vod->pf_media_new = MediaNew;
p_vod->pf_media_del = MediaAskDel;
error:
if( p_sys )
{
- free( p_sys->psz_rtsp_url );
+ free( p_sys->psz_rtsp_path );
free( p_sys );
}
}
block_FifoRelease( p_sys->p_fifo_cmd );
- free( p_sys->psz_rtsp_url );
+ free( p_sys->psz_rtsp_path );
free( p_sys );
}
const char *psz_name )
{
vod_sys_t *p_sys = p_vod->p_sys;
- char *psz_url;
+ char *psz_path;
- if( asprintf( &psz_url, "%s%s", p_sys->psz_rtsp_url, psz_name ) < 0 )
+ if( asprintf( &psz_path, "%s%s", p_sys->psz_rtsp_path, psz_name ) < 0 )
return;
- vlc_url_t url;
- vlc_UrlParse( &url, psz_url, 0 );
- free( psz_url );
-
- p_media->rtsp = RtspSetup(VLC_OBJECT(p_vod), p_media, url.psz_path);
-
- vlc_UrlClean( &url );
+ p_media->rtsp = RtspSetup(VLC_OBJECT(p_vod), p_media, psz_path);
+ free( psz_path );
if (p_media->rtsp == NULL)
return;
else
cmd.psz_arg = NULL;
- p_cmd = block_New( p_vod, sizeof(rtsp_cmd_t) );
+ p_cmd = block_Alloc( sizeof(rtsp_cmd_t) );
memcpy( p_cmd->p_buffer, &cmd, sizeof(cmd) );
block_FifoPut( p_vod->p_sys->p_fifo_cmd, p_cmd );