set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_ACCESS );
add_integer( "gnomevfs-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
- set_capability( "access2", 0 );
+ set_capability( "access2", 10 );
add_shortcut( "gnomevfs" );
set_callbacks( Open, Close );
vlc_module_end();
{
access_t *p_access = (access_t*)p_this;
access_sys_t *p_sys;
- char *psz_name = strdup( p_access->psz_path );
+ char *psz_name;
char *psz, *psz_uri;
GnomeVFSURI *p_uri;
GnomeVFSResult i_ret;
p_sys->i_nb_reads = 0;
p_sys->b_pace_control = VLC_TRUE;
+
+ if( strcmp( "gnomevfs", p_access->psz_access ) )
+ {
+ psz_name = malloc( strlen( p_access->psz_access ) +
+ strlen( p_access->psz_path ) + 3 );
+ strcpy( psz_name, p_access->psz_access );
+ strcat( psz_name, "://" );
+ strcat( psz_name, p_access->psz_path );
+ }
+ else
+ {
+ psz_name = strdup( p_access->psz_path );
+ }
+
psz = ToLocale( psz_name );
psz_uri = gnome_vfs_make_uri_from_input_with_dirs( psz,
GNOME_VFS_MAKE_URI_DIR_CURRENT);
if( p_uri )
{
- i_ret = gnome_vfs_open( &(p_sys->p_handle), psz_uri, 5 );
+ p_sys->p_file_info = gnome_vfs_file_info_new();
+ i_ret = gnome_vfs_get_file_info_uri( p_uri,
+ p_sys->p_file_info, 8 );
+
if( i_ret )
{
- msg_Warn( p_access, "cannot open file %s: %s", psz_name,
+ msg_Err( p_access, "cannot get file info %s",
gnome_vfs_result_to_string( i_ret ) );
-
- LocaleFree( psz );
- g_free( psz_uri );
+ gnome_vfs_file_info_unref( p_sys->p_file_info );
gnome_vfs_uri_unref( p_uri);
free( p_sys );
free( psz_name );
return VLC_EGENERIC;
}
- gnome_vfs_uri_unref( p_uri);
}
else
{
return VLC_EGENERIC;
}
LocaleFree( psz );
- g_free( psz_uri );
-
- p_sys->p_file_info = gnome_vfs_file_info_new();
- i_ret = gnome_vfs_get_file_info_from_handle( p_sys->p_handle,
- p_sys->p_file_info, 8 );
+ i_ret = gnome_vfs_open( &(p_sys->p_handle), psz_uri, 5 );
if( i_ret )
{
- msg_Err( p_access, "cannot get file info %s",
- gnome_vfs_result_to_string( i_ret ) );
- gnome_vfs_file_info_unref( p_sys->p_file_info );
+ msg_Warn( p_access, "cannot open file %s: %s", psz_name,
+ gnome_vfs_result_to_string( i_ret ) );
+
+ LocaleFree( psz );
+ g_free( psz_uri );
+ gnome_vfs_uri_unref( p_uri);
free( p_sys );
free( psz_name );
return VLC_EGENERIC;
var_Create( p_access, "gnomevfs-caching",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+ g_free( psz_uri );
p_sys->psz_name = psz_name;
+ gnome_vfs_uri_unref( p_uri);
return VLC_SUCCESS;
}