From 9370ef34a127f64dbbbdb8e631c02039e81afde7 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Thu, 6 Dec 2012 19:23:41 -0500 Subject: [PATCH] libsaria: Escape filepaths passed to gstreamer Otherwise songs might error out part way through playing and skip to something else. It doesn't make sense and I wish I knew why :( Signed-off-by: Bryan Schumaker --- libsaria/audio.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libsaria/audio.cpp b/libsaria/audio.cpp index 34c29367..6c71a3d6 100644 --- a/libsaria/audio.cpp +++ b/libsaria/audio.cpp @@ -36,15 +36,19 @@ static bool change_state(GstState new_state) void load_file(GstElement *playbin, string file, GstState state) { + gchar *escaped; if (file == "" || !libsaria::exists(file)) return; - string uri = "file://" + file; - println("Loading uri: " + uri); + println("Loading file: " + file); + escaped = gst_filename_to_uri(file.c_str(), NULL); + /* Set pipeline to the requested state */ change_state(GST_STATE_READY); - g_object_set(G_OBJECT(playbin), "uri", uri.c_str(), NULL); + g_object_set(G_OBJECT(playbin), "uri", escaped, NULL); change_state(state); + + g_free(escaped); } static string to_string(gint64 time)