Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Dec 2025 21:22:29 +0000
From:      Christian Weisgerber <naddy@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 3cced352fcc2 - main - audio/libopusenc: avoid __opus_check_* macros
Message-ID:  <69447095.411b1.376f64f1@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by naddy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3cced352fcc234b9317688ad81dabca7be920e05

commit 3cced352fcc234b9317688ad81dabca7be920e05
Author:     Christian Weisgerber <naddy@FreeBSD.org>
AuthorDate: 2025-12-18 21:10:28 +0000
Commit:     Christian Weisgerber <naddy@FreeBSD.org>
CommitDate: 2025-12-18 21:22:09 +0000

    audio/libopusenc: avoid __opus_check_* macros
    
    opus 1.6 removed internal macros starting with an __opus prefix.
    
    PR:             291730
    Obtained from:  https://gitlab.xiph.org/xiph/libopusenc/-/commit/04c6172ffbbd5c7f7f2e170cf843872113f33b05
---
 audio/libopusenc/Makefile                      |  2 +-
 audio/libopusenc/files/patch-include_opusenc.h | 53 ++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/audio/libopusenc/Makefile b/audio/libopusenc/Makefile
index 38d048114ad0..16ed51b39131 100644
--- a/audio/libopusenc/Makefile
+++ b/audio/libopusenc/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	libopusenc
 PORTVERSION=	0.2.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	audio
 MASTER_SITES=	MOZILLA/opus
 
diff --git a/audio/libopusenc/files/patch-include_opusenc.h b/audio/libopusenc/files/patch-include_opusenc.h
new file mode 100644
index 000000000000..1c3774038996
--- /dev/null
+++ b/audio/libopusenc/files/patch-include_opusenc.h
@@ -0,0 +1,53 @@
+https://gitlab.xiph.org/xiph/libopusenc/-/commit/04c6172ffbbd5c7f7f2e170cf843872113f33b05
+
+--- include/opusenc.h.orig	2018-09-14 17:12:05 UTC
++++ include/opusenc.h
+@@ -121,6 +121,13 @@ extern "C" {
+ #define OPE_GET_NB_STREAMS_REQUEST          14013
+ #define OPE_GET_NB_COUPLED_STREAMS_REQUEST  14015
+ 
++/* Macros to trigger compilation errors when the wrong types are provided to a CTL. */
++/* These macros are not part of the API and are only for use within the macros below. */
++#define ope_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x))
++#define ope_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr)))
++#define ope_check_packet_func(x) ((void)((void (*)(void *, const unsigned char *, opus_int32, opus_uint32))0 == (x)), (x))
++#define ope_check_void_ptr(x) ((void)((void *)0 == (x)), (x))
++
+ /**\defgroup encoder_ctl Encoding Options*/
+ /*@{*/
+ 
+@@ -129,21 +136,20 @@ extern "C" {
+    Macros for setting encoder options.*/
+ /*@{*/
+ 
+-#define OPE_SET_DECISION_DELAY(x) OPE_SET_DECISION_DELAY_REQUEST, __opus_check_int(x)
+-#define OPE_GET_DECISION_DELAY(x) OPE_GET_DECISION_DELAY_REQUEST, __opus_check_int_ptr(x)
+-#define OPE_SET_MUXING_DELAY(x) OPE_SET_MUXING_DELAY_REQUEST, __opus_check_int(x)
+-#define OPE_GET_MUXING_DELAY(x) OPE_GET_MUXING_DELAY_REQUEST, __opus_check_int_ptr(x)
+-#define OPE_SET_COMMENT_PADDING(x) OPE_SET_COMMENT_PADDING_REQUEST, __opus_check_int(x)
+-#define OPE_GET_COMMENT_PADDING(x) OPE_GET_COMMENT_PADDING_REQUEST, __opus_check_int_ptr(x)
+-#define OPE_SET_SERIALNO(x) OPE_SET_SERIALNO_REQUEST, __opus_check_int(x)
+-#define OPE_GET_SERIALNO(x) OPE_GET_SERIALNO_REQUEST, __opus_check_int_ptr(x)
+-/* FIXME: Add type-checking macros to these. */
+-#define OPE_SET_PACKET_CALLBACK(x,u) OPE_SET_PACKET_CALLBACK_REQUEST, (x), (u)
++#define OPE_SET_DECISION_DELAY(x) OPE_SET_DECISION_DELAY_REQUEST, ope_check_int(x)
++#define OPE_GET_DECISION_DELAY(x) OPE_GET_DECISION_DELAY_REQUEST, ope_check_int_ptr(x)
++#define OPE_SET_MUXING_DELAY(x) OPE_SET_MUXING_DELAY_REQUEST, ope_check_int(x)
++#define OPE_GET_MUXING_DELAY(x) OPE_GET_MUXING_DELAY_REQUEST, ope_check_int_ptr(x)
++#define OPE_SET_COMMENT_PADDING(x) OPE_SET_COMMENT_PADDING_REQUEST, ope_check_int(x)
++#define OPE_GET_COMMENT_PADDING(x) OPE_GET_COMMENT_PADDING_REQUEST, ope_check_int_ptr(x)
++#define OPE_SET_SERIALNO(x) OPE_SET_SERIALNO_REQUEST, ope_check_int(x)
++#define OPE_GET_SERIALNO(x) OPE_GET_SERIALNO_REQUEST, ope_check_int_ptr(x)
++#define OPE_SET_PACKET_CALLBACK(x,u) OPE_SET_PACKET_CALLBACK_REQUEST, ope_check_packet_func(x), ope_check_void_ptr(u)
+ /*#define OPE_GET_PACKET_CALLBACK(x,u) OPE_GET_PACKET_CALLBACK_REQUEST, (x), (u)*/
+-#define OPE_SET_HEADER_GAIN(x) OPE_SET_HEADER_GAIN_REQUEST, __opus_check_int(x)
+-#define OPE_GET_HEADER_GAIN(x) OPE_GET_HEADER_GAIN_REQUEST, __opus_check_int_ptr(x)
+-#define OPE_GET_NB_STREAMS(x) OPE_GET_NB_STREAMS_REQUEST, __opus_check_int_ptr(x)
+-#define OPE_GET_NB_COUPLED_STREAMS(x) OPE_GET_NB_COUPLED_STREAMS_REQUEST, __opus_check_int_ptr(x)
++#define OPE_SET_HEADER_GAIN(x) OPE_SET_HEADER_GAIN_REQUEST, ope_check_int(x)
++#define OPE_GET_HEADER_GAIN(x) OPE_GET_HEADER_GAIN_REQUEST, ope_check_int_ptr(x)
++#define OPE_GET_NB_STREAMS(x) OPE_GET_NB_STREAMS_REQUEST, ope_check_int_ptr(x)
++#define OPE_GET_NB_COUPLED_STREAMS(x) OPE_GET_NB_COUPLED_STREAMS_REQUEST, ope_check_int_ptr(x)
+ /*@}*/
+ /*@}*/
+ 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69447095.411b1.376f64f1>