gst-plugins-good: use g_sort_array() instead of deprecated g_qsort_with_data()

Fixes compiler warnings with the latest GLib versions.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4127

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7384>
This commit is contained in:
Tim-Philipp Müller 2024-08-20 01:53:37 +01:00 committed by GStreamer Marge Bot
parent 3beb06952e
commit ec6763b122
3 changed files with 24 additions and 2 deletions

View file

@ -78,6 +78,26 @@ gst_g_string_replace (GString *string,
/* adaptations */
#if !GLIB_CHECK_VERSION(2, 81, 1)
#define g_sort_array(a,n,s,f,udata) gst_g_sort_array(a,n,s,f,udata)
// Don't need to maintain ABI compat here (n_elements), since we never pass
// the function as pointer but always call it directly ourselves.
static inline void
gst_g_sort_array (const void *array,
gssize n_elements,
size_t element_size,
GCompareDataFunc compare_func,
void *user_data)
{
if (n_elements >= 0 && n_elements <= G_MAXINT) {
g_qsort_with_data (array, n_elements, element_size, compare_func, user_data);
} else {
g_abort ();
}
}
#endif
G_END_DECLS
#endif

View file

@ -76,6 +76,8 @@
#include <gst/audio/audio.h>
#include <gst/audio/audio-enumtypes.h>
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (gst_interleave_debug);
#define GST_CAT_DEFAULT gst_interleave_debug
@ -299,7 +301,7 @@ gst_interleave_channel_positions_to_mask (GValueArray * positions,
for (i = 0; i < channels; i++) {
default_ordering_map[i] = i;
}
g_qsort_with_data (default_ordering_map, channels,
g_sort_array (default_ordering_map, channels,
sizeof (*default_ordering_map), compare_positions, pos);
ret = gst_audio_channel_positions_to_mask (pos, channels, FALSE, mask);

View file

@ -1,7 +1,7 @@
gstinterleave = library('gstinterleave',
'plugin.c', 'interleave.c', 'deinterleave.c',
c_args : gst_plugins_good_args,
include_directories : [configinc],
include_directories : [configinc, libsinc],
dependencies : [gstbase_dep, gstaudio_dep],
install : true,
install_dir : plugins_install_dir,