From 8542d18d4372a8e2ace07321001b7c5d5aaa2a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 2 May 2012 08:44:25 +0100 Subject: [PATCH] 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 --- tools/ges-launch.c | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/tools/ges-launch.c b/tools/ges-launch.c index 769809cb46..18124d7fa6 100644 --- a/tools/ges-launch.c +++ b/tools/ges-launch.c @@ -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;