commit:     6f9633fa02ef5fcb8f300a098b950addb78d438b
Author:     Daniel Pielmeier <billie <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 30 14:48:28 2023 +0000
Commit:     Daniel Pielmeier <billie <AT> gentoo <DOT> org>
CommitDate: Sat Sep 30 14:48:28 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f9633fa

media-sound/aqualung/files: Add missing patches

Signed-off-by: Daniel Pielmeier <billie <AT> gentoo.org>

 .../files/aqualung-1.2-mac-configure.patch         |  48 ++++++++
 .../aqualung/files/aqualung-1.2-mac-dec.patch      | 136 +++++++++++++++++++++
 .../files/aqualung-1.2-mac-endianness.patch        |  73 +++++++++++
 .../aqualung/files/aqualung-1.2-mac-glib.patch     |  22 ++++
 4 files changed, 279 insertions(+)

diff --git a/media-sound/aqualung/files/aqualung-1.2-mac-configure.patch 
b/media-sound/aqualung/files/aqualung-1.2-mac-configure.patch
new file mode 100644
index 000000000000..6418228158bf
--- /dev/null
+++ b/media-sound/aqualung/files/aqualung-1.2-mac-configure.patch
@@ -0,0 +1,48 @@
+diff -Naur aqualung-1.2_orig/configure.ac aqualung-1.2/configure.ac
+--- aqualung-1.2_orig/configure.ac     2023-08-13 18:12:52.281251038 +0200
++++ aqualung-1.2/configure.ac  2023-08-13 18:13:55.693247259 +0200
+@@ -275,11 +275,11 @@
+         [AQUALUNG_FOUND([lavc])],
+         [AQUALUNG_MISSING([lavc], [$lavc_PKG_ERRORS])])])
+ 
+-AQUALUNG_DETECT([mac], [Monkey's Audio Codec],
+-    [AC_CHECK_LIB([mac], [CreateIAPEDecompress],
+-        [AQUALUNG_FOUND([mac], [-lmac -lstdc++])],
+-        [AQUALUNG_MISSING([mac],
+-            [Monkey's Audio Codec support requires libmac])],
++AQUALUNG_DETECT([MAC], [Monkey's Audio Codec],
++    [AC_CHECK_LIB([MAC], [CreateIAPEDecompress],
++        [AQUALUNG_FOUND([MAC], [-lMAC -lstdc++])],
++        [AQUALUNG_MISSING([MAC],
++            [Monkey's Audio Codec support requires libMAC])],
+         [-lstdc++])])
+ 
+ AQUALUNG_DETECT([mod], [MOD Audio],
+diff -Naur aqualung-1.2_orig/src/decoder/dec_mac.cpp 
aqualung-1.2/src/decoder/dec_mac.cpp
+--- aqualung-1.2_orig/src/decoder/dec_mac.cpp  2023-08-13 18:20:40.318223141 
+0200
++++ aqualung-1.2/src/decoder/dec_mac.cpp       2023-08-13 18:21:33.661219962 
+0200
+@@ -31,9 +31,9 @@
+ #define DLLEXPORT
+ 
+ #include "../undef_ac_pkg.h"
+-#include <mac/All.h>
+-#include <mac/MACLib.h>
+-#include <mac/CharacterHelper.h>
++#include <MAC/All.h>
++#include <MAC/MACLib.h>
++#include <MAC/CharacterHelper.h>
+ #include "../undef_ac_pkg.h"
+ #include <config.h>   /* re-establish undefined autoconf macros */
+ 
+diff -Naur aqualung-1.2_orig/src/Makefile.am aqualung-1.2/src/Makefile.am
+--- aqualung-1.2_orig/src/Makefile.am  2023-08-14 00:51:00.972827161 +0200
++++ aqualung-1.2/src/Makefile.am       2023-08-14 00:51:10.563826590 +0200
+@@ -25,7 +25,7 @@
+ aqualung_LDADD = $(LDADD) $(xml_LIBS) $(gtk_LIBS) $(glib_LIBS) \
+                  $(alsa_LIBS) $(jack_LIBS) $(oss_LIBS) $(pulse_LIBS) \
+                  $(sndio_LIBS) $(winmm_LIBS) \
+-                 $(flac_LIBS) $(lame_LIBS) $(lavc_LIBS) $(mac_LIBS) \
++                 $(flac_LIBS) $(lame_LIBS) $(lavc_LIBS) $(MAC_LIBS) \
+                  $(mad_LIBS) $(mod_LIBS) $(mpc_LIBS) $(sndfile_LIBS) \
+                  $(speex_LIBS) $(vorbis_LIBS) $(vorbisenc_LIBS) \
+                  $(wavpack_LIBS) \

diff --git a/media-sound/aqualung/files/aqualung-1.2-mac-dec.patch 
b/media-sound/aqualung/files/aqualung-1.2-mac-dec.patch
new file mode 100644
index 000000000000..a7fb369cb1c2
--- /dev/null
+++ b/media-sound/aqualung/files/aqualung-1.2-mac-dec.patch
@@ -0,0 +1,136 @@
+--- aqualung-1.2_orig/src/decoder/dec_mac.cpp  2023-08-13 19:40:59.245935911 
+0200
++++ aqualung-1.2/src/decoder/dec_mac.cpp       2023-08-13 19:41:33.660933860 
+0200
+@@ -24,6 +24,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <glib.h>
+ 
+ 
+ /* expand this to nothing so there's no error when including MACLib.h */
+@@ -60,16 +61,16 @@
+ 
+       mac_pdata_t * pd = (mac_pdata_t *)dec->pdata;
+       file_decoder_t * fdec = dec->fdec;
+-      IAPEDecompress * pdecompress = (IAPEDecompress *)pd->decompress;
++        APE::IAPEDecompress * pdecompress = (APE::IAPEDecompress 
*)pd->decompress;
+ 
+-      int act_read = 0;
++      APE::int64 act_read = 0;
+       unsigned long scale = 1 << (pd->bits_per_sample - 1);
+       float fbuf[2 * BLOCKS_PER_READ];
+       int n = 0;
+ 
+       switch (pd->bits_per_sample) {
+       case 8:
+-              char data8[2 * BLOCKS_PER_READ];
++              unsigned char data8[2 * BLOCKS_PER_READ];
+               pdecompress->GetData(data8, BLOCKS_PER_READ, &act_read);
+               if (!act_read) {
+                       return 1;
+@@ -84,7 +85,7 @@
+ 
+       case 16:
+               short data16[2 * BLOCKS_PER_READ];
+-              pdecompress->GetData((char *)data16, BLOCKS_PER_READ, 
&act_read);
++              pdecompress->GetData((unsigned char *)data16, BLOCKS_PER_READ, 
&act_read);
+               if (!act_read) {
+                       return 1;
+               }
+@@ -100,7 +101,7 @@
+ 
+       case 32:
+               int data32[2 * BLOCKS_PER_READ];
+-              pdecompress->GetData((char *)data32, BLOCKS_PER_READ, 
&act_read);
++              pdecompress->GetData((unsigned char *)data32, BLOCKS_PER_READ, 
&act_read);
+               if (!act_read) {
+                       return 1;
+               }
+@@ -170,31 +171,33 @@
+       mac_pdata_t * pd = (mac_pdata_t *)dec->pdata;
+       file_decoder_t * fdec = dec->fdec;
+       metadata_t * meta;
+-      IAPEDecompress * pdecompress = (IAPEDecompress *)pd->decompress;
++      APE::IAPEDecompress * pdecompress = (APE::IAPEDecompress 
*)pd->decompress;
+       const char * comp_level = NULL;
+ 
+ 
+       int ret = 0;
+ #ifdef __OpenBSD__
+         wchar_t * pUTF16 = GetUTF16FromANSI(filename);
+-#else
+-        wchar_t * pUTF16 = CAPECharacterHelper::GetUTF16FromANSI(filename);
+-#endif
+         pdecompress = CreateIAPEDecompress(pUTF16, &ret);
+         free(pUTF16);
++#else
++        gunichar2 * pUTF16 = g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
++        pdecompress = CreateIAPEDecompress((wchar_t *)pUTF16, &ret, FALSE, 
FALSE, FALSE);
++        g_free(pUTF16);
++#endif
+ 
+         if (!pdecompress || ret != ERROR_SUCCESS) {
+                 return DECODER_OPEN_BADLIB;
+         }
+ 
+       pd->decompress = (void *)pdecompress;
+-        pd->sample_rate = pdecompress->GetInfo(APE_INFO_SAMPLE_RATE);
+-        pd->bits_per_sample = pdecompress->GetInfo(APE_INFO_BITS_PER_SAMPLE);
+-        pd->bitrate = pdecompress->GetInfo(APE_DECOMPRESS_AVERAGE_BITRATE);
+-        pd->channels = pdecompress->GetInfo(APE_INFO_CHANNELS);
+-        pd->length_in_ms = pdecompress->GetInfo(APE_DECOMPRESS_LENGTH_MS);
+-        pd->block_align = pdecompress->GetInfo(APE_INFO_BLOCK_ALIGN);
+-      pd->compression_level = 
pdecompress->GetInfo(APE_INFO_COMPRESSION_LEVEL);
++        pd->sample_rate = 
pdecompress->GetInfo(APE::IAPEDecompress::APE_INFO_SAMPLE_RATE);
++        pd->bits_per_sample = 
pdecompress->GetInfo(APE::IAPEDecompress::APE_INFO_BITS_PER_SAMPLE);
++        pd->bitrate = 
pdecompress->GetInfo(APE::IAPEDecompress::APE_DECOMPRESS_AVERAGE_BITRATE);
++        pd->channels = 
pdecompress->GetInfo(APE::IAPEDecompress::APE_INFO_CHANNELS);
++        pd->length_in_ms = 
pdecompress->GetInfo(APE::IAPEDecompress::APE_DECOMPRESS_LENGTH_MS);
++        pd->block_align = 
pdecompress->GetInfo(APE::IAPEDecompress::APE_INFO_BLOCK_ALIGN);
++      pd->compression_level = 
pdecompress->GetInfo(APE::IAPEDecompress::APE_INFO_COMPRESSION_LEVEL);
+ 
+       if ((pd->channels != 1) && (pd->channels != 2)) {
+               printf("Sorry, MAC file with %d channels is not supported.\n", 
pd->channels);
+@@ -218,19 +221,19 @@
+       fdec->file_lib = MAC_LIB;
+ 
+       switch (pd->compression_level) {
+-      case COMPRESSION_LEVEL_FAST:
++      case APE_COMPRESSION_LEVEL_FAST:
+               comp_level = _("Compression: Fast");
+               break;
+-      case COMPRESSION_LEVEL_NORMAL:
++      case APE_COMPRESSION_LEVEL_NORMAL:
+               comp_level = _("Compression: Normal");
+               break;
+-      case COMPRESSION_LEVEL_HIGH:
++      case APE_COMPRESSION_LEVEL_HIGH:
+               comp_level = _("Compression: High");
+               break;
+-      case COMPRESSION_LEVEL_EXTRA_HIGH:
++      case APE_COMPRESSION_LEVEL_EXTRA_HIGH:
+               comp_level = _("Compression: Extra High");
+               break;
+-      case COMPRESSION_LEVEL_INSANE:
++      case APE_COMPRESSION_LEVEL_INSANE:
+               comp_level = _("Compression: Insane");
+               break;
+       default:
+@@ -255,7 +258,7 @@
+ mac_decoder_close(decoder_t * dec) {
+ 
+       mac_pdata_t * pd = (mac_pdata_t *)dec->pdata;
+-      IAPEDecompress * pdecompress = (IAPEDecompress *)pd->decompress;
++      APE::IAPEDecompress * pdecompress = (APE::IAPEDecompress 
*)pd->decompress;
+ 
+       delete(pdecompress);
+       rb_free(pd->rb);
+@@ -294,7 +297,7 @@
+       
+       mac_pdata_t * pd = (mac_pdata_t *)dec->pdata;
+       file_decoder_t * fdec = dec->fdec;
+-      IAPEDecompress * pdecompress = (IAPEDecompress *)pd->decompress;
++      APE::IAPEDecompress * pdecompress = (APE::IAPEDecompress 
*)pd->decompress;
+       char flush_dest;
+ 
+       pdecompress->Seek(seek_to_pos);

diff --git a/media-sound/aqualung/files/aqualung-1.2-mac-endianness.patch 
b/media-sound/aqualung/files/aqualung-1.2-mac-endianness.patch
new file mode 100644
index 000000000000..3296bd67ad7e
--- /dev/null
+++ b/media-sound/aqualung/files/aqualung-1.2-mac-endianness.patch
@@ -0,0 +1,73 @@
+From d2c88317b6042a05c236faf3c09f600337c6379e Mon Sep 17 00:00:00 2001
+From: Jeremy Evans <[email protected]>
+Date: Tue, 5 Sep 2023 17:48:00 +0100
+Subject: [PATCH] Fix the Monkey's Audio decoder to work with current Monkey's
+ Audio (Fixes #33)
+
+Using g_utf8_to_utf16 doesn't work because current Monkey's Audio
+expects a different endianness of the multibyte character string.
+Using GetUTF16FromANSI works for compiling only if namedspaced
+correctly, and if namespaced correctly, it cannot link. Use a
+similar approach for building the correct multibyte string.
+
+Remove the DLLEXPORT define, to avoid a warning when including
+the MAC headers.
+
+Tested using the Monkey's Audio 10.20 SDK.
+---
+ src/decoder/dec_mac.cpp | 25 ++++++++++---------------
+ 1 file changed, 10 insertions(+), 15 deletions(-)
+
+diff --git a/src/decoder/dec_mac.cpp b/src/decoder/dec_mac.cpp
+index b007f74..6d4b658 100644
+--- a/src/decoder/dec_mac.cpp
++++ b/src/decoder/dec_mac.cpp
+@@ -27,14 +27,9 @@
+ #include <glib.h>
+ 
+ 
+-/* expand this to nothing so there's no error when including MACLib.h */
+-/* -- talkin' about cross-platform libraries? */
+-#define DLLEXPORT
+-
+ #include "../undef_ac_pkg.h"
+ #include <MAC/All.h>
+ #include <MAC/MACLib.h>
+-#include <MAC/CharacterHelper.h>
+ #include "../undef_ac_pkg.h"
+ #include <config.h>   /* re-establish undefined autoconf macros */
+ 
+@@ -48,7 +43,6 @@
+ 
+ extern size_t sample_size;
+ 
+-
+ #define BLOCKS_PER_READ 2048
+ 
+ 
+@@ -176,15 +170,16 @@ mac_decoder_open(decoder_t * dec, char * filename) {
+ 
+ 
+       int ret = 0;
+-#ifdef __OpenBSD__
+-        wchar_t * pUTF16 = GetUTF16FromANSI(filename);
+-        pdecompress = CreateIAPEDecompress(pUTF16, &ret);
+-        free(pUTF16);
+-#else
+-        gunichar2 * pUTF16 = g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
+-        pdecompress = CreateIAPEDecompress((wchar_t *)pUTF16, &ret, FALSE, 
FALSE, FALSE);
+-        g_free(pUTF16);
+-#endif
++        int filename_len = strlen(filename);
++        int i;
++        APE::str_utfn * filename_utf16 = new APE::str_utfn 
[static_cast<size_t>(filename_len) + 1];
++
++        for (i = 0; i < filename_len; i++)
++            filename_utf16[i] = (APE::str_utfn)(APE::str_utf8)filename[i];
++        filename_utf16[i] = 0;
++
++        pdecompress = CreateIAPEDecompress(filename_utf16, &ret, FALSE, 
FALSE, FALSE);
++        delete [] filename_utf16;
+ 
+         if (!pdecompress || ret != ERROR_SUCCESS) {
+                 return DECODER_OPEN_BADLIB;

diff --git a/media-sound/aqualung/files/aqualung-1.2-mac-glib.patch 
b/media-sound/aqualung/files/aqualung-1.2-mac-glib.patch
new file mode 100644
index 000000000000..59aee6432581
--- /dev/null
+++ b/media-sound/aqualung/files/aqualung-1.2-mac-glib.patch
@@ -0,0 +1,22 @@
+From 1c2a295a72e1e3abc6df40714d9753e311541550 Mon Sep 17 00:00:00 2001
+From: Jeremy Evans <[email protected]>
+Date: Wed, 6 Sep 2023 09:02:31 +0100
+Subject: [PATCH] Remove now unnecessary glib include in mac decoder
+
+Pointed out by Daniel Pielmeier.
+---
+ src/decoder/dec_mac.cpp | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/decoder/dec_mac.cpp b/src/decoder/dec_mac.cpp
+index 6d4b658..f89450d 100644
+--- a/src/decoder/dec_mac.cpp
++++ b/src/decoder/dec_mac.cpp
+@@ -24,7 +24,6 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <glib.h>
+ 
+ 
+ #include "../undef_ac_pkg.h"

Reply via email to