DIST apulse-0.1.12.tar.gz 117220 BLAKE2B 04d88a298ff5e21e19fda1979ebbc96a6441f83212d6903a004a54ee360276985e66b637571a76e3fe6821d42762ac515b02a8a2cb0149a66f3150e34bd0d9b7 SHA512 9fe39ab93e90d7ec589c7632bf439bfc7fe8bbd0792ce1197ec8547fbe1901fec50facdf33c55cfbadbc1af4414fdf48f1f241406903a8f15f445b97dca7076a
+DIST apulse-0.1.13.tar.gz 117369 BLAKE2B 8cf527daf21420a72e46968a3b07ab61029f404a2b6574ac1f08dd40528f3e6e4baf7e38f5914b0c89252e16eec5e8f3722be51e5a61b6a71c683e994740b4bf SHA512 366385ae2304f7ff697ba70951d0753a5b1630310922e3763fd0813a73e0b4088b715135295aa2fa9111b8edcf91d82849dc31346b292b2e9db598bcdd47b007
--- /dev/null
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+CMAKE_ECLASS=cmake
+inherit multilib cmake-multilib
+
+DESCRIPTION="PulseAudio emulation for ALSA"
+HOMEPAGE="https://github.com/i-rinat/apulse"
+SRC_URI="https://github.com/i-rinat/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="debug sdk test"
+RESTRICT="!test? ( test )"
+
+DEPEND="dev-libs/glib:2[${MULTILIB_USEDEP}]
+ media-libs/alsa-lib[${MULTILIB_USEDEP}]
+ sdk? ( !media-sound/pulseaudio ) "
+RDEPEND="${DEPEND}
+ !!media-plugins/alsa-plugins[pulseaudio]"
+
+PATCHES=(
+ "${FILESDIR}/sdk.patch"
+ "${FILESDIR}/check-key-before-remove.patch"
+ "${FILESDIR}/man.patch"
+)
+
+src_prepare() {
+ cmake_src_prepare
+
+ if ! use sdk; then
+ # Ensure all relevant libdirs are added, to support all ABIs
+ DIRS=
+ _add_dir() { DIRS="${EPREFIX}/usr/$(get_libdir)/apulse${DIRS:+:${DIRS}}"; }
+ multilib_foreach_abi _add_dir
+ sed -e "s#@@DIRS@@#${DIRS}#g" "${FILESDIR}"/apulse > "${T}"/apulse || die
+ fi
+}
+
+multilib_src_configure() {
+ local mycmakeargs=(
+ "-DINSTALL_SDK=$(usex sdk)"
+ "-DLOG_TO_STDERR=$(usex debug)"
+ "-DWITH_TRACE=$(usex debug)"
+ )
+ cmake_src_configure
+}
+
+multilib_src_test() {
+ emake check
+}
+
+multilib_src_install_all() {
+ if ! use sdk; then
+ _install_wrapper() { newbin "${BUILD_DIR}/apulse" "${CHOST}-apulse"; }
+ multilib_foreach_abi _install_wrapper
+ dobin "${T}/apulse"
+ fi
+ einstalldocs
+}
--- /dev/null
+From bf146f0d711ce3e48cdc8ba772039d843d590b47 Mon Sep 17 00:00:00 2001
+From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
+Date: Sun, 20 Oct 2019 05:09:29 +0200
+Subject: [PATCH] stream: Check the key before invoking g_hash_table_remove
+
+Turns out that I hit a bug where pa_stream_unref would
+call g_hash_table_remove with a NULL key.
+
+Thanks for the lightweight and smooth error handling from
+Glib, g_hash_table_remove generated an ABORT call, crashing
+some Unity3D games I was trying to start.
+Now, you also CANNOT call g_hash_table_lookup with a NULL
+key. That also generate a crash... Ugh...
+
+So, yeah, we first check that the key is not 0, then check
+if the key is actually inside the Hash table and THEN remove
+it.
+
+Note, here's my ~/.asoundrc, just in case :
+defaults.pcm.!card Audio
+defaults.ctl.!card Audio
+
+Audio being :
+card 3: Audio [DigiHug USB Audio], device 0: USB Audio [USB Audio]
+ Subdevices: 0/1
+ Subdevice #0: subdevice #0
+card 3: Audio [DigiHug USB Audio], device 1: USB Audio [USB Audio #1]
+ Subdevices: 1/1
+ Subdevice #0: subdevice #0
+
+I'm using a FiiO device for sound output.
+
+Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
+---
+ src/apulse-stream.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/apulse-stream.c b/src/apulse-stream.c
+index 84b18bb..1de4885 100644
+--- a/src/apulse-stream.c
++++ b/src/apulse-stream.c
+@@ -1019,7 +1019,11 @@ pa_stream_unref(pa_stream *s)
+
+ s->ref_cnt--;
+ if (s->ref_cnt == 0) {
+- g_hash_table_remove(s->c->streams_ht, GINT_TO_POINTER(s->idx));
++ GHashTable * __restrict const streams_ht =
++ s->c->streams_ht;
++ void const * key = GINT_TO_POINTER(s->idx);
++ if (key && g_hash_table_lookup(streams_ht, key))
++ g_hash_table_remove(streams_ht, key);
+ ringbuffer_free(s->rb);
+ free(s->peek_buffer);
+ free(s->write_buffer);
--- /dev/null
+From 2c2bf366599d957837acbdf54eb300526fc125a1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
+Date: Tue, 5 May 2020 14:24:52 -0300
+Subject: [PATCH] Add ENVIRONMENT to man-page.
+
+---
+ man/apulse.1 | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/man/apulse.1 b/man/apulse.1
+index cd67cf3..df75c60 100644
+--- a/man/apulse.1
++++ b/man/apulse.1
+@@ -36,6 +36,16 @@ compatibility layer between OSS programs and \fBALSA\fR, \fBapulse\fR was
+ designed to be compatibility layer between PulseAudio applications and
+ \fBALSA\fR.
+
++.SH ENVIRONMENT
++
++The following environment variables can be used to configure the devices used
++by \fBapulse\fR. Try \fIhw:0,0\fR, \fIplughw:0,0\fR and the like.
++Refer to the ALSA user guide for a full list of device names.
++
++\fIAPULSE_CAPTURE_DEVICE\fR: Can be used to configure the capture device.
++
++\fIAPULSE_PLAYBACK_DEVICE\fR: Can be used to configure the playback device.
++
+ .SH RETURN VALUE
+
+ \fBapulse\fR is a simple shell wrapper script that calls \fBexec\fR on the