From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Mon, 7 Feb 2022 22:44:30 +0100 Subject: [PATCH] openaptx: Support libfreeaptx [libfreeaptx][1] is a fork of libopenapt 0.2.0, used by pipewire. [1]: https://github.com/iamthehorker/libfreeaptx --- .../gst-plugins-bad/ext/openaptx/gstopenaptxdec.h | 4 ++++ .../gst-plugins-bad/ext/openaptx/gstopenaptxenc.h | 4 ++++ .../gst-plugins-bad/ext/openaptx/meson.build | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/openaptx/gstopenaptxdec.h b/subprojects/gst-plugins-bad/ext/openaptx/gstopenaptxdec.h index 95b126c57ecb..081b194fb542 100644 --- a/subprojects/gst-plugins-bad/ext/openaptx/gstopenaptxdec.h +++ b/subprojects/gst-plugins-bad/ext/openaptx/gstopenaptxdec.h @@ -24,7 +24,11 @@ #include #include +#ifdef USE_FREEAPTX +#include +#else #include +#endif G_BEGIN_DECLS diff --git a/subprojects/gst-plugins-bad/ext/openaptx/gstopenaptxenc.h b/subprojects/gst-plugins-bad/ext/openaptx/gstopenaptxenc.h index ab80b61b7c94..4cf7e17b93af 100644 --- a/subprojects/gst-plugins-bad/ext/openaptx/gstopenaptxenc.h +++ b/subprojects/gst-plugins-bad/ext/openaptx/gstopenaptxenc.h @@ -24,7 +24,11 @@ #include #include +#ifdef USE_FREEAPTX +#include +#else #include +#endif G_BEGIN_DECLS diff --git a/subprojects/gst-plugins-bad/ext/openaptx/meson.build b/subprojects/gst-plugins-bad/ext/openaptx/meson.build index e361ef3b6c59..4db8fdbb1564 100644 --- a/subprojects/gst-plugins-bad/ext/openaptx/meson.build +++ b/subprojects/gst-plugins-bad/ext/openaptx/meson.build @@ -4,12 +4,23 @@ openaptx_sources = [ 'gstopenaptxenc.c', ] -openaptx_dep = dependency('libopenaptx', version : '== 0.2.0', required : get_option('openaptx')) +if not get_option('openaptx').allowed() + subdir_done() +endif + +openaptx_defines = [] + +openaptx_dep = dependency('libfreeaptx', version : '>= 0.1.1', required : false) +if openaptx_dep.found() + openaptx_defines += ['-DUSE_FREEAPTX'] +else + openaptx_dep = dependency('libopenaptx', version : '== 0.2.0', required : get_option('openaptx')) +endif if openaptx_dep.found() gstopenaptx = library('gstopenaptx', openaptx_sources, - c_args : gst_plugins_bad_args, + c_args : gst_plugins_bad_args + openaptx_defines, include_directories : [configinc], dependencies : [gstaudio_dep, openaptx_dep], install : true,