From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0D88415814C for ; Fri, 15 Sep 2023 09:16:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 30D112BC021; Fri, 15 Sep 2023 09:16:35 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id EDECD2BC01C for ; Fri, 15 Sep 2023 09:16:34 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1D3B6335D1B for ; Fri, 15 Sep 2023 09:16:34 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6C2FD11A2 for ; Fri, 15 Sep 2023 09:16:32 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1694769356.1869e5c50ca0705e8bb2bbe144273ea272215946.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/webrtc-audio-processing/files/, media-libs/webrtc-audio-processing/ X-VCS-Repository: repo/gentoo X-VCS-Files: media-libs/webrtc-audio-processing/files/webrtc-audio-processing-0.3-Add-generic-byte-order-and-pointer-size-detection.patch media-libs/webrtc-audio-processing/files/webrtc-audio-processing-0.3-big-endian-support.patch media-libs/webrtc-audio-processing/webrtc-audio-processing-0.3.1-r1.ebuild X-VCS-Directories: media-libs/webrtc-audio-processing/files/ media-libs/webrtc-audio-processing/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 1869e5c50ca0705e8bb2bbe144273ea272215946 X-VCS-Branch: master Date: Fri, 15 Sep 2023 09:16:32 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ebdca263-d54a-4776-b64b-b7b4f6a6d095 X-Archives-Hash: 176a5cfe9c06fe66ed72f56607e13f8c commit: 1869e5c50ca0705e8bb2bbe144273ea272215946 Author: Niccolò Belli linuxsystems it> AuthorDate: Thu Feb 23 09:13:27 2023 +0000 Commit: Sam James gentoo org> CommitDate: Fri Sep 15 09:15:56 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1869e5c5 media-libs/webrtc-audio-processing: add big-endian patches, keyword 0.3.1 for ~ppc64 Signed-off-by: Niccolò Belli linuxsystems.it> Signed-off-by: Sam James gentoo.org> ...ric-byte-order-and-pointer-size-detection.patch | 35 +++++++ ...c-audio-processing-0.3-big-endian-support.patch | 103 +++++++++++++++++++++ .../webrtc-audio-processing-0.3.1-r1.ebuild | 36 +++++++ 3 files changed, 174 insertions(+) diff --git a/media-libs/webrtc-audio-processing/files/webrtc-audio-processing-0.3-Add-generic-byte-order-and-pointer-size-detection.patch b/media-libs/webrtc-audio-processing/files/webrtc-audio-processing-0.3-Add-generic-byte-order-and-pointer-size-detection.patch new file mode 100644 index 000000000000..0c4508986e4b --- /dev/null +++ b/media-libs/webrtc-audio-processing/files/webrtc-audio-processing-0.3-Add-generic-byte-order-and-pointer-size-detection.patch @@ -0,0 +1,35 @@ +From: Than +Date: Wed, 8 Jun 2016 19:10:08 -0400 +Subject: Add generic byte order and pointer size detection + +https://sources.debian.org/patches/webrtc-audio-processing/0.3-1/Add-generic-byte-order-and-pointer-size-detection.patch/ +https://bugs.freedesktop.org/show_bug.cgi?id=95738 +--- + webrtc/typedefs.h | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/webrtc/typedefs.h b/webrtc/typedefs.h +index d875490..dc074f1 100644 +--- a/webrtc/typedefs.h ++++ b/webrtc/typedefs.h +@@ -48,7 +48,19 @@ + #define WEBRTC_ARCH_32_BITS + #define WEBRTC_ARCH_LITTLE_ENDIAN + #else +-#error Please add support for your architecture in typedefs.h ++/* instead of failing, use typical unix defines... */ ++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ++#define WEBRTC_ARCH_LITTLE_ENDIAN ++#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ++#define WEBRTC_ARCH_BIG_ENDIAN ++#else ++#error __BYTE_ORDER__ is not defined ++#endif ++#if defined(__LP64__) ++#define WEBRTC_ARCH_64_BITS ++#else ++#define WEBRTC_ARCH_32_BITS ++#endif + #endif + + #if !(defined(WEBRTC_ARCH_LITTLE_ENDIAN) ^ defined(WEBRTC_ARCH_BIG_ENDIAN)) diff --git a/media-libs/webrtc-audio-processing/files/webrtc-audio-processing-0.3-big-endian-support.patch b/media-libs/webrtc-audio-processing/files/webrtc-audio-processing-0.3-big-endian-support.patch new file mode 100644 index 000000000000..34f27dd70484 --- /dev/null +++ b/media-libs/webrtc-audio-processing/files/webrtc-audio-processing-0.3-big-endian-support.patch @@ -0,0 +1,103 @@ +From: Than +Date: Mon, 6 Jun 2016 12:08:58 -0400 +Subject: big endian support + +https://sources.debian.org/patches/webrtc-audio-processing/0.3-1/big-endian-support.patch/ +https://bugs.freedesktop.org/show_bug.cgi?id=95738 +--- + webrtc/common_audio/wav_file.cc | 20 +++++++++++++++----- + webrtc/common_audio/wav_header.cc | 34 +++++++++++++++++++++++++++++++++- + 2 files changed, 48 insertions(+), 6 deletions(-) + +diff --git a/webrtc/common_audio/wav_file.cc b/webrtc/common_audio/wav_file.cc +index b14b620..05fa052 100644 +--- a/webrtc/common_audio/wav_file.cc ++++ b/webrtc/common_audio/wav_file.cc +@@ -64,9 +64,6 @@ WavReader::~WavReader() { + } + + size_t WavReader::ReadSamples(size_t num_samples, int16_t* samples) { +-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN +-#error "Need to convert samples to big-endian when reading from WAV file" +-#endif + // There could be metadata after the audio; ensure we don't read it. + num_samples = std::min(rtc::checked_cast(num_samples), + num_samples_remaining_); +@@ -76,6 +73,12 @@ size_t WavReader::ReadSamples(size_t num_samples, int16_t* samples) { + RTC_CHECK(read == num_samples || feof(file_handle_)); + RTC_CHECK_LE(read, num_samples_remaining_); + num_samples_remaining_ -= rtc::checked_cast(read); ++#ifndef WEBRTC_ARCH_LITTLE_ENDIAN ++ //convert to big-endian ++ for(size_t idx = 0; idx < num_samples; idx++) { ++ samples[idx] = (samples[idx]<<8) | (samples[idx]>>8); ++ } ++#endif + return read; + } + +@@ -120,10 +123,17 @@ WavWriter::~WavWriter() { + + void WavWriter::WriteSamples(const int16_t* samples, size_t num_samples) { + #ifndef WEBRTC_ARCH_LITTLE_ENDIAN +-#error "Need to convert samples to little-endian when writing to WAV file" +-#endif ++ int16_t * le_samples = new int16_t[num_samples]; ++ for(size_t idx = 0; idx < num_samples; idx++) { ++ le_samples[idx] = (samples[idx]<<8) | (samples[idx]>>8); ++ } ++ const size_t written = ++ fwrite(le_samples, sizeof(*le_samples), num_samples, file_handle_); ++ delete []le_samples; ++#else + const size_t written = + fwrite(samples, sizeof(*samples), num_samples, file_handle_); ++#endif + RTC_CHECK_EQ(num_samples, written); + num_samples_ += static_cast(written); + RTC_CHECK(written <= std::numeric_limits::max() || +diff --git a/webrtc/common_audio/wav_header.cc b/webrtc/common_audio/wav_header.cc +index 61cfffe..53882ff 100644 +--- a/webrtc/common_audio/wav_header.cc ++++ b/webrtc/common_audio/wav_header.cc +@@ -129,7 +129,39 @@ static inline std::string ReadFourCC(uint32_t x) { + return std::string(reinterpret_cast(&x), 4); + } + #else +-#error "Write be-to-le conversion functions" ++static inline void WriteLE16(uint16_t* f, uint16_t x) { ++ *f = ((x << 8) & 0xff00) | ( ( x >> 8) & 0x00ff); ++} ++ ++static inline void WriteLE32(uint32_t* f, uint32_t x) { ++ *f = ( (x & 0x000000ff) << 24 ) ++ | ((x & 0x0000ff00) << 8) ++ | ((x & 0x00ff0000) >> 8) ++ | ((x & 0xff000000) >> 24 ); ++} ++ ++static inline void WriteFourCC(uint32_t* f, char a, char b, char c, char d) { ++ *f = (static_cast(a) << 24 ) ++ | (static_cast(b) << 16) ++ | (static_cast(c) << 8) ++ | (static_cast(d) ); ++} ++ ++static inline uint16_t ReadLE16(uint16_t x) { ++ return (( x & 0x00ff) << 8 )| ((x & 0xff00)>>8); ++} ++ ++static inline uint32_t ReadLE32(uint32_t x) { ++ return ( (x & 0x000000ff) << 24 ) ++ | ( (x & 0x0000ff00) << 8 ) ++ | ( (x & 0x00ff0000) >> 8) ++ | ( (x & 0xff000000) >> 24 ); ++} ++ ++static inline std::string ReadFourCC(uint32_t x) { ++ x = ReadLE32(x); ++ return std::string(reinterpret_cast(&x), 4); ++} + #endif + + static inline uint32_t RiffChunkSize(uint32_t bytes_in_payload) { diff --git a/media-libs/webrtc-audio-processing/webrtc-audio-processing-0.3.1-r1.ebuild b/media-libs/webrtc-audio-processing/webrtc-audio-processing-0.3.1-r1.ebuild new file mode 100644 index 000000000000..946115a3b322 --- /dev/null +++ b/media-libs/webrtc-audio-processing/webrtc-audio-processing-0.3.1-r1.ebuild @@ -0,0 +1,36 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools multilib-minimal + +DESCRIPTION="AudioProcessing library from the webrtc.org code base" +HOMEPAGE="https://www.freedesktop.org/software/pulseaudio/webrtc-audio-processing/" +SRC_URI="https://freedesktop.org/software/pulseaudio/${PN}/${P}.tar.xz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86 ~amd64-linux" +IUSE="static-libs" + +DOCS=( AUTHORS NEWS README.md ) + +PATCHES=( + "${FILESDIR}"/${PN}-0.3-proper_detection_cxxabi_execinfo.patch + "${FILESDIR}"/${PN}-0.3-Add-generic-byte-order-and-pointer-size-detection.patch + "${FILESDIR}"/${PN}-0.3-big-endian-support.patch +) + +src_prepare() { + default + eautoreconf +} + +multilib_src_configure() { + ECONF_SOURCE="${S}" econf $(use_enable static-libs static) +} + +multilib_src_install_all() { + find "${ED}" -type f -name "*.la" -delete || die +}