Add new port: libtwolame - MPEG Audio Layer 2 encoder for broadcast-quality audio (#51728)

Co-authored-by: Kai Pastor <dg0yt@darc.de>
Co-authored-by: Victor Romero <romerosanchezv@gmail.com>
This commit is contained in:
Greisberger Christophe 2026-05-30 10:37:56 +02:00 committed by GitHub
parent d9aa23d009
commit 27e2035aa8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 158 additions and 0 deletions

View File

@ -0,0 +1,11 @@
--- a/libtwolame/twolame.h
+++ b/libtwolame/twolame.h
@@ -263,7 +263,7 @@
* \return The number of bytes put in output buffer
* or a negative value on error
*/
-int twolame_encode_buffer_float32_interleaved(twolame_options * glopts,
+TL_API int twolame_encode_buffer_float32_interleaved(twolame_options * glopts,
const float pcm[],
int num_samples,
unsigned char *mp2buffer, int mp2buffer_size);

View File

@ -0,0 +1,25 @@
diff --git a/Makefile.am b/Makefile.am
index 6504bf7..a00cb6d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -I build-scripts
-SUBDIRS = . libtwolame frontend simplefrontend doc tests
+SUBDIRS = . libtwolame frontend simplefrontend tests
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = twolame.pc
@@ -23,11 +23,7 @@ ChangeLog:
[ -d .git ] && git log > ChangeLog || true
pkgdocdir = @docdir@
-pkgdoc_DATA = \
- AUTHORS \
- COPYING \
- README \
- NEWS
+pkgdoc_DATA =
EXTRA_DIST = \
$(pkgdoc_DATA) \

View File

@ -0,0 +1,14 @@
--- a/libtwolame/psycho_2.c
+++ b/libtwolame/psycho_2.c
@@ -54,10 +54,7 @@
4.5, 4.5, 4.5, 3.5, 3.5, 3.5
};
-static void psycho_2_read_absthr(absthr, table)
-FLOAT *absthr;
-int table;
-{
+static void psycho_2_read_absthr(FLOAT *absthr, int table) {
int j;
#include "psycho_2_absthr.h"

View File

@ -0,0 +1,17 @@
--- a/frontend/frontend.c
+++ b/frontend/frontend.c
@@ -20,7 +20,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <getopt.h>

View File

@ -0,0 +1,13 @@
diff --git a/twolame.pc.in b/twolame.pc.in
index 0395b69..882c984 100644
--- a/twolame.pc.in
+++ b/twolame.pc.in
@@ -8,6 +8,6 @@ Description: An optimized MPEG Audio Layer 2 encoder
Requires:
Version: @VERSION@
Libs: -L${libdir} -ltwolame
-Libs.Private: @LIBS@
+Libs.private: @LIBS@
Cflags: -I${includedir}
Cflags.private: -DLIBTWOLAME_STATIC

View File

@ -0,0 +1,40 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO njh/twolame
REF "${VERSION}"
SHA512 9a0d3ef430ca93b561caa7e56fe60c126135b1c36294a280fa21699402b3922a3992035f3d421f3bbe131cdc04459cc907059dfe0c2f512427f305fe3936e54d
HEAD_REF main
PATCHES
patches/001-fix-tl-api-export.patch
patches/002-disable-doc-subdir.patch
patches/003-fix-kr-declaration.patch
patches/004-fix-frontend-msvc.patch
patches/005-fix-pc-in-case.patch
)
set(options "")
if("tool" IN_LIST FEATURES)
list(APPEND options "--enable-sndfile")
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
list(APPEND options "LIBS=\$LIBS -lgetopt")
endif()
else()
list(APPEND options "--disable-sndfile")
endif()
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
OPTIONS
${options}
)
vcpkg_install_make()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/tools")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

6
ports/libtwolame/usage Normal file
View File

@ -0,0 +1,6 @@
The package libtwolame can be imported via CMake FindPkgConfig module:
find_package(PkgConfig REQUIRED)
pkg_check_modules(twolame REQUIRED IMPORTED_TARGET twolame)
target_link_libraries(main PkgConfig::twolame)

View File

@ -0,0 +1,19 @@
{
"name": "libtwolame",
"version": "0.4.0",
"description": "TwoLAME is an optimised MPEG Audio Layer 2 (MP2) encoder",
"homepage": "https://www.twolame.org",
"license": "LGPL-2.1-or-later",
"features": {
"tool": {
"description": "Build the twolame command-line frontend",
"dependencies": [
{
"name": "getopt-win32",
"platform": "windows & !mingw"
},
"libsndfile"
]
}
}
}

View File

@ -5768,6 +5768,10 @@
"baseline": "1.4.0",
"port-version": 0
},
"libtwolame": {
"baseline": "0.4.0",
"port-version": 0
},
"libu2f-server": {
"baseline": "1.1.0",
"port-version": 6

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "e00ea4eb67bd8ad572b6883e178aed7856a5f68b",
"version": "0.4.0",
"port-version": 0
}
]
}