gstreamer/ext/gnomevfs/gstgnomevfsuri.c
Ronald S. Bultje 67c5e9fdda ext/gnomevfs/: Add URI support to Gnome-VFS plugins. Tries to load a fixed list of fake URIs to see which this versio...
Original commit message from CVS:
* ext/gnomevfs/Makefile.am:
* ext/gnomevfs/gstgnomevfs.c: (plugin_init):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_get_type),
(gst_gnomevfssink_dispose), (gst_gnomevfssink_init),
(gst_gnomevfssink_uri_get_type),
(gst_gnomevfssink_uri_get_protocols),
(gst_gnomevfssink_uri_get_uri), (gst_gnomevfssink_uri_set_uri),
(gst_gnomevfssink_uri_handler_init),
(gst_gnomevfssink_set_property), (gst_gnomevfssink_get_property),
(gst_gnomevfssink_open_file), (gst_gnomevfssink_close_file):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get_type),
(gst_gnomevfssrc_init), (gst_gnomevfssrc_dispose),
(gst_gnomevfssrc_uri_get_type),
(gst_gnomevfssrc_uri_get_protocols), (gst_gnomevfssrc_uri_get_uri),
(gst_gnomevfssrc_uri_set_uri), (gst_gnomevfssrc_uri_handler_init),
(gst_gnomevfssrc_set_property), (gst_gnomevfssrc_get_property),
(gst_gnomevfssrc_open_file), (gst_gnomevfssrc_close_file):
* ext/gnomevfs/gstgnomevfsuri.c: (gst_gnomevfs_get_supported_uris):
* ext/gnomevfs/gstgnomevfsuri.h:
Add URI support to Gnome-VFS plugins. Tries to load a fixed list
of fake URIs to see which this version of Gnome-VFS likes, and
uses that for the Gst-URI interface. Makes playbin support http://
streams. Also fix up some stupid behaviour in gnomevfssrc.
2004-09-13 17:33:19 +00:00

76 lines
2 KiB
C

/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
* 2001 Bastien Nocera <hadess@hadess.net>
* 2003 Colin Walters <walters@verbum.org>
*
* gstgnomevfssink.c:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <libgnomevfs/gnome-vfs.h>
#include "gstgnomevfsuri.h"
gchar **
gst_gnomevfs_get_supported_uris (GnomeVFSOpenMode mode)
{
GnomeVFSResult res;
GnomeVFSHandle *handle;
gchar *uris[] = {
"http://localhost/bla",
"file:///bla",
"smb://localhost/bla",
"ftp://localhost/bla",
"sftp://localhost/bla",
"nfs://localhost/bla",
"ssh://localhost/bla",
"bla://bla",
NULL
}
, **result;
gint n, r = 0;
result = g_new (gchar *, 9);
for (n = 0; uris[n] != NULL; n++) {
res = gnome_vfs_open (&handle, uris[n], mode);
if (res == GNOME_VFS_OK) {
gnome_vfs_close (handle);
}
/* FIXME: do something with mode error */
if (res != GNOME_VFS_ERROR_INVALID_URI) {
gchar *protocol = g_strdup (uris[n]);
gint n;
for (n = 0; protocol[n] != '\0'; n++) {
if (protocol[n] == ':') {
protocol[n] = '\0';
break;
}
}
result[r++] = protocol;
}
}
result[r] = NULL;
return result;
}