+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):
-Subproject commit 5685efc3f9976d6abe3fec557353fc2053b0e3fb
+Subproject commit 45cc64e522d61410eb8d1a3e7ef67569851cd77a
#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)
{
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__ */
switch (prop_id) {
case ARG_LOCATION:{
+ const gchar *new_location;
+
if (sink->uri) {
gnome_vfs_uri_unref (sink->uri);
sink->uri = NULL;
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;
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)
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) {