ges-launch: replace home-grown version of gst_filename_to_uri()

and remove superfluous check if file is readable with
fopen. Code appears to also want to accept URIs, so this
doesn't work so well, and should probably be done differently
anyway if required.

https://bugzilla.gnome.org/show_bug.cgi?id=674296
This commit is contained in:
Tim-Philipp Müller 2012-05-02 08:44:25 +01:00
parent 59e156ea3a
commit 8542d18d43

View file

@ -39,24 +39,10 @@ void load_project (gchar * uri);
static gchar *
ensure_uri (gchar * location)
{
gchar *res;
gchar *path;
if (gst_uri_is_valid (location))
return g_strdup (location);
if (!g_path_is_absolute (location)) {
gchar *cur_dir;
cur_dir = g_get_current_dir ();
path = g_build_filename (cur_dir, location, NULL);
g_free (cur_dir);
} else
path = g_strdup (location);
res = g_filename_to_uri (path, NULL, NULL);
g_free (path);
return res;
else
return gst_filename_to_uri (location, NULL);
}
static gboolean
@ -77,18 +63,6 @@ thumbnail_cb (gpointer pipeline)
return res;
}
static gboolean
check_path (char *path)
{
FILE *fp = fopen (path, "r");
if (fp) {
fclose (fp);
return TRUE;
}
return FALSE;
}
static gboolean
check_time (char *time)
{
@ -96,7 +70,7 @@ check_time (char *time)
if (!re) {
if (NULL == (re = g_regex_new ("^[0-9]+(.[0-9]+)?$", G_REGEX_EXTENDED, 0,
NULL)))
NULL)))
return FALSE;
}
@ -233,11 +207,6 @@ create_timeline (int nbargs, gchar ** argv, gchar * audio, gchar * video)
gchar *uri;
guint64 inpoint;
if (!check_path (source)) {
g_error ("'%s': could not open path!", source);
goto build_failure;
}
if (!(uri = ensure_uri (source))) {
GST_ERROR ("couldn't create uri for '%s'", source);
goto build_failure;