summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2006-03-27 16:15:00 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-03-27 16:15:00 +0000
commite5e5e53f0722aec70fa9dfa373851e1504e7fc6c (patch)
tree10f0d408d9eb007a2f97e27f3cee605d483d807d
parent049573dc5660829494a602953230b0c64d4b327a (diff)
downloadgstreamer-plugins-base-e5e5e53f0722aec70fa9dfa373851e1504e7fc6c.tar.gz
ext/gnomevfs/: Make gnomevfssink accept filenames as well as URIs for the "location" property, just like gnomevfssrc ...
Original commit message from CVS: * ext/gnomevfs/gstgnomevfs.c: (gst_gnome_vfs_location_to_uri_string): * ext/gnomevfs/gstgnomevfs.h: * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_set_property): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_set_property): Make gnomevfssink accept filenames as well as URIs for the "location" property, just like gnomevfssrc does (and filesrc/filesink do) (#336190).
-rw-r--r--ChangeLog12
m---------common0
-rw-r--r--ext/gnomevfs/gstgnomevfs.c30
-rw-r--r--ext/gnomevfs/gstgnomevfs.h2
-rw-r--r--ext/gnomevfs/gstgnomevfssink.c8
-rw-r--r--ext/gnomevfs/gstgnomevfssrc.c25
6 files changed, 57 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 47051d85b..a4cb49333 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2006-03-27 Tim-Philipp Müller <tim at centricular dot net>
+
+ * ext/gnomevfs/gstgnomevfs.c:
+ (gst_gnome_vfs_location_to_uri_string):
+ * ext/gnomevfs/gstgnomevfs.h:
+ * ext/gnomevfs/gstgnomevfssink.c:
+ (gst_gnome_vfs_sink_set_property):
+ * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_set_property):
+ Make gnomevfssink accept filenames as well as URIs for the
+ "location" property, just like gnomevfssrc does (and
+ filesrc/filesink do) (#336190).
+
2006-03-24 Thomas Vander Stichele <thomas at apestaart dot org>
* tests/check/generic/clock-selection.c: (GST_START_TEST):
diff --git a/common b/common
-Subproject 5685efc3f9976d6abe3fec557353fc2053b0e3f
+Subproject 45cc64e522d61410eb8d1a3e7ef67569851cd77
diff --git a/ext/gnomevfs/gstgnomevfs.c b/ext/gnomevfs/gstgnomevfs.c
index b6b12599c..a9792c767 100644
--- a/ext/gnomevfs/gstgnomevfs.c
+++ b/ext/gnomevfs/gstgnomevfs.c
@@ -32,6 +32,36 @@
#include <libgnomevfs/gnome-vfs.h>
#include <gst/gst.h>
+#include <string.h>
+
+gchar *
+gst_gnome_vfs_location_to_uri_string (const gchar * location)
+{
+ gchar *newloc, *ret;
+
+ if (location == NULL)
+ return NULL;
+
+ /* already an URI string? */
+ if (strstr (location, "://"))
+ return g_strdup (location);
+
+ newloc = gnome_vfs_escape_path_string (location);
+
+ if (newloc && *newloc == '/') {
+ ret = g_strdup_printf ("file://%s", newloc);
+ } else {
+ gchar *curdir;
+
+ curdir = g_get_current_dir ();
+ ret = g_strdup_printf ("file://%s/%s", curdir, newloc);
+ g_free (curdir);
+ }
+
+ g_free (newloc);
+ return ret;
+}
+
GType
gst_gnome_vfs_uri_get_type (void)
{
diff --git a/ext/gnomevfs/gstgnomevfs.h b/ext/gnomevfs/gstgnomevfs.h
index 8069a6f36..f2228bea1 100644
--- a/ext/gnomevfs/gstgnomevfs.h
+++ b/ext/gnomevfs/gstgnomevfs.h
@@ -31,6 +31,8 @@ G_BEGIN_DECLS
GType gst_gnome_vfs_uri_get_type (void);
GType gst_gnome_vfs_handle_get_type (void);
+gchar * gst_gnome_vfs_location_to_uri_string (const gchar * location);
+
G_END_DECLS
#endif /* __GST_GNOME_VFS_H__ */
diff --git a/ext/gnomevfs/gstgnomevfssink.c b/ext/gnomevfs/gstgnomevfssink.c
index f6dbb3db6..c1a1961ba 100644
--- a/ext/gnomevfs/gstgnomevfssink.c
+++ b/ext/gnomevfs/gstgnomevfssink.c
@@ -267,6 +267,8 @@ gst_gnome_vfs_sink_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case ARG_LOCATION:{
+ const gchar *new_location;
+
if (sink->uri) {
gnome_vfs_uri_unref (sink->uri);
sink->uri = NULL;
@@ -275,8 +277,10 @@ gst_gnome_vfs_sink_set_property (GObject * object, guint prop_id,
g_free (sink->uri_name);
sink->uri_name = NULL;
}
- if (g_value_get_string (value)) {
- sink->uri_name = g_value_dup_string (value);
+
+ new_location = g_value_get_string (value);
+ if (new_location) {
+ sink->uri_name = gst_gnome_vfs_location_to_uri_string (new_location);
sink->uri = gnome_vfs_uri_new (sink->uri_name);
}
break;
diff --git a/ext/gnomevfs/gstgnomevfssrc.c b/ext/gnomevfs/gstgnomevfssrc.c
index bae262dea..8da031114 100644
--- a/ext/gnomevfs/gstgnomevfssrc.c
+++ b/ext/gnomevfs/gstgnomevfssrc.c
@@ -384,12 +384,13 @@ gst_gnome_vfs_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstGnomeVFSSrc *src;
- gchar cwd[PATH_MAX];
src = GST_GNOME_VFS_SRC (object);
switch (prop_id) {
- case ARG_LOCATION:
+ case ARG_LOCATION:{
+ const gchar *new_location;
+
/* the element must be stopped or paused in order to do this */
if (GST_STATE (src) == GST_STATE_PLAYING ||
GST_STATE (src) == GST_STATE_PAUSED)
@@ -404,25 +405,13 @@ gst_gnome_vfs_src_set_property (GObject * object, guint prop_id,
src->uri_name = NULL;
}
- if (g_value_get_string (value)) {
- const gchar *location = g_value_get_string (value);
-
- if (!strchr (location, ':')) {
- gchar *newloc = gnome_vfs_escape_path_string (location);
-
- if (*newloc == '/')
- src->uri_name = g_strdup_printf ("file://%s", newloc);
- else
- src->uri_name =
- g_strdup_printf ("file://%s/%s", getcwd (cwd, PATH_MAX),
- newloc);
- g_free (newloc);
- } else
- src->uri_name = g_strdup (location);
-
+ new_location = g_value_get_string (value);
+ if (new_location) {
+ src->uri_name = gst_gnome_vfs_location_to_uri_string (new_location);
src->uri = gnome_vfs_uri_new (src->uri_name);
}
break;
+ }
case ARG_HANDLE:
if (GST_STATE (src) == GST_STATE_NULL ||
GST_STATE (src) == GST_STATE_READY) {