mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
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).
This commit is contained in:
parent
049573dc56
commit
e5e5e53f07
6 changed files with 58 additions and 21 deletions
12
ChangeLog
12
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):
|
||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit 5685efc3f9976d6abe3fec557353fc2053b0e3fb
|
||||
Subproject commit 45cc64e522d61410eb8d1a3e7ef67569851cd77a
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue