Commit f5dd41d7 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Update GLib dependency to 2.40.0

parent f8e11fe6
......@@ -190,7 +190,7 @@ AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket)])
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
dnl GLib is required
GLIB_REQ=2.32.0
GLIB_REQ=2.40.0
AG_GST_GLIB_CHECK([$GLIB_REQ])
dnl checks for gstreamer
......
......@@ -30,25 +30,6 @@
#define GST_CAT_DEFAULT fragmented_debug
#if !GLIB_CHECK_VERSION (2, 33, 4)
#define g_list_copy_deep gst_g_list_copy_deep
static GList *
gst_g_list_copy_deep (GList * list, GCopyFunc func, gpointer user_data)
{
list = g_list_copy (list);
if (func != NULL) {
GList *l;
for (l = list; l != NULL; l = l->next) {
l->data = func (l->data, user_data);
}
}
return list;
}
#endif
static GstM3U8 *gst_m3u8_new (void);
static void gst_m3u8_free (GstM3U8 * m3u8);
static gboolean gst_m3u8_update (GstM3U8Client * client, GstM3U8 * m3u8,
......
......@@ -41,58 +41,6 @@
#include "libde265-dec.h"
#if !GLIB_CHECK_VERSION(2, 36, 0)
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef G_OS_WIN32
#include <windows.h>
#endif
#define g_get_num_processors gst_g_get_num_processors
static guint
gst_g_get_num_processors (void)
{
guint threads = 0;
#if defined(_SC_NPROC_ONLN)
threads = sysconf (_SC_NPROC_ONLN);
#elif defined(_SC_NPROCESSORS_ONLN)
threads = sysconf (_SC_NPROCESSORS_ONLN);
#elif defined(G_OS_WIN32)
{
SYSTEM_INFO sysinfo;
DWORD_PTR process_cpus;
DWORD_PTR system_cpus;
/* This *never* fails, but doesn't take CPU affinity into account */
GetSystemInfo (&sysinfo);
threads = (int) sysinfo.dwNumberOfProcessors;
/* This *can* fail, but produces correct results if affinity mask is used,
* unlike the simpler code above.
*/
if (GetProcessAffinityMask (GetCurrentProcess (),
&process_cpus, &system_cpus)) {
unsigned int count;
for (count = 0; process_cpus != 0; process_cpus >>= 1)
if (process_cpus & 1)
count++;
}
}
#else
#warning "Don't know how to get number of CPU cores, will use the default thread count"
threads = DEFAULT_THREAD_COUNT;
#endif
if (threads > 0)
return threads;
return 1;
}
#endif /* !GLIB_CHECK_VERSION(2, 36, 0) */
/* use two decoder threads if no information about
* available CPU cores can be retrieved */
#define DEFAULT_THREAD_COUNT 2
......
......@@ -27,114 +27,6 @@
G_BEGIN_DECLS
#if !GLIB_CHECK_VERSION(2,25,0)
#if defined (_MSC_VER) && !defined(_WIN64)
typedef struct _stat32 GStatBuf;
#else
typedef struct stat GStatBuf;
#endif
#endif
#if GLIB_CHECK_VERSION(2,26,0)
#define GLIB_HAS_GDATETIME
#endif
/* See bug #651514 */
#if GLIB_CHECK_VERSION(2,29,5)
#define G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE(a,b,c) \
g_atomic_pointer_compare_and_exchange ((a),(b),(c))
#define G_ATOMIC_INT_COMPARE_AND_EXCHANGE(a,b,c) \
g_atomic_int_compare_and_exchange ((a),(b),(c))
#else
#define G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE(a,b,c) \
g_atomic_pointer_compare_and_exchange ((volatile gpointer *)(a),(b),(c))
#define G_ATOMIC_INT_COMPARE_AND_EXCHANGE(a,b,c) \
g_atomic_int_compare_and_exchange ((volatile int *)(a),(b),(c))
#endif
/* See bug #651514 */
#if GLIB_CHECK_VERSION(2,29,5)
#define G_ATOMIC_INT_ADD(a,b) g_atomic_int_add ((a),(b))
#else
#define G_ATOMIC_INT_ADD(a,b) g_atomic_int_exchange_and_add ((a),(b))
#endif
/* copies */
#if GLIB_CHECK_VERSION (2, 31, 0)
#define g_mutex_new gst_g_mutex_new
static inline GMutex *
gst_g_mutex_new (void)
{
GMutex *mutex = g_slice_new (GMutex);
g_mutex_init (mutex);
return mutex;
}
#define g_mutex_free gst_g_mutex_free
static inline void
gst_g_mutex_free (GMutex *mutex)
{
g_mutex_clear (mutex);
g_slice_free (GMutex, mutex);
}
#define g_cond_new gst_g_cond_new
static inline GCond *
gst_g_cond_new (void)
{
GCond *cond = g_slice_new (GCond);
g_cond_init (cond);
return cond;
}
#define g_cond_free gst_g_cond_free
static inline void
gst_g_cond_free (GCond *cond)
{
g_cond_clear (cond);
g_slice_free (GCond, cond);
}
#define g_cond_timed_wait gst_g_cond_timed_wait
static inline gboolean
gst_g_cond_timed_wait (GCond *cond, GMutex *mutex, GTimeVal *abs_time)
{
gint64 end_time;
if (abs_time == NULL) {
g_cond_wait (cond, mutex);
return TRUE;
}
end_time = abs_time->tv_sec;
end_time *= 1000000;
end_time += abs_time->tv_usec;
/* would be nice if we had clock_rtoffset, but that didn't seem to
* make it into the kernel yet...
*/
/* if CLOCK_MONOTONIC is not defined then g_get_montonic_time() and
* g_get_real_time() are returning the same clock and we'd add ~0
*/
end_time += g_get_monotonic_time () - g_get_real_time ();
return g_cond_wait_until (cond, mutex, end_time);
}
#endif /* GLIB_CHECK_VERSION (2, 31, 0) */
#if GLIB_CHECK_VERSION (2, 31, 0)
#define g_thread_create gst_g_thread_create
static inline GThread *
gst_g_thread_create (GThreadFunc func, gpointer data, gboolean joinable,
GError **error)
{
GThread *thread = g_thread_try_new ("gst-check", func, data, error);
if (!joinable)
g_thread_unref (thread);
return thread;
}
#endif /* GLIB_CHECK_VERSION (2, 31, 0) */
/* adaptations */
G_END_DECLS
#endif
......@@ -1176,11 +1176,7 @@ gst_ssim_request_new_pad (GstElement * element, GstPadTemplate * templ,
goto could_not_add_sink;
else
/* increment pad counter */
#if GLIB_CHECK_VERSION(2,29,5)
padcount = g_atomic_int_add (&ssim->padcount, 1);
#else
padcount = g_atomic_int_exchange_and_add (&ssim->padcount, 1);
#endif
if (num != -1) {
GstSSimOutputContext *c;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment