Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / ext / gnomevfs / gstgnomevfsuri.c
1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  *                    2000 Wim Taymans <wtay@chello.be>
4  *                    2001 Bastien Nocera <hadess@hadess.net>
5  *                    2003 Colin Walters <walters@verbum.org>
6  *
7  * gstgnomevfssink.c: 
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the
21  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22  * Boston, MA 02111-1307, USA.
23  */
24
25
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29
30 #include <libgnomevfs/gnome-vfs.h>
31 #include "gstgnomevfsuri.h"
32
33 #include <gst/gst.h>
34
35 /* FIXME: move this to source and sink and remove this file:
36  * e.g. sinks cannot save to http:// and src cannot read from burn://
37  */
38 static gpointer
39 _internal_get_supported_uris (gpointer data)
40 {
41   /* no dav/davs in the list, because they don't appear to be reliable enough */
42   const gchar *uris[] = {
43     "http://localhost/bla",
44     "https://localhost/bla",
45     "file:///bla",
46     "smb://localhost/bla",
47     "ftp://localhost/bla",
48     "sftp://localhost/bla",
49     "nfs://localhost/bla",
50     "ssh://localhost/bla",
51     "burn://"
52   };
53   GnomeVFSURI *uri;
54   gchar **result;
55   gint n, r = 0;
56
57   result = g_new0 (gchar *, G_N_ELEMENTS (uris) + 1);
58   for (n = 0; n < G_N_ELEMENTS (uris); n++) {
59     uri = gnome_vfs_uri_new (uris[n]);
60     if (uri != NULL) {
61       gchar *protocol = g_strdup (uris[n]);
62       gint n;
63
64       gnome_vfs_uri_unref (uri);
65       for (n = 0; protocol[n] != '\0'; n++) {
66         if (protocol[n] == ':') {
67           protocol[n] = '\0';
68           break;
69         }
70       }
71
72       GST_DEBUG ("adding protocol '%s'", protocol);
73       result[r++] = protocol;
74     } else {
75       GST_DEBUG ("could not create GnomeVfsUri from '%s'", uris[n]);
76     }
77   }
78   result[r] = NULL;
79
80   return result;
81 }
82
83 gchar **
84 gst_gnomevfs_get_supported_uris (void)
85 {
86   static GOnce once = G_ONCE_INIT;
87
88   g_once (&once, _internal_get_supported_uris, NULL);
89   return (gchar **) once.retval;
90 }