Commit 1a29c863 authored by Benjamin Pracht's avatar Benjamin Pracht

* Try the gnomevfs plugin last if we didn't find any other matching access

* Now MRLs such as ssh://user:pass@server work.
parent 2caff730
......@@ -70,7 +70,7 @@ vlc_module_begin();
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();
......@@ -103,7 +103,7 @@ static int Open( vlc_object_t *p_this )
{
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;
......@@ -128,6 +128,20 @@ static int Open( vlc_object_t *p_this )
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);
......@@ -136,20 +150,20 @@ static int Open( vlc_object_t *p_this )
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
{
......@@ -161,17 +175,16 @@ static int Open( vlc_object_t *p_this )
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;
......@@ -214,7 +227,9 @@ static int Open( vlc_object_t *p_this )
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;
}
......
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