summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBastien Nocera <hadess@users.sourceforge.net>2005-05-13 14:33:09 +0000
committerBastien Nocera <hadess@users.sourceforge.net>2005-05-13 14:33:09 +0000
commita10c8d08840c2e5598b4e51fc648a9bc972d2b31 (patch)
tree08249c35f2b4f98d819def01e65c0fb32fc0a9df /src
parente1bbc779c8e9552ae551baad9f22a722b52dab4c (diff)
downloadxine-lib-a10c8d08840c2e5598b4e51fc648a9bc972d2b31.tar.gz
xine-lib-a10c8d08840c2e5598b4e51fc648a9bc972d2b31.tar.bz2
**BUGFIX**
Plenty of changes for the gnome-vfs plugin * Make it top priority, but only load the plugin if gnome_vfs_init() was called (meaning that the gnome-vfs plugin will automatically be used for smb://, http://, etc. if the application is a GNOME one and calls gnome-vfs' init) * Handle the http URI scheme (allows for seeking in HTTP stream in recent gnome-vfs versions) * Send events via _x_message for common errors CVS patchset: 7534 CVS date: 2005/05/13 14:33:09
Diffstat (limited to 'src')
-rw-r--r--src/input/input_gnome_vfs.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/src/input/input_gnome_vfs.c b/src/input/input_gnome_vfs.c
index 3babf1fc1..3ce0efa62 100644
--- a/src/input/input_gnome_vfs.c
+++ b/src/input/input_gnome_vfs.c
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: input_gnome_vfs.c,v 1.25 2005/02/07 23:58:58 tmattern Exp $
+ * $Id: input_gnome_vfs.c,v 1.26 2005/05/13 14:33:09 hadess Exp $
*/
@@ -256,11 +256,33 @@ static int
gnomevfs_plugin_open (input_plugin_t *this_gen )
{
gnomevfs_input_t *this = (gnomevfs_input_t *) this_gen;
+ GnomeVFSResult res;
D("gnomevfs_klass_open: opening '%s'", this->mrl);
- if (gnome_vfs_open_uri (&this->fh, this->uri, GNOME_VFS_OPEN_READ) != GNOME_VFS_OK)
+ res = gnome_vfs_open_uri (&this->fh, this->uri, GNOME_VFS_OPEN_READ | GNOME_VFS_OPEN_RANDOM);
+ if (res != GNOME_VFS_OK)
{
- D("gnomevfs_klass_open: failed to open '%s'", this->mrl);
+ int err;
+
+ D("gnomevfs_klass_open: failed to open '%s': %s (%d)", this->mrl, gnome_vfs_result_to_string (res), res);
+ switch (res) {
+ case GNOME_VFS_ERROR_HOST_NOT_FOUND:
+ err = XINE_MSG_UNKNOWN_HOST;
+ break;
+ case GNOME_VFS_ERROR_NOT_FOUND:
+ err = XINE_MSG_FILE_NOT_FOUND;
+ break;
+ case GNOME_VFS_ERROR_ACCESS_DENIED:
+ err = XINE_MSG_PERMISSION_ERROR;
+ break;
+ default:
+ err = XINE_MSG_NO_ERROR;
+ }
+
+ if (err != XINE_MSG_NO_ERROR) {
+ D("gnomevfs_klass_open: sending error %d", err);
+ _x_message(this->stream, err, this->mrl, NULL);
+ }
return 0;
}
@@ -275,7 +297,7 @@ gnomevfs_klass_dispose (input_class_t *this_gen)
g_free (this);
}
-static char * ignore_scheme[] = { "cdda", "http", "file" };
+static char * ignore_scheme[] = { "cdda", "file" };
static input_plugin_t *
gnomevfs_klass_get_instance (input_class_t *klass_gen, xine_stream_t *stream,
@@ -333,11 +355,12 @@ static void
xprintf (xine, XINE_VERBOSITY_DEBUG, "gnome_vfs init_input_class\n");
- if (gnome_vfs_initialized () == FALSE)
- if (gnome_vfs_init () == FALSE) {
- xprintf (xine, XINE_VERBOSITY_DEBUG, "Couldn't initialise gnome-vfs\n");
- return NULL;
- }
+ /* Don't initialise gnome-vfs, only gnome-vfs enabled applications
+ * should be using it */
+ if (gnome_vfs_initialized () == FALSE) {
+ xprintf (xine, XINE_VERBOSITY_DEBUG, "gnome-vfs not initialised\n");
+ return NULL;
+ }
if (!g_thread_supported ())
g_thread_init (NULL);
@@ -355,9 +378,13 @@ static void
return (input_class_t *) this;
}
+static input_info_t input_info_gnomevfs = {
+ 100 /* priority */
+};
+
plugin_info_t xine_plugin_info[] = {
- { PLUGIN_INPUT | PLUGIN_NO_UNLOAD, 16, "gnomevfs", XINE_VERSION_CODE, NULL,
- init_input_class },
+ { PLUGIN_INPUT | PLUGIN_NO_UNLOAD, 16, "gnomevfs", XINE_VERSION_CODE,
+ &input_info_gnomevfs, init_input_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};