From 7bce030be35532a1a2025bf5fea0d47dd822adb5 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 20 Oct 2018 00:10:04 +0900 Subject: [PATCH] qtdemux: Fix build with GLib versions < 2.54 g_ptr_array_find_with_equal_func was introduced in glib 2.54 which is a higher version than our minimum required one. https://bugzilla.gnome.org/show_bug.cgi?id=797239 --- gst/isomp4/qtdemux.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index dadf354e87..6832a5ebf8 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -12507,6 +12507,33 @@ qtdemux_reuse_and_configure_stream (GstQTDemux * qtdemux, return gst_qtdemux_configure_stream (qtdemux, newstream); } +/* g_ptr_array_find_with_equal_func is available since 2.54, + * replacement until we can depend unconditionally on the real one in GLib */ +#if !GLIB_CHECK_VERSION(2,54,0) +#define g_ptr_array_find_with_equal_func qtdemux_ptr_array_find_with_equal_func +static gboolean +qtdemux_ptr_array_find_with_equal_func (GPtrArray * haystack, + gconstpointer needle, GEqualFunc equal_func, guint * index_) +{ + guint i; + + g_return_val_if_fail (haystack != NULL, FALSE); + + if (equal_func == NULL) + equal_func = g_direct_equal; + + for (i = 0; i < haystack->len; i++) { + if (equal_func (g_ptr_array_index (haystack, i), needle)) { + if (index_ != NULL) + *index_ = i; + return TRUE; + } + } + + return FALSE; +} +#endif + static gboolean qtdemux_update_streams (GstQTDemux * qtdemux) {