2 * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
4 * gnomevfs.c: register gnomevfs elements
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
26 #include "gst/gst-i18n-plugin.h"
28 #include "gstgnomevfs.h"
29 #include "gstgnomevfssrc.h"
30 #include "gstgnomevfssink.h"
32 #include <libgnomevfs/gnome-vfs.h>
38 gst_gnome_vfs_location_to_uri_string (const gchar * location)
45 /* already an URI string? */
46 if (strstr (location, "://"))
47 return g_strdup (location);
49 newloc = gnome_vfs_escape_path_string (location);
51 if (newloc && *newloc == '/') {
52 ret = g_strdup_printf ("file://%s", newloc);
56 curdir = g_get_current_dir ();
57 ret = g_strdup_printf ("file://%s/%s", curdir, newloc);
66 gst_gnome_vfs_uri_get_type (void)
68 static GType type; /* 0 */
71 type = g_boxed_type_register_static ("GnomeVFSURI",
72 (GBoxedCopyFunc) gnome_vfs_uri_ref,
73 (GBoxedFreeFunc) gnome_vfs_uri_unref);
80 gst_gnome_vfs_handle_copy (gpointer handle)
86 gst_gnome_vfs_handle_free (gpointer handle)
92 gst_gnome_vfs_handle_get_type (void)
94 static GType type; /* 0 */
97 /* hackish, but makes it show up nicely in gst-inspect */
98 type = g_boxed_type_register_static ("GnomeVFSHandle",
99 (GBoxedCopyFunc) gst_gnome_vfs_handle_copy,
100 (GBoxedFreeFunc) gst_gnome_vfs_handle_free);
107 plugin_init (GstPlugin * plugin)
109 /* gnome vfs engine init */
110 if (!gnome_vfs_initialized ()) {
111 if (!gnome_vfs_init ()) {
112 GST_WARNING ("Failed to initialize GnomeVFS - not registering plugin!");
117 gst_plugin_add_dependency_simple (plugin, NULL, GNOME_VFS_MODULES_DIR, NULL,
118 GST_PLUGIN_DEPENDENCY_FLAG_NONE);
120 if (!gst_element_register (plugin, "gnomevfssrc", GST_RANK_MARGINAL,
121 gst_gnome_vfs_src_get_type ()))
124 if (!gst_element_register (plugin, "gnomevfssink", GST_RANK_MARGINAL,
125 gst_gnome_vfs_sink_get_type ()))
129 /* FIXME: add category
130 GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, LOCALEDIR);
132 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
133 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
134 #endif /* ENABLE_NLS */
139 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
142 "elements to read from and write to Gnome-VFS uri's",
143 plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)