commit:     a4098282abf2ea5c80ed202416b85431e79e53ef
Author:     Igor V. Kovalenko <igor.v.kovalenko <AT> gmail <DOT> com>
AuthorDate: Tue Feb 15 10:14:17 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Mar  8 13:32:23 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a4098282

media-plugins/gst-plugins-openaptx: Add openaptx plugin from gstreamer 1.20.0

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-plugins/gst-plugins-openaptx/Manifest        |  1 +
 .../gst-plugins-openaptx-1.20.0-freeaptx.patch     | 76 ++++++++++++++++++++++
 .../gst-plugins-openaptx-1.20.0.ebuild             | 24 +++++++
 media-plugins/gst-plugins-openaptx/metadata.xml    |  8 +++
 4 files changed, 109 insertions(+)

diff --git a/media-plugins/gst-plugins-openaptx/Manifest 
b/media-plugins/gst-plugins-openaptx/Manifest
new file mode 100644
index 000000000000..269dcd662f74
--- /dev/null
+++ b/media-plugins/gst-plugins-openaptx/Manifest
@@ -0,0 +1 @@
+DIST gst-plugins-bad-1.20.0.tar.xz 6203880 BLAKE2B 
3c2bcbd5e3af56497415ac9e32b91bf0f9ed0668d6992c8d14b2b56c86be2178ea93409e505d438b56fe87bf75a4c96554fd3cbf9ea5b204b2a520fccb6894fe
 SHA512 
d79fedba96517c25d2ba3925405933671fa05e350b8e133277a7c1d509e08a49ceeb50c016e23e798667fa0b09783105914f06538bdcaae969fdba8ac385a51b

diff --git 
a/media-plugins/gst-plugins-openaptx/files/gst-plugins-openaptx-1.20.0-freeaptx.patch
 
b/media-plugins/gst-plugins-openaptx/files/gst-plugins-openaptx-1.20.0-freeaptx.patch
new file mode 100644
index 000000000000..82602552838e
--- /dev/null
+++ 
b/media-plugins/gst-plugins-openaptx/files/gst-plugins-openaptx-1.20.0-freeaptx.patch
@@ -0,0 +1,76 @@
+commit acd0300485a49f2d5929252139011453e9611fe3
+Author: Jan Alexander Steffens (heftig) <hef...@archlinux.org>
+Date:   Tue Feb 8 15:22:39 2022 +0100
+
+    openaptx: Support libfreeaptx
+    
+    [libfreeaptx][1] is a fork of libopenapt 0.2.0, used by pipewire.
+    
+    [1]: https://github.com/iamthehorker/libfreeaptx
+    
+    Fixes: 
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1642
+    Closes: 
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1589
+    Part-of: 
<https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1667>
+
+diff --git a/ext/openaptx/gstopenaptxdec.h b/ext/openaptx/gstopenaptxdec.h
+index 95b126c57e..081b194fb5 100644
+--- a/ext/openaptx/gstopenaptxdec.h
++++ b/ext/openaptx/gstopenaptxdec.h
+@@ -24,7 +24,11 @@
+ #include <gst/gst.h>
+ #include <gst/audio/audio.h>
+ 
++#ifdef USE_FREEAPTX
++#include <freeaptx.h>
++#else
+ #include <openaptx.h>
++#endif
+ 
+ G_BEGIN_DECLS
+ 
+diff --git a/ext/openaptx/gstopenaptxenc.h b/ext/openaptx/gstopenaptxenc.h
+index ab80b61b7c..4cf7e17b93 100644
+--- a/ext/openaptx/gstopenaptxenc.h
++++ b/ext/openaptx/gstopenaptxenc.h
+@@ -24,7 +24,11 @@
+ #include <gst/gst.h>
+ #include <gst/audio/audio.h>
+ 
++#ifdef USE_FREEAPTX
++#include <freeaptx.h>
++#else
+ #include <openaptx.h>
++#endif
+ 
+ G_BEGIN_DECLS
+ 
+diff --git a/ext/openaptx/meson.build b/ext/openaptx/meson.build
+index e361ef3b6c..4db8fdbb15 100644
+--- a/ext/openaptx/meson.build
++++ b/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,

diff --git 
a/media-plugins/gst-plugins-openaptx/gst-plugins-openaptx-1.20.0.ebuild 
b/media-plugins/gst-plugins-openaptx/gst-plugins-openaptx-1.20.0.ebuild
new file mode 100644
index 000000000000..e1f991dab9bc
--- /dev/null
+++ b/media-plugins/gst-plugins-openaptx/gst-plugins-openaptx-1.20.0.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+GST_ORG_MODULE=gst-plugins-bad
+
+inherit gstreamer-meson
+
+DESCRIPTION="openaptx plugin for GStreamer"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="
+       || (
+               >=media-libs/libfreeaptx-0.1.1[${MULTILIB_USEDEP}]
+               =media-libs/libopenaptx-0.2.0*[${MULTILIB_USEDEP}]
+       )
+"
+DEPEND="${RDEPEND}"
+
+# Fixes backported to 1.20.0, to be removed in 1.20.1
+PATCHES=(
+       "${FILESDIR}/gst-plugins-openaptx-1.20.0-freeaptx.patch"
+)

diff --git a/media-plugins/gst-plugins-openaptx/metadata.xml 
b/media-plugins/gst-plugins-openaptx/metadata.xml
new file mode 100644
index 000000000000..33fa99dbc4ba
--- /dev/null
+++ b/media-plugins/gst-plugins-openaptx/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+<maintainer type="project">
+       <email>gstrea...@gentoo.org</email>
+       <name>GStreamer package maintainers</name>
+</maintainer>
+</pkgmetadata>

Reply via email to