From b54bf3175c0dde840902f47bbbc63422fe136fe7 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Mon, 30 Jan 2012 18:25:03 +0100 Subject: [PATCH] Add glib compatibility glue for older versions. --- configure.ac | 3 +++ gst-libs/gst/vaapi/Makefile.am | 1 + gst-libs/gst/vaapi/glibcompat.h | 36 +++++++++++++++++++++++++++++++++ gst-libs/gst/vaapi/sysdeps.h | 2 ++ 4 files changed, 42 insertions(+) create mode 100644 gst-libs/gst/vaapi/glibcompat.h diff --git a/configure.ac b/configure.ac index 9a5ff8401f..1d4e343f2e 100644 --- a/configure.ac +++ b/configure.ac @@ -147,6 +147,9 @@ AC_SUBST(GTKDOC_VERSION) dnl Check for GLib AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal]) PKG_CHECK_MODULES([GLIB], [glib-2.0]) +AC_CHECK_LIB([glib-2.0], [g_list_free_full], [ + AC_DEFINE([HAVE_G_LIST_FREE_FULL], [1], + [Define to 1 if g_list_free_full() is available.])]) AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) diff --git a/gst-libs/gst/vaapi/Makefile.am b/gst-libs/gst/vaapi/Makefile.am index 4314d3a8ff..d35c23d5de 100644 --- a/gst-libs/gst/vaapi/Makefile.am +++ b/gst-libs/gst/vaapi/Makefile.am @@ -76,6 +76,7 @@ libgstvaapi_source_h = \ $(NULL) libgstvaapi_source_priv_h = \ + glibcompat.h \ gstvaapi_priv.h \ gstvaapicompat.h \ gstvaapidebug.h \ diff --git a/gst-libs/gst/vaapi/glibcompat.h b/gst-libs/gst/vaapi/glibcompat.h new file mode 100644 index 0000000000..7df3ddfe67 --- /dev/null +++ b/gst-libs/gst/vaapi/glibcompat.h @@ -0,0 +1,36 @@ +/* + * glibcompat.h - System-dependent definitions + * + * Copyright (C) 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef GLIB_COMPAT_H +#define GLIB_COMPAT_H + +#include + +#ifndef HAVE_G_LIST_FREE_FULL +static inline void +g_list_free_full(GList *list, GDestroyNotify free_func) +{ + g_list_foreach(list, (GFunc)free_func, NULL); + g_list_free(list); +} +#endif + +#endif /* GLIB_COMPAT_H */ diff --git a/gst-libs/gst/vaapi/sysdeps.h b/gst-libs/gst/vaapi/sysdeps.h index b4a8878d16..c8be89076c 100644 --- a/gst-libs/gst/vaapi/sysdeps.h +++ b/gst-libs/gst/vaapi/sysdeps.h @@ -26,4 +26,6 @@ # include "config.h" #endif +#include "glibcompat.h" + #endif /* SYSDEPS_H */