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 <bjschuma@gmail.com>
This commit is contained in:
parent
b2226d926e
commit
9370ef34a1
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue