gst-play: Use gst_util_filename_compare

The added benefit is not assuming UTF-8 in filenames.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4491>
This commit is contained in:
Jonas K Danielsson 2024-01-17 15:58:50 +01:00 committed by GStreamer Marge Bot
parent fa4b46680d
commit 0cd3a98c78

View file

@ -855,21 +855,6 @@ do_play (GstPlay * play)
g_main_loop_run (play->loop);
}
static gint
compare (gconstpointer a, gconstpointer b)
{
gchar *a1, *b1;
gint ret;
a1 = g_utf8_collate_key_for_filename ((gchar *) a, -1);
b1 = g_utf8_collate_key_for_filename ((gchar *) b, -1);
ret = strcmp (a1, b1);
g_free (a1);
g_free (b1);
return ret;
}
static void
add_to_playlist (GPtrArray * playlist, const gchar * filename)
{
@ -889,7 +874,9 @@ add_to_playlist (GPtrArray * playlist, const gchar * filename)
gchar *path;
path = g_build_filename (filename, entry, NULL);
files = g_list_insert_sorted (files, path, compare);
files =
g_list_insert_sorted (files, path,
(GCompareFunc) gst_util_filename_compare);
}
g_dir_close (dir);