From b0becfa46bd115f6b1a1eb1712803719918dd1ea Mon Sep 17 00:00:00 2001 From: Jonas K Danielsson Date: Wed, 17 Jan 2024 15:59:15 +0100 Subject: [PATCH] splitmuxsrc: Use natural ordering to find files Today when using the `splitmuxsrc` on a collection of files named as: ``` item0.mkv item1.mkv item2.mkv [...] item10.mkv item11.mkv [...] ``` You will get a continuous stream made in the order of: ``` item0.mkv -> item1.mkv -> item10.mkv -> item11.mkv -> [...] ``` You can fix this by having smarter names of the items: ``` item000.mkv item001.mkv item002.mkv [...] item010.mkv item011.mkv [...] ``` Will get you: ``` item000.mkv -> item001.mkv -> item003.mkv -> item004.mkv -> [...] ``` But, we could also "fix" the former case by using natural ordering when comparing the files in gstsplitutils.c. Fixes #2523 Part-of: --- girs/Gst-1.0.gir | 17 +++++++++++++++++ .../gst/multifile/gstsplitutils.c | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/girs/Gst-1.0.gir b/girs/Gst-1.0.gir index 92f61b1c34..d3aee71f7f 100644 --- a/girs/Gst-1.0.gir +++ b/girs/Gst-1.0.gir @@ -54381,6 +54381,23 @@ the result. + + Compares the given filenames using natural ordering. + + + + + + + a filename to compare with @b + + + + a filename to compare with @a + + + + Adds the fractions @a_n/@a_d and @b_n/@b_d and stores the result in @res_n and @res_d. diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitutils.c b/subprojects/gst-plugins-good/gst/multifile/gstsplitutils.c index 9b088a5f77..2649a229bb 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitutils.c +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitutils.c @@ -30,7 +30,7 @@ static int gst_split_util_array_sortfunc (gchar ** a, gchar ** b) { - return strcmp (*a, *b); + return gst_util_filename_compare (*a, *b); } gchar **