libmad: update to 0.16.4

This commit is contained in:
Sergey Fedorov
2024-11-27 06:53:31 +08:00
committed by Herby Gillot
parent 67f086bf57
commit 30e53a21ca
7 changed files with 8 additions and 963 deletions
+8 -35
View File
@@ -1,11 +1,12 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup cmake 1.1
PortGroup codeberg 1.0
PortGroup muniversal 1.0
name libmad
version 0.15.1b
revision 5
codeberg.setup tenacityteam libmad 0.16.4
revision 0
categories audio
license GPL-2+
maintainers nomaintainer
@@ -16,37 +17,9 @@ long_description \
MPEG-2 extension to Lower Sampling Frequencies. \
All three audio layers (Layer I, Layer II, and Layer \
III a.k.a. MP3) are fully implemented.
homepage http://www.underbit.com/products/mad/
homepage https://tenacityaudio.org
platforms darwin freebsd
master_sites ftp://ftp.mars.org/pub/mpeg/ \
sourceforge:mad
checksums rmd160 0f3415ee10b188681e282ca69dec74c46ca73b0f \
sha256 bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690 \
size 502379
depends_build port:pkgconfig
use_autoreconf yes
autoreconf.args -fvi
post-extract {
copy ${filespath}/mad.pc.in ${worksrcpath}/mad.pc
touch ${worksrcpath}/AUTHORS ${worksrcpath}/ChangeLog ${worksrcpath}/NEWS
}
patchfiles patch-configure.ac.diff automake.patch remove-optimizations.patch md_size.diff length-check.patch
post-patch {
reinplace "s|%PREFIX%|${prefix}|g" ${worksrcpath}/mad.pc
reinplace "s|%VERSION%|${version}|g" ${worksrcpath}/mad.pc
}
post-destroot {
xinstall -d ${destroot}${prefix}/lib/pkgconfig
xinstall -m 644 ${worksrcpath}/mad.pc ${destroot}${prefix}/lib/pkgconfig
}
livecheck.type regex
livecheck.url ftp://ftp.mars.org/pub/mpeg/
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*\[a-z\])${extract.suffix}"
checksums rmd160 e8b86b0f88bbf41f4b6d17f34da01b7823e15033 \
sha256 f4eb229452252600ce48f3c2704c9e6d97b789f81e31c37b0c67dd66f445ea35 \
size 204446
-11
View File
@@ -1,11 +0,0 @@
--- configure.ac.orig 2013-01-06 00:37:58.000000000 -0800
+++ configure.ac 2013-01-06 00:38:08.000000000 -0800
@@ -28,7 +28,7 @@ AC_CONFIG_SRCDIR([decoder.h])
AM_INIT_AUTOMAKE
-AM_CONFIG_HEADER([config.h])
+AC_CONFIG_HEADERS([config.h])
dnl System type.
File diff suppressed because it is too large Load Diff
-11
View File
@@ -1,11 +0,0 @@
prefix=%PREFIX%
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: mad
Description: MPEG Audio Decoder
Requires:
Version: %VERSION%
Libs: -L${libdir} -lmad -lm
Cflags: -I${includedir}
-58
View File
@@ -1,58 +0,0 @@
From: Kurt Roeckx <kurt@roeckx.be>
Date: Sun, 28 Jan 2018 15:44:08 +0100
Subject: Check the size of the main data
The main data to decode a frame can come from the current frame and part of the
previous frame, the so called bit reservoir. si.main_data_begin is the part of
the previous frame we need for this frame. frame_space is the amount of main
data that can be in this frame, and next_md_begin is the part of this frame that
is going to be used for the next frame.
The maximum amount of data from a previous frame that the format allows is 511
bytes. The maximum frame size for the defined bitrates is at MPEG 2.5 layer 2
at 320 kbit/s and 8 kHz sample rate which gives 72 * (320000 / 8000) + 1 = 2881.
So those defines are not large enough:
# define MAD_BUFFER_GUARD 8
# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
There is also support for a "free" bitrate which allows you to create any frame
size, which can be larger than the buffer.
Changing the defines is not an option since it's part of the ABI, so we check
that the main data fits in the bufer.
The previous frame data is stored in *stream->main_data and contains
stream->md_len bytes. If stream->md_len is larger than the data we
need from the previous frame (si.main_data_begin) it still wouldn't fit
in the buffer, so just keep the data that we need.
Index: layer3.c
===================================================================
--- layer3.c.orig
+++ layer3.c
@@ -2608,6 +2608,11 @@ int mad_layer_III(struct mad_stream *str
next_md_begin = 0;
md_len = si.main_data_begin + frame_space - next_md_begin;
+ if (md_len + MAD_BUFFER_GUARD > MAD_BUFFER_MDLEN) {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
frame_used = 0;
@@ -2625,8 +2630,11 @@ int mad_layer_III(struct mad_stream *str
}
}
else {
- mad_bit_init(&ptr,
- *stream->main_data + stream->md_len - si.main_data_begin);
+ memmove(stream->main_data,
+ *stream->main_data + stream->md_len - si.main_data_begin,
+ si.main_data_begin);
+ stream->md_len = si.main_data_begin;
+ mad_bit_init(&ptr, *stream->main_data);
if (md_len > si.main_data_begin) {
assert(stream->md_len + md_len -
@@ -1,10 +0,0 @@
--- configure.ac.orig 2004-01-23 03:41:32.000000000 -0600
+++ configure.ac 2012-03-10 02:22:40.000000000 -0600
@@ -128,7 +128,6 @@
then
case "$host" in
i386-*) ;;
- i?86-*) arch="-march=i486" ;;
arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;;
armv4*-*) arch="-march=armv4 -mtune=strongarm" ;;
powerpc-*) ;;
@@ -1,21 +0,0 @@
--- configure.ac.orig 2004-01-23 04:41:32.000000000 -0500
+++ configure.ac 2020-12-06 10:22:19.000000000 -0500
@@ -139,18 +139,13 @@
case "$optimize" in
-O|"-O "*)
optimize="-O"
- optimize="$optimize -fforce-mem"
optimize="$optimize -fforce-addr"
: #x optimize="$optimize -finline-functions"
: #- optimize="$optimize -fstrength-reduce"
- optimize="$optimize -fthread-jumps"
- optimize="$optimize -fcse-follow-jumps"
- optimize="$optimize -fcse-skip-blocks"
: #x optimize="$optimize -frerun-cse-after-loop"
: #x optimize="$optimize -frerun-loop-opt"
: #x optimize="$optimize -fgcse"
optimize="$optimize -fexpensive-optimizations"
- optimize="$optimize -fregmove"
: #* optimize="$optimize -fdelayed-branch"
: #x optimize="$optimize -fschedule-insns"
optimize="$optimize -fschedule-insns2"