mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
gst-plugins-base: 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:
parent
6031f9ece1
commit
3beb06952e
3 changed files with 26 additions and 4 deletions
|
@ -98,6 +98,8 @@
|
||||||
#include "gstaudiocdsrc.h"
|
#include "gstaudiocdsrc.h"
|
||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
|
|
||||||
|
#include "gst/glib-compat-private.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (gst_audio_cd_src_debug);
|
GST_DEBUG_CATEGORY_STATIC (gst_audio_cd_src_debug);
|
||||||
#define GST_CAT_DEFAULT gst_audio_cd_src_debug
|
#define GST_CAT_DEFAULT gst_audio_cd_src_debug
|
||||||
|
|
||||||
|
@ -1575,7 +1577,7 @@ gst_audio_cd_src_start (GstBaseSrc * basesrc)
|
||||||
* sort the data tracks to end and ignore them */
|
* sort the data tracks to end and ignore them */
|
||||||
src->priv->num_all_tracks = src->priv->num_tracks;
|
src->priv->num_all_tracks = src->priv->num_tracks;
|
||||||
|
|
||||||
g_qsort_with_data (src->priv->tracks, src->priv->num_tracks,
|
g_sort_array (src->priv->tracks, src->priv->num_tracks,
|
||||||
sizeof (GstAudioCdSrcTrack), gst_audio_cd_src_track_sort_func, NULL);
|
sizeof (GstAudioCdSrcTrack), gst_audio_cd_src_track_sort_func, NULL);
|
||||||
|
|
||||||
while (src->priv->num_tracks > 0
|
while (src->priv->num_tracks > 0
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#ifndef __GLIB_COMPAT_PRIVATE_H__
|
#ifndef __GLIB_COMPAT_PRIVATE_H__
|
||||||
#define __GLIB_COMPAT_PRIVATE_H__
|
#define __GLIB_COMPAT_PRIVATE_H__
|
||||||
|
|
||||||
#if 0
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -32,7 +31,26 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
/* adaptations */
|
/* adaptations */
|
||||||
|
|
||||||
G_END_DECLS
|
#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
|
#endif
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
#include "gstaudiomixerelements.h"
|
#include "gstaudiomixerelements.h"
|
||||||
#include "gstaudiointerleave.h"
|
#include "gstaudiointerleave.h"
|
||||||
|
|
||||||
|
#include "gst/glib-compat-private.h"
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_audio_interleave_debug
|
#define GST_CAT_DEFAULT gst_audio_interleave_debug
|
||||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||||
|
|
||||||
|
@ -313,7 +315,7 @@ gst_audio_interleave_channel_positions_to_mask (GValueArray * positions,
|
||||||
for (i = 0; i < channels; i++) {
|
for (i = 0; i < channels; i++) {
|
||||||
default_ordering_map[i] = 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);
|
sizeof (*default_ordering_map), compare_positions, pos);
|
||||||
|
|
||||||
ret = gst_audio_channel_positions_to_mask (pos, channels, FALSE, mask);
|
ret = gst_audio_channel_positions_to_mask (pos, channels, FALSE, mask);
|
||||||
|
|
Loading…
Reference in a new issue