mpg123-1.32.0

This commit is contained in:
Ozkan Sezer
2023-09-24 08:51:02 +03:00
parent 89d671ef14
commit 2279cffc0f
241 changed files with 18940 additions and 16360 deletions

View File

@@ -1,3 +1,5 @@
This is a dummy file. If you want to see the change log, use subversion:
svn log -v svn://orgis.org/mpg123
svn log -v svn://scm.orgis.org/mpg123
The tool svn2cl provides nice formatting in traditional ChangeLog style.

View File

@@ -10,13 +10,21 @@ ACLOCAL_AMFLAGS = -I m4
bin_PROGRAMS =
EXTRA_PROGRAMS =
EXTRA_DIST =
if NEED_LIB
pkglib_LTLIBRARIES =
lib_LTLIBRARIES =
endif
noinst_LIBRARIES =
noinst_LTLIBRARIES =
nodist_include_HEADERS =
if NEED_MAINLIB
if NEED_LIB
include_HEADERS =
endif
endif
if NEED_MAN
dist_man_MANS =
endif
CLEANFILES =
TESTS =
XFAIL_TESTS =
@@ -31,22 +39,37 @@ AM_CPPFLAGS += \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/compat \
-I$(top_srcdir)/src/libmpg123 \
-I$(top_srcdir)/src/libsyn123 \
-I$(top_srcdir)/src/libout123 \
-I$(top_builddir)/src/libmpg123 \
-I$(top_builddir)/src/libsyn123 \
-I$(top_builddir)/src/libout123
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA =
# Include Make modules from subdirectories.
include src/Makemodule.am
include doc/Makemodule.am
# Stuff from this directory.
pkgconfig_DATA += libmpg123.pc libout123.pc libsyn123.pc
if NEED_MAINLIB
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA =
# Stuff from this directory.
if BUILD_LIBMPG123
pkgconfig_DATA += libmpg123.pc
endif
if BUILD_LIBOUT123
pkgconfig_DATA += libout123.pc
endif
if BUILD_LIBSYN123
pkgconfig_DATA += libsyn123.pc
endif
endif
if BUILD_PROGRAMS
if NEED_MAN
dist_man_MANS += man1/mpg123.1 man1/out123.1
endif
endif
# mpg123.spec is autogenerated but needs to be present in tarball!
EXTRA_DIST += \
@@ -73,10 +96,6 @@ EXTRA_DIST += \
ports/cmake/src/tests/CMakeLists.txt \
ports/cmake/src/compat/CMakeLists.txt \
ports/README \
ports/Sony_PSP/config.h \
ports/Sony_PSP/README \
ports/Sony_PSP/Makefile.psp \
ports/Sony_PSP/readers.c.patch \
scripts/benchmark-cpu.pl \
scripts/tag_lyrics.py \
scripts/conplay \

File diff suppressed because it is too large Load Diff

54
NEWS
View File

@@ -1,5 +1,59 @@
1.32.0
------
- build:
-- Move version handling out of configure.ac to ease other build systems.
-- Include "fmt123.h" instead of <fmt123.h> in main API headers to make it more likely the
correct one is included (at least gcc picks the one in the same directory as the
including header first).
-- All headers are build-independent now.
-- Fix build for picky linkers by avoiding definition of wrap_getcpuflags() where it is not
used (spurious linker error to non-exitent getcpuflags(), bug 353).
-- Handle deprecation of C99 detection macro in autoconf 2.70.
-- No use of AC_SYS_LARGEFILE anymore for explicit handling and differing choice for
the libraries and frontend programs.
-- Added --enable-portable and --disable-largefile to configure, removing the other
largefile-related options.
-- Added --disable-components --enable-libmpg123 to only build libmpg123 (and likewise
--enable-libout123, --enable-libout123-modules, --enable-libsyn123) to autoconf
build. CMake build has something similar with BUILD_PROGRAMS and BUILD_LIBOUT123,
which leave only libmpg123 and libsyn123 if disabled). (bug 351)
-- Consistent formatting of ./configure --help with AS_HELP_STRING().
- ports/Sony_PSP: removed
- mpg123:
-- Added --libversion.
-- Added proper A-B looping with terminal control key 'o', renamed
--pauseloop to --presetloop.
-- Really get rid of mpg123_position() usage. (It was all lies before!)
-- Fix terminal progress info when seeking in stopped mode (1.31 regression).
-- Patch up interaction of output buffer with generic remote control, adding
non-interruptible drain after P 3, and dropping buffer on QUIT.
-- Uppercase some generic control replies for consinstency: SILENCE, PROGRESS,
MUTE, UNMUTE
- libmpg123, libout123, libsyn123:
-- Bumped API version for version query functions.
-- Replaced nearly all symbol renames with explicit INT123_ prefix declarations
(intsym.h close to empty now).
- libout123:
-- Add sleep builtin output module (silent, but proper timing).
- libsyn123:
-- Introduced SYN123_PORTABLE_API for an API without off_t and ssize_t
(see NEWS.libsyn123).
- libmpg123:
-- Internal I/O using explicit largefile support via off64_t, lseek64, fallback
to plain 32 bit off_t.
-- Added explicit 64 bit API with 64 suffix (mpg123_tell64(), not mpg123_tell_64()).
This allows full avoidance of ambiguus off_t. The API is always using 64 bit
integers, regardless of internal implementation. (bug 344)
-- Introduced MPG123_PORTABLE_API for an API subset without off_t and
ssize_t.
-- Made mpg123_seek() and friends ignore offset sign for SEEK_END (always seeking
towards beginning, assuming negative offset) to make lseek()-conforming usage
possible. Seeking beyond the end never made sense, so no loss of valid functionality.
- Overall use of INT123_strerror(), trying to use thread-safe strerror_l() if possible.
1.31.3
------
- build:
-- Fix --disable-8bit.
-- Fall back to generic decoder if no yasm for MSVC (bug 346).

View File

@@ -1,8 +1,24 @@
Changes in libmpg123 libtool interface versions...
Changes in libmpg123 libtool interface versions. Next to the version
the mpg123 release where its changes first appeared to the public
is given.
47.0.47 - Added mpg123_eq_bands(), mpg123_eq_change() and mpg123_volume_change_db().
48.0.48 (mpg123 1.32)
- Added mpg123_distversion() and mpg123_libversion().
- Added mpg123_reader64() and the other int64_t-based functions:
mpg123_framebyframe_decode64(), mpg123_framepos64(), mpg123_tell64(),
mpg123_tellframe64(), mpg123_tell_stream64(), mpg123_seek64(),
mpg123_feedseek64(), mpg123_seek_frame64(), mpg123_timeframe64(),
mpg123_index64(), mpg123_set_index64(), mpg123_framelength64(),
mpg123_length64(), and mpg123_set_filesize64().
- Added MPG123_PORTABLE_API to hide non-portable API (off_t, ssize_t)
from mpg123.h.
- Made mpg123_seek() family ignore sign with SEEK_END offsets, always
putting a negative one on it to allow usage consistent with lseek().
46.0.46
47.0.47 (mpg123 1.30)
- Added mpg123_eq_bands(), mpg123_eq_change() and mpg123_volume_change_db().
46.0.46 (mpg123 1.27)
- Functions mpg123_init() and mpg123_exit() are really no-ops now.
There is no need to call them, and no harm done calling them in
parallel. The latter used to be the case before, too, but only in
@@ -11,7 +27,7 @@ Changes in libmpg123 libtool interface versions...
- There are enum-less variants of all API entry points now, mapped to
by default unless MPG123_ENUM_API is defined.
45.0.45
45.0.45 (mpg123 1.26)
- mpg123_read(), mpg123_decode(), and mpg123_replace_buffer() now taking
void* for output buffers
- value 0 for any rate in mpg123_format()/mpg123_fmt()
@@ -37,20 +53,20 @@ Changes in libmpg123 libtool interface versions...
MPG123_FEATURE_OUTPUT_FLOAT32
- added mpg123_open_fixed()
44.0.44
44.0.44 (mpg123 1.25)
- added mpg123_getformat2()
43.0.43
43.0.43 (mpg123 1.24)
- added MPG123_NO_PEEK_END and MPG123_FORCE_SEEKABLE
42.0.42
42.0.42 (mpg123 1.23)
- added mpg123_framelength()
Now mpg123_position() is truly obsolete!
- hardened string API to not crash if given NULL pointers
(except mpg123_init_string())
- equalizer feature optional
41.0.41
41.0.41 (mpg123 1.22)
- Add checks for NULL handles in some API functions that missed that, changed return value in others to MPG123_BAD_HANDLE where appropriate:
- mpg123_format_none(NULL) == MPG123_BAD_HANDLE (was: MPG123_ERR)
- mpg123_format_all(NULL) == MPG123_BAD_HANDLE (was: MPG123_ERR)
@@ -83,153 +99,155 @@ Changes in libmpg123 libtool interface versions...
- Changed return value of mpg123_geteq() to 0 for NULL handle to be consistent with itself.
40.0.40
40.0.40 (mpg123 1.19)
- Bump for marking the first actual implementation of A-Law encoding.
Not that it matters to anyone, though --- I wonder why not even the
Asterisk users wanted this. It's for telephony, dammit!
- Added arm_fpu decoder for runtime switch between NEON and generic fpu.
39.2.39
39.2.39 (mpg123 1.19)
- Added more elaborate post-processing to enable 32 and 24 bit output also with low-precision decoder (16 bit, fixed-point).
39.0.39
39.0.39 (mpg123 1.18)
- Added MPG123_FRESH_DECODER.
- Also containing several regression fixes.
38.0.38
38.0.38 (mpg123 1.16)
- Added MPG123_PICTURE and associated addition to mpg123_id3v2 struct.
37.0.37
37.0.37 (mpg123 1.16)
- Added mpg123_chomp_string.
36.0.36
36.0.36 (mpg123 1.14)
- Extended MPG123_RESYNC_LIMIT to initial header search.
- Not cutting decoder delay unconditionally anymore (only in combination with known encoder delay / padding).
35.0.35
35.0.35 (mpg123 1.14)
- Added mpg123_meta_free().
34.0.34
34.0.34 (mpg123 1.14)
- Added flag MPG123_AUTO_RESAMPLE.
- Changed (improved;-) outbuffer behaviour.
33.0.33
33.0.33 (mpg123 1.14)
- Added MPG123_BUFFERFILL.
32.0.32
32.0.32 (mpg123 1.14)
- Added mpg123_framepos()
31.0.31
31.0.31 (mpg123 1.14)
- Added mpg123_framedata() and MPG123_IGNORE_INFOFRAME.
30.0.30
30.0.30 (mpg123 1.14)
- Added MPG123_FEEDPOOL and MPG123_FEEDBUFFER.
29.0.29
29.0.29 (mpg123 1.13)
- New decoder: ARM neon.
- Added support for 24 bit output (dumb byte-chopping of 32 bit output).
28.0.28
28.0.28 (mpg123 1.13)
- Add mpg123_strlen().
27.0.27
27.0.27 (mpg123 1.13)
- Implictly disable seeking on streams when client enforced ICY parsing.
This helps debugging dumps of http streams.
26.0.26
26.0.26 (mpg123 1.13)
- Added mpg123_encsize().
- Added flag MPG123_SKIP_ID3V2.
25.0.25
25.0.25 (mpg123 1.12)
- Version increase to mark the point where the split between normal and large-file-enabled library vanishes again. The world did not like it.
Now Thomas lost some days of recreation and sleep to give it a dual-mode libmpg123 on large-file-sensitive systems.
24.0.24
24.0.24 (mpg123 1.12)
- Introduce mpg123_replace_reader_handle() and mpg123_open_handle()
... this is also in preparation for the next version which will drop the separated large-file library again, due to public display of dismay.
- Add the experimental mpg123_framebyframe_decode to the off_t-sensitive functions.
23.0.23
23.0.23 (mpg123 1.11)
- Version increase to mark the point where the explicit split between normal and large-file-enabled library has been introduced.
22.0.22
22.0.22 (mpg123 1.10)
- Experimental framebyframe API added.
21.0.21
21.0.21 (mpg123 1.10)
- Added support of unicode file names under windows via UTF-8 argument to mpg123_open.
- Added mpg123_feature(), for example to test for the above behaviour.
20.0.20
20.0.20 (mpg123 1.9)
- New flag: MPG123_PLAIN_ID3TEXT
- Corresponding text encoding handling API added:
mpg123_enc_from_id3, mpg123_store_utf8
19.0.19
19.0.19 (mpg123 1.9)
- Hm, what was it exactly now... there are candidates:
- runtime dithering
- free format
- ARM optimizations
18.0.18
18.0.18 (mpg123 1.8)
- new parameter: MPG123_PREFRAMES is now tunable (the number of frames to decode and skip before a seek point), also default value increased
17.0.17
17.0.17 (mpg123 1.8)
- introduction optimized stereo synths
16.0.16
16.0.16 (mpg123 1.8)
- introducing floating point x86-64 SSE synth
15.0.15
15.0.15 (mpg123 1.8)
- first addition of x86-64 SSE optimizations
14.0.14
14.0.14 (mpg123 1.7)
- the first libmpg123 with actually working MPG123_UPSPEED
- also important regression fix concerning skipping of frames
13.0.13
13.0.13 (mpg123 1.7)
- The whole set of output formats is generally available (8, 16 and 32 bit integer, signed/unsigned, float)
- Many features can be absent from libary as build decision (minimize binary size).
12.0.12
12.0.12 (mpg123 1.7)
- added mpg123_current_decoder
- fixed value of MPG123_ENC_FLOAT
- float output now is a real runtime option
11.0.11
11.0.11 (mpg123 1.6)
- added mpg123_getstate
- run-time tunable frame index
- officially configured with largefile support where available
10.0.10
10.0.10 (mpg123 1.6)
- new flag MPG123_FUZZY (along with the fuzzy seek functionality)
9.0.9
9.0.9 (mpg123 1.6)
- added mpg123_tell_stream
8.0.8
8.0.8 (mpg123 1.6)
- added mpg123_get_eq
7.0.7
7.0.7 (mpg123 1.6)
- added mpg123_set_filesize
6.0.6
6.0.6 (mpg123 1.5)
- added mpg123_icy2utf8
5.0.5
5.0.5 (mpg123 1.5)
- added mpg123_feed
- input buffers now const
4.0.4
4.0.4 (mpg123 1.5)
- extended mpg123_string api (mpg123_add_substring, mpg123_grow_string)
3.0.3
3.0.3 (mpg123 1.5)
- Initial floating point support as compile-time option.
2.0.2
2.0.2 (mpg123 1.3)
- New flag MPG123_SEEKBUFFER.
1.0.1
1.0.1 (mpg123 1.2)
- Added MPG123_RESYNC_LIMIT parameter.
- Added MPG123_OUT_OF_SYNC and MPG123_RESYNC_FAIL error codes.
- Fix for uninitialized framesize value in handle.
0.0.0 (mpg123 1.0)
- Initial library design.

View File

@@ -1,15 +1,22 @@
4.0.4
Changes in libout123 libtool interface versions. Next to the version
the mpg123 release where its changes first appeared to the public
is given.
5.0.5
- Added out123_distversion() and out123_libversion().
4.0.4 (mpg123 1.27)
- added enum-less variants out123_param2() and out123_getparam2(), replacing
the enum variants unless MPG123_ENUM_API is defined
- added out123_devices()
- added out123_stringlists_free()
- module API version 3 with enumeration and void deinit()
3.0.3
3.0.3 (mpg123 1.26)
- added out123_free()
2.0.2
2.0.2 (mpg123 1.24)
- added OUT123_BINDIR
1.0.1
1.0.1 (mpg123 1.23)
- initial version

View File

@@ -1,3 +1,17 @@
1.0.1
- initial version
Changes in libsyn23 libtool interface versions. Next to the version
the mpg123 release where its changes first appeared to the public
is given.
2.0.2 (mpg123 1.32)
- Added syn123_distversion() and syn123_libversion().
- Added switch SYN123_PORTABLE_API to hide off_t and ssize_t
(consistent with libmpg123).
- Added direct int64_t prototypes (syn123_resample_total64() and
syn123_resample_inttotal64().
- Added syn123_resample_in() and syn123_resample_out() as
replacements for syn123_resample_expect() and syn123_resample_inexpect().
- Deprecated ill-designed syn123_resample_expect() and
syn123_resample_inexpect() in documentation.
1.0.1 (mpg123 1.26)
- initial version

91
aclocal.m4 vendored
View File

@@ -1,6 +1,6 @@
# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -14,8 +14,8 @@
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.69.
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
[m4_warning([this file was generated for autoconf 2.71.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
@@ -930,9 +930,9 @@ AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], [])
dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
dnl serial 11 (pkg-config-0.29.1)
dnl
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 12 (pkg-config-0.29.2)
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
dnl
@@ -973,7 +973,7 @@ dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29.1])
[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
@@ -1074,7 +1074,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $1])
AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
@@ -1206,7 +1206,7 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1221,7 +1221,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.16.1], [],
m4_if([$1], [1.16.5], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -1237,14 +1237,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.16.1])dnl
[AM_AUTOMAKE_VERSION([1.16.5])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# Figure out how to run the assembler. -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1264,7 +1264,7 @@ _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1316,7 +1316,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1347,7 +1347,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1538,7 +1538,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1577,7 +1577,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
done
if test $am_rc -ne 0; then
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
for automatic dependency tracking. If GNU make was not used, consider
re-running the configure script with MAKE="gmake" (or whatever is
necessary). You can also try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).])
fi
@@ -1604,7 +1606,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1632,6 +1634,10 @@ m4_defn([AC_PROG_CC])
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.65])dnl
m4_ifdef([_$0_ALREADY_INIT],
[m4_fatal([$0 expanded multiple times
]m4_defn([_$0_ALREADY_INIT]))],
[m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -1668,7 +1674,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(
m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
[ok:ok],,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
@@ -1720,6 +1726,20 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
[m4_define([AC_PROG_OBJCXX],
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
])
# Variables for tags utilities; see am/tags.am
if test -z "$CTAGS"; then
CTAGS=ctags
fi
AC_SUBST([CTAGS])
if test -z "$ETAGS"; then
ETAGS=etags
fi
AC_SUBST([ETAGS])
if test -z "$CSCOPE"; then
CSCOPE=cscope
fi
AC_SUBST([CSCOPE])
AC_REQUIRE([AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
@@ -1801,7 +1821,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1822,7 +1842,7 @@ if test x"${install_sh+set}" != xset; then
fi
AC_SUBST([install_sh])])
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
# Copyright (C) 2003-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1843,7 +1863,7 @@ AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1886,7 +1906,7 @@ AC_SUBST([am__quote])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1907,12 +1927,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
MISSING="\${SHELL} '$am_aux_dir/missing'"
fi
# Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then
@@ -1925,7 +1940,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1954,7 +1969,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -2001,7 +2016,7 @@ AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -2020,7 +2035,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -2101,7 +2116,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
# Copyright (C) 2009-2018 Free Software Foundation, Inc.
# Copyright (C) 2009-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -2161,7 +2176,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -2189,7 +2204,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2018 Free Software Foundation, Inc.
# Copyright (C) 2006-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -2208,7 +2223,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2018 Free Software Foundation, Inc.
# Copyright (C) 2004-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,

View File

@@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@@ -53,7 +53,7 @@ func_file_conv ()
MINGW*)
file_conv=mingw
;;
CYGWIN*)
CYGWIN* | MSYS*)
file_conv=cygwin
;;
*)
@@ -67,7 +67,7 @@ func_file_conv ()
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
cygwin/* | msys/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)

1454
build/config.guess vendored

File diff suppressed because it is too large Load Diff

2849
build/config.sub vendored

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2018-03-11.20; # UTC
scriptversion=2020-11-14.01; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -69,6 +69,11 @@ posix_mkdir=
# Desired mode of installed file.
mode=0755
# Create dirs (including intermediate dirs) using mode 755.
# This is like GNU 'install' as of coreutils 8.32 (2020).
mkdir_umask=22
backupsuffix=
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
@@ -99,18 +104,28 @@ Options:
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-C install only if different (preserve data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-p pass -p to $cpprog.
-s $stripprog installed files.
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
By default, rm is invoked with -f; when overridden with RMPROG,
it's up to you to specify -f if you want it.
If -S is not specified, no backups are attempted.
Email bug reports to bug-automake@gnu.org.
Automake home page: https://www.gnu.org/software/automake/
"
while test $# -ne 0; do
@@ -137,8 +152,13 @@ while test $# -ne 0; do
-o) chowncmd="$chownprog $2"
shift;;
-p) cpprog="$cpprog -p";;
-s) stripcmd=$stripprog;;
-S) backupsuffix="$2"
shift;;
-t)
is_target_a_directory=always
dst_arg=$2
@@ -255,6 +275,10 @@ do
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
# Don't chown directories that already exist.
if test $dstdir_status = 0; then
chowncmd=""
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
@@ -301,22 +325,6 @@ do
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
@@ -326,22 +334,20 @@ do
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
# Note that $RANDOM variable is not portable (e.g. dash); Use it
# The $RANDOM variable is not portable (e.g., dash). Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
trap '
ret=$?
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
exit $ret
' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p' feature.
# 'mkdir -p'.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
@@ -371,7 +377,6 @@ do
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
@@ -382,7 +387,7 @@ do
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
@@ -411,7 +416,7 @@ do
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
(umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
@@ -451,7 +456,18 @@ do
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
(umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
@@ -477,6 +493,13 @@ do
then
rm -f "$dsttmp"
else
# If $backupsuffix is set, and the file being installed
# already exists, attempt a backup. Don't worry if it fails,
# e.g., if mv doesn't support -f.
if test -n "$backupsuffix" && test -f "$dst"; then
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
fi
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
@@ -491,9 +514,9 @@ do
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
$doit $rmcmd "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1

4
build/ltmain.sh Normal file → Executable file
View File

@@ -31,7 +31,7 @@
PROGRAM=libtool
PACKAGE=libtool
VERSION="2.4.6 Debian-2.4.6-14"
VERSION="2.4.6 Debian-2.4.6-15build2"
package_revision=2.4.6
@@ -2141,7 +2141,7 @@ include the following information:
compiler: $LTCC
compiler flags: $LTCFLAGS
linker: $LD (gnu? $with_gnu_ld)
version: $progname $scriptversion Debian-2.4.6-14
version: $progname $scriptversion Debian-2.4.6-15build2
automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`

View File

@@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 2011-2018 Free Software Foundation, Inc.
# Copyright (C) 2011-2021 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,11 +42,13 @@ print_usage ()
{
cat <<END
Usage:
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
[--expect-failure={yes|no}] [--color-tests={yes|no}]
[--enable-hard-errors={yes|no}] [--]
test-driver --test-name NAME --log-file PATH --trs-file PATH
[--expect-failure {yes|no}] [--color-tests {yes|no}]
[--enable-hard-errors {yes|no}] [--]
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
See the GNU Automake documentation for information.
END
}
@@ -103,8 +105,11 @@ trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15
# Test script is run here.
"$@" >$log_file 2>&1
# Test script is run here. We create the file first, then append to it,
# to ameliorate tests themselves also writing to the log file. Our tests
# don't, but others can (automake bug#35762).
: >"$log_file"
"$@" >>"$log_file" 2>&1
estatus=$?
if test $enable_hard_errors = no && test $estatus -eq 99; then
@@ -126,7 +131,7 @@ esac
# know whether the test passed or failed simply by looking at the '.log'
# file, without the need of also peaking into the corresponding '.trs'
# file (automake bug#11814).
echo "$res $test_name (exit status: $estatus)" >>$log_file
echo "$res $test_name (exit status: $estatus)" >>"$log_file"
# Report outcome to console.
echo "${col}${res}${std}: $test_name"

10103
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -9,32 +9,64 @@ dnl 2.69 at least.
AC_PREREQ([2.69])
dnl ############# Initialisation
AC_INIT([mpg123], [1.31.3], [maintainer@mpg123.org])
dnl Increment API_VERSION when the API gets changes (new functions).
dnl Set version numbers from header version.h and each library API header.
dnl Do not forget the re-generate configure on version changes. This does
dnl not happen automatically, as it would with m4_include() usage, wich
dnl is too fragile with arbitrary header contents.
m4_define([V_HEADER], m4_esyscmd(grep MPG123_ src/version.h))
m4_define([V_MAJOR], m4_bregexp(V_HEADER,
[#define MPG123_MAJOR\s+\([0-9]+\)],
[\1]))
m4_define([V_MINOR], m4_bregexp(V_HEADER,
[\#define MPG123_MINOR\s+\([0-9]+\)],
[\1]))
m4_define([V_PATCH], m4_bregexp(V_HEADER,
[\#define MPG123_PATCH\s+\([0-9]+\)],
[\1]))
m4_define([V_SUFFIX], m4_bregexp(V_HEADER,
[\#define MPG123_SUFFIX\s+"\(.+\)"],
[\1]))
m4_undefine([V_HEADER])
AC_INIT([mpg123], V_MAJOR.V_MINOR.V_PATCH[]V_SUFFIX, [maintainer@mpg123.org])
m4_define([V_HEADER], m4_esyscmd(grep -e _API_VERSION -e _PATCHLEVEL src/libmpg123/mpg123.h src/libout123/out123.h src/libsyn123/syn123.h))
dnl libmpg123
API_VERSION=47
LIB_PATCHLEVEL=0
m4_define([API_VERSION], m4_bregexp(V_HEADER,
[\#define MPG123_API_VERSION\s+\([0-9]+\)],
[\1]))
m4_define([LIB_PATCHLEVEL], m4_bregexp(V_HEADER,
[\#define MPG123_PATCHLEVEL\s+\([0-9]+\)],
[\1]))
dnl libout123
OUTAPI_VERSION=4
OUTLIB_PATCHLEVEL=7
m4_define([OUTAPI_VERSION], m4_bregexp(V_HEADER,
[\#define OUT123_API_VERSION\s+\([0-9]+\)],
[\1]))
m4_define([OUTLIB_PATCHLEVEL], m4_bregexp(V_HEADER,
[\#define OUT123_PATCHLEVEL\s+\([0-9]+\)],
[\1]))
dnl libsyn123
SYNAPI_VERSION=1
SYNLIB_PATCHLEVEL=5
m4_define([SYNAPI_VERSION], m4_bregexp(V_HEADER,
[\#define SYN123_API_VERSION\s+\([0-9]+\)],
[\1]))
m4_define([SYNLIB_PATCHLEVEL], m4_bregexp(V_HEADER,
[\#define SYN123_PATCHLEVEL\s+\([0-9]+\)],
[\1]))
m4_undefine([V_HEADER])
dnl Since we want to be backwards compatible, both sides get set to API_VERSION.
LIBMPG123_VERSION=$API_VERSION:$LIB_PATCHLEVEL:$API_VERSION
LIBOUT123_VERSION=$OUTAPI_VERSION:$OUTLIB_PATCHLEVEL:$OUTAPI_VERSION
LIBSYN123_VERSION=$SYNAPI_VERSION:$SYNLIB_PATCHLEVEL:$SYNAPI_VERSION
AC_SUBST(LIBMPG123_VERSION)
AC_SUBST(API_VERSION)
AC_SUBST(LIBOUT123_VERSION)
AC_SUBST(OUTAPI_VERSION)
AC_SUBST(LIBSYN123_VERSION)
AC_SUBST(SYNAPI_VERSION)
LIBMPG123_VERSION=API_VERSION:LIB_PATCHLEVEL:API_VERSION
LIBOUT123_VERSION=OUTAPI_VERSION:OUTLIB_PATCHLEVEL:OUTAPI_VERSION
LIBSYN123_VERSION=SYNAPI_VERSION:SYNLIB_PATCHLEVEL:SYNAPI_VERSION
AC_SUBST([LIBMPG123_VERSION])
AC_SUBST([LIBOUT123_VERSION])
AC_SUBST([LIBSYN123_VERSION])
AC_CONFIG_SRCDIR(src/mpg123.c)
AC_CONFIG_AUX_DIR(build)
@@ -103,14 +135,19 @@ if test "x$all_static" = xyes; then
fi
AM_PROG_AS
dnl For autocinf 2.69, the C99 macro still does something.
AC_PROG_CC_C99
AM_PROG_CC_C_O
m4_version_prereq(2.70, [AC_PROG_CC], [AC_PROG_CC_C99])
AC_PROG_CPP
AC_PROG_INSTALL
# Just look, no touch.
oldLIBS=$LIBS
LT_LIB_M
dnl Test if -lrt is required for clock_gettime() (old glibc).
AC_SEARCH_LIBS([clock_gettime], [rt])
if echo " $LIBS" | grep -q -w -- -lrt; then
LIBRT=-lrt
fi
# Could actually be missing.
AC_CHECK_FUNCS([clock_gettime])
LIBS=$oldLIBS
AC_SUBST(LIBM)
dnl "Checking for egrep is broken after removal of libltdl stuff... checks use $EGREP, so searching it here."
@@ -129,7 +166,7 @@ dnl ############# Use Libtool for dynamic module loading
modules=auto
AC_ARG_ENABLE(modules,
[ --enable-modules=[no/yes] dynamically loadable output modules],
[AS_HELP_STRING([--disable-modules], [dynamically loadable output module support (default enabled in shared library builds)])],
[
if test "x$enableval" = xyes
then
@@ -155,6 +192,10 @@ fi
dnl We need the windows header also for checking the module mechanism.
AC_CHECK_HEADERS([windows.h])
# enable win32 code
if test "x$ac_cv_header_windows_h" = xyes -a "x$host_os" != xcygwin -a "x$host_os" != xmidipix; then
win32_specific_codes=enabled
fi
android_build=no
case "$host" in
@@ -198,6 +239,40 @@ case "$host" in
;;
esac
if test x$win32_specific_codes = xenabled; then
# Check GetThreadErrorMode
if test x"$modules" != xdisabled; then
AC_MSG_CHECKING([if we have GetThreadErrorMode])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <windows.h>
int main(){
return GetThreadErrorMode();
}])],[win32_thread_error=yes],[win32_winver_bump=yes])
if test "x$win32_thread_error" != "xyes"; then
AC_MSG_CHECKING([if we have GetThreadErrorMode])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#define WINVER 0x600
#define _WIN32_WINNT 0x600
#include <windows.h>
int main(){
return GetThreadErrorMode();
}])],[win32_thread_error=yes],[win32_thread_error=no])
fi
if test "x$win32_thread_error" = "xyes"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
if test "x$modules" = xenabled; then
AC_MSG_ERROR([GetThreadErrorMode is required for modules but not found.])
else
AC_MSG_WARN([Disabling modules because of missing GetThreadErrorMode()])
modules=disabled
fi
fi
fi
fi
LIBDL=
if test x"$modules" = xdisabled
@@ -291,7 +366,7 @@ AC_SUBST(EXEC_LT_LDFLAGS)
dnl ############## Configurable Options
AC_ARG_ENABLE(debug,
[ --enable-debug=[no/yes] turn on debugging],
[AS_HELP_STRING([--enable-debug], [turn on (lots of) debugging printouts])],
[
if test "x$enableval" = xyes
then
@@ -304,7 +379,7 @@ AC_ARG_ENABLE(debug,
)
AC_ARG_ENABLE(xdebug,
[ --enable-xdebug=[no/yes] turn on extreme debugging],
[AS_HELP_STRING([--enable-xdebug], [turn on (yet more) extreme debugging printouts])],
[
if test "x$enableval" = xyes
then
@@ -322,7 +397,7 @@ if test x"$xdebugging" = xenabled; then
fi
AC_ARG_ENABLE(nagging,
[ --enable-nagging=[no/yes] turn on GCC's pedantic nagging with error on warnings, does not include --enable-debug anymore ],
[AS_HELP_STRING([--enable-nagging], [turn on GCC's pedantic nagging with error on warnings])],
[
if test "x$enableval" = xyes
then
@@ -339,24 +414,23 @@ if test x"$debugging" = xenabled; then
fi
AC_ARG_ENABLE(gapless,
[ --enable-gapless=[no/yes] turn on gapless (enabled per default)],
[AS_HELP_STRING( [--disable-gapless], [turn off gapless decoding (please don't)])],
[
if test "x$enableval" = xyes
then
gapless="enabled"
AC_DEFINE(GAPLESS, 1, [ Define if gapless is enabled. ])
else
gapless="disabled"
fi
],
[
gapless="enabled"
AC_DEFINE(GAPLESS, 1, [ Define if gapless is enabled. ])
]
[ gapless="enabled" ]
)
if test "x$gapless" = xenabled; then
AC_DEFINE(GAPLESS, 1, [ Define if gapless is enabled. ])
fi
AC_ARG_ENABLE(fifo,
[ --enable-fifo=[no/yes] FIFO support for control interface (auto-enabled on linux) ],
[AS_HELP_STRING( [--enable-fifo], [FIFO support for control interface (auto-enabled on linux)])],
[
if test "x$enableval" = xyes
then
@@ -377,7 +451,7 @@ dnl Core features that can be disabled to reduce binary size.
id3v2=enabled
AC_ARG_ENABLE(id3v2,
[ --disable-id3v2=[no/yes] no ID3v2 parsing ],
[AS_HELP_STRING( [--disable-id3v2], [no ID3v2 parsing])],
[
if test "x$enableval" = xno; then
id3v2="disabled"
@@ -387,7 +461,7 @@ AC_ARG_ENABLE(id3v2,
# id3v2 depends on strings... so check that in between.
string=enabled
AC_ARG_ENABLE(string,
[ --disable-string=[no/yes] no string API (this will disable ID3v2; main mpg123 won't build anymore) ],
[AS_HELP_STRING( [--disable-string], [no string API (this will disable ID3v2; main mpg123 won't build anymore)])],
[
if test "x$enableval" = xno; then
string="disabled"
@@ -407,7 +481,7 @@ fi
icy=enabled
AC_ARG_ENABLE(icy,
[ --disable-icy=[no/yes] no ICY metainfo parsing/conversion (main mpg123 won't build!) ],
[AS_HELP_STRING( [--disable-icy], [no ICY metainfo parsing/conversion (main mpg123 won't build!)])],
[
if test "x$enableval" = xno; then
icy="disabled"
@@ -421,7 +495,7 @@ AM_CONDITIONAL([HAVE_ICY], [test "x$icy" = xenabled])
ntom=enabled
AC_ARG_ENABLE(ntom,
[ --disable-ntom=[no/yes] no flexible resampling ],
[AS_HELP_STRING( [--disable-ntom], [no flexible resampling])],
[
if test "x$enableval" = xno; then
ntom="disabled"
@@ -435,7 +509,7 @@ AM_CONDITIONAL([HAVE_NTOM], [test "x$ntom" = xenabled])
downsample=enabled
AC_ARG_ENABLE(downsample,
[ --disable-downsample=[no/yes] no downsampled decoding ],
[AS_HELP_STRING( [--disable-downsample], [no downsampled decoding])],
[
if test "x$enableval" = xno; then
downsample="disabled"
@@ -448,7 +522,7 @@ fi
feeder=enabled
AC_ARG_ENABLE(feeder,
[ --disable-feeder=[no/yes] no feeder decoding, no buffered readers ],
[AS_HELP_STRING( [--disable-feeder], [no feeder decoding, no buffered readers])],
[
if test "x$enableval" = xno; then
feeder="disabled"
@@ -461,7 +535,7 @@ fi
moreinfo=enabled
AC_ARG_ENABLE(moreinfo,
[ --disable-moreinfo=[no/yes] no extra information for frame analyzers ],
[AS_HELP_STRING( [--disable-moreinfo], [no extra information for frame analyzers])],
[
if test "x$enableval" = xno; then
moreinfo="disabled"
@@ -474,7 +548,7 @@ fi
messages=enabled
AC_ARG_ENABLE(messages,
[ --disable-messages=[no/yes] no error/warning messages on the console ],
[AS_HELP_STRING( [--disable-messages], [no error/warning messages on the console])],
[
if test "x$enableval" = xno; then
messages="disabled"
@@ -489,7 +563,7 @@ fi
runtimetables=disabled
AC_ARG_ENABLE(runtime-tables,
[ --enable-runtime-tables=[yes/no] calculate tables at runtime saving size at the expense of additional computation at load time ],
[AS_HELP_STRING([--enable-runtime-tables], [calculate tables at runtime saving size at the expense of additional computation at load time])],
[
if test "x$enableval" = xyes; then
runtimetables=enabled
@@ -505,7 +579,7 @@ AM_CONDITIONAL([HAVE_RUNTIME_TABLES], [test "x$runtimetables" = xenabled] )
newhuff=enabled
AC_ARG_ENABLE(new-huffman,
[ --enable-new-huffman=[yes/no] use new huffman decoding scheme by Taihei (faster on modern CPUs at least, so on by default) ],
[AS_HELP_STRING([--disable-new-huffman], [new huffman decoding scheme by Taihei (faster on modern CPUs at least, so on by default)])],
[
if test "x$enableval" = xno; then
newhuff=disabled
@@ -519,7 +593,7 @@ fi
integers=quality
AC_ARG_ENABLE(int-quality,
[ --enable-int-quality=[yes/no] use rounding instead of fast truncation for integer output, where possible ],
[AS_HELP_STRING([--disable-int-quality], [use rounding instead of fast truncation for integer output, where possible])],
[
if test "x$enableval" = xno; then
integers=fast
@@ -533,7 +607,7 @@ AM_CONDITIONAL([HAVE_ACCURATE], [ test x"$integers" = xquality ])
int16=enabled
AC_ARG_ENABLE(16bit,
[ --disable-16bit=[no/yes] no 16 bit integer output ],
[AS_HELP_STRING( [--disable-16bit], [no 16 bit integer output])],
[
if test "x$enableval" = xno; then
int16="disabled"
@@ -542,7 +616,7 @@ AC_ARG_ENABLE(16bit,
int8=enabled
AC_ARG_ENABLE(8bit,
[ --disable-8bit=[no/yes] no 8 bit integer output ],
[AS_HELP_STRING( [--disable-8bit], [no 8 bit integer output])],
[
if test "x$enableval" = xno; then
int8="disabled"
@@ -551,7 +625,7 @@ AC_ARG_ENABLE(8bit,
int32=enabled
AC_ARG_ENABLE(32bit,
[ --disable-32bit=[no/yes] no 32 bit integer output (also 24 bit) ],
[AS_HELP_STRING( [--disable-32bit], [no 32 bit integer output (also 24 bit)])],
[
if test "x$enableval" = xno; then
int32="disabled"
@@ -560,7 +634,7 @@ AC_ARG_ENABLE(32bit,
real=enabled
AC_ARG_ENABLE(real,
[ --disable-real=[no/yes] no real (floating point) output ],
[AS_HELP_STRING( [--disable-real], [no real (floating point) output])],
[
if test "x$enableval" = xno; then
real="disabled"
@@ -569,48 +643,49 @@ AC_ARG_ENABLE(real,
equalizer=enabled
AC_ARG_ENABLE(equalizer,
[ --disable-equalizer=[no/yes] no equalizer support ],
[AS_HELP_STRING( [--disable-equalizer], [no equalizer support])],
[
if test "x$enableval" = xno; then
equalizer="disabled"
fi
], [])
AC_ARG_WITH([cpu], [
--with-cpu=generic[[_fpu]] Use generic processor code with floating point arithmetic
--with-cpu=generic_float Plain alias to generic_fpu now... float output is a normal runtime option!
--with-cpu=generic_nofpu Use generic processor code with fixed point arithmetic (p.ex. ARM)
--with-cpu=generic_dither Use generic processor code with floating point arithmetic and dithering for 1to1 16bit decoding.
--with-cpu=i386[[_fpu]] Use code optimized for i386 processors with floating point arithmetic
--with-cpu=i386_nofpu Use code optimized for i386 processors with fixed point arithmetic
--with-cpu=i486 Use code optimized for i486 processors (only usable alone!)
--with-cpu=i586 Use code optimized for i586 processors
--with-cpu=i586_dither Use code optimized for i586 processors with dithering (noise shaping), adds 256K to binary size
--with-cpu=3dnow Use code optimized for 3DNow processors
--with-cpu=3dnow_vintage Use code optimized for older 3DNow processors (K6 family)
--with-cpu=3dnowext Use code optimized for 3DNowExt processors (K6-3+, Athlon)
--with-cpu=3dnowext_alone Really only 3DNowExt decoder, without 3DNow fallback for flexible rate
--with-cpu=3dnow_vintage Use code optimized for older extended 3DNow processors (like K6-III+)
--with-cpu=mmx Use code optimized for MMX processors
--with-cpu=mmx_alone Really only MMX decoder, without i586 fallback for flexible rate
--with-cpu=sse Use code optimized for SSE processors
--with-cpu=sse_vintage Use code optimized for older SSE processors (plain C DCT36)
--with-cpu=sse_alone Really only SSE decoder, without i586 fallback for flexible rate
--with-cpu=avx Use code optimized for x86-64 with AVX processors
--with-cpu=x86 Pack all x86 opts into one binary (excluding i486, including dither)
--with-cpu=x86-64 Use code optimized for x86-64 processors (AMD64 and Intel64, including AVX and dithered generic)
--with-cpu=altivec Use code optimized for Altivec processors (PowerPC G4 and G5)
--with-cpu=ppc_nofpu Use code optimized for PowerPC processors with fixed point arithmetic
--with-cpu=neon Use code optimized for ARM NEON SIMD engine (Cortex-A series)
--with-cpu=arm_fpu Pack neon and generic[[_dither]] decoders, for ARM processors with FPU and/or NEON
--with-cpu=arm_nofpu Use code optimized for ARM processors with fixed point arithmetic
--with-cpu=neon64 Use code optimized for AArch64 NEON SIMD engine
--with-cpu=aarch64 Pack neon64 and generic[[_dither]] decoders, for 64bit ARM processors
AC_ARG_WITH([cpu], [AS_HELP_STRING([--with-cpu=<type>], [select CPU optimization. Choices are:])
generic[[_fpu]] Use generic processor code with floating point arithmetic
generic_float Plain alias to generic_fpu now... float output is a normal runtime option!
generic_nofpu Use generic processor code with fixed point arithmetic (p.ex. ARM)
generic_dither Use generic processor code with floating point arithmetic and dithering for 1to1 16bit decoding.
i386[[_fpu]] Use code optimized for i386 processors with floating point arithmetic
i386_nofpu Use code optimized for i386 processors with fixed point arithmetic
i486 Use code optimized for i486 processors (only usable alone!)
i586 Use code optimized for i586 processors
i586_dither Use code optimized for i586 processors with dithering (noise shaping), adds 256K to binary size
3dnow Use code optimized for 3DNow processors
3dnow_vintage Use code optimized for older 3DNow processors (K6 family)
3dnowext Use code optimized for 3DNowExt processors (K6-3+, Athlon)
3dnowext_alone Really only 3DNowExt decoder, without 3DNow fallback for flexible rate
3dnow_vintage Use code optimized for older extended 3DNow processors (like K6-III+)
mmx Use code optimized for MMX processors
mmx_alone Really only MMX decoder, without i586 fallback for flexible rate
sse Use code optimized for SSE processors
sse_vintage Use code optimized for older SSE processors (plain C DCT36)
sse_alone Really only SSE decoder, without i586 fallback for flexible rate
avx Use code optimized for x86-64 with AVX processors
x86 Pack all x86 opts into one binary (excluding i486, including dither)
x86-64 Use code optimized for x86-64 processors (AMD64 and Intel64, including AVX and dithered generic)
altivec Use code optimized for Altivec processors (PowerPC G4 and G5)
ppc_nofpu Use code optimized for PowerPC processors with fixed point arithmetic
neon Use code optimized for ARM NEON SIMD engine (Cortex-A series)
arm_fpu Pack neon and generic[[_dither]] decoders, for ARM processors with FPU and/or NEON
arm_nofpu Use code optimized for ARM processors with fixed point arithmetic
neon64 Use code optimized for AArch64 NEON SIMD engine
aarch64 Pack neon64 and generic[[_dither]] decoders, for 64bit ARM processors
])
use_yasm=auto
AC_ARG_ENABLE(yasm,
[ --enable-yasm=[no/yes] enforce yasm instad of default assembler for some optimizations (AVX, currently) ],
[AS_HELP_STRING( [--enable-yasm], [enforce yasm instad of default assembler for some optimizations (AVX, currently)])],
[
if test "x$enableval" = xyes; then
use_yasm="enabled"
@@ -623,7 +698,7 @@ if test x"$use_yasm" = xenabled; then
fi
AC_ARG_ENABLE(ieeefloat,
[ --enable-ieeefloat=[yes/no] use special hackery relying on IEEE 754 floating point storage format (to accurately round to 16 bit integer at bit more efficiently in generic decoder, enabled by default, disable in case you have a very special computer) ],
[AS_HELP_STRING( [--disable-ieeefloat], [use special hackery relying on IEEE 754 floating point storage format (to accurately round to 16 bit integer at bit more efficiently in generic decoder, enabled by default, disable in case you have a very special computer)])],
[
if test "x$enableval" = xyes; then
ieee=enabled
@@ -638,7 +713,7 @@ if test "x$ieee" = xenabled; then
fi
AC_ARG_ENABLE(cases,
[ --enable-cases=[yes/no] include special cases for likely parameter values (channel count, encoding sizes in libsyn123 routines) in the hope of better optimization at the expense of some code bloat (default enabled) ],
[AS_HELP_STRING([--disable-cases], [include special cases for likely parameter values (channel count, encoding sizes in libsyn123 routines) in the hope of better optimization at the expense of some code bloat])],
[
if test "x$enableval" = xyes; then
specialcases=enabled
@@ -846,7 +921,7 @@ case $host in
esac
AC_ARG_ENABLE(buffer,
[ --enable-buffer=[yes/no] disable audio buffer code (default uses system whitelist... proper checks later) ],
[AS_HELP_STRING([--disable-buffer], [disable audio buffer code (default enabled by some heuristics)])],
[
if test "x$enableval" = xyes
then
@@ -860,7 +935,7 @@ AC_ARG_ENABLE(buffer,
)
AC_ARG_ENABLE(newoldwritesample,
[ --enable-newoldwritesample=[no/yes] enable new/old WRITE_SAMPLE macro for non-accurate 16 bit output, faster on certain CPUs (default on on x86-32)],
[AS_HELP_STRING( [--enable-newoldwritesample], [new/old WRITE_SAMPLE macro for non-accurate 16 bit output, faster on certain CPUs (default on on 32 bit x86)])],
[
if test "x$enableval" = xyes
then
@@ -919,7 +994,7 @@ AM_CONDITIONAL([HAVE_EQUALIZER], [ test x"$equalizer" = xenabled ] )
layer1=enabled
AC_ARG_ENABLE(layer1,
[ --disable-layer1=[no/yes] no layer I decoding ],
[AS_HELP_STRING( [--disable-layer1], [no layer I decoding])],
[
if test "x$enableval" = xno; then
layer1="disabled"
@@ -931,7 +1006,7 @@ AM_CONDITIONAL([HAVE_LAYER1], [test "x$layer1" = xenabled] )
layer2=enabled
AC_ARG_ENABLE(layer2,
[ --disable-layer2=[no/yes] no layer II decoding ],
[AS_HELP_STRING( [--disable-layer2], [no layer II decoding])],
[
if test "x$enableval" = xno; then
layer2="disabled"
@@ -943,7 +1018,7 @@ AM_CONDITIONAL([HAVE_LAYER2], [test "x$layer2" = xenabled] )
layer3=enabled
AC_ARG_ENABLE(layer3,
[ --disable-layer3=[no/yes] no layer III decoding ],
[AS_HELP_STRING( [--disable-layer3], [no layer III decoding])],
[
if test "x$enableval" = xno; then
layer3="disabled"
@@ -954,7 +1029,8 @@ AC_ARG_ENABLE(layer3,
AM_CONDITIONAL([HAVE_LAYER3], [test "x$layer3" = xenabled] )
AC_ARG_WITH([audio], [
--with-audio=<list of modules> Select a list (or only one) of audio output modules (comma or space separated list). Choices are:
AS_HELP_STRING([--with-audio=<list of modules>], [Select a list (or only one) of audio output modules (comma or space separated list). Choices are:])
aix Use AIX as default audio output sub-system
alib Use Alib as default audio output sub-system (for HPUX)
alsa Use ALSA as default audio output sub-system (libasound)
@@ -1112,99 +1188,137 @@ AC_CHECK_HEADERS([stdio.h stdlib.h string.h unistd.h sched.h sys/ioctl.h sys/typ
dnl ############## Types
dnl Large file support stuff needs cleanup. There are superfluous variables.
dnl Detect large file support, enable switches if needed.
AC_SYS_LARGEFILE
dnl If we do have a switch for large files, rename off_t-aware API calls.
dnl Using the file_offset_bits variable here is fine for linux (possibly Solaris),
dnl Others... we'll have to see.
dnl Note: I started writing this with with multiline replacements.
dnl Does not work. Automake insists on putting these into Makefiles where they break things.
dnl It is also assumed that a system that does not set file offset bits is not
dnl sensitive to largefile changes, i.e. FreeBSD always using 64 bit off_t.
if test "x$ac_cv_sys_file_offset_bits" = x || echo "$ac_cv_sys_file_offset_bits" | $GREP '@<:@^0-9@:>@' > /dev/null; then
dnl if it has non-numeric chars or is empty... ignore...
largefile_sensitive=no
BUILD_NO_LARGENAME=1
AC_DEFINE(BUILD_NO_LARGENAME, 1, [ No suffixed symbols for large file support (only alias for backwards compat.) ])
else
largefile_sensitive=yes
BUILD_NO_LARGENAME=0
fi
# Add dual-mode wrapper code.
AM_CONDITIONAL([HAVE_LFS_WRAP], [ test x"$largefile_sensitive" = xyes ] )
# Any non-sensitive platform does not bother with off_t-based function renaming.
AC_SUBST(BUILD_NO_LARGENAME)
# Using the lower level macros instead of AC_TYPE_* for compatibility with not freshest autoconf.
# Re-think this list. Some things just should be a given. We assume C99 now.
# Rather think about assumptions like int64_t >= ptrdiff_t.
AC_CHECK_TYPE(size_t, unsigned long)
AC_CHECK_TYPE(uintptr_t, unsigned long)
AC_CHECK_TYPE(ssize_t, long)
AC_CHECK_TYPE(off_t, long int)
AC_CHECK_TYPE(ptrdiff_t, long)
AC_CHECK_TYPE(int32_t, int)
AC_CHECK_TYPE(int64_t, long long)
AC_CHECK_TYPE(uint32_t, unsigned int)
AC_CHECK_TYPE(int16_t, short)
AC_CHECK_TYPE(uint16_t, unsigned short)
AC_CHECK_SIZEOF(size_t,4)
AC_CHECK_SIZEOF(ssize_t,4)
AC_CHECK_SIZEOF(off_t,4)
AC_CHECK_SIZEOF(off64_t,8)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(ssize_t)
AC_CHECK_SIZEOF(int32_t)
AC_CHECK_SIZEOF(long,4)
AC_CHECK_SIZEOF(long)
dnl The native type used for aliases is what off_t maps to without any largefile-
dnl enabling switches. So, it's long int if the system is largefile-senstive,
dnl but it is actual plain off_t if the system does not have such switches.
if test "x$largefile_sensitive" = xyes; then
lfs_alias_type=long
lfs_alias_size=$ac_cv_sizeof_long
elif test "x$android_build" = xyes; then
lfs_alias_type=off64_t
lfs_alias_size=$ac_cv_sizeof_off64_t
else
lfs_alias_type=off_t
lfs_alias_size=$ac_cv_sizeof_off_t
fi
# We do not need to know if off_t actually changes size using
# _FILE_OFFSET_BITS, only need to know what size it has.
if test "x$lfs_alias_size" = "x"; then
AC_MSG_ERROR([Cannot determine sizeof(lfs_alias_t)?])
else
LFS_ALIAS_BITS=`expr "$lfs_alias_size" "*" "8"`
AC_DEFINE_UNQUOTED([lfs_alias_t], $lfs_alias_type,
[Define to the native offset type (long or actually off_t).])
AC_DEFINE_UNQUOTED([LFS_ALIAS_BITS], $LFS_ALIAS_BITS,
[Define this to the size of native offset type in bits, used for LFS alias functions.])
fi
dnl ############## LFS stuff
AC_SUBST(LFS_ALIAS_BITS)
lfs_alias=enabled
AC_ARG_ENABLE(lfs-alias,
[ --disable-lfs-alias disable alias wrappers for largefile bitness (mpg123_seek_32 or mpg123_seek_64 in addition to mpg123_seek, or the other way around; It is a mess, do not play with this!) ],
portable_api=no
AC_ARG_ENABLE(portable,
[AS_HELP_STRING( [--enable-portable], [only build portable API (no off_t, no internal I/O)])],
[
if test "x$enableval" = xno; then
lfs_alias="disabled"
if test "x$enableval" = xyes; then
portable_api="yes"
fi
],
[
case $host in
*-cygwin*)
lfs_alias="disabled"
AC_MSG_NOTICE([lfs-alias disabled for Cygwin, use --enable-lfs-alias explicitly to enable, only if you know what you are doing])
;;
esac
], [])
if test "x$portable_api" = xyes; then
AC_DEFINE(PORTABLE_API, 1, [ Define to only include portable library API (no off_t, no internal I/O). ])
fi
])
AM_CONDITIONAL([HAVE_LFS_WRAP], [ test x"$portable_api" = xno ] )
AC_MSG_CHECKING([if we want to enable alias wrappers for largefile])
if test "x$lfs_alias" = "xenabled"; then
# Check for shape-shifting off_t just for the mpg123 client application.
# At least at first, mpg123 itself will excercise the wrappers, otherwise
# we don't know they work.
# Do not use AC_CHECK_SIZEOF twice to avoid redefinition of SIZEOF_OFF_T
# in further tests via confdefs.h.
AC_MSG_CHECKING([switched off_t size])
AC_COMPUTE_INT(switched_off_size, sizeof(off_t), [
#undef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
])
AC_MSG_RESULT([$switched_off_size])
# If you have predefined _FILE_OFFSET_BITS, I will treat that as a system
# property.
AC_CHECK_SIZEOF(off_t, [], [
#include <sys/types.h>
])
# Some paranoia about the limited choices we accept.
# 32 or 64 bit offsets, an the switched one better not be smaller.
if test "x$ac_cv_sizeof_off_t" = x0; then
AC_MSG_ERROR([Not even off_t found. I need some POSIX.])
fi
if test "x$ac_cv_sizeof_off_t" != x8 &&
test "x$ac_cv_sizeof_off_t" != x4; then
AC_MSG_ERROR([unexpected size of off_t])
fi
if test "x$ac_cv_sizeof_off_t" != "x$switched_off_size"; then
if test "x$switched_off_size" != x8; then
AC_MSG_ERROR([bad switched off_t size])
fi
lfs_sensitive=yes
AC_DEFINE(LFS_SENSITIVE, 1, [ System redefines off_t when defining _FILE_OFFSET_BITS to 64. ])
else
lfs_sensitive=no
fi
use_largefile=auto
AC_MSG_CHECKING([if native off_t is already 64 bits])
if test "x$ac_cv_sizeof_off_t" = x8; then
AC_MSG_RESULT([yes])
use_largefile=no
else
AC_MSG_RESULT([no])
fi
AM_CONDITIONAL([HAVE_LFS_ALIAS], [ test x"$lfs_alias" = xenabled ])
AC_ARG_ENABLE(largefile,
[AS_HELP_STRING([--disable-largefile], [to not attempt to use 64 bit file offsets internally])],
[ if test "x$enableval" = xno; then
use_largefile=no
fi
],
[])
# Large file support without the magic. Check for the API explicitly.
# The shape-shifting off_t has to be avoided for the library builds.
# The mpg123 application might still use it to check if the API works.
# Or we limit it to portable, off_t-less API at some point.
if test x"$use_largefile" != xno; then
# Expect usual_LARGEFILE64_SOURCE mechanics with off64_t and lseek64 present.
AC_CHECK_FUNCS([lseek64])
AC_CHECK_TYPE(off64_t, [have_off64_t=yes], [have_off64_t=no], [[
#define _LARGEFILE64_SOURCE
#include <sys/types.h>
#include <unistd.h>
]])
if test "x$have_off64_t" = xyes && test "x$ac_cv_func_lseek64" = xyes; then
use_largefile=yes
AC_DEFINE(LFS_LARGEFILE_64, 1, [ Define if we use _LARGEFILE64_SOURCE with off64_t and lseek64. ])
AC_MSG_CHECKING([if we have O_LARGEFILE])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#define _LARGEFILE64_SOURCE
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
int foo()
{
return open("foo", O_RDONLY|O_LARGEFILE);
}
])],[have_o_largefile=yes],[have_o_largefile=no])
AC_MSG_RESULT([$have_o_largefile])
if test x"$have_o_largefile" = xno; then
AC_DEFINE(O_LARGEFILE, 0, [ Define to 0 if system does not have/need it. ])
fi
else
use_largefile=no
fi
fi # use_largefile auto or yes
dnl ############## Function Checks
@@ -1244,7 +1358,7 @@ AC_CHECK_FUNCS( sched_setscheduler setuid getuid)
# Check for setpriority
AC_CHECK_FUNCS( setpriority )
AC_CHECK_FUNCS( strerror )
AC_CHECK_FUNCS( strerror strerror_l uselocale )
AC_CHECK_FUNCS( setlocale nl_langinfo mbstowcs wcstombs wcswidth iswprint )
@@ -1310,29 +1424,6 @@ AC_SEARCH_LIBS(socket, socket)
AC_CHECK_FUNCS( getaddrinfo, [ have_ipv6=yes ], [ have_ipv6=no ] )
# Substitutions for the installable mpg123.h header
if test "x$ac_cv_header_stdio_h" = "xyes"; then
INCLUDE_STDIO_H="#include <stdio.h>"
else
INCLUDE_STDIO_H="/* #include <stdio.h> is not available on this system */"
fi
AC_SUBST(INCLUDE_STDIO_H)
if test "x$ac_cv_header_stdlib_h" = "xyes"; then
INCLUDE_STDLIB_H="#include <stdlib.h>"
else
INCLUDE_STDLIB_H="/* #include <stdlib.h> is not available on this system */"
fi
AC_SUBST(INCLUDE_STDLIB_H)
if test "x$ac_cv_header_sys_types_h" = "xyes"; then
INCLUDE_SYS_TYPE_H="#include <sys/types.h>"
else
INCLUDE_SYS_TYPE_H="/* #include <sys/types.h> is not available on this system */"
fi
AC_SUBST(INCLUDE_SYS_TYPE_H)
# Checks for maths libraries.
AC_CHECK_LIB([m], [sqrt])
AC_CHECK_LIB([mx], [powf])
@@ -1600,7 +1691,7 @@ AC_SUBST(YASM_FORMAT)
AC_MSG_CHECKING([if we want feature report function])
feature_report=enabled
AC_ARG_ENABLE(feature_report,
[ --disable-feature_report Disable feature report function ],
[AS_HELP_STRING([--disable-feature_report], [Disable feature report function])],
[
if test "x$enableval" = xno; then
AC_MSG_RESULT([no])
@@ -2344,11 +2435,6 @@ case $host_os in
;;
esac
# enable win32 code
if test "x$ac_cv_header_windows_h" = xyes -a "x$host_os" != xcygwin -a "x$host_os" != xmidipix; then
win32_specific_codes=enabled
fi
dnl We do not support non-unicode Windows.
if test "x$win32_specific_codes" = xenabled; then
#### Check for Wide functions
@@ -2485,31 +2571,6 @@ if test x$win32_specific_codes = xenabled; then
else
AC_MSG_RESULT([no])
fi
# Check GetThreadErrorMode
if test x"$modules" != xdisabled; then
AC_MSG_CHECKING([if we have GetThreadErrorMode])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <windows.h>
int main(){
return GetThreadErrorMode();
}])],[win32_thread_error=yes],[win32_winver_bump=yes])
if test "x$win32_thread_error" != "xyes"; then
AC_MSG_CHECKING([if we have GetThreadErrorMode])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#define WINVER 0x600
#define _WIN32_WINNT 0x600
#include <windows.h>
int main(){
return GetThreadErrorMode();
}])],[win32_thread_error=yes],[win32_thread_error=no])
fi
if test "x$win32_thread_error" = "xyes"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR(GetThreadErrorMode is required but not found)
fi
fi
fi
#### WINVER Bump
@@ -2542,7 +2603,7 @@ AS_IF([test "x$eoverflow_present" = "xyes"],[],[AC_DEFINE([EOVERFLOW],[EFBIG],[U
# old network choice
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6=[no/yes] IPv6 support in internal network stack ],
[AS_HELP_STRING( [--enable-ipv6], [IPv6 support in internal network stack])],
[
if test "x$enableval" = xyes
then
@@ -2563,7 +2624,7 @@ dnl This is to be kept in sync with --with-network, it is a shortcut that
dnl keep the old semantics of being able to --disable-network support altogether.
dnl The default should match the --with-network default.
AC_ARG_ENABLE(network,
[ --enable-network=[no/yes] network support (http streams / webradio), if available (overruled by --with-network!) ],
[AS_HELP_STRING( [--enable-network], [network support (http streams / webradio), if available (overruled by --with-network!)])],
[
if test "x$enableval" = xyes
then
@@ -2726,13 +2787,127 @@ if test x"$ipv6" = xenabled; then
fi
fi
dnl ############## Component selection
AC_ARG_ENABLE(components,
[AS_HELP_STRING([--disable-components], [(not) build end-user programs with default components, select individual components via --enable-libmpg123 etc.])],
[
if test "x$enableval" = xyes
then
build_all=yes
else
build_all=no
fi
],
[
build_all=yes
]
)
AC_ARG_ENABLE(libmpg123,
[AS_HELP_STRING([--enable-libmpg123], [build (only) libmpg123 (with --disable-components)])],
[
if test "x$enableval" = xyes
then
build_libmpg123=yes
else
build_libmpg123=no
fi
],
[
build_libmpg123=no
]
)
AC_ARG_ENABLE(libout123,
[AS_HELP_STRING([--enable-libout123], [build (only) libout123 (with --disable-components)])],
[
if test "x$enableval" = xyes
then
build_libout123=yes
else
build_libout123=no
fi
],
[
build_libout123=no
]
)
AC_ARG_ENABLE(libout123-modules,
[AS_HELP_STRING([--enable-libout123-modules], [build (only) libout123 modules (with --disable-components)])],
[
if test "x$enableval" = xyes
then
build_libout123_modules=yes
else
build_libout123_modules=no
fi
],
[
build_libout123_modules=no
]
)
AC_ARG_ENABLE(libsyn123,
[AS_HELP_STRING([--enable-libsyn123], [build (only) libsyn123 (with --disable-components)])],
[
if test "x$enableval" = xyes
then
build_libsyn123=yes
else
build_libsyn123=no
fi
],
[
build_libsyn123=no
]
)
if test "x$build_all" = xyes; then
build_programs=yes
build_libmpg123=yes
build_libout123=yes
build_libout123_modules=yes
build_libsyn123=yes
components="programs"
else
build_programs=no
fi
AM_CONDITIONAL([BUILD_PROGRAMS], [ test "x$build_programs" = xyes ])
AM_CONDITIONAL([BUILD_LIBMPG123], [ test "x$build_libmpg123" = xyes ])
AM_CONDITIONAL([BUILD_LIBOUT123], [ test "x$build_libout123" = xyes ])
AM_CONDITIONAL([BUILD_LIBOUT123_MODULES], [ test "x$build_libout123_modules" = xyes ])
AM_CONDITIONAL([BUILD_LIBSYN123], [ test "x$build_libsyn123" = xyes ])
AM_CONDITIONAL([NEED_FMT123], [ test "x$build_libmpg123" = xyes || test "x$build_libout123" = xyes || test "x$build_libsyn123" = xyes ])
# If we install libraries, prompting pkgconfig and include directories.
AM_CONDITIONAL([NEED_LIB], [ test "x$build_libmpg123" = xyes || test "x$build_libout123" = xyes || test "x$build_libout123_modules" = xyes || test "x$build_libsyn123" = xyes ])
AM_CONDITIONAL([NEED_MAINLIB], [ test "x$build_libmpg123" = xyes || test "x$build_libout123" = xyes || test "x$build_libsyn123" = xyes ])
AM_CONDITIONAL([NEED_MAN], [ test "x$build_programs"= = xyes ])
if test "x$build_libmpg123" = xyes; then
components="$components libmpg123"
fi
if test "x$build_libout123" = xyes; then
components="$components libout123"
fi
if test "x$build_libout123_modules" = xyes; then
components="$components libout123-modules"
fi
if test "x$build_libsyn123" = xyes; then
components="$components libsyn123"
fi
components=$(echo $components)
dnl ############## Library cleanup
PROG_LIBS=$LIBS
LIBS=
LIBMPG123_LIBS="$LIBM $COMPAT_LIBS"
LIBSYN123_LIBS=$LIBM
LIBOUT123_LIBS="$LIBM $COMPAT_LIBS"
LIBOUT123_LIBS="$LIBRT $LIBM $COMPAT_LIBS"
AC_SUBST(PROG_LIBS)
AC_SUBST(LIBM)
@@ -2748,22 +2923,28 @@ AC_CONFIG_FILES([
libout123.pc
libsyn123.pc
mpg123.spec
src/libmpg123/mpg123.h
src/libout123/out123.h
src/libsyn123/syn123.h
])
AC_OUTPUT
dnl ############## Display Message
default_offset_bits=`expr "$ac_cv_sizeof_off_t" "*" "8"`
echo "
$PACKAGE_NAME $PACKAGE_VERSION
Install path ............ $prefix
Components .............. $components
CPU Optimization ........ $cpu_type
Compiler Optimization ... $with_optimization
Gapless Support ......... $gapless
Compiler Optimization ... $with_optimization"
if test x"$use_yasm_for_avx" = xyes; then
echo " Use yasm (for AVX only) . enabled"
else
echo " Use yasm (for AVX only) . disabled"
fi
echo " Gapless Support ......... $gapless
Debugging ............... $debugging
Terminal control ........ $term_type
Extreme debugging ....... $xdebugging
@@ -2777,19 +2958,10 @@ if test x$network_type != xdisabled; then
echo " Internal network type ... $network_internal
IPv6 (getaddrinfo) ...... $ipv6"
fi
if test x"$LARGEFILE_BITS" = x; then
echo " File offsets ............ default"
else
echo " File offsets ............ $LARGEFILE_BITS"
echo " The lib will (try to) support default offset size, too."
fi
echo " LFS alias symbols ....... $lfs_alias ($LFS_ALIAS_BITS)"
echo " LFS alias type .......... $lfs_alias_type"
if test x"$use_yasm_for_avx" = xyes; then
echo " Use yasm (for AVX only) . enabled"
else
echo " Use yasm (for AVX only) . disabled"
fi
echo " largefile sensitive ..... $lfs_sensitive"
echo " default offsets ......... $default_offset_bits"
echo " explicit 64 bit offsets . $use_largefile"
echo " only portable API ....... $portable_api"
echo "
Core libmpg123 features:

View File

@@ -1,3 +1,115 @@
The state from 1.32.0 on:
=========================
Yet again, things had to change. The previous state works fine for Unix (adjacent)
sytems, also MinGW stuff on Windows, but it still suffers from off_t being shifty
and not behaving as I expect, even, when people try to build mpg123 with rogue
compilers like MSVC, where off_t is always 32 bits, no largefile support, the whole
idea falls flat. I was pushed to introduce API without off_t where the user can
provide I/O and ensure largefile support and whatnot without being encumbered by
offsets possibly limited to 32 bits.
So this is a new set of API functions with the explicit suffix 64 (not _64), notably
simple functions like
int64_t mpg123_tell64()
but also
int mpg123_reader64()
which takes callbacks that work on int64_t, always. The internal reader code path
in libmpg123 uses either 32 bit or 64 bit offsets, but throughout the library,
it is 64 bits being used as if we supported large files everywhere. And in fact,
we do, if the user provides callbacks that are smart enough.
All existing offset-sensitive code paths are to be rephrased in terms of the new
portable API (portable, because the platform specifics of off_t implementation are
not present). All old API entry points in that regard become wrappers over this
portable API.
The build of libmpg123 needs explicit awareness of largefile support to properly
reason about which wrapper uses which types. It makes use of off_t at default
size and explicit off64_t if available. This results in this for a typical 32 bit
Linux system:
int64_t mpg123_tell64(); // passing on the internal int64_t value
off_t mpg123_tell(); // converting to 32 bit off_t (overflow check)
off_t mpg123_tell_32(); // converting to 32 bit off_t (overflow check)
off64_t mpg123_tell_64(); // converting to 64 bit off_t (no overflow)
A 64 bit Linux would have only these:
int64_t mpg123_tell64(); // passing on the internal int64_t value
off_t mpg123_tell(); // converting to 64 bit off_t (no overflow)
off_t mpg123_tell_64(); // converting to 64 bit off_t (no overflow)
This would look the same on a 32 bit system that also went for fixed 64 bit offsets,
or if you
#define _FILE_OFFSET_BITS 64
during build on a sensitive system. On a funny system that has 64 bit native integers
but still 32 bit off_t, this would also be:
int64_t mpg123_tell64(); // passing on the internal int64_t value
off_t mpg123_tell(); // converting to 32 bit off_t (overflow check)
off_t mpg123_tell_32(); // converting to 32 bit off_t (overflow check)
If this weird system would be also largefile-sensitive, you get the additional
off64_t mpg123_tell_64(); // converting to 64 bit off_t (no overflow)
entry point.
The whole point here: If you stick to mpg123_tell64(), you always can assume
64 bit offsets on any platform. If you also provide your own reader functions, you
can ensure it. Even if we don't properly do large file I/O in libmpg123 itself in
an MSVC build, users can provide it with their application. Providing a full mpg123
program binary along with it in that environment is not a current target. You want
the library.
The point that every platform gets the _64 suffix means that the header can still
do the renaming of function calls if client code defines _FILE_OFFSET_BITS and not
depend on any build-time switches for that. This is what we do officially now with
headers that are not preprocessed anymore, independent of platform.
The build, just assuming int64 is available, needs to know some bits:
- SIZEOF_OFF_T==8: Is the system 64 bit clean, anyway, with 64 bit off_t?
- LFS_LARGEFILE_64: Is there explicit 64 bit I/O for the 32 bit system?
This includes availability of off64_t.
If SIZEOF_OFF_T==8, there will be all 64 bit internal code and two wrappers:
off_t mpg123_tell(); // converting to 64 bit off_t (no overflow)
off_t mpg123_tell_64(); // converting to 64 bit off_t (no overflow)
The second question isn't even needed. If SIZEOF_OFF_T==4, you get
off_t mpg123_tell(); // converting to 32 bit off_t (overflow check)
off_t mpg123_tell_32(); // converting to 32 bit off_t (overflow check)
and the additional decision of LFS_LARGEFILE_64 gives actual 64 bit internal
reader code and the wrapper
off64_t mpg123_tell_64(); // converting to 64 bit off_t (no overflow)
along with that. There is nothing more to know about a system. I do not care how
large your long is. I only ask
1. How big is your off_t?
2. If small, can you give me some off64_t?
That's all what there is to it. The build is not even interested in whether off_t
changes size. This is a detail on the client side that it then gets the off64_t
versions. I do not support a system that allows changing off_t size _without_
off64_t being available.
The state from 1.15.4 on:
=========================
Regarding largefile setup, client apps can be built three ways:
1. _FILE_OFFSET_BITS == 64 (header maps to mpg123_open_64)

View File

@@ -14,6 +14,7 @@ EXTRA_DIST += \
doc/THANKS \
doc/ACCURACY \
doc/LARGEFILE \
doc/READERS \
doc/libmpg123_speed.txt \
doc/doxyhead.xhtml \
doc/doxyfoot.xhtml \
@@ -21,6 +22,8 @@ EXTRA_DIST += \
doc/doxygen.conf \
doc/windows-notes.html \
doc/examples/mpg123_to_out123.c \
doc/examples/mpg123_to_wav_replaced_io.c \
doc/examples/mpg123_to_wav_reader64.c \
doc/examples/scan.c \
doc/examples/mpglib.c \
doc/examples/id3dump.c \

209
doc/READERS Normal file
View File

@@ -0,0 +1,209 @@
The libmpg123 web of reader abstractions
========================================
Somehow the differing ways of getting compressed data into libmpg123 reached
unholy numbers with the years. As keeper of the legacy, I got quite some of that
to keep. There are intersectional layers ... however you might call it.
An attempt to get an overview and be able to refactor that for the glorious
portable API of mpg123 1.32.0.
The frame struct has two parts concerned with input streams.
struct reader *rd; /* pointer to the reading functions */
struct reader_data rdat; /* reader data and state info */
The distinction is blurred a bit: Over time, I added function pointers to
the latter.
1. Basic methods of data input for (seekable) streams
-----------------------------------------------------
These reside in the struct reader_data member of the frame struct (mpg123_handle), so
normally fr->rdat. This is an assortment of (user-supplied) function pointers
and stores the stream position and length. The latter was the initial purpose.
1.1 Reader based around POSIX I/O
---------------------------------
This one relies on some read() and lseek() to give the input bytes. With an
innocent mpg123_open(), you trigger compat_open() and further work on the
resulting fd.
But you can also do mpg123_open_fd() to provide the descriptor yourself. Same
further code path, just no closing.
1.1.1 Timeout read
------------------
The timeout reader is a variant that squeezes into the internal POSIX I/O with
some fcntl() and select() on the file descriptor, and a separate reader callback
stored as fdread().
1.2 Replaced I/O on file descriptor
-----------------------------------
After calling mpg123_replace_reader(), you have your callbacks (or the respective
fallback callback) operating on the file descriptor that could have resulted
from internal opening or been handed over to libmpg123.
1.3 Replaced I/O on custom handle
---------------------------------
This replaces both read() and lseek() with your callbacks and opening is
full external, just the handle being handed over via mpg123_open_handle().
1.4 Replaced I/O on custom handle using 64 bit offsets
------------------------------------------------------
This is to come, the above just with a differing style of callbacks that avoid
off_t. I intend to pack all the above into wrapper code and have this whole
first aspect of differing callbacks removed.
2. Abstractions
---------------
The actual interface to the parser is given by instances of struct reader. This
is usually accessed as fr->rd and contains function pointers to specific routines
like fullread() and head_read(). These access the basic methods behind the scenes.
There is overlap in the functions. The main differentiator is the fullread() call,
which is the next layer of read(). I guess code sharing could be one excuse not
to have each of these as a wholly separate I/O layer implementation.
2.1 READER_STREAM
-----------------
This reader handles a plain possibly seekable input stream. It introduces the
plain_fullread() function which loops over fr->rdat.fdread() until the desired
bytes are aquired or EOF occurs. There is no signal handling. A return value
less than zero is an error and the end, the function returning a short byte
count. This function also advances fr->rdat.filepos if the reader is not
buffered.
2.2 READER_ICY_STREAM
---------------------
This replaces plain_fullread() with icy_fullread(), which looks out for ICY
metadata at the configured interval. It resorts to fr->rdat.fdread() and
plain_fullread() to do its chores.
2.3 READER_FEED
---------------
The reader handling libmpg123 feeder mode. It stuffs data into an internal buffer
and extracts from that, handing out READER_MORE as error to be recovered from
when the client provides more data. It provides a bit of seeking within the
buffer for parsing (look-ahead) purposes, before read data is purged from the
buffer chain.
The actual mid-level reader here is feed_read(), wrapping over the bufferchain data
structre with its methods.
2.4 READER_BUF_STREAM
---------------------
For some reason, I had to add a mode for a stream with some buffering
(MPG123_SEEKBUFFER). Well ... yes, MPEG parsing is just more fun if you can peek
ahead and have a little window of input data to work with. This used to employ
buffered_fullread(), which in turn called fr->rdat.fullread(), which was
plain_fullread() for this variant, and wraped a bufferchain around it.
Now this got its separate buffered_plain_fullread() without the extra function
pointer in fr->rdat.
2.5 READER_BUF_ICY_STREAM
-------------------------
This is the same buffered reader but with buffered_icy_fullread() instead.
3. Control flow for setting up a stream
=======================================
3.1 mpg123_open()
-----------------
Client code just opens a track or possibly called mpg123_replace_reader()
beforehand, which does not change the opening behaviour.
This accesses the given file path via compat_open(), stores a file descriptor,
calls reader stream init which checks seekability (also fetching ID3v1) and
stores file size. This results in one of the READER_*STREAM family.
The lfs_wrap machinery gets triggrered and inserts its callbacks, working
on the prepared wrapper data.
3.2 mpg123_open_fd()
--------------------
This just skips the compat_open() and stores the given file descriptor, assuming
that it works with the configured callbacks. The same dance with stream setup.
The lfs_wrap machinery gets triggrered and inserts its callbacks, working
on the prepared wrapper data.
3.3 mpg123_open_handle()
------------------------
Also skips the opening, stores the handle and does the stream setup.
This shall not trigger callback insertion. The idea is that the user did
call mpg123_reader64() or a wrapper variant of it before. The wrapper code
itself finalizes its work with a call to mpg123_reader64().
Oh, wait. What about the other wrapper calls? Client code calls
mpg123_replace_reader_handle() with its callbacks, be it off_t or off64_t.
This needs to trigger preparation of wrapperdata and installment of wrapper
callbacks via mpg123_reader64(). A subsequent mpg123_open_handle() needs
to store the actual client handle inside the wrapperdata structure and use
the latter as iohandle for stream operation. I need tell apart internal and
external use of mpg123_reader64().
So store a flag for that? Is there another way without introducing yet another
function? Well, the wrapperdata can have two states that fit this scenario:
- not present at all
- present with a respective state set
I want to avoid unnecessary allocation of the wrapperdata (just because I am that
kind of person). So I need to ensure that INT123_wrap_open() when called with
an external handle and not encountering an existing wrapperdata instance, does not
allocate one, but just silently does nothing, as there is nothing to do. Well,
it can check if callbacks are in place. At least that.
3.4 mpg123_open_feed()
----------------------
Prepares for the non-seekable feeder mode, limited stream setup because peeking
at the end won't work.
This does not trigger the wrapper ... except ... should it unregister its
callbacks? No. The code path of the feeder is separate enough that it does
not interfere.
4. Plan
=======
Keep the abstractions in readers.c, move all variants of POSIX-like callback stuff
into the wrapper section (lfs_wrap.c for now). In theory, the buffer chain for
the feeder could also be moved into a variant hidden behind mpg123_reader64(). Maybe
in the future. At some point.
I don't want any mpg123 internals regarding the frame struct in the wrapper
implementation. So maybe lfs_wrap.c only offers wrapper setup as such and
libmpg123.c does the actual stream opening? No. The explicit largefile stuff
needs to be handled (O_LARGEFILE). But the further stream setup ... that
should happen in mpg123_open() and friends, after reader handle setup.
I still need fr->rdat.flags for selecting buffered etc., but not for
READER_FD_OPENEND or READER_NONBLOCK.
Both fr->rdat.fullread and fr->rdat.fdread are gone now. The picture is getting
clearer.
I made the static functions fdread() and fdseek() robust against missing
callbacks. It's a question if we'd rather want to catch those earlier, though.

View File

@@ -179,6 +179,10 @@ to help parsers decide if they got the whole list.
a = 2: playing unpaused
a = 3: end of track reached (followed by another status response)
@DRAIN <s>
Output buffer of s seconds is being drained, without chance of interruption.
(since v11)
@E <a>
An error occured
Errors may be also reported by mpg123 through

View File

@@ -9,10 +9,10 @@
<strong>Note:</strong>
This API doc is automatically generated from the current development version that you can get via Subversion or as a daily snapshot from <a href="http://mpg123.org/snapshot">http://mpg123.org/snapshot</a>.
There may be differences (additions) compared to the latest stable release. See
<a href="http://mpg123.org/cgi-bin/viewvc.cgi/trunk/NEWS.libmpg123?view=markup">NEWS.libmpg123</a>,
<a href="http://mpg123.org/cgi-bin/viewvc.cgi/trunk/NEWS.libout123?view=markup">NEWS.libout123</a>,
<a href="http://mpg123.org/cgi-bin/viewvc.cgi/trunk/NEWS.libsyn123?view=markup">NEWS.libsyn123</a>,
and the overall <a href="http://mpg123.org/cgi-bin/viewvc.cgi/trunk/NEWS?view=markup">NEWS</a> file on libmpg123 versions and important changes between them.<br />
<a href="https://mpg123.org/trunk/NEWS.libmpg123">NEWS.libmpg123</a>,
<a href="https://mpg123.org/trunk/NEWS.libout123">NEWS.libout123</a>,
<a href="https://mpg123.org/trunk/NEWS.libsyn123">NEWS.libsyn123</a>,
and the overall <a href="https://mpg123.org/trunk/NEWS">NEWS</a> file on libmpg123 versions and important changes between them.<br />
Let me emphasize that the policy for the lib*123 family is to always stay backwards compatible -- only <em>additions</em> are planned (and it's not yet planned to change the plans;-).
</div>
<div> <!-- for some reason, doxygen closes a div where non is open, bug in my version? -->

View File

@@ -2,6 +2,7 @@ targets = \
feedseek \
mpg123_to_out123 \
mpg123_to_wav_replaced_io \
mpg123_to_wav_reader64 \
scan \
id3dump \
mpglib \
@@ -40,6 +41,9 @@ mpg123_to_out123: mpg123_to_out123.c
mpg123_to_wav_replaced_io: mpg123_to_wav_replaced_io.c
$(compile) -o $@ $< $(OUT123_CFLAGS) $(OUT123_LDFLAGS) $(linkflags)
mpg123_to_wav_reader64: mpg123_to_wav_reader64.c
$(compile) -o $@ $< $(OUT123_CFLAGS) $(OUT123_LDFLAGS) $(linkflags)
feedseek: feedseek.c
$(compile) -o feedseek feedseek.c $(OUT123_CFLAGS) $(OUT123_LDFLAGS) $(linkflags)

View File

@@ -69,7 +69,8 @@ int do_work(mpg123_handle *m)
ret = mpg123_open_fd(m, STDIN_FILENO);
if(ret != MPG123_OK) return ret;
while( (ret = mpg123_framebyframe_next(m)) == MPG123_OK || ret == MPG123_NEW_FORMAT )
ssize_t wret = 0;
while( !wret && (ret = mpg123_framebyframe_next(m)) == MPG123_OK || ret == MPG123_NEW_FORMAT )
{
unsigned long header;
unsigned char *bodydata;
@@ -82,14 +83,20 @@ int do_work(mpg123_handle *m)
for(i=0; i<4; ++i) hbuf[i] = (unsigned char) ((header >> ((3-i)*8)) & 0xff);
/* Now write out both header and data, fire and forget. */
write(STDOUT_FILENO, hbuf, 4);
write(STDOUT_FILENO, bodydata, bodybytes);
wret = write(STDOUT_FILENO, hbuf, 4);
if(!wret)
wret = write(STDOUT_FILENO, bodydata, bodybytes);
fprintf(stderr, "%zu: header 0x%08lx, %zu body bytes\n", ++count, header, bodybytes);
}
}
if(ret != MPG123_DONE)
fprintf(stderr, "Some error occured (non-fatal?): %s\n", mpg123_strerror(m));
if(wret)
{
fprintf(stderr, "Write error.\n");
ret = MPG123_ERR;
}
fprintf(stderr, "Done with %zu MPEG frames.\n", count);

View File

@@ -0,0 +1,203 @@
/*
mpg123_to_wav_replaced_io.c
This is example code only sensible to be considered in the public domain.
Initially written by Nicholas Humfrey (moved to 64 bit handle I/O by Thomas Orgis).
This example program demonstrates how to use libmpg123 to decode a file to WAV (writing via libsndfile), while doing the I/O (read and seek) with custom callback functions.
This should cater for any situation where you have some special means to get to the data (like, mmapped files / plain buffers in memory, funky network streams).
Disregarding format negotiations, the basic synopsis is:
mpg123_init()
mpg123_new()
mpg123_replace_reader_handle()
mpg123_open_handle()
mpg123_read()
mpg123_close()
mpg123_delete()
mpg123_exit()
*/
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <mpg123.h>
#include <out123.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifndef _MSC_VER
#include <unistd.h>
#else
#include <io.h>
#endif
#include <string.h>
#if MPG123_API_VERSION < 48
#error "Need minimum mpg123 API version 48."
#endif
void usage(const char *cmd)
{
printf("Usage: %s <input> <output>\n", cmd);
exit(99);
}
void cleanup(mpg123_handle *mh, out123_handle *ao)
{
out123_del(ao);
/* It's really to late for error checks here;-) */
mpg123_close(mh);
mpg123_delete(mh);
mpg123_exit();
}
/* Simple handle for you private I/O data. */
struct ioh { int fd; };
/* The callback functions; simple wrappers over standard I/O.
They could be anything you like... */
static int read_cb(void *handle, void *buf, size_t sz, size_t *got)
{
if(!handle)
return -1;
struct ioh *h = handle;
errno = 0;
// Ideally, you check for singnals in here where they should not interrupt
// operations (handle EINTR, for example).
ssize_t gots = read(h->fd, buf, sz);
if(gots < 0)
{
fprintf(stderr, "read error: %s\n", strerror(errno));
return -1;
}
if(got)
*got = (size_t)gots;
return 0;
}
// You should be more careful if off_t < int64_t. Ideally, you know
// you have 64 bit I/O.
static int64_t lseek_cb(void *handle, int64_t offset, int whence)
{
if(!handle)
return -1;
int64_t ret;
struct ioh *h = handle;
ret = (int64_t)lseek(h->fd, (off_t)offset, whence);
if(ret < 0) fprintf(stderr, "seek error: %s\n", strerror(errno));
return ret;
}
/* The cleanup handler is called on mpg123_close(), it can cleanup your part of the mess... */
void cleanup_cb(void *handle)
{
if(!handle)
return;
struct ioh *h = handle;
close(h->fd);
h->fd = -1;
}
int main(int argc, char *argv[])
{
mpg123_handle *mh = NULL;
out123_handle *ao = NULL;
unsigned char* buffer = NULL;
size_t buffer_size = 0;
size_t done = 0;
int channels = 0, encoding = 0;
long rate = 0;
int err = MPG123_OK;
off_t samples = 0;
struct ioh *iohandle;
if (argc!=3) usage(argv[0]);
printf( "Input file: %s\n", argv[1]);
printf( "Output file: %s\n", argv[2]);
#if MPG123_API_VERSION < 46
// Newer versions of the library don't need that anymore, but it is safe
// to have the no-op call present for compatibility with old versions.
err = mpg123_init();
#endif
errno = 0;
iohandle = malloc(sizeof(struct ioh));
iohandle->fd = open(argv[1], O_RDONLY);
if(iohandle->fd < 0)
{
fprintf(stderr, "Cannot open input file (%s).\n", strerror(errno));
return -1;
}
if( err != MPG123_OK || (mh = mpg123_new(NULL, &err)) == NULL
/* Let mpg123 work with the file, that excludes MPG123_NEED_MORE messages. */
|| mpg123_reader64(mh, read_cb, lseek_cb, cleanup_cb) != MPG123_OK
|| mpg123_open_handle(mh, iohandle) != MPG123_OK
/* Peek into track and get first output format. */
|| mpg123_getformat(mh, &rate, &channels, &encoding) != MPG123_OK )
{
fprintf( stderr, "Trouble with mpg123: %s\n",
mh==NULL ? mpg123_plain_strerror(err) : mpg123_strerror(mh) );
cleanup(mh, ao);
return -1;
}
if(encoding != MPG123_ENC_SIGNED_16)
{ /* Signed 16 is the default output format anyways; it would actually by only different if we forced it.
So this check is here just for this explanation. */
cleanup(mh, ao);
fprintf(stderr, "Bad encoding: 0x%x!\n", encoding);
return -2;
}
/* Ensure that this output format will not change (it could, when we allow it). */
mpg123_format_none(mh);
mpg123_format(mh, rate, channels, encoding);
printf("Creating 16bit WAV with %i channels and %liHz.\n", channels, rate);
if(
!(ao = out123_new())
|| out123_open(ao, "wav", argv[2])
|| out123_start(ao, rate, channels, encoding)
)
{
fprintf(stderr, "Cannot create / start output: %s\n"
, out123_strerror(ao));
cleanup(mh, ao);
return -1;
}
/* Buffer could be almost any size here, mpg123_outblock() is just some recommendation.
Important, especially for sndfile writing, is that the size is a multiple of sample size. */
buffer_size = mpg123_outblock( mh );
buffer = malloc( buffer_size );
do
{
err = mpg123_read( mh, buffer, buffer_size, &done );
out123_play(ao, buffer, done);
samples += done/sizeof(short);
/* We are not in feeder mode, so MPG123_OK, MPG123_ERR and MPG123_NEW_FORMAT are the only possibilities.
We do not handle a new format, MPG123_DONE is the end... so abort on anything not MPG123_OK. */
} while (done && err==MPG123_OK);
free(buffer);
if(err != MPG123_DONE)
fprintf( stderr, "Warning: Decoding ended prematurely because: %s\n",
err == MPG123_ERR ? mpg123_strerror(mh) : mpg123_plain_strerror(err) );
samples /= channels;
printf("%li samples written.\n", (long)samples);
cleanup(mh, ao);
free(iohandle);
return 0;
}

View File

@@ -0,0 +1,185 @@
/*
mpg123_to_wav_replaced_io.c
This is example code only sensible to be considered in the public domain.
Initially written by Nicholas Humfrey (moved to handle I/O by Thomas Orgis).
This example program demonstrates how to use libmpg123 to decode a file to WAV (writing via libout123), while doing the I/O (read and seek) with custom callback functions.
This should cater for any situation where you have some special means to get to the data (like, mmapped files / plain buffers in memory, funky network streams).
Disregarding format negotiations, the basic synopsis is:
mpg123_init()
mpg123_new()
mpg123_replace_reader_handle()
mpg123_open_handle()
mpg123_read()
mpg123_close()
mpg123_delete()
mpg123_exit()
*/
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <mpg123.h>
#include <out123.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifndef _MSC_VER
#include <unistd.h>
#else
#include <io.h>
#endif
#include <string.h>
void usage(const char *cmd)
{
printf("Usage: %s <input> <output>\n", cmd);
exit(99);
}
void cleanup(mpg123_handle *mh, out123_handle *ao)
{
out123_del(ao);
/* It's really to late for error checks here;-) */
mpg123_close(mh);
mpg123_delete(mh);
mpg123_exit();
}
/* Simple handle for you private I/O data. */
struct ioh { int fd; };
/* The callback functions; simple wrappers over standard I/O.
They could be anything you like... */
static mpg123_ssize_t read_cb(void *handle, void *buf, size_t sz)
{
mpg123_ssize_t ret;
struct ioh *h = handle;
errno = 0;
ret = read(h->fd, buf, sz);
if(ret < 0) fprintf(stderr, "read error: %s\n", strerror(errno));
return ret;
}
static off_t lseek_cb(void *handle, off_t offset, int whence)
{
off_t ret;
struct ioh *h = handle;
ret = lseek(h->fd, offset, whence);
if(ret < 0) fprintf(stderr, "seek error: %s\n", strerror(errno));
return ret;
}
/* The cleanup handler is called on mpg123_close(), it can cleanup your part of the mess... */
void cleanup_cb(void *handle)
{
struct ioh *h = handle;
close(h->fd);
h->fd = -1;
}
int main(int argc, char *argv[])
{
mpg123_handle *mh = NULL;
out123_handle *ao = NULL;
unsigned char* buffer = NULL;
size_t buffer_size = 0;
size_t done = 0;
int channels = 0, encoding = 0;
long rate = 0;
int err = MPG123_OK;
off_t samples = 0;
struct ioh *iohandle;
if (argc!=3) usage(argv[0]);
printf( "Input file: %s\n", argv[1]);
printf( "Output file: %s\n", argv[2]);
#if MPG123_API_VERSION < 46
// Newer versions of the library don't need that anymore, but it is safe
// to have the no-op call present for compatibility with old versions.
err = mpg123_init();
#endif
errno = 0;
iohandle = malloc(sizeof(struct ioh));
iohandle->fd = open(argv[1], O_RDONLY);
if(iohandle->fd < 0)
{
fprintf(stderr, "Cannot open input file (%s).\n", strerror(errno));
return -1;
}
if( err != MPG123_OK || (mh = mpg123_new(NULL, &err)) == NULL
/* Let mpg123 work with the file, that excludes MPG123_NEED_MORE messages. */
|| mpg123_replace_reader_handle(mh, read_cb, lseek_cb, cleanup_cb) != MPG123_OK
|| mpg123_open_handle(mh, iohandle) != MPG123_OK
/* Peek into track and get first output format. */
|| mpg123_getformat(mh, &rate, &channels, &encoding) != MPG123_OK )
{
fprintf( stderr, "Trouble with mpg123: %s\n",
mh==NULL ? mpg123_plain_strerror(err) : mpg123_strerror(mh) );
cleanup(mh, ao);
return -1;
}
if(encoding != MPG123_ENC_SIGNED_16)
{ /* Signed 16 is the default output format anyways; it would actually by only different if we forced it.
So this check is here just for this explanation. */
cleanup(mh, ao);
fprintf(stderr, "Bad encoding: 0x%x!\n", encoding);
return -2;
}
/* Ensure that this output format will not change (it could, when we allow it). */
mpg123_format_none(mh);
mpg123_format(mh, rate, channels, encoding);
printf("Creating 16bit WAV with %i channels and %liHz.\n", channels, rate);
if(
!(ao = out123_new())
|| out123_open(ao, "wav", argv[2])
|| out123_start(ao, rate, channels, encoding)
)
{
fprintf(stderr, "Cannot create / start output: %s\n"
, out123_strerror(ao));
cleanup(mh, ao);
return -1;
}
/* Buffer could be almost any size here, mpg123_outblock() is just some recommendation.
Important, especially for sndfile writing, is that the size is a multiple of sample size. */
buffer_size = mpg123_outblock( mh );
buffer = malloc( buffer_size );
do
{
err = mpg123_read( mh, buffer, buffer_size, &done );
out123_play(ao, buffer, done);
samples += done/sizeof(short);
/* We are not in feeder mode, so MPG123_OK, MPG123_ERR and MPG123_NEW_FORMAT are the only possibilities.
We do not handle a new format, MPG123_DONE is the end... so abort on anything not MPG123_OK. */
} while (done && err==MPG123_OK);
free(buffer);
if(err != MPG123_DONE)
fprintf( stderr, "Warning: Decoding ended prematurely because: %s\n",
err == MPG123_ERR ? mpg123_strerror(mh) : mpg123_plain_strerror(err) );
samples /= channels;
printf("%li samples written.\n", (long)samples);
cleanup(mh, ao);
free(iohandle);
return 0;
}

4
m4/libtool.m4 vendored
View File

@@ -1071,11 +1071,11 @@ _LT_EOF
# to the OS version, if on x86, and 10.4, the deployment
# target defaults to 10.4. Don't you love it?
case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
10.0,*86*-darwin8*|10.0,*-darwin[[912]]*)
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
10.[[012]][[,.]]*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
10.*)
10.*|11.*)
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
esac
;;

View File

@@ -1,643 +0,0 @@
.TH mpg123 1 "11 Jul 2022"
.SH NAME
mpg123 \- play audio MPEG 1.0/2.0/2.5 stream (layers 1, 2 and 3)
.SH SYNOPSIS
.B mpg123
[
.I options
]
.IR file-or-URL ...
.SH DESCRIPTION
.B mpg123
reads one or more
.IR file\^ s
(or standard input if ``\-'' is specified) or
.IR URL\^ s
and plays them on the audio device (default) or
outputs them to stdout.
.IR file\^ / URL
is assumed to be an MPEG audio bit stream.
.SH OPERANDS
The following operands are supported:
.TP 8
.IR file (s)
The path name(s) of one or more input files. They must be
valid MPEG-1.0/2.0/2.5 audio layer 1, 2 or 3 bit streams.
If a dash ``\-'' is specified, MPEG data will
be read from the standard input. Furthermore, any name
starting with ``http://'' or ``https://'' is recognized as
.I URL
(see next section), while a leading ``file://'' is being stripped for
normal local file access, for consistency (since mpg123 1.30.1).
.SH OPTIONS
.B mpg123
options may be either the traditional POSIX one letter options,
or the GNU style long options. POSIX style options start with a
single ``\-'', while GNU long options start with ``\-\^\-''.
Option arguments (if needed) follow separated by whitespace (not ``='').
Note that some options can be absent from your installation when disabled in the build process.
.SH INPUT OPTIONS
.TP
\fB\-k \fInum\fR, \fB\-\^\-skip \fInum
Skip first
.I num
frames. By default the decoding starts at the first frame.
.TP
\fB\-n \fInum\fR, \fB\-\^\-frames \fInum
Decode only
.I num
frames. By default the complete stream is decoded.
.TP
.BR \-\-fuzzy
Enable fuzzy seeks (guessing byte offsets or using approximate seek points from Xing TOC).
Without that, seeks need a first scan through the file before they can jump at positions.
You can decide here: sample-accurate operation with gapless features or faster (fuzzy) seeking.
.TP
.BR \-y ", " \-\^\-no\-resync
Do NOT try to resync and continue decoding if an error occurs in
the input file. Normally,
.B mpg123
tries to keep the playback alive at all costs, including skipping invalid material and searching new header when something goes wrong.
With this switch you can make it bail out on data errors
(and perhaps spare your ears a bad time). Note that this switch has been renamed from \-\-resync.
The old name still works, but is not advertised or recommended to use (subject to removal in future).
.TP
.BR \-F ", " \-\^\-no\-frankenstein
Disable support for Frankenstein streams. Normally, mpg123 stays true to the concept of MPEG audio being
just a concatenation of MPEG frames. It will continue decoding even if the type of MPEG frames varies
wildly. With this switch, it will only decode the input as long as it does not change its character
(from layer I to layer III, changing sampling rate, from mono to stereo), silently assuming end of
stream on such occasion. The switch also stops decoding of compatible MPEG frames if there was an
Info frame (Xing header, Lame tag) that contained a length of the track in MPEG frames.
This comes a bit closer to the notion of a MP3 file as a defined collection
of MPEG frames that belong together, but gets rid of the flexibility that can be fun at times but
mostly is hell for the programmer of the parser and decoder ...
.TP
\fB\-\^\-network \fI backend
Select network backend (helper program), choices are usually auto, wget, and curl.
Auto means to try the first available backend.
.TP
\fB\-\^-resync\-limit \fIbytes\fR
Set number of bytes to search for valid MPEG data once lost in stream; <0 means search whole stream.
If you know there are huge chunks of invalid data in your files... here is your hammer.
Note: Only since version 1.14 this also increases the amount of junk skipped on beginning.
.TP
\fB\-u \fIauth\fR, \fB\-\^\-auth \fIauth
HTTP authentication to use when receiving files via HTTP.
The format used is user:password. Mpg123 will clear this quickly, but it may still appear
in sight of other users or even just in your shell history. You may seek alternative ways
to specify that to your network backend.
.TP
\fB\-\^\-auth-file \fIauthfile
Provide the authentication info via given file instead of command line directly.
.TP
\fB\-\^\-ignore\-mime
Ignore MIME types given by HTTP server. If you know better and want mpg123
to decode something the server thinks is image/png, then just do it.
.TP
\fB\-\^\-no\-icy\-meta
Do not accept ICY meta data.
.TP
\fB\-\^-streamdump \fIfilename\fR
Dump a copy of the input data (as read by libmpg123) to the given file.
This enables you to store a web stream to disk while playing, or just create
a concatenation of the local files you play for ... why not?
.TP
\fB\-\^-icy\-interval \fIbytes\fR
This setting enables you to play a stream dump containing ICY metadata at the given
interval in bytes (the value of the icy-metaint HTTP response header). Without it,
such a stream will play, but will cause regular decoding glitches with resync.
.TP
\fB\-\^\-no\-seekbuffer
Disable the default micro-buffering of non-seekable streams that gives the
parser a safer footing.
.TP
\fB\-@ \fIfile\fR, \fB\-\^\-list \fIfile
Read filenames and/or URLs of MPEG audio streams from the specified
.I file
in addition to the ones specified on the command line (if any).
Note that
.I file
can be either an ordinary file, a dash ``\-'' to indicate that
a list of filenames/URLs is to be read from the standard input,
or an URL pointing to a an appropriate list file. Note: only
one
.B \-@
option can be used (if more than one is specified, only the
last one will be recognized). Furthermore, for HTTP resources, the
MIME type information will be used to re-open an actual MPEG stream as
such instead of treating it as playlist file. So you could just always
use
.B \-@
for web resources without bothering if it is a playlist or already the resolved
stream address.
.TP
\fB\-l \fIn\fR, \fB\-\^\-listentry \fIn
Of the playlist, play specified entry only.
.I n
is the number of entry starting at 1. A value of 0 is the default and means playing the whole list, a negative value means showing of the list of titles with their numbers...
.TP
\fB\-\^\-continue
Enable playlist continuation mode. This changes frame skipping to apply only to the first track and also continues to play following tracks in playlist after the selected one. Also, the option to play a number of frames only applies to the whole playlist. Basically, this tries to treat the playlist more like one big stream (like, an audio book).
The current track number in list (1-based) and frame number (0-based) are printed at exit (useful if you interrupted playback and want to continue later).
Note that the continuation info is printed to standard output unless the switch for piping audio data to standard out is used. Also, it really makes sense to work with actual playlist files instead of lists of file names as arguments, to keep track positions consistent.
.TP
\fB\-\-loop \fItimes\fR
for looping track(s) a certain number of times, < 0 means infinite loop (not with \-\-random!).
.TP
.BR \-\-keep\-open
For remote control mode: Keep loaded file open after reaching end.
.TP
\fB\-\-timeout \fIseconds\fR
Timeout in (integer) seconds before declaring a stream dead (if <= 0, wait forever).
.TP
.BR \-z ", " \-\^\-shuffle
Shuffle play. Randomly shuffles the order of files specified on the command
line, or in the list file.
.TP
.BR \-Z ", " \-\-random
Continuous random play. Keeps picking a random file from the command line
or the play list. Unlike shuffle play above, random play never ends, and
plays individual songs more than once.
.TP
\fB\-i, \-\^-index
Index / scan through the track before playback.
This fills the index table for seeking (if enabled in libmpg123) and may make the operating system cache the file contents for smoother operating on playback.
.TP
\fB\-\-index\-size \fIsize\fR
Set the number of entries in the seek frame index table.
.TP
\fB\-\-preframes \fInum\fR
Set the number of frames to be read as lead-in before a seeked-to position.
This serves to fill the layer 3 bit reservoir, which is needed to faithfully reproduce a certain sample at a certain position.
Note that for layer 3, a minimum of 1 is enforced (because of frame overlap), and for layer 1 and 2, this is limited to 2 (no bit reservoir in that case, but engine spin-up anyway).
.SH OUTPUT and PROCESSING OPTIONS
.TP
\fB\-o \fImodule\fR, \fB\-\^\-output \fImodule\fR
Select audio output module. You can provide a comma-separated list to use the first one that works.
Also see \fB\-a\fR.
.TP
\fB\-\^\-list\-modules
List the available modules.
.TP
\fB\-\^\-list\-devices
List the available output devices for given output module. If there is no functionality
to list devices in the chosen module, an error will be printed and mpg123 will exit with
a non-zero code.
.TP
\fB\-a \fIdev\fR, \fB\-\^\-audiodevice \fIdev
Specify the audio device to use. The default as well as the possible values
depend on the active output. For the JACK output, a comma-separated list
of ports to connect to (for each channel) can be specified.
.TP
.BR \-s ", " \-\^\-stdout
The decoded audio samples are written to standard output,
instead of playing them through the audio device. This
option must be used if your audio hardware is not supported
by
.BR mpg123 .
The output format per default is raw (headerless) linear PCM audio data,
16 bit, stereo, host byte order (you can force mono or 8bit).
.TP
\fB\-O \fIfile\fR, \fB\-\^\-outfile
Write raw output into a file (instead of simply redirecting standard output to a file with the shell).
.TP
\fB\-w \fIfile\fR, \fB\-\^\-wav
Write output as WAV file. This will cause the MPEG stream to be decoded
and saved as file
.I file
, or standard output if
.I -
is used as file name. You can also use
.I --au
and
.I --cdr
for AU and CDR format, respectively. Note that WAV/AU writing to non-seekable files, or redirected stdout, needs some thought. Since 1.16.0, the logic changed to writing the header with the first actual data. This avoids spurious WAV headers in a pipe, for example. The result of decoding nothing to WAV/AU is a file consisting just of the header when it is seekable and really nothing when not (not even a header). Correctly writing data with prophetic headers to stdout is no easy business.
.TP
\fB\-\^\-au \fIfile
Does not play the MPEG file but writes it to
.I file
in SUN audio format. If \- is used as the filename, the AU file is
written to stdout. See paragraph about WAV writing for header fun with non-seekable streams.
.TP
\fB\-\^\-cdr \fIfile
Does not play the MPEG file but writes it to
.I file
as a CDR file. If \- is used as the filename, the CDR file is written
to stdout.
.TP
.BR \-\-reopen
Forces reopen of the audiodevice after ever song
.TP
.BR \-\-cpu\ \fIdecoder\-type
Selects a certain decoder (optimized for specific CPU), for example i586 or MMX.
The list of available decoders can vary; depending on the build and what your CPU supports.
This option is only available when the build actually includes several optimized decoders.
.TP
.BR \-\-test\-cpu
Tests your CPU and prints a list of possible choices for \-\-cpu.
.TP
.BR \-\-list\-cpu
Lists all available decoder choices, regardless of support by your CPU.
.TP
\fB\-g \fIgain\fR, \fB\-\^\-gain \fIgain
[DEPRECATED] Set audio hardware output gain (default: don't change). The unit of the gain value is hardware and output module dependent.
(This parameter is only provided for backwards compatibility and may be removed in the future without prior notice. Use the audio player for playing and a mixer app for mixing, UNIX style!)
.TP
\fB\-f \fIfactor\fR, \fB\-\^\-scale \fIfactor
Change scale factor (default: 32768).
.TP
.BR \-\-rva-mix,\ \-\-rva-radio
Enable RVA (relative volume adjustment) using the values stored for ReplayGain radio mode / mix mode with all tracks roughly equal loudness.
The first valid information found in ID3V2 Tags (Comment named RVA or the RVA2 frame) or ReplayGain header in Lame/Info Tag is used.
.TP
.BR \-\-rva-album,\ \-\-rva-audiophile
Enable RVA (relative volume adjustment) using the values stored for ReplayGain audiophile mode / album mode with usually the effect of adjusting album loudness but keeping relative loudness inside album.
The first valid information found in ID3V2 Tags (Comment named RVA_ALBUM or the RVA2 frame) or ReplayGain header in Lame/Info Tag is used.
.TP
.BR \-0 ", " \-\^\-single0 "; " \-1 ", " \-\^\-single1
Decode only channel 0 (left) or channel 1 (right),
respectively. These options are available for
stereo MPEG streams only.
.TP
.BR \-m ", " \-\^\-mono ", " \-\^\-mix ", " \-\^\-singlemix
Mix both channels / decode mono. It takes less
CPU time than full stereo decoding.
.TP
.BR \-\-stereo
Force stereo output
.TP
\fB\-r \fIrate\fR, \fB\-\^\-rate \fIrate
Set sample rate (default: automatic). You may want to
change this if you need a constant bitrate independent of
the mpeg stream rate. mpg123 automagically converts the
rate. You should then combine this with \-\-stereo or \-\-mono.
.TP
\fB\-\^\-resample \fImethod
Set resampling method to employ if forcing an output rate. Choices (case-insensitive) are NtoM,
dirty, and fine. The fine resampler is the default. It employs libsyn123's low-latency fairly
efficient resampler to postprocess the output from libmpg123 instead of the fast but very crude
NtoM decoder (drop sample method) that mpg123 offers since decades. If you are really low on
CPU time, choose NtoM, as the resampler usually needs more time than the MPEG decoder itself.
The mpg123 program is smart enough to combine the 2to1 or 4to1 downsampling modes with the
postprocessing for extreme downsampling.
.TP
.BR \-2 ", " \-\^\-2to1 "; " \-4 ", " \-\^\-4to1
Performs a downsampling of ratio 2:1 (22 kHz from 44.1 kHz) or 4:1 (11 kHz)
on the output stream, respectively. Saves some CPU cycles, but of course throws away
the high frequencies, as the decoder does not bother producing them.
.TP
.BR \-\-pitch\ \fIvalue
Set a pitch change (speedup/down, 0 is neutral; 0.05 is 5% speedup). When not enforcing an
output rate, this changes the output sampling rate, so it only works in the range your audio
system/hardware supports. When you combine this with a fixed output rate, it modifies a
software resampling ratio instead.
.TP
.BR \-\-8bit
Forces 8bit output
.TP
\fB\-\^\-float
Forces f32 encoding
.TP
\fB\-e \fIenc\fR, \fB\-\^\-encoding \fIenc
Choose output sample encoding. Possible values look like f32 (32-bit floating point), s32 (32-bit signed integer), u32 (32-bit unsigned integer) and the variants with different numbers of bits (s24, u24, s16, u16, s8, u8) and also special variants like ulaw and alaw 8-bit.
See the output of mpg123's longhelp for actually available encodings.
.TP
\fB\-d \fIn\fR, \fB\-\^\-doublespeed \fIn
Only play every
.IR n 'th
frame. This will cause the MPEG stream
to be played
.I n
times faster, which can be used for special
effects. Can also be combined with the
.B \-\^\-halfspeed
option to play 3 out of 4 frames etc. Don't expect great
sound quality when using this option.
.TP
\fB\-h \fIn\fR, \fB\-\^\-halfspeed \fIn
Play each frame
.I n
times. This will cause the MPEG stream
to be played at
.IR 1 / n 'th
speed (n times slower), which can be
used for special effects. Can also be combined with the
.B \-\^\-doublespeed
option to double every third frame or things like that.
Don't expect great sound quality when using this option.
.TP
\fB\-E \fIfile\fR, \fB\-\^\-equalizer
Enables equalization, taken from
.IR file .
The file needs to contain 32 lines of data, additional comment lines may
be prefixed with
.IR # .
Each data line consists of two floating-point entries, separated by
whitespace. They specify the multipliers for left and right channel of
a certain frequency band, respectively. The first line corresponds to the
lowest, the 32nd to the highest frequency band.
Note that you can control the equalizer interactively with the generic control interface.
Also note that these are the 32 bands of the MPEG codec, not spaced like you
would see for a usual graphic equalizer. The upside is that there is zero computational
cost in addition to decoding. The downside is that you roughly have bass in band 0,
(upper) mids in band 1, treble in all others.
.TP
\fB\-\^\-gapless
Enable code that cuts (junk) samples at beginning and end of tracks, enabling gapless transitions between MPEG files when encoder padding and codec delays would prevent it.
This is enabled per default beginning with mpg123 version 1.0.0 .
.TP
\fB\-\^\-no\-gapless
Disable the gapless code. That gives you MP3 decodings that include encoder delay and padding plus mpg123's decoder delay.
.TP
\fB\-\^\-no\-infoframe
Do not parse the Xing/Lame/VBR/Info frame, decode it instead just like a stupid old MP3 hardware player.
This implies disabling of gapless playback as the necessary information is in said metadata frame.
.TP
\fB\-D \fIn\fR, \fB\-\-delay \fIn
Insert a delay of \fIn\fR seconds before each track.
.TP
.BR "\-o h" ", " \-\^\-headphones
Direct audio output to the headphone connector (some hardware only; AIX, HP, SUN).
.TP
.BR "\-o s" ", " \-\^\-speaker
Direct audio output to the speaker (some hardware only; AIX, HP, SUN).
.TP
.BR "\-o l" ", " \-\^\-lineout
Direct audio output to the line-out connector (some hardware only; AIX, HP, SUN).
.TP
\fB\-b \fIsize\fR, \fB\-\^\-buffer \fIsize
Use an audio output buffer of
.I size
Kbytes. This is useful to bypass short periods of heavy
system activity, which would normally cause the audio output
to be interrupted.
You should specify a buffer size of at least 1024
(i.e. 1 Mb, which equals about 6 seconds of audio data) or more;
less than about 300 does not make much sense. The default is 0,
which turns buffering off.
.TP
\fB\-\^\-preload \fIfraction
Wait for the buffer to be filled to
.I fraction
before starting playback (fraction between 0 and 1). You can tune this prebuffering to either get faster sound to your ears or safer uninterrupted web radio.
Default is 0.2 (wait for 20 % of buffer to be full, changed from 1 in version 1.23).
.TP
\fB\-\^\-devbuffer \fIseconds
Set device buffer in seconds; <= 0 means default value. This is the small buffer between the
application and the audio backend, possibly directly related to hardware buffers.
.TP
\fB\-\^\-smooth
Keep buffer over track boundaries -- meaning, do not empty the buffer between tracks for possibly some added smoothness.
.SH MISC OPTIONS
.TP
.BR \-t ", " \-\^\-test
Test mode. The audio stream is decoded, but no output occurs.
.TP
.BR \-c ", " \-\^\-check
Check for filter range violations (clipping), and report them for each frame
if any occur.
.TP
.BR \-v ", " \-\^\-verbose
Increase the verbosity level. For example, displays the frame
numbers during decoding.
.TP
.BR \-q ", " \-\^\-quiet
Quiet. Suppress diagnostic messages.
.TP
.BR \-C ", " \-\^\-control
Enable terminal control keys. This is enabled automatically if a terminal is detected.
By default use 's' or the space bar to stop/restart (pause, unpause) playback, 'f' to jump forward to the next song, 'b' to jump back to the
beginning of the song, ',' to rewind, '.' to fast forward, and 'q' to quit.
Type 'h' for a full list of available controls.
.TP
\fB\-\^\-no\-control
Disable terminal control even if terminal is detected.
.TP
\fB\-\^\-title
In an xterm, rxvt, screen, iris-ansi (compatible, TERM environment variable is examined), change the window's title to the name of song currently
playing.
.TP
\fB\-\^\-pauseloop \fIseconds
Set the length of the loop interval in terminal control paused mode, away from the default of 0.5 seconds, as a floating
point number.
.TP
\fB\-\^\-name \fIname
Set the name of this instance, possibly used in various places. This sets the client name for JACK output.
.TP
\fB\-\^\-long\-tag
Display ID3 tag info always in long format with one line per item (artist, title, ...)
.TP
.BR \-\-utf8
Regardless of environment, print metadata in UTF-8 (otherwise, when not using UTF-8 locale, you'll get ASCII stripdown).
.TP
.BR \-R ", " \-\^\-remote
Activate generic control interface.
.B mpg123
will then read and execute commands from stdin. Basic usage is ``load <filename> '' to play some file and the obvious ``pause'', ``command.
``jump <frame>'' will jump/seek to a given point (MPEG frame number).
Issue ``help'' to get a full list of commands and syntax.
.TP
.BR \-\^\-remote\-err
Print responses for generic control mode to standard error, not standard out.
This is automatically triggered when using \fB-s\fR.
.TP
\fB\-\-fifo \fIpath
Create a fifo / named pipe on the given path and use that for reading commands instead of standard input.
.TP
\fB\-\^\-aggressive
Tries to get higher priority
.TP
.BR \-T ", " \-\-realtime
Tries to gain realtime priority. This option usually requires root
privileges to have any effect.
.TP
.BR \-? ", " \-\^\-help
Shows short usage instructions.
.TP
.BR \-\^\-longhelp
Shows long usage instructions.
.TP
.BR \-\^\-version
Print the version string.
.SH HTTP SUPPORT
In addition to reading MPEG audio streams from ordinary
files and from the standard input,
.B mpg123
supports retrieval of MPEG audio streams or playlists via the HTTP protocol,
which is used in the World Wide Web (WWW). Such files are
specified using a so-called URL, which starts with http:// or https://.
When a file with that prefix is encountered,
.B mpg123
since 1.30.0 will by default call an external helper program (either
.BR wget (1)
or
.BR curl (1),
see the
.B \-\^\-network
option)
to retrieve the resource. You can configure access via a proxy
server using the standard environment variables those programs support. The
.BR \-\^\-proxy
option that
.B mpg123
before 1.30.0 used for its internal network code is gone
in the default build now and will probably disappear for good with 1.31.1.
.P
Note that, in order to play MPEG audio files from a WWW
server, it is necessary that the connection to that server
is fast enough. For example, a 128 kbit/s MPEG file
requires the network connection to be at least 128 kbit/s
(16 kbyte/s) plus protocol overhead. If you suffer from
short network outages, you should try the
.B \-b
option (buffer) to bypass such outages. If your network
connection is generally not fast enough to retrieve MPEG
audio files in realtime, you can first download the files
to your local harddisk (e.g. using
.BR wget (1))
and then play them from there.
.P
Streams with embedded ICY metadata are supported, the interval being communicated via HTTP
headers or \fB\-\^\-icy-interval\fR.
.SH INTERRUPT
When in terminal control mode, you can quit via pressing the q key,
while any time you can abort
.B mpg123
by pressing Ctrl-C. If not in terminal control mode, this will
skip to the next file (if any). If you want to abort playing immediately
in that case, press Ctrl-C twice in short succession (within about one second).
.P
Note that the result of quitting
.B mpg123
pressing Ctrl-C might not be audible
immediately, due to audio data buffering in the audio device.
This delay is system dependent, but it is usually not more
than one or two seconds.
.SH PLAYBACK STATUS LINE
In verbose mode, mpg123 updates a line with various information centering around
the current playback position. On any decent terminal, the line also works
as a progress bar in the current file by reversing video for a fraction of the
line according to the current position. An example for a full line is this:
> 0291+0955 00:01.68+00:28.22 [00:05.30] mix 100=085 192 kb/s 576 B acc 18 clip p+0.014
The information consists of, in order:
.TP
.BR >
single-character playback state (``>'' for playing, ``='' for pausing/looping, ``_'' for stopped)
.TP
.BR 0291+0955
current frame offset and number of remaining frames after the plus sign
.TP
.BR 00:01.68+00:28.22
current position from and remaining time in human terms
(hours, minutes, seconds)
.TP
.BR [00:05.30]
fill of the output buffer in terms of playback time, if the buffer is enabled
.TP
.BR mix
selected RVA mode (possible values: mix, alb (album), and \-\^\-\^\- (neutral, off))
.TP
.BR 100=085
set volume and the RVA-modified effective volume after the equal sign
.TP
.BR 192\ kb/s
current bitrate
.TP
.BR 576\ B
size of current frame in bytes
.TP
.BR acc
if positions are accurate, possible values are ``acc'' for accurate positions or ``fuz'' for fuzzy
(with guessed byte offsets using mean frame size)
.TP
.BR 18\ clip
amount of clipped samples, non-zero only if decoder reports that
(generic does, some optimized ones not)
.TP
.BR p+0.014
pitch change (increased/decreased playback sampling rate on user request)
.SH NOTES
MPEG audio decoding requires a good deal of CPU performance,
especially layer-3. To decode it in realtime, you should
have at least an i486DX4, Pentium, Alpha, SuperSparc or equivalent
processor. You can also use the
.B -m
option to decode mono only, which reduces the CPU load
somewhat for layer-3 streams. See also the
.BR \-2 " and " \-4
options.
.P
If everything else fails, have mpg123 decode to a file
and then use an appropriate utility to play that file with less CPU load.
Most probably you can configure mpg123 to produce a format suitable
for your audio device (see above about encodings and sampling rates).
.P
If your system is generally fast enough to decode in
realtime, but there are sometimes periods of heavy
system load (such as cronjobs, users logging in remotely,
starting of ``big'' programs etc.) causing the
audio output to be interrupted, then you should use
the
.B \-b
option to use a buffer of reasonable size (at least 1000 Kbytes).
.SH EXIT CODE
.P
Up to version 1.25.x, mpg123 always returned exit code 0 also for
complete junk on the input side. Fatal errors were only considered
for output. With version 1.26.0, this changed to the behaviour
described below.
.P
When not using the remote control interface (which returns input
errors as text messages), the process exit code is zero (success)
only if all tracks in a playlist had at least one frame parsed,
even if it did not decode cleanly, or
are empty, MPEG-wise (perhaps only metadata, or really an empty file).
When you decode nothing, nothing is the result and that is fine. When
a track later aborts because of parser errors or breakdown of the
network communication, this is treated as end of a track, but does
not make the process as such fail. One really bad (or non-existing)
stream in the playlist results in a non-zero error code, consistent
with other UNIX tools.
.P
An error in audio output results in the process ending with a
non-zero exit code immediately, regardless of how much data has
been successfully played before. The forgiveness is only on the
input side.
.SH BUGS
.P
Mostly MPEG-1 layer 2 and 3 are tested in real life.
Please report any issues and provide test files to help fixing them.
.P
No CRC error checking is performed. But the decoder is built and tested
to behave nicely with damaged streams. Mostly, damaged frames will just be
silent.
.P
Some platforms lack audio hardware support; you may be able to use the
.B -s
switch to feed the decoded data to a program that can play it on your audio device.
.SH AUTHORS
.TP
Maintainer:
.br
Thomas Orgis <maintainer@mpg123.org>, <thomas@orgis.org>
.TP
Original Creator:
.br
Michael Hipp
.PP
Uses code or ideas from various people, see the AUTHORS file accompanying the source code.
.SH LICENSE
.B mpg123
is licensed under the GNU Lesser/Library General Public License, LGPL, version 2.1 .
.SH WEBSITE
http://www.mpg123.org
.br
http://sourceforge.net/projects/mpg123

View File

@@ -1,335 +0,0 @@
.TH out123 1 "26 Apr 2020"
.SH NAME
out123 \- send raw PCM audio or a waveform pattern to an output device
.SH SYNOPSIS
\fBcat \fRaudio.raw \fR| \fBout123 \fR[ \fR- \fR] [ \fIoptions \fR ]
\fBout123 \fR[ \fIoptions \fR] \fIfilename \fR[ \fIfilename \fR... ]
\fBout123 \fR--wave-freq \fIfreq1\fR[,\fIfreq2\fR,...] [ \fIoptions \fR]
\fBout123 \fR--source \fRgeiger \fR[ \fIoptions \fR]
.SH DESCRIPTION
.B out123
reads raw PCM data (in host byte order) from standard input
and plays it on the audio device specified by given options.
Alternatively, it can generate periodic or random signals for playback
itself.
.SH OPTIONS
.B out123
options may be either the traditional POSIX one letter options,
or the GNU style long options. POSIX style options start with a
single '\-', while GNU long options start with '\-\^\-'.
Option arguments (if needed) follow separated by whitespace (not '=').
Note that some options can be absent from your installation when disabled in the build process.
.TP
\fB\-\^\-name \fIname
Set the name of this instance, possibly used in various places. This sets the client name for JACK output.
.TP
\fB\-o \fImodule\fR, \-\^\-\fBoutput \fImodule\fR
Select audio output module. You can provide a comma-separated list to use the first one that works.
Also see \fB\-a\fR.
.TP
\fB\-\^\-list\-modules
List the available modules.
.TP
\fB\-\^\-list\-devices
List the available output devices for given output module. If there is no functionality
to list devices in the chosen module, an error will be printed and out123 will exit with
a non-zero code.
.TP
\fB\-a \fIdev\fR, \fB\-\^\-audiodevice \fIdev
Specify the audio device to use. The default as well as the possible values
depend on the active output. For the JACK output, a comma-separated list
of ports to connect to (for each channel) can be specified.
.TP
.BR \-s ", " \-\^\-stdout
The audio samples are written to standard output,
instead of playing them through the audio device.
The output format is the same as the input ... so in this mode,
.B out123
acts similar the standard tool \fB cat\fR, possibly with some conversions
involved.
This shortcut is equivalent to '-o raw -a -'.
.TP
.BR \-S ", " \-\^\-STDOUT
This variant additionally writes the data to stdout, while still
playing it on the output device. So it is more like some flavour of
\fBtee\fR than a \fBcat\fR.
.TP
\fB\-O \fIfile\fR, \fB\-\^\-outfile
Write raw output into a file (instead of simply redirecting standard output to a file with the shell).
This shortcut is equivalent to '-o raw -a \fIfile\fR'.
.TP
\fB\-w \fIfile\fR, \fB\-\^\-wav
Write output as WAV file
.I file
, or standard output if
.I -
is or the empty string used as file name. You can also use
.I --au
and
.I --cdr
for AU and CDR format, respectively. Note that WAV/AU writing to non-seekable files or redirected stdout needs some thought. The header is written with the first actual data. The result of decoding nothing to WAV/AU is a file consisting just of the header when it is seekable and really nothing when not (not even a header). Correctly writing data with prophetic headers to stdout is no easy business.
This shortcut is equivalent to '-o wav -a \fIfile\fR'.
.TP
\fB\-\^\-au \fIfile
Write to
.I file
in SUN audio format. If \- or the empty string is used as the filename, the AU file is
written to stdout. See paragraph about WAV writing for header fun with non-seekable streams.
This shortcut is equivalent to '-o au -a \fIfile\fR'.
.TP
\fB\-\^\-cdr \fIfile
Write to
.I file
as a CDR (CD-ROM audio, more correctly CDDA for Compact Disc Digital Audio).
If \- is or the empty string used as the filename, the CDR file is written
to stdout.
This shortcut is equivalent to '-o cdr -a \fIfile\fR'.
.TP
\fB\-r \fIrate\fR, \fB\-\^\-rate \fIrate
Set sample rate in Hz (default: 44100). If this does not match the actual input
sampling rate, you get changed pitch. Might be intentional;-)
.TP
\fB\-R \fIrate\fR, \fB\-\^\-inputrate \fIrate
Set input sample rate to a different value. This triggers resampling if the output
rate is indeed different. See \fB\-\^\-resample\fR.
.TP
\fB\-\^\-speed \fIfactor
Speed up/down playback by that factor using resampling. See \fB\-\^\-resample\fR.
.TP
\fB\-\^\-resample \fImethod
This chooses the method for resampling between differing sampling rates or to apply
a change in tempo. You can choose between two variants of the syn123 resampler: fine
(the default) and dirty. The fine one features 108 dB dynamic range and at worst-case 84%
bandwidth. The dirty one uses a bit less CPU time (not that much, though) by reducing
the dynamic range to 72 dB with worst-case bandwidth of 85%. The exact properties vary
with the sampling rate ratio, as there is interpolation of filter coefficients involved.
.TP
\fB\-c \fIcount\fR, \fB\-\^\-channels \fIcount
Set channel count to given value.
.TP
\fB\-C \fIcount\fR, \fB\-\^\-inputch \fIcount
Set input channel count to a differnt value than for output. This probably means you want
some remixing. Also see \fB\-\^\-mix\fR.
.TP
\fB\-e \fIenc\fR, \fB\-\^\-encoding \fIenc
Choose output sample encoding. Possible values look like f32 (32-bit floating point), s32 (32-bit signed integer), u32 (32-bit unsigned integer) and the variants with different numbers of bits (s24, u24, s16, u16, s8, u8) and also special variants like ulaw and alaw 8-bit.
See the output of \fBout123\fR's longhelp for actually available encodings.
Default is s16.
.TP
\fB\-\^\-endian \fIchoice
Select output endianess (byte order). Choice is big, little, or native, which is the default.
The processing can only work in native mode, so you need to specify input or output byte order
if that does not match your machine. This also sets the input endianess if that is
not set separately. See also \fB\-\^\-inputend\fR and \fB\-\^\-byteswap\fR.
.TP
\fB\-E \fIenc\fR, \fB\-\^\-inputenc \fIenc
Specify input encoding different from output encoding for conversion.
.TP
\fB\-\^\-inputend \fIchoice
Select input endianess (byte order). By default it is the same as output byte order.
See \fB\-\^\-endian\fR.
.TP
.BR \-\^\-byteswap
A switch to trigger swapping of byte order just before output, after any other transformations.
This works on top of any endianess you specify with
.TP
.BR \-m ", " \-\^\-mono "
Set for single-channel audio (default is two channels, stereo).
.TP
.BR \-\-stereo
Select stereo output (2 channels, default).
.TP
.BR \-\^\-list\-encodings
List known encoding short and long names to standard output.
.TP
\fB\-\^\-mix \fImatrix
Specify a mixing matrix between input and output channels as linear factors, comma separated list for
the input channel factors for output channel 1, then output channel 2, and so forth.
The default is a unit matrix if channel counts match, so for 3 channels the equivalent of
'\-\^\-mix 1,0,0,0,1,0,0,0,1'. For stereo to mono conversion, the default is mixing of
both channels with halved amplitude, so '\-\^\-mix 0.5,0.5'. For splitting mono to stereo,
it is '\-\^\-mix 1,1' top keep the symmetry.
.TP
\fB\-\^\-filter \fIcoeff
Apply digital filter(s) before pre-amplification (see \fB\-\^\-preamp\fR) with the coefficient
list coeff as
.ce
b_0,...,b_N,a_0,...,a_N
where a_0=1 is mandatory and perhaps helps orientation a bit. Multiple filters are separated
by ':'.
.TP
\fB\-P \fIdbvalue \fB\-\^\-preamp \fIdbvalue
Enable a pre-amplification stage that amplifies the signal with the given value in dB before output.
.TP
\fB\-\^\-offset \fIvalue
Apply a PCM offset (floating point value scaled in [-1:1] in the pre-amplification stage.
Normally, you would do that to correct a known DC offset in a recording.
.TP
\fB\-\^\-clip \fImode
Select clipping mode: 'soft' or 'hard' for forced clipping also for
floating point output, 'implicit' (default) for implied hard clipping during
conversion where necessary.
.TP
\fB\-\^\-dither
Enable dithering for conversions to integer. If you insist.
This is just some un-spectacular TPDF dither. For some people, that is not fancy enough.
Most people cannot be bothered that way or the other.
.TP
.BR \-\^\-test\-format
Check if given format is supported by given driver and device (in command line before
encountering this), silently returning 0 as exit value if it is the case.
.TP
.BR \-\^\-test\-encodings
Print out the short names of encodings supported with the current setup.
.TP
.BR \-\^\-query\-format
If the selected driver and device communicate some default accepted format, print
out a command line fragment for \fBout123\fR setting that format, always in that order:
\-\^\-rate <r> -\^\-channels <c> -\^\-encoding <e>
.TP
.BR "\-o h" ", " \-\^\-headphones
Direct audio output to the headphone connector (some hardware only; AIX, HP, SUN).
.TP
.BR "\-o s" ", " \-\^\-speaker
Direct audio output to the speaker (some hardware only; AIX, HP, SUN).
.TP
.BR "\-o l" ", " \-\^\-lineout
Direct audio output to the line-out connector (some hardware only; AIX, HP, SUN).
.TP
\fB\-b \fIsize\fR, \fB\-\^\-buffer \fIsize
Use an audio output buffer of
.I size
Kbytes. This is useful to bypass short periods of heavy
system activity, which would normally cause the audio output
to be interrupted.
You should specify a buffer size of at least 1024
(i.e. 1 Mb, which equals about 6 seconds of usual audio data) or more;
less than about 300 does not make much sense. The default is 0,
which turns buffering off.
.TP
\fB\-\^\-preload \fIfraction
Wait for the buffer to be filled to
.I fraction
before starting playback (fraction between 0 and 1). You can tune this prebuffering to either get sound faster to your ears or safer uninterrupted web radio.
Default is 0.2 (changed from 1 since version 1.23).
.TP
\fB\-\^\-devbuffer \fIseconds
Set device buffer in seconds; <= 0 means default value. This is the small buffer between the
application and the audio backend, possibly directly related to hardware buffers.
.TP
\fB\-\^\-timelimit \fIsamples
Set playback time limit in PCM samples if set to a value greater than zero.
\fBout123\fR will stop reading from stdin or playing from the generated wave
table after reaching that number of samples.
.TP
\fB\-\^\-seconds \fIseconds
Set time limit in seconds instead.
.TP
\fB\-\^\-source \fIname
Choose the signal source: 'file' (default) for playback of the given file(s) on the command line
or standard input if there are none, or one of the generators 'wave' (see \fB\-\^\-wave\-freq\fR),
'sweep' (see \fB\-\^\-wave\-sweep\fR), 'pink' (see \fB\-\^\-ping\-rows\fR),
geiger (see \fB\-\^\-geiger\-activity\fR), or just 'white' for some white noise.
.TP
\fB\-\^\-wave\-freq \fIfrequencies
Set wave generator frequency or list of those with comma separation for enabling
a generated test signal instead of standard input. Empty values repeat the
previous one.
.TP
\fB\-\^\-wave\-pat \fIpatterns
Set the waveform patterns of the generated waves as comma-separated list.
Choices include sine, square, triangle, sawtooth, gauss, pulse, and shot.
Empty values repeat the previous one.
.TP
\fB\-\^\-wave\-phase \fIphases
Set waveform phase shift(s) as comma-separated list, negative values
inverting the pattern in time and empty value repeating the previous. There is
also \fB\-\^\-wave\-direction\fR overriding the negative bit.
.TP
\fB\-\^\-wave\-direction\fR
Set wave direction explicitly (the sign counts).
.TP
\fB\-\^\-wave\-sweep \fIfrequency
Sweep a generated wave to the given frequency, from
first one specified for \fB\-\^\-wave\-freq\fR, using the
first wave pattern and direction, too.
.TP
\fB\-\^\-sweep\-time \fIseconds
Set frequency sweep duration in seconds if > 0. This defaults
to the configured time limit if set, otherwise one second, as endless
sweeps are not sensible.
.TP
\fB\-\^\-sweep\-count \fIcount
Set timelimit to exactly produce that many (smooth) sweeps
.TP
\fB\-\^\-sweep\-type \fItype
Set sweep type: lin(ear) for linear, qua(d) (default) for quadratic, or exp(onential)
for an exponential change of frequency with time.
.TP
\fB\-\^\-sweep\-hard
Disable post-sweep smoothing for periodicity.
.TP
\fB\-\^\-genbuffer \fIbytes
Set the buffer size (limit) for signal generators,
if > 0 (default), this enforces a periodic
buffer also for non-periodic signals, benefit:
less runtime CPU overhead, as everything is precomputed as enforced periodic signal.
.TP
\fB\-\^\-wave\-limit \fIsamples
This is an alias for \fB\-\^\-genbuffer\fR.
.TP
\fB\-\^\-pink\-rows \fInumber
Activate pink noise source and choose rows for the algorithm (<1 chooses default).
The generator follows code provided by Phil Burk (http://softsynth.com) and uses
the Gardner method.
.TP
\fB\-\^\-geiger\-activity \fInumber
This configures the simulation of a Geiger-Mueller counter as source, with the given
numer as average events per second. Play with it. It's fun!
.TP
.BR \-t ", " \-\^\-test
Test mode. The audio stream is read, but no output occurs.
.TP
.BR \-v ", " \-\^\-verbose
Increase the verbosity level.
.TP
.BR \-q ", " \-\^\-quiet
Quiet. Suppress diagnostic messages.
.TP
\fB\-\^\-aggressive
Tries to get higher priority
.TP
.BR \-T ", " \-\-realtime
Tries to gain realtime priority. This option usually requires root
privileges to have any effect.
.TP
.BR \-? ", " \-\^\-help
Shows short usage instructions.
.TP
.BR \-\^\-longhelp
Shows long usage instructions.
.TP
.BR \-\^\-version
Print the version string.
.SH AUTHORS
.TP
Maintainer:
.br
Thomas Orgis <maintainer@mpg123.org>, <thomas@orgis.org>
.TP
Creator (ancestry of code inside mpg123):
.br
Michael Hipp
.TP
Uses code or ideas from various people, see the AUTHORS file accompanying the source code.
.SH LICENSE
.B out123
is licensed under the GNU Lesser/Library General Public License, LGPL, version 2.1 .
.SH WEBSITE
http://www.mpg123.org
.br
http://sourceforge.net/projects/mpg123

View File

@@ -3,7 +3,7 @@
# - devel packages for alsa, sdl, etc... to build the respective output modules.
Summary: The fast console mpeg audio decoder/player.
Name: mpg123
Version: 1.31.3
Version: 1.32.0
Release: 1
URL: http://www.mpg123.org/
License: GPL

View File

@@ -13,5 +13,7 @@ it to work with minimal fuzz.
- cmake: CMake build to get started on non-Unix-like platforms, especially
for just libmpg123 on Windows
- Sony PSP: Sony_PSP/; building libmpg123 for the PSP (used for the MODO player).
...by Bastian Pflieger <wb@illogical.de>
There used to be other ports, last of those for the Sony PSP. There was not
much porting involved on that one, though, just a custom Makefile for building
a generic libmpg123.

View File

@@ -1,38 +0,0 @@
PSPSDK = $(shell psp-config --pspsdk-path)
PSPDIR = $(shell psp-config --psp-prefix)
#DEFINES := PSP OPT_GENERIC REAL_IS_FIXED HAVE_CONFIG_H
DEFINES := PSP OPT_GENERIC REAL_IS_FLOAT HAVE_CONFIG_H
#DEFINES := PSP OPT_GENERIC FLOATOUT REAL_IS_FLOAT HAVE_CONFIG_H
DEFINEFLAGS := $(addprefix -D,$(DEFINES))
INCDIR := ../.
CFLAGS = -g -O2 -Wall -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math $(DEFINEFLAGS)
MPG123_OBJS = compat.o parse.o frame.o format.o index.o synth.o synth_8bit.o \
ntom.o icy2utf8.o synth_real.o synth_s32.o\
equalizer.o icy.o id3.o layer1.o layer2.o layer3.o optimize.o readers.o tabinit.o stringbuf.o libmpg123.o dct64.o
MPG123_LIB_FILE = ./libmpg123.a
OBJS = $(MPG123_OBJS)
TARGET_LIB = $(MPG123_LIB_FILE)
include $(PSPSDK)/lib/build.mak
####################
## Makefile rules ##
####################
install: $(MPG123_LIB_FILE)
@echo ""
@echo "**********************************************************************"
@echo "Installing libstsound into $(PSPDIR)"
@mkdir -p $(PSPDIR)/include $(PSPDIR)/lib
@cp -v mpg123.h $(PSPDIR)/include
@cp -v libmpg123.a $(PSPDIR)/lib
@echo "Done"
@echo "**********************************************************************"
@echo ""

View File

@@ -1,11 +0,0 @@
Hi
* Place Makefile.psp in the directory src/libmpg123.
* Patch readers.c (present in src/libmpg123) using readers.c.patch
* Place Config.h in directory src/
* cd to src/libmpg123 and do "make -f Makefile.psp install"
Tested on mpg123 1.4.x and psptoolchain rev. 2398
Regards
Bastian

View File

@@ -1,368 +0,0 @@
/* src/config.h. Generated from config.h.in by configure. */
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* Define if your architecture wants/needs/can use attribute_align_arg and
alignment checks. It's for 32bit x86... */
#define ABI_ALIGN_FUN 1
/* Define to use proper rounding. */
/* #undef ACCURATE_ROUNDING */
/* Define if .align takes 3 for alignment of 2^3=8 bytes instead of 8. */
/* #undef ASMALIGN_EXP */
/* Define if __attribute__((aligned(16))) shall be used */
/* #undef CCALIGN */
/* Define if checking of stack alignment is wanted. */
#define CHECK_ALIGN 1
/* Define if debugging is enabled. */
/* #undef DEBUG */
/* The default audio output module(s) to use */
#define DEFAULT_OUTPUT_MODULE "alsa,oss,esd,sdl,nas,arts"
/* Define if building with dynamcally linked libmpg123 */
#define DYNAMIC_BUILD 1
/* Define if FIFO support is enabled. */
#define FIFO 1
/* Define if frame index should be used. */
#define FRAME_INDEX 1
/* Define if gapless is enabled. */
#define GAPLESS 1
/* Define to 1 if you have the <Alib.h> header file. */
/* #undef HAVE_ALIB_H */
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <asm/audioio.h> header file. */
/* #undef HAVE_ASM_AUDIOIO_H */
/* Define to 1 if you have the `atoll' function. */
#define HAVE_ATOLL 1
/* Define to 1 if you have the <audios.h> header file. */
/* #undef HAVE_AUDIOS_H */
/* Define to 1 if you have the <AudioToolbox/AudioToolbox.h> header file. */
/* #undef HAVE_AUDIOTOOLBOX_AUDIOTOOLBOX_H */
/* Define to 1 if you have the <AudioUnit/AudioUnit.h> header file. */
/* #undef HAVE_AUDIOUNIT_AUDIOUNIT_H */
/* Define to 1 if you have the <CoreServices/CoreServices.h> header file. */
/* #undef HAVE_CORESERVICES_CORESERVICES_H */
/* Define to 1 if you have the <CUlib.h> header file. */
/* #undef HAVE_CULIB_H */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `getaddrinfo' function. */
#define HAVE_GETADDRINFO 1
/* Define to 1 if you have the `getpagesize' function. */
#define HAVE_GETPAGESIZE 1
/* Define to 1 if you have the `getuid' function. */
#define HAVE_GETUID 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <langinfo.h> header file. */
#define HAVE_LANGINFO_H 1
/* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1
/* Define to 1 if you have the `mx' library (-lmx). */
/* #undef HAVE_LIBMX */
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the <linux/soundcard.h> header file. */
#define HAVE_LINUX_SOUNDCARD_H 1
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define if libltdl is available */
#define HAVE_LTDL 1
/* Define to 1 if you have the <machine/soundcard.h> header file. */
/* #undef HAVE_MACHINE_SOUNDCARD_H */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mkfifo' function. */
#define HAVE_MKFIFO 1
/* Define to 1 if you have a working `mmap' system call. */
#define HAVE_MMAP 1
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <netinet/tcp.h> header file. */
/* #undef HAVE_NETINET_TCP_H */
/* Define to 1 if you have the `nl_langinfo' function. */
#define HAVE_NL_LANGINFO 1
/* Define to 1 if you have the <os2me.h> header file. */
/* #undef HAVE_OS2ME_H */
/* Define to 1 if you have the <os2.h> header file. */
/* #undef HAVE_OS2_H */
/* Define to 1 if you have the `random' function. */
#define HAVE_RANDOM 1
/* Define to 1 if you have the <sched.h> header file. */
#define HAVE_SCHED_H 1
/* Define to 1 if you have the `sched_setscheduler' function. */
#define HAVE_SCHED_SETSCHEDULER 1
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
/* Define to 1 if you have the `setpriority' function. */
#define HAVE_SETPRIORITY 1
/* Define to 1 if you have the `setuid' function. */
#define HAVE_SETUID 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the <sndio.h> header file. */
/* #undef HAVE_SNDIO_H */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sun/audioio.h> header file. */
/* #undef HAVE_SUN_AUDIOIO_H */
/* Define to 1 if you have the <sys/audioio.h> header file. */
/* #undef HAVE_SYS_AUDIOIO_H */
/* Define to 1 if you have the <sys/audio.h> header file. */
/* #undef HAVE_SYS_AUDIO_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/signal.h> header file. */
#define HAVE_SYS_SIGNAL_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/soundcard.h> header file. */
#define HAVE_SYS_SOUNDCARD_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
/* Define this if you have the POSIX termios library */
#define HAVE_TERMIOS 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <windows.h> header file. */
/* #undef HAVE_WINDOWS_H */
/* Define to indicate that float storage follows IEEE754. */
#define IEEE_FLOAT 1
/* size of the frame index seek table */
#define INDEX_SIZE 1000
/* Define if IPV6 support is enabled. */
#define IPV6 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Define if network support is enabled. */
/* #define NETWORK 1 */
/* Define to disable 16 bit integer output. */
/* #undef NO_16BIT */
/* Define to disable 32 bit integer output. */
/* define NO_32BIT 1 */
/* Define to disable 8 bit integer output. */
/* #undef NO_8BIT */
/* Define to disable downsampled decoding. */
/* #undef NO_DOWNSAMPLE */
/* Define to disable error messages in combination with a return value (the
return is left intact). */
/* #undef NO_ERETURN */
/* Define to disable error messages. */
/* #undef NO_ERRORMSG */
/* Define to disable feeder and buffered readers. */
/* #undef NO_FEEDER */
/* Define to disable ICY handling. */
/* #undef NO_ICY */
/* Define to disable ID3v2 parsing. */
/* #undef NO_ID3V2 */
/* Define to disable layer I. */
/* #undef NO_LAYER1 */
/* Define to disable layer II. */
/* #undef NO_LAYER2 */
/* Define to disable layer III. */
/* #undef NO_LAYER3 */
/* Define to disable ntom resampling. */
/* #undef NO_NTOM */
/* Define to disable real output. */
/* define NO_REAL 1 */
/* Define to disable string functions. */
/* #undef NO_STRING */
/* Define to disable warning messages. */
/* #undef NO_WARNING */
/* Name of package */
#define PACKAGE "mpg123"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "mpg123-devel@lists.sourceforge.net"
/* Define to the full name of this package. */
#define PACKAGE_NAME "mpg123"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "mpg123 1.8rc5"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "mpg123"
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.8rc5"
/* Define if portaudio v18 API is wanted. */
/* #undef PORTAUDIO18 */
/* The size of `int32_t', as computed by sizeof. */
#define SIZEOF_INT32_T 4
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 4
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
/* The size of `ssize_t', as computed by sizeof. */
#define SIZEOF_SSIZE_T 4
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if modules are enabled */
#define USE_MODULES 1
/* Version number of package */
#define VERSION "1.8rc5"
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to `short' if <sys/types.h> does not define. */
/* #undef int16_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef int32_t */
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to `unsigned long' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to `long' if <sys/types.h> does not define. */
/* #undef ssize_t */
/* Define to `unsigned short' if <sys/types.h> does not define. */
/* #undef uint16_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef uint32_t */

View File

@@ -1,2 +0,0 @@
14a15
> #include <sys/fd_set.h>

View File

@@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 3.12)
include(cmake/read_api_version.cmake)
read_api_version(MPG123_VERSION API_VERSION OUTAPI_VERSION SYNAPI_VERSION)
read_api_version(MPG123_VERSION)
project(mpg123 VERSION ${MPG123_VERSION} LANGUAGES C ASM)
option(BUILD_LIBOUT123 "build libout123" ON)
option(BUILD_LIBOUT123 "build libout123 (prerequisite for included programs)" ON)
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(WARNING "Output module is not implemented for '${CMAKE_SYSTEM_NAME}' platform.")
message(WARNING "To prevent build errors 'BUILD_LIBOUT123' option is set to OFF.")

View File

@@ -1,17 +1,18 @@
function(read_api_version project_version api_version outapi_version synapi_version )
function(read_api_version project_version)
file( READ "${CMAKE_CURRENT_SOURCE_DIR}/../../configure.ac" configure_ac )
file( READ "${CMAKE_CURRENT_SOURCE_DIR}/../../src/version.h" version_h )
string( REGEX MATCH "AC_INIT\\(\\[mpg123\\], \\[([0-9\\.]+)" result ${configure_ac} )
set( ${project_version} ${CMAKE_MATCH_1} PARENT_SCOPE )
string( REGEX MATCH "#define +MPG123_MAJOR +([0-9]+)" result ${version_h} )
set( major_version ${CMAKE_MATCH_1})
string( REGEX MATCH "#define +MPG123_MINOR +([0-9]+)" result ${version_h} )
set( minor_version ${CMAKE_MATCH_1})
string( REGEX MATCH "API_VERSION=([0-9]+)" result ${configure_ac} )
set( ${api_version} ${CMAKE_MATCH_1} PARENT_SCOPE )
string( REGEX MATCH "#define +MPG123_PATCH +([0-9]+)" result ${version_h} )
set( patch_version ${CMAKE_MATCH_1})
string( REGEX MATCH "OUTAPI_VERSION=([0-9]+)" result ${configure_ac} )
set( ${outapi_version} ${CMAKE_MATCH_1} PARENT_SCOPE )
string( REGEX MATCH "SYNAPI_VERSION=([0-9]+)" result ${configure_ac} )
set( ${synapi_version} ${CMAKE_MATCH_1} PARENT_SCOPE )
# string( REGEX MATCH "#define +MPG123_SUFFIX +\"([^\"]+)\"" result ${version_h} )
# set( version_suffix ${CMAKE_MATCH_1})
# CMake project() chokes on version with suffix, so give it just the numbers.
set( ${project_version} ${major_version}.${minor_version}.${patch_version} PARENT_SCOPE)
endfunction()

View File

@@ -8,6 +8,8 @@ include(CheckSymbolExists)
include(CMakeDependentOption)
include(TestBigEndian)
option(PORTABLE_API "Only build portable library API (no off_t, no internal I/O." OFF)
check_include_file("arpa/inet.h" HAVE_ARPA_INET_H)
check_include_file("dirent.h" HAVE_DIRENT_H)
check_include_file("dlfcn.h" HAVE_DLFCN_H)
@@ -54,15 +56,32 @@ check_function_exists(random HAVE_RANDOM)
check_function_exists(setenv HAVE_SETENV)
check_function_exists(unsetenv HAVE_UNSETENV)
check_function_exists(setlocale HAVE_SETLOCALE)
check_function_exists(uselocale HAVE_USELOCALE)
check_function_exists(setpriority HAVE_SETPRIORITY)
check_function_exists(shmget HAVE_SHMGET)
check_function_exists(shmat HAVE_SHMAT)
check_function_exists(shmdt HAVE_SHMDT)
check_function_exists(shmctl HAVE_SHMCTL)
check_function_exists(strerror HAVE_STRERROR)
check_function_exists(strerror_l HAVE_STRERROR_L)
check_function_exists(fork HAVE_FORK)
check_function_exists(execvp HAVE_EXECVP)
check_function_exists(ctermid HAVE_CTERMID)
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
check_function_exists(lseek64 LFS_LARGEFILE_64)
if(LFS_LARGEFILE_64)
check_c_source_compiles(
" #define _LARGEFILE64_SOURCE
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
int fd = open(\"/foo\", O_RDONLY|O_LARGEFILE);
" HAVE_O_LARGEFILE)
endif()
search_libs(gethostbyname GETHOSTBYNAME_LIB nsl socket network)
search_libs(socket SOCKET_LIB socket)
@@ -83,26 +102,6 @@ check_c_source_compiles(
"int main() { __attribute__((aligned(16))) float var; return 0; }"
CCALIGN)
if(MSVC)
# Here, off_t is always 32 bit, the whole machinery doesn't work without explicit
# API for 64 bit file access.
unset(_FILE_OFFSET_BITS)
set(LFS_SENSITIVE OFF)
set(LFS_INSENSITIVE ON)
set(MPG123_LARGE_FILE_SUPPORT OFF)
# We disable all the dynamic naming with MSVC to avoid confusing consumers.
# Maybe it would be more proper to conditionit on LFS_INSENSTIIVE.
set(BUILD_NO_LARGENAME 1)
else()
option(MPG123_LARGE_FILE_SUPPORT "Support large files (define _FILE_OFFSET_BITS)" ON)
if(MPG123_LARGE_FILE_SUPPORT)
set(_FILE_OFFSET_BITS 64)
else()
unset(_FILE_OFFSET_BITS)
endif()
set(BUILD_NO_LARGENAME 0)
endif()
if(NOT LFS_INSENSITIVE)
check_c_source_compiles("
#include <sys/types.h>
@@ -132,17 +131,6 @@ if(NOT LFS_INSENSITIVE)
endif()
check_type_size(long SIZEOF_LONG)
check_type_size(off_t SIZEOF_OFF_T)
if(LFS_SENSITIVE)
set(LFS_ALIAS_TYPE long)
math(EXPR LFS_ALIAS_BITS "${SIZEOF_LONG} * 8")
elseif(CMAKE_ANDROID_ARCH_ABI)
check_type_size(off64_t SIZEOF_OFF64_T)
set(LFS_ALIAS_TYPE off64_t)
math(EXPR LFS_ALIAS_BITS "${SIZEOF_OFF64_T} * 8")
else()
set(LFS_ALIAS_TYPE off_t)
math(EXPR LFS_ALIAS_BITS "${SIZEOF_OFF_T} * 8")
endif()
if(WIN32 AND HAVE_WINDOWS_H)
check_c_source_compiles("
@@ -330,13 +318,6 @@ cmake_dependent_option(NO_BUFFER "enable audio buffer code (default uses system
option(NO_DOWNSAMPLE "no downsampled decoding" OFF)
option(NO_EQUALIZER "no equalizer support" OFF)
option(NO_FEEDER "no feeder decoding, no buffered readers" OFF)
if(CYGWIN)
option(NO_LFS_ALIAS "disable alias wrappers for largefile bitness (mpg123_seek_32 or mpg123_seek_64 in addition to mpg123_seek, or the other way around; It is a mess, do not play with this!)" ON)
elseif(MSVC)
set(NO_LFS_ALIAS ON)
else()
option(NO_LFS_ALIAS "disable alias wrappers for largefile bitness (mpg123_seek_32 or mpg123_seek_64 in addition to mpg123_seek, or the other way around; It is a mess, do not play with this!)" OFF)
endif()
option(NO_ICY "ICY metainfo parsing/conversion" OFF)
option(NO_LAYER1 "no layer I decoding" OFF)
option(NO_LAYER2 "no layer II decoding" OFF)
@@ -359,6 +340,8 @@ include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/../../../src/"
"${CMAKE_CURRENT_BINARY_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../src/compat"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../src/libsyn123"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../src/libout123"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../src/libmpg123")
add_compile_definitions(
@@ -376,8 +359,8 @@ if(BUILD_LIBOUT123)
endif()
add_subdirectory("libsyn123")
if(UNIX)
option(BUILD_PROGRAMS "Build programs" ON)
if(UNIX AND NOT PORTABLE_API)
option(BUILD_PROGRAMS "Build programs (mpg123 executable and others)" ON)
if(BUILD_PROGRAMS)

View File

@@ -1,3 +1,6 @@
// Define to only include portable API in libraries.
#cmakedefine PORTABLE_API 1
// Define to use proper rounding.
#cmakedefine ACCURATE_ROUNDING 1
@@ -36,12 +39,18 @@
#cmakedefine HAVE_RANDOM 1
#cmakedefine HAVE_SCHED_H 1
#cmakedefine HAVE_SETLOCALE 1
#cmakedefine HAVE_USELOCALE 1
#cmakedefine HAVE_SETPRIORITY 1
#cmakedefine HAVE_SIGNAL_H 1
#cmakedefine HAVE_STDIO_H 1
#cmakedefine HAVE_STDINT_H 1
#cmakedefine HAVE_STDLIB_H 1
#cmakedefine HAVE_STRERROR 1
#cmakedefine HAVE_STRERROR_L 1
#cmakedefine HAVE_FORK 1
#cmakedefine HAVE_EXECVP 1
#cmakedefine HAVE_CTERMID 1
#cmakedefine HAVE_CLOCK_GETTIME 1
#cmakedefine HAVE_STRING_H 1
#cmakedefine HAVE_STRINGS_H 1
#cmakedefine HAVE_SYS_IOCTL_H 1
@@ -67,7 +76,6 @@
// Define if IPV6 support is enabled.
#cmakedefine IPV6 1
#define LFS_ALIAS_BITS @LFS_ALIAS_BITS@
#define LT_MODULE_EXT "@CMAKE_SHARED_MODULE_SUFFIX@"
// Define if network support is enabled.
@@ -140,8 +148,10 @@
#define PKGLIBDIR "@CMAKE_INSTALL_LIBDIR@/@PROJECT_NAME@"
#define SIZEOF_LONG @SIZEOF_LONG@
#define SIZEOF_OFF_T @SIZEOF_OFF_T@
// CMake leaves it emtpy for non-existing type. Autoconf sets it to 0.
#define SIZEOF_LONG (@SIZEOF_LONG@+0)
#define SIZEOF_OFF_T (@SIZEOF_OFF_T@+0)
#define SIZEOF_OFF64_T (@SIZEOF_OFF64_T@+0)
#cmakedefine STDERR_FILENO @STDERR_FILENO@
#cmakedefine STDIN_FILENO @STDIN_FILENO@
@@ -158,7 +168,7 @@
// Define to use Unicode for Windows
#cmakedefine WANT_WIN32_UNICODE 1
#if WANT_WIN32_UNICODE == 1
#ifdef WANT_WIN32_UNICODE
# define strcasecmp _stricmp
# define strncasecmp _strnicmp
#endif
@@ -168,8 +178,9 @@
#cmakedefine WORDS_BIGENDIAN 1
// Number of bits in a file offset, on hosts where this is settable.
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
// Define to the native offset type (long or actually off_t).
#define lfs_alias_t @LFS_ALIAS_TYPE@
#cmakedefine LFS_LARGEFILE_64 1
#cmakedefine LFS_SENSITIVE 1
#cmakedefine HAVE_O_LARGEFILE 1
#ifndef HAVE_O_LARGEFILE
#define O_LARGEFILE 0
#endif

View File

@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.12)
option(NO_FEATURE_REPORT "Disable feature report function" OFF)
option(NO_LFS_ALIAS "disable alias wrappers for largefile bitness (mpg123_seek_32 or mpg123_seek_64 in addition to mpg123_seek, or the other way around; It is a mess, do not play with this!)" OFF)
include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/")
@@ -40,8 +39,6 @@ else()
endif()
message(STATUS "Detected machine: ${MACHINE}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/mpg123.h.in" mpg123.h)
set(TARGET lib${PROJECT_NAME})
add_library(${TARGET}
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/parse.c"
@@ -60,7 +57,6 @@ add_library(${TARGET}
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<NOT:$<BOOL:${NO_LAYER1}>>:layer1.c>"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<NOT:$<OR:$<BOOL:${NO_LAYER1}>,$<BOOL:${NO_LAYER2}>>>:layer2.c>"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<NOT:$<BOOL:${NO_LAYER3}>>:layer3.c>"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<NOT:$<BOOL:${NO_LFS_ALIAS}>>:lfs_alias.c>"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<NOT:$<BOOL:${NO_NTOM}>>:ntom.c>"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<NOT:$<BOOL:${NO_8BIT}>>:synth_8bit.c>"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<NOT:$<BOOL:${NO_16BIT}>>:synth.c>"
@@ -68,7 +64,7 @@ add_library(${TARGET}
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<AND:$<BOOL:${HAVE_FPU}>,$<NOT:$<BOOL:${NO_REAL}>>>:synth_real.c>"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<NOT:$<BOOL:${NO_STRING}>>:stringbuf.c>"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<NOT:$<BOOL:${NO_FEATURE_REPORT}>>:feature.c>"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<BOOL:${LFS_SENSITIVE}>:lfs_wrap.c>"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<NOT:$<BOOL:${PORTABLE_API}>>:lfs_wrap.c>"
$<TARGET_OBJECTS:compat>)
if(MSVC)
@@ -252,7 +248,7 @@ install(TARGETS ${TARGET} EXPORT targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mpg123.h"
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/mpg123.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/fmt123.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")

View File

@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.12)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libout123/out123.h.in" out123.h)
include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libout123/")
add_subdirectory("modules")
@@ -33,5 +31,5 @@ install(TARGETS ${TARGET} EXPORT targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/out123.h"
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libout123/out123.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")

View File

@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.12)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libsyn123/syn123.h.in" syn123.h)
include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/libsyn123/")
set(TARGET libsyn123)
@@ -28,5 +26,5 @@ install(TARGETS ${TARGET} EXPORT targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/syn123.h"
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libsyn123/syn123.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")

View File

@@ -2,15 +2,23 @@
include src/tests/Makemodule.am
include src/compat/Makemodule.am
include src/libmpg123/Makemodule.am
if NEED_LIB
include src/libout123/Makemodule.am
if NEED_MAINLIB
include src/libmpg123/Makemodule.am
include src/libsyn123/Makemodule.am
endif
endif
if BUILD_PROGRAMS
bin_PROGRAMS += src/out123
if HAVE_LFS_WRAP
bin_PROGRAMS += \
src/mpg123 \
src/out123 \
src/mpg123-id3dump \
src/mpg123-strip
endif
endif
src_mpg123_LDADD = \
src/compat/libcompat.la \
@@ -30,7 +38,7 @@ src_out123_LDADD = \
src_out123_LDFLAGS = @EXEC_LT_LDFLAGS@
EXTRA_DIST += \
src/intsym.h \
src/version.h \
src/mpg123-with-modules \
src/out123-with-modules

View File

@@ -20,9 +20,12 @@
#include "debug.h"
int stopped = 0;
int paused = 0;
enum player_state playstate = STATE_PLAYING;
const char playsym[STATE_COUNT] = { '>', '_', '=', '?' };
int muted = 0;
// On LFS conversion trouble with large files, print_stat() gets disabled.
// Some heuristic re-enables it (when you print headers).
static int print_stat_disabled = FALSE;
const char* rva_name[3] = { "off", "mix", "album" };
static const char* rva_statname[3] = { "---", "mix", "alb" };
@@ -60,6 +63,7 @@ void print_remote_header(mpg123_handle *mh)
i.bitrate,
i.flags & MPG123_PRIVATE ? 1 : 0,
i.vbr);
print_stat_disabled=FALSE;
}
void print_header(mpg123_handle *mh)
@@ -89,6 +93,7 @@ void print_header(mpg123_handle *mh)
default: fprintf(stderr, "???");
}
fprintf(stderr, " Extension value: %d\n", i.flags & MPG123_PRIVATE ? 1 : 0);
print_stat_disabled=FALSE;
}
void print_header_compact(mpg123_handle *mh)
@@ -111,6 +116,7 @@ void print_header_compact(mpg123_handle *mh)
default: fprintf(stderr, "???");
}
fprintf(stderr," %ld %s\n", i.rate, smodes[i.mode]);
print_stat_disabled=FALSE;
}
unsigned int roundui(double val)
@@ -159,6 +165,64 @@ void print_buf(const char* prefix, out123_handle *ao)
, prefix, times[0], times[1], timesep, times[2] );
}
// This is a massively complicated function just for telling where we are.
// Blame buffering. Blame format conversion. Blame the universe.
int position_info( mpg123_handle *fr, off_t offset, out123_handle *ao
, off_t *frame, off_t *frame_remain
, double *seconds, double *seconds_remain, double *seconds_buffered, double *seconds_total )
{
size_t buffered;
off_t decoded;
double elapsed;
double remain;
double length;
off_t frameo;
off_t frames;
off_t rframes;
int framesize;
int spf;
long inrate;
long rate;
if(mpg123_getformat(fr, &inrate, NULL, NULL) || inrate < 1)
return -1;
if(out123_getformat(ao, &rate, NULL, NULL, &framesize) || rate < 1 || framesize < 1)
return -1;
buffered = out123_buffered(ao)/framesize;
decoded = mpg123_tell(fr);
length = (double)mpg123_length(fr)/inrate;
frameo = mpg123_tellframe(fr);
frames = mpg123_framelength(fr);
spf = mpg123_spf(fr);
if(decoded < 0 || length < 0 || frameo < 0 || frames <= 0 || spf <= 0)
{
merror("Failed to gather position data: %s", mpg123_strerror(fr));
return -1;
}
frameo += offset;
if(frameo < 0)
frameo = 0;
/* Some sensible logic around offsets and time.
Buffering makes the relationships between the numbers non-trivial. */
rframes = frames-frameo;
// May be negative, a countdown. Buffer only confuses in paused (looping) mode, though.
elapsed = (double)(decoded + offset*spf)/inrate - (double)(playstate==STATE_LOOPING ? 0 : buffered)/rate;
remain = elapsed > 0 ? length - elapsed : length;
if(frame)
*frame = frameo;
if(frame_remain)
*frame_remain = rframes;
if(seconds)
*seconds = elapsed;
if(seconds_remain)
*seconds_remain = remain;
if(seconds_buffered)
*seconds_buffered = (double)buffered/rate;
if(seconds_total)
*seconds_total = length;
return 0;
}
/* Note about position info with buffering:
@@ -168,20 +232,16 @@ void print_buf(const char* prefix, out123_handle *ao)
void print_stat(mpg123_handle *fr, long offset, out123_handle *ao, int draw_bar
, struct parameter *param)
{
if(print_stat_disabled)
return;
static int old_term_width = -1;
size_t buffered;
off_t decoded;
double basevol, realvol;
double elapsed;
double remain;
double bufsec;
double length;
off_t frame;
off_t frames;
off_t rframes;
int spf;
double basevol, realvol;
long inrate;
long rate;
int framesize;
struct mpg123_frameinfo mi;
char linebuf[256];
char *line = NULL;
@@ -205,28 +265,12 @@ void print_stat(mpg123_handle *fr, long offset, out123_handle *ao, int draw_bar
#endif
#endif
#endif
if(mpg123_getformat(fr, &inrate, NULL, NULL))
if(position_info(fr, offset, ao, &frame, &rframes, &elapsed, &remain, &bufsec, &length))
{
debug("position_info() failed");
print_stat_disabled=TRUE;
return;
if(out123_getformat(ao, &rate, NULL, NULL, &framesize))
return;
buffered = out123_buffered(ao)/framesize;
decoded = mpg123_tell(fr);
length = (double)mpg123_length(fr)/inrate;
frame = mpg123_tellframe(fr);
frames = mpg123_framelength(fr);
spf = mpg123_spf(fr);
if(decoded < 0 || length < 0 || frame < 0 || frames <= 0 || spf <= 0)
return;
/* Apply offset. */
frame += offset;
if(frame < 0)
frame = 0;
/* Some sensible logic around offsets and time.
Buffering makes the relationships between the numbers non-trivial. */
rframes = frames-frame;
// May be negative, a countdown. Buffer only confuses in paused (looping) mode, though.
elapsed = (double)(decoded + offset*spf)/inrate - (double)(paused ? 0 : buffered)/rate;
remain = elapsed > 0 ? length - elapsed : length;
}
if( MPG123_OK == mpg123_info(fr, &mi)
&& MPG123_OK == mpg123_getvolume(fr, &basevol, &realvol, NULL) )
{
@@ -268,7 +312,7 @@ void print_stat(mpg123_handle *fr, long offset, out123_handle *ao, int draw_bar
tim[0] = elapsed;
tim[1] = remain;
tim[2] = (double)buffered/rate;
tim[2] = bufsec;
for(ti=0; ti<3; ++ti)
{
if(tim[ti] < 0.){ sign[ti] = '-'; tim[ti] = -tim[ti]; }
@@ -276,7 +320,7 @@ void print_stat(mpg123_handle *fr, long offset, out123_handle *ao, int draw_bar
}
/* Taking pains to properly size the frame number fields. */
len = snprintf( framefmt, sizeof(framefmt)
, "%%0%d"OFF_P, (int)log10(frames)+1 );
, "%%0%d"OFF_P, (int)log10(frame+rframes)+1 );
if(len < 0 || len >= sizeof(framefmt))
memcpy(framefmt, "%05"OFF_P, sizeof("%05"OFF_P));
snprintf( framestr[0], sizeof(framestr[0])-1, framefmt, (off_p)frame);
@@ -288,7 +332,7 @@ void print_stat(mpg123_handle *fr, long offset, out123_handle *ao, int draw_bar
/* Start with position info. */
len = snprintf( line, linelen
, "%c %s+%s %c%02lu:%02lu%c%02lu+%02lu:%02lu%c%02lu"
, stopped ? '_' : (paused ? '=' : '>')
, playsym[playstate]
, framestr[0], framestr[1]
, sign[0]
, times[0][0], times[0][1], timesep[0], times[0][2]

View File

@@ -1,7 +1,7 @@
/*
common: anything can happen here... frame reading, output, messages
copyright ?-2020 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright ?-2022 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Michael Hipp
*/
@@ -12,8 +12,13 @@
#include "mpg123app.h"
#include "out123.h"
extern int stopped;
extern int paused;
enum player_state
{
STATE_PLAYING=0
, STATE_STOPPED, STATE_LOOPING, STATE_AB
, STATE_COUNT
};
extern enum player_state playstate;
extern int muted;
void print_header(mpg123_handle *);
@@ -22,6 +27,9 @@ void print_stat(mpg123_handle *fr, long offset, out123_handle *ao, int draw_bar
, struct parameter *param);
void print_buf(const char* prefix, out123_handle *ao);
void clear_stat();
// input: decoder and output handle, frame offset
// output: frames, frames_remain, seconds, seconds_remain, seconds_buffered, seconds_total
int position_info( mpg123_handle *, off_t, out123_handle *, off_t *, off_t *, double *, double *, double *, double *);
/* for control_generic */
extern const char* remote_header_help;
void print_remote_header(mpg123_handle *mh);

View File

@@ -4,7 +4,7 @@
The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX.
So anything possibly somewhat advanced should be considered to be put here, with proper #ifdef;-)
copyright 2007-2020 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis, Windows Unicode stuff by JonY.
*/
@@ -43,23 +43,23 @@
#ifndef WINDOWS_UWP
char *compat_getenv(const char* name)
char *INT123_compat_getenv(const char* name)
{
char *ret = NULL;
#ifdef WANT_WIN32_UNICODE
wchar_t *env;
wchar_t *wname = NULL;
if(win32_utf8_wide(name, &wname, NULL) > 0)
if(INT123_win32_utf8_wide(name, &wname, NULL) > 0)
{
env = _wgetenv(wname);
free(wname);
if(env)
win32_wide_utf8(env, &ret, NULL);
INT123_win32_wide_utf8(env, &ret, NULL);
}
#else
ret = getenv(name);
if(ret)
ret = compat_strdup(ret);
ret = INT123_compat_strdup(ret);
#endif
return ret;
}
@@ -69,7 +69,7 @@ char *compat_getenv(const char* name)
#include "wpathconv.h"
/* Always add a default permission mask in case of flags|O_CREAT. */
int compat_open(const char *filename, int flags)
int INT123_compat_open(const char *filename, int flags)
{
int ret;
#if defined (WANT_WIN32_UNICODE)
@@ -105,8 +105,8 @@ open_ok:
}
/* Moved over from wav.c, logic with fallbacks added from the
example of compat_open(). */
FILE* compat_fopen(const char *filename, const char *mode)
example of INT123_compat_open(). */
FILE* INT123_compat_fopen(const char *filename, const char *mode)
{
FILE* stream = NULL;
#ifdef WANT_WIN32_UNICODE
@@ -117,7 +117,7 @@ FILE* compat_fopen(const char *filename, const char *mode)
wname = u2wlongpath(filename);
if(!wname)
goto fopen_fallback;
cnt = win32_utf8_wide(mode, &wmode, NULL);
cnt = INT123_win32_utf8_wide(mode, &wmode, NULL);
if( (wmode == NULL) || (cnt == 0))
goto fopen_fallback;
@@ -136,12 +136,12 @@ fopen_ok:
return stream;
}
FILE* compat_fdopen(int fd, const char *mode)
FILE* INT123_compat_fdopen(int fd, const char *mode)
{
return fdopen(fd, mode);
}
int compat_close(int infd)
int INT123_compat_close(int infd)
{
#if (defined(WIN32) && !defined (__CYGWIN__)) /* MSDN says POSIX function is deprecated beginning in Visual C++ 2005 */
return _close(infd);
@@ -150,12 +150,12 @@ int compat_close(int infd)
#endif
}
int compat_fclose(FILE *stream)
int INT123_compat_fclose(FILE *stream)
{
return fclose(stream);
}
void compat_binmode(int fd, int enable)
void INT123_compat_binmode(int fd, int enable)
{
#if defined(HAVE__SETMODE)
_setmode(fd, enable ? _O_BINARY : _O_TEXT);
@@ -183,7 +183,7 @@ void compat_binmode(int fd, int enable)
typedef HRESULT (__stdcall *PCA_ptr)( const wchar_t *, const wchar_t*, unsigned long, wchar_t **);
#endif
char* compat_catpath(const char *prefix, const char* path)
char* INT123_compat_catpath(const char *prefix, const char* path)
{
char *ret = NULL;
#ifdef WANT_WIN32_UNICODE
@@ -253,7 +253,7 @@ catpath_end:
return ret;
}
int compat_isdir(const char *path)
int INT123_compat_isdir(const char *path)
{
int ret = 0;
#ifdef WANT_WIN32_UNICODE
@@ -289,7 +289,7 @@ struct compat_dir
#endif
};
struct compat_dir* compat_diropen(char *path)
struct compat_dir* INT123_compat_diropen(char *path)
{
struct compat_dir *cd;
if(!path)
@@ -302,7 +302,7 @@ struct compat_dir* compat_diropen(char *path)
{
char *pattern;
wchar_t *wpattern;
pattern = compat_catpath(path, "*");
pattern = INT123_compat_catpath(path, "*");
wpattern = u2wlongpath(pattern);
if(wpattern)
{
@@ -329,17 +329,17 @@ struct compat_dir* compat_diropen(char *path)
#endif
if(cd)
{
cd->path = compat_strdup(path);
cd->path = INT123_compat_strdup(path);
if(!cd->path)
{
compat_dirclose(cd);
INT123_compat_dirclose(cd);
cd = NULL;
}
}
return cd;
}
void compat_dirclose(struct compat_dir *cd)
void INT123_compat_dirclose(struct compat_dir *cd)
{
if(cd)
{
@@ -353,7 +353,7 @@ void compat_dirclose(struct compat_dir *cd)
}
}
char* compat_nextfile(struct compat_dir *cd)
char* INT123_compat_nextfile(struct compat_dir *cd)
{
if(!cd)
return NULL;
@@ -364,7 +364,7 @@ char* compat_nextfile(struct compat_dir *cd)
if(!(cd->d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
char *ret;
win32_wide_utf8(cd->d.cFileName, &ret, NULL);
INT123_win32_wide_utf8(cd->d.cFileName, &ret, NULL);
return ret;
}
}
@@ -374,11 +374,11 @@ char* compat_nextfile(struct compat_dir *cd)
while((dp = readdir(cd->dir)))
{
struct stat fst;
char *fullpath = compat_catpath(cd->path, dp->d_name);
char *fullpath = INT123_compat_catpath(cd->path, dp->d_name);
if(fullpath && !stat(fullpath, &fst) && S_ISREG(fst.st_mode))
{
free(fullpath);
return compat_strdup(dp->d_name);
return INT123_compat_strdup(dp->d_name);
}
free(fullpath);
}
@@ -387,7 +387,7 @@ char* compat_nextfile(struct compat_dir *cd)
return NULL;
}
char* compat_nextdir(struct compat_dir *cd)
char* INT123_compat_nextdir(struct compat_dir *cd)
{
if(!cd)
return NULL;
@@ -398,7 +398,7 @@ char* compat_nextdir(struct compat_dir *cd)
if(cd->d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
char *ret;
win32_wide_utf8(cd->d.cFileName, &ret, NULL);
INT123_win32_wide_utf8(cd->d.cFileName, &ret, NULL);
return ret;
}
}
@@ -408,11 +408,11 @@ char* compat_nextdir(struct compat_dir *cd)
while((dp = readdir(cd->dir)))
{
struct stat fst;
char *fullpath = compat_catpath(cd->path, dp->d_name);
char *fullpath = INT123_compat_catpath(cd->path, dp->d_name);
if(fullpath && !stat(fullpath, &fst) && S_ISDIR(fst.st_mode))
{
free(fullpath);
return compat_strdup(dp->d_name);
return INT123_compat_strdup(dp->d_name);
}
free(fullpath);
}
@@ -438,14 +438,14 @@ char* compat_nextdir(struct compat_dir *cd)
// because of a serious reason (maybe EOF, maybe out of disk space). You
// can inspect errno.
size_t unintr_write(int fd, void const *buffer, size_t bytes)
size_t INT123_unintr_write(int fd, void const *buffer, size_t bytes)
{
size_t written = 0;
errno = 0;
while(bytes)
{
errno = 0;
ssize_t part = write(fd, (char*)buffer+written, bytes);
ptrdiff_t part = write(fd, (char*)buffer+written, bytes);
// Just on short writes, we do not abort. Only when
// there was no successful operation (even zero write) at all.
// Any other error than EINTR ends things here.
@@ -466,14 +466,14 @@ size_t unintr_write(int fd, void const *buffer, size_t bytes)
}
/* Same for reading the data. */
size_t unintr_read(int fd, void *buffer, size_t bytes)
size_t INT123_unintr_read(int fd, void *buffer, size_t bytes)
{
size_t got = 0;
errno = 0;
while(bytes)
{
errno = 0;
ssize_t part = read(fd, (char*)buffer+got, bytes);
ptrdiff_t part = read(fd, (char*)buffer+got, bytes);
if(part > 0) // == 0 is end of file
{
bytes -= part;
@@ -489,7 +489,7 @@ size_t unintr_read(int fd, void *buffer, size_t bytes)
}
// and again for streams
size_t unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
size_t INT123_unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
{
size_t written = 0;
errno = 0;
@@ -509,7 +509,7 @@ size_t unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
#ifndef NO_CATCHSIGNAL
#if (!defined(WIN32) || defined (__CYGWIN__)) && defined(HAVE_SIGNAL_H)
void (*catchsignal(int signum, void(*handler)()))()
void (*INT123_catchsignal(int signum, void(*handler)()))()
{
struct sigaction new_sa;
struct sigaction old_sa;

View File

@@ -6,7 +6,7 @@
It is envisioned to include this compat header instead of any of the "standard" headers, to catch compatibility issues.
So, don't include stdlib.h or string.h ... include compat.h.
copyright 2007-21 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-23 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
@@ -26,6 +26,8 @@
#include <stdlib.h>
#endif
#include <stddef.h>
#include <stdio.h>
#include <math.h>
@@ -63,15 +65,34 @@
#ifndef SSIZE_MAX
#define SSIZE_MAX ((size_t)-1/2)
#endif
#ifndef PTRDIFF_MAX
#define PTRDIFF_MAX SSIZE_MAX
#endif
#ifndef ULONG_MAX
#define ULONG_MAX ((unsigned long)-1)
#endif
#ifndef INT64_MAX
#define INT64_MAX 9223372036854775807LL
#endif
#ifndef INT64_MIN
#define INT64_MIN (-INT64_MAX - 1)
#endif
#ifndef INT32_MAX
#define INT32_MAX 2147483647L
#endif
#ifndef INT32_MIN
#define INT32_MIN (-INT32_MAX - 1)
#endif
#ifndef OFF_MAX
#undef OFF_MIN
#if SIZEOF_OFF_T == 4
#define OFF_MAX ((uint32_t)-1/2)
#define OFF_MAX INT32_MAX
#define OFF_MIN INT32_MIN
#elif SIZEOF_OFF_T == 8
#define OFF_MAX ((uint64_t)-1/2)
#define OFF_MAX INT64_MAX
#define OFF_MIN INT64_MIN
#else
#error "Unexpected width of off_t."
#endif
@@ -79,6 +100,7 @@
// Add two values (themselves assumed to be < limit), saturating to given limit.
#define SATURATE_ADD(inout, add, limit) inout = (limit-add >= inout) ? inout+add : limit;
#define SATURATE_SUB(inout, sub, limit) inout = (limit+sub >= inout) ? inout-sub : limit;
#ifdef HAVE_STRING_H
#include <string.h>
@@ -99,7 +121,7 @@
#include <sys/select.h>
#endif
/* compat_open makes little sense without */
/* INT123_compat_open makes little sense without */
#include <fcntl.h>
/* To parse big numbers... */
@@ -112,34 +134,21 @@
typedef unsigned char byte;
#if defined(_MSC_VER)
// For _setmode(), at least.
#include <io.h>
#if !defined(MPG123_DEF_SSIZE_T)
#define MPG123_DEF_SSIZE_T
#include <stddef.h>
typedef ptrdiff_t ssize_t;
#endif
#endif
// Not too early, leave system headers alone (strerror).
#include "intsym.h"
/* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */
void *safe_realloc(void *ptr, size_t size);
void *INT123_safe_realloc(void *ptr, size_t size);
// Also freeing ptr if result is NULL. You can do
// ptr = safer_realloc(ptr, size)
// Also, ptr = safer_realloc(ptr, 0) will do free(ptr); ptr=NULL;.
void *safer_realloc(void *ptr, size_t size);
#ifndef HAVE_STRERROR
const char *strerror(int errnum);
#endif
// ptr = INT123_safer_realloc(ptr, size)
// Also, ptr = INT123_safer_realloc(ptr, 0) will do free(ptr); ptr=NULL;.
void *INT123_safer_realloc(void *ptr, size_t size);
const char *INT123_strerror(int errnum);
/* Roll our own strdup() that does not depend on libc feature test macros
and returns NULL on NULL input instead of crashing. */
char* compat_strdup(const char *s);
char* INT123_compat_strdup(const char *s);
/* If we have the size checks enabled, try to derive some sane printfs.
Simple start: Use max integer type and format if long is not big enough.
@@ -152,25 +161,21 @@ typedef intmax_t off_p;
typedef long off_p;
#endif
#if (defined SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > SIZEOF_LONG) && (defined PRIuMAX)
#if (defined SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > SIZEOF_LONG) && (defined PRIuMAX) && (defined PRIiMAX)
# define SIZE_P PRIuMAX
typedef uintmax_t size_p;
# define SSIZE_P PRIiMAX
typedef intmax_t ssize_p;
#else
# define SIZE_P "lu"
typedef unsigned long size_p;
#endif
#if (defined SIZEOF_SSIZE_T) && (SIZEOF_SSIZE_T > SIZEOF_LONG) && (defined PRIiMAX)
# define SSIZE_P PRIuMAX
typedef intmax_t ssize_p;
#else
# define SSIZE_P "li"
# define SSIZE_P "ld"
typedef long ssize_p;
#endif
/* Get an environment variable, possibly converted to UTF-8 from wide string.
The return value is a copy that you shall free. */
char *compat_getenv(const char* name);
char *INT123_compat_getenv(const char* name);
/**
* Opening a file handle can be different.
@@ -179,12 +184,12 @@ char *compat_getenv(const char* name);
* @param[in] mbptr Pointer to multibyte string.
* @return file descriptor (>=0) or error code.
*/
int compat_open(const char *filename, int flags);
FILE* compat_fopen(const char *filename, const char *mode);
int INT123_compat_open(const char *filename, int flags);
FILE* INT123_compat_fopen(const char *filename, const char *mode);
/**
* Also fdopen to avoid having to define POSIX macros in various source files.
*/
FILE* compat_fdopen(int fd, const char *mode);
FILE* INT123_compat_fdopen(int fd, const char *mode);
/**
* Closing a file handle can be platform specific.
@@ -192,8 +197,8 @@ FILE* compat_fdopen(int fd, const char *mode);
* @param[in] infd File descriptor to be closed.
* @return 0 if the file was successfully closed. A return value of -1 indicates an error.
*/
int compat_close(int infd);
int compat_fclose(FILE* stream);
int INT123_compat_close(int infd);
int INT123_compat_fclose(FILE* stream);
/**
@@ -201,7 +206,7 @@ int compat_fclose(FILE* stream);
* We do not bother with errors. This has to work.
* You can enable or disable binary mode.
*/
void compat_binmode(int fd, int enable);
void INT123_compat_binmode(int fd, int enable);
/* Those do make sense in a separate file, but I chose to include them in compat.c because that's the one source whose object is shared between mpg123 and libmpg123 -- and both need the functionality internally. */
@@ -217,7 +222,7 @@ void compat_binmode(int fd, int enable);
*
* WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx
*/
int win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen);
int INT123_win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen);
/**
* win32_uni2mbc
@@ -230,7 +235,7 @@ int win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen);
*
* WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx
*/
int win32_wide_utf7(const wchar_t * const wptr, char **mbptr, size_t * buflen);
int INT123_win32_wide_utf7(const wchar_t * const wptr, char **mbptr, size_t * buflen);
/**
* win32_mbc2uni
@@ -244,7 +249,7 @@ int win32_wide_utf7(const wchar_t * const wptr, char **mbptr, size_t * buflen);
* MultiByteToWideChar - http://msdn.microsoft.com/en-us/library/dd319072(VS.85).aspx
*/
int win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen);
int INT123_win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen);
#endif
/*
@@ -270,11 +275,11 @@ int win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen);
(meaning: for Windows), else they are preserved (on POSIX, actual
file system access would be needed because of symlinks).
*/
char* compat_catpath(const char *prefix, const char* path);
char* INT123_compat_catpath(const char *prefix, const char* path);
/* Return 1 if the given path indicates an existing directory,
0 otherwise. */
int compat_isdir(const char *path);
int INT123_compat_isdir(const char *path);
/*
Directory traversal. This talks ASCII/UTF-8 paths externally, converts
@@ -286,14 +291,14 @@ struct compat_dir;
/* Returns NULL if either directory failed to open or listing is empty.
Listing can still be empty even if non-NULL, so always rely on the
nextfile/nextdir functions. */
struct compat_dir* compat_diropen(char *path);
void compat_dirclose(struct compat_dir*);
struct compat_dir* INT123_compat_diropen(char *path);
void INT123_compat_dirclose(struct compat_dir*);
/* Get the next entry that is a file (or symlink to one).
The returned string is a copy that needs to be freed after use. */
char* compat_nextfile(struct compat_dir*);
char* INT123_compat_nextfile(struct compat_dir*);
/* Get the next entry that is a directory (or symlink to one).
The returned string is a copy that needs to be freed after use. */
char* compat_nextdir (struct compat_dir*);
char* INT123_compat_nextdir (struct compat_dir*);
#ifdef USE_MODULES
/*
@@ -303,17 +308,17 @@ char* compat_nextdir (struct compat_dir*);
Use of absolute paths is a good idea if you want to be sure which
file is openend, as default search paths vary.
*/
void *compat_dlopen (const char *path);
void *compat_dlsym (void *handle, const char* name);
void compat_dlclose(void *handle);
void *INT123_compat_dlopen (const char *path);
void *INT123_compat_dlsym (void *handle, const char* name);
void INT123_compat_dlclose(void *handle);
#endif
/* Blocking write/read of data with signal resilience.
They continue after being interrupted by signals and always return the
amount of processed data (shortage indicating actual problem or EOF). */
size_t unintr_write(int fd, void const *buffer, size_t bytes);
size_t unintr_read (int fd, void *buffer, size_t bytes);
size_t unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
size_t INT123_unintr_write(int fd, void const *buffer, size_t bytes);
size_t INT123_unintr_read (int fd, void *buffer, size_t bytes);
size_t INT123_unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
/* OSX SDK defines an enum with "normal" as value. That clashes with
optimize.h */
@@ -324,7 +329,7 @@ size_t unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
#include "true.h"
#if (!defined(WIN32) || defined (__CYGWIN__)) && defined(HAVE_SIGNAL_H)
void (*catchsignal(int signum, void(*handler)()))();
void (*INT123_catchsignal(int signum, void(*handler)()))();
#endif
#endif

View File

@@ -62,7 +62,7 @@
clobbering each other when setting/restoring across different threads.
*/
void *compat_dlopen(const char *path)
void *INT123_compat_dlopen(const char *path)
{
void *handle = NULL;
#ifdef WANT_WIN32_UNICODE
@@ -83,7 +83,7 @@ void *compat_dlopen(const char *path)
return handle;
}
void *compat_dlsym(void *handle, const char *name)
void *INT123_compat_dlsym(void *handle, const char *name)
{
void *sym = NULL;
if(!handle)
@@ -96,7 +96,7 @@ void *compat_dlsym(void *handle, const char *name)
return sym;
}
void compat_dlclose(void *handle)
void INT123_compat_dlclose(void *handle)
{
if(!handle)
return;

View File

@@ -4,11 +4,13 @@
The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX.
So anything possibly somewhat advanced should be considered to be put here, with proper #ifdef;-)
copyright 2007-2016 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-2023 by the mpg123 project
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis, Windows Unicode stuff by JonY.
*/
// Need POSIX 2008 for uselocale stuff.
#define _POSIX_C_SOURCE 200809L
#include "compat.h"
/* Win32 is only supported with unicode now. These headers also cover
@@ -20,10 +22,14 @@
#include <winnls.h>
#endif
#if HAVE_LOCALE_H
#include <locale.h>
#endif
#include "debug.h"
/* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */
void *safe_realloc(void *ptr, size_t size)
void *INT123_safe_realloc(void *ptr, size_t size)
{
if(ptr == NULL) return malloc(size);
else return realloc(ptr, size);
@@ -31,25 +37,33 @@ void *safe_realloc(void *ptr, size_t size)
// A more sensible variant of realloc: It deallocates the original memory if
// realloc fails or if size zero was requested.
void *safer_realloc(void *ptr, size_t size)
void *INT123_safer_realloc(void *ptr, size_t size)
{
void *nptr = size ? safe_realloc(ptr, size) : NULL;
void *nptr = size ? INT123_safe_realloc(ptr, size) : NULL;
if(!nptr && ptr)
free(ptr);
return nptr;
}
#ifndef HAVE_STRERROR
const char *strerror(int errnum)
const char *INT123_strerror(int errnum)
{
#if defined(HAVE_STRERROR_L) && defined(HAVE_USELOCALE)
locale_t curloc = uselocale((locale_t)0);
if(curloc != LC_GLOBAL_LOCALE)
return strerror_l(errnum, curloc);
#endif
// Also fall back to strerror() in case of no set locale.
#if defined(HAVE_STRERROR)
return strerror(errnum);
#else
extern int sys_nerr;
extern char *sys_errlist[];
return (errnum < sys_nerr) ? sys_errlist[errnum] : "";
}
#endif
}
char* compat_strdup(const char *src)
char* INT123_compat_strdup(const char *src)
{
char *dest = NULL;
if(src)
@@ -85,17 +99,17 @@ int win32_wide_common(const wchar_t * const wptr, char **mbptr, size_t * buflen,
return ret;
}
int win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen)
int INT123_win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen)
{
return win32_wide_common(wptr, mbptr, buflen, CP_UTF8);
}
int win32_wide_utf7(const wchar_t * const wptr, char **mbptr, size_t * buflen)
int INT123_win32_wide_utf7(const wchar_t * const wptr, char **mbptr, size_t * buflen)
{
return win32_wide_common(wptr, mbptr, buflen, CP_UTF7);
}
int win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen)
int INT123_win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen)
{
size_t len;
wchar_t *buf;

View File

@@ -18,7 +18,7 @@
static wchar_t* u2wpath(const char *upath)
{
wchar_t* wpath, *p;
if(!upath || win32_utf8_wide(upath, &wpath, NULL) < 1)
if(!upath || INT123_win32_utf8_wide(upath, &wpath, NULL) < 1)
return NULL;
for(p=wpath; *p; ++p)
if(*p == L'/')
@@ -31,7 +31,7 @@ static wchar_t* u2wpath(const char *upath)
static char* w2upath(const wchar_t *wpath)
{
char* upath, *p;
if(!wpath || win32_wide_utf8(wpath, &upath, NULL) < 1)
if(!wpath || INT123_win32_wide_utf8(wpath, &upath, NULL) < 1)
return NULL;
for(p=upath; *p; ++p)
if(*p == '\\')
@@ -111,7 +111,7 @@ static wchar_t* u2wlongpath(const char *upath)
static wchar_t* u2wlongpath(const char *upath)
{
wchar_t* wpath, *p;
if (!upath || win32_utf8_wide(upath, &wpath, NULL) < 1)
if (!upath || INT123_win32_utf8_wide(upath, &wpath, NULL) < 1)
return NULL;
for (p = wpath; *p; ++p)
if (*p == L'/')

View File

@@ -19,10 +19,6 @@
/* Define if .align takes 3 for alignment of 2^3=8 bytes instead of 8. */
#undef ASMALIGN_EXP
/* No suffixed symbols for large file support (only alias for backwards
compat.) */
#undef BUILD_NO_LARGENAME
/* Define if __attribute__((aligned(16))) shall be used */
#undef CCALIGN
@@ -83,6 +79,9 @@
/* Define to 1 if you have the <byteswap.h> header file. */
#undef HAVE_BYTESWAP_H
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/* Define to 1 if you have the <CoreServices/CoreServices.h> header file. */
#undef HAVE_CORESERVICES_CORESERVICES_H
@@ -143,15 +142,15 @@
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if you have the `lseek64' function. */
#undef HAVE_LSEEK64
/* Define to 1 if you have the <machine/soundcard.h> header file. */
#undef HAVE_MACHINE_SOUNDCARD_H
/* Define to 1 if you have the `mbstowcs' function. */
#undef HAVE_MBSTOWCS
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `mkfifo' function. */
#undef HAVE_MKFIFO
@@ -233,6 +232,9 @@
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the `strerror_l' function. */
#undef HAVE_STRERROR_L
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
@@ -296,6 +298,9 @@
/* Define to 1 if you have the `unsetenv' function. */
#undef HAVE_UNSETENV
/* Define to 1 if you have the `uselocale' function. */
#undef HAVE_USELOCALE
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
@@ -329,9 +334,11 @@
/* Define if IPV6 support is enabled. */
#undef IPV6
/* Define this to the size of native offset type in bits, used for LFS alias
functions. */
#undef LFS_ALIAS_BITS
/* Define if we use _LARGEFILE64_SOURCE with off64_t and lseek64. */
#undef LFS_LARGEFILE_64
/* System redefines off_t when defining _FILE_OFFSET_BITS to 64. */
#undef LFS_SENSITIVE
/* Define to the extension used for runtime loadable modules, say, ".so". */
#undef LT_MODULE_EXT
@@ -418,6 +425,9 @@
/* Define to disable warning messages. */
#undef NO_WARNING
/* Define to 0 if system does not have/need it. */
#undef O_LARGEFILE
/* Name of package */
#undef PACKAGE
@@ -439,6 +449,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to only include portable library API (no off_t, no internal I/O). */
#undef PORTABLE_API
/* Define if portaudio v18 API is wanted. */
#undef PORTAUDIO18
@@ -451,9 +464,6 @@
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of `off64_t', as computed by sizeof. */
#undef SIZEOF_OFF64_T
/* The size of `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T
@@ -463,7 +473,9 @@
/* The size of `ssize_t', as computed by sizeof. */
#undef SIZEOF_SSIZE_T
/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Define to not duplicate some code for likely cases in libsyn123. */
@@ -511,17 +523,6 @@
/* Define for extreme debugging. */
#undef XDEBUG
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Windows Vista and later APIs */
#undef _WIN32_WINNT
@@ -543,11 +544,8 @@
/* Define to `long long' if <sys/types.h> does not define. */
#undef int64_t
/* Define to the native offset type (long or actually off_t). */
#undef lfs_alias_t
/* Define to `long int' if <sys/types.h> does not define. */
#undef off_t
/* Define to `long' if <sys/types.h> does not define. */
#undef ptrdiff_t
/* Define to `unsigned long' if <sys/types.h> does not define. */
#undef size_t

View File

@@ -1,7 +1,8 @@
/*
control_generic.c: control interface for frontends and real console warriors
copyright 1997-99,2004-20 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 1997-99,2004-23 by the mpg123 project
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Andreas Neuhaus and Michael Hipp
reworked by Thomas Orgis - it was the entry point for eventually becoming maintainer...
@@ -57,6 +58,7 @@ FILE *outstream;
int out_is_term = FALSE;
static int mode = MODE_STOPPED;
static int init = 0;
static int sendstat_disabled = FALSE;
#include "debug.h"
@@ -167,10 +169,18 @@ static void generic_send_lines(int is_utf8, const char* fmt, mpg123_string *inli
void generic_sendstat (mpg123_handle *fr)
{
if(sendstat_disabled)
return;
off_t current_frame, frames_left;
double current_seconds, seconds_left;
if(!mpg123_position(fr, 0, out123_buffered(ao), &current_frame, &frames_left, &current_seconds, &seconds_left))
if(!position_info(fr, 0, ao, &current_frame, &frames_left, &current_seconds, &seconds_left, NULL, NULL))
generic_sendmsg("F %"OFF_P" %"OFF_P" %3.2f %3.2f", (off_p)current_frame, (off_p)frames_left, current_seconds, seconds_left);
else
{
sendstat_disabled = TRUE;
generic_sendmsg("E Error getting position information, disabling playback status.");
}
}
// This is only valid as herlper to generic_sendv1, observe info memory usage!
@@ -300,6 +310,7 @@ void generic_sendinfo (char *filename)
static void generic_load(mpg123_handle *fr, char *arg, int state)
{
sendstat_disabled = FALSE;
out123_drop(ao);
if(mode != MODE_STOPPED)
{
@@ -408,7 +419,7 @@ int control_generic (mpg123_handle *fr)
#endif
/* the command behaviour is different, so is the ID */
/* now also with version for command availability */
fprintf(outstream, "@R MPG123 (ThOr) v10\n");
fprintf(outstream, "@R MPG123 (ThOr) v11\n");
#ifdef FIFO
if(param.fifo)
{
@@ -421,7 +432,7 @@ int control_generic (mpg123_handle *fr)
unlink(param.fifo);
if(mkfifo(param.fifo, 0666) == -1)
{
error2("Failed to create FIFO at %s (%s)", param.fifo, strerror(errno));
error2("Failed to create FIFO at %s (%s)", param.fifo, INT123_strerror(errno));
return 1;
}
debug("going to open named pipe ... blocking until someone gives command");
@@ -455,8 +466,34 @@ int control_generic (mpg123_handle *fr)
if (n == 0) {
if (!play_frame())
{
generic_sendmsg("P 3");
size_t drain_block;
size_t buffered;
// Ensure that prepared audio really got played, drain buffer.
// There is no control during draining. This mode was not planned for big buffers.
play_prebuffer();
buffered = out123_buffered(ao);
if(buffered)
{
int framesize = 1;
long rate = 1;
out123_getformat(ao, &rate, NULL, NULL, &framesize);
generic_sendmsg("DRAIN %.1f", (double)buffered/framesize/rate);
if(silent == 0)
{
generic_sendstat(fr);
drain_block = 1152*framesize;
do
{
out123_ndrain(ao, drain_block);
generic_sendstat(fr);
}
while(out123_buffered(ao));
} else
out123_drain(ao);
}
out123_pause(ao);
generic_sendmsg("P 3");
/* When the track ended, user may want to keep it open (to seek back),
so there is a decision between stopping and pausing at the end. */
if(param.keep_open)
@@ -505,7 +542,7 @@ int control_generic (mpg123_handle *fr)
/* on error */
if(n < 0)
{
merror("waiting for command: %s", strerror(errno));
merror("waiting for command: %s", INT123_strerror(errno));
return 1;
}
/* read & process commands */
@@ -536,11 +573,11 @@ int control_generic (mpg123_handle *fr)
close(control_file);
control_file = open(param.fifo,O_RDONLY|O_NONBLOCK);
#endif
if(control_file < 0){ error1("open of fifo failed... %s", strerror(errno)); break; }
if(control_file < 0){ error1("open of fifo failed... %s", INT123_strerror(errno)); break; }
continue;
}
#endif
if(len < 0) error1("command read error: %s", strerror(errno));
if(len < 0) error1("command read error: %s", INT123_strerror(errno));
break;
}
@@ -600,26 +637,26 @@ int control_generic (mpg123_handle *fr)
/* SILENCE */
if(!strcasecmp(comstr, "SILENCE")) {
silent = 1;
generic_sendmsg("silence");
generic_sendmsg("SILENCE");
continue;
}
/* PROGRESS, opposite of silence */
if(!strcasecmp(comstr, "PROGRESS")) {
silent = 0;
generic_sendmsg("progress");
generic_sendmsg("PROGRESS");
continue;
}
if(!strcasecmp(comstr, "MUTE")) {
set_mute(ao, muted=TRUE);
generic_sendmsg("mute");
generic_sendmsg("MUTE");
continue;
}
if(!strcasecmp(comstr, "UNMUTE")) {
set_mute(ao, muted=FALSE);
generic_sendmsg("unmute");
generic_sendmsg("UNMUTE");
continue;
}
@@ -690,6 +727,7 @@ int control_generic (mpg123_handle *fr)
/* QUIT */
if (!strcasecmp(comstr, "Q") || !strcasecmp(comstr, "QUIT")){
out123_drop(ao);
alive = FALSE; continue;
}

View File

@@ -1,7 +1,7 @@
/*
filters: parse filter specifications
copyright 2020 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2020-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
@@ -91,7 +91,7 @@ static int store_filters(struct filterlist *fl, const char *spec)
}
if(errno)
{
merror("Number parsing error on validated spec: %s", strerror(errno));
merror("Number parsing error on validated spec: %s", INT123_strerror(errno));
return -1;
}
if(*spec) // Skip ":"

View File

@@ -44,7 +44,7 @@ static void setcharoption(topt *opt, char *value)
free(*((char**)opt->var));
if(value)
{
*((char **) opt->var) = compat_strdup(value);
*((char **) opt->var) = INT123_compat_strdup(value);
opt->flags |= GLO_VAR_MEM;
} else
{

View File

@@ -28,6 +28,7 @@
#include "mpg123app.h"
#include "httpget.h"
#include "version.h"
#ifdef NETWORK
#include "resolver.h"
@@ -329,7 +330,7 @@ int fill_request(mpg123_string *request, mpg123_string *host, mpg123_string *por
if( !mpg123_add_string(request, " HTTP/1.0\r\nUser-Agent: ")
|| !mpg123_add_string(request, PACKAGE_NAME)
|| !mpg123_add_string(request, "/")
|| !mpg123_add_string(request, PACKAGE_VERSION)
|| !mpg123_add_string(request, MPG123_VERSION)
|| !mpg123_add_string(request, "\r\n") )
return FALSE;
@@ -472,7 +473,7 @@ int http_open(const char* url, struct httpdata *hd, const char * const *client_h
#ifdef WANT_WIN32_SOCKETS
if(!win32_net_writestring (sock, &request))
#else
if(unintr_write(sock, request.p, request.fill-1) != request.fill-1)
if(INT123_unintr_write(sock, request.p, request.fill-1) != request.fill-1)
#endif
{
http_failure;

View File

@@ -1,367 +0,0 @@
#ifndef MPG123_INTSYM_H
#define MPG123_INTSYM_H
/* Mapping of internal mpg123 symbols to something that is less likely to
conflict in case of static linking. */
#include "config.h"
#define COS9 INT123_COS9
#define tfcos36 INT123_tfcos36
#define pnts INT123_pnts
#define catchsignal INT123_catchsignal
#define safe_realloc INT123_safe_realloc
#define safer_realloc INT123_safer_realloc
#define compat_strdup INT123_compat_strdup
#define compat_getenv INT123_compat_getenv
#define compat_open INT123_compat_open
#define compat_fopen INT123_compat_fopen
#define compat_fdopen INT123_compat_fdopen
#define compat_close INT123_compat_close
#define compat_fclose INT123_compat_fclose
#define compat_binmode INT123_compat_binmode
#define win32_wide_utf8 INT123_win32_wide_utf8
#define win32_wide_utf7 INT123_win32_wide_utf7
#define win32_utf8_wide INT123_win32_utf8_wide
#define compat_catpath INT123_compat_catpath
#define compat_isdir INT123_compat_isdir
#define compat_diropen INT123_compat_diropen
#define compat_dirclose INT123_compat_dirclose
#define compat_nextfile INT123_compat_nextfile
#define compat_nextdir INT123_compat_nextdir
#define compat_dlopen INT123_compat_dlopen
#define compat_dlsym INT123_compat_dlsym
#define compat_dlclose INT123_compat_dlclose
#define unintr_write INT123_unintr_write
#define unintr_read INT123_unintr_read
#define unintr_fwrite INT123_unintr_fwrite
#define ntom_set_ntom INT123_ntom_set_ntom
#define synth_1to1 INT123_synth_1to1
#define synth_1to1_dither INT123_synth_1to1_dither
#define synth_1to1_i386 INT123_synth_1to1_i386
#define synth_1to1_i586 INT123_synth_1to1_i586
#define synth_1to1_i586_dither INT123_synth_1to1_i586_dither
#define synth_1to1_mmx INT123_synth_1to1_mmx
#define synth_1to1_3dnow INT123_synth_1to1_3dnow
#define synth_1to1_sse INT123_synth_1to1_sse
#define synth_1to1_stereo_sse INT123_synth_1to1_stereo_sse
#define synth_1to1_3dnowext INT123_synth_1to1_3dnowext
#define synth_1to1_altivec INT123_synth_1to1_altivec
#define synth_1to1_stereo_altivec INT123_synth_1to1_stereo_altivec
#define synth_1to1_x86_64 INT123_synth_1to1_x86_64
#define synth_1to1_stereo_x86_64 INT123_synth_1to1_stereo_x86_64
#define synth_1to1_avx INT123_synth_1to1_avx
#define synth_1to1_stereo_avx INT123_synth_1to1_stereo_avx
#define synth_1to1_arm INT123_synth_1to1_arm
#define synth_1to1_neon INT123_synth_1to1_neon
#define synth_1to1_stereo_neon INT123_synth_1to1_stereo_neon
#define synth_1to1_neon64 INT123_synth_1to1_neon64
#define synth_1to1_stereo_neon64 INT123_synth_1to1_stereo_neon64
#define absynth_1to1_i486 INT123_absynth_1to1_i486
#define synth_1to1_mono INT123_synth_1to1_mono
#define synth_1to1_m2s INT123_synth_1to1_m2s
#define synth_2to1 INT123_synth_2to1
#define synth_2to1_dither INT123_synth_2to1_dither
#define synth_2to1_i386 INT123_synth_2to1_i386
#define synth_2to1_mono INT123_synth_2to1_mono
#define synth_2to1_m2s INT123_synth_2to1_m2s
#define synth_4to1 INT123_synth_4to1
#define synth_4to1_dither INT123_synth_4to1_dither
#define synth_4to1_i386 INT123_synth_4to1_i386
#define synth_4to1_mono INT123_synth_4to1_mono
#define synth_4to1_m2s INT123_synth_4to1_m2s
#define synth_ntom INT123_synth_ntom
#define synth_ntom_mono INT123_synth_ntom_mono
#define synth_ntom_m2s INT123_synth_ntom_m2s
#define synth_1to1_8bit INT123_synth_1to1_8bit
#define synth_1to1_8bit_i386 INT123_synth_1to1_8bit_i386
#define synth_1to1_8bit_wrap INT123_synth_1to1_8bit_wrap
#define synth_1to1_8bit_mono INT123_synth_1to1_8bit_mono
#define synth_1to1_8bit_m2s INT123_synth_1to1_8bit_m2s
#define synth_1to1_8bit_wrap_mono INT123_synth_1to1_8bit_wrap_mono
#define synth_1to1_8bit_wrap_m2s INT123_synth_1to1_8bit_wrap_m2s
#define synth_2to1_8bit INT123_synth_2to1_8bit
#define synth_2to1_8bit_i386 INT123_synth_2to1_8bit_i386
#define synth_2to1_8bit_mono INT123_synth_2to1_8bit_mono
#define synth_2to1_8bit_m2s INT123_synth_2to1_8bit_m2s
#define synth_4to1_8bit INT123_synth_4to1_8bit
#define synth_4to1_8bit_i386 INT123_synth_4to1_8bit_i386
#define synth_4to1_8bit_mono INT123_synth_4to1_8bit_mono
#define synth_4to1_8bit_m2s INT123_synth_4to1_8bit_m2s
#define synth_ntom_8bit INT123_synth_ntom_8bit
#define synth_ntom_8bit_mono INT123_synth_ntom_8bit_mono
#define synth_ntom_8bit_m2s INT123_synth_ntom_8bit_m2s
#define synth_1to1_real INT123_synth_1to1_real
#define synth_1to1_real_i386 INT123_synth_1to1_real_i386
#define synth_1to1_real_sse INT123_synth_1to1_real_sse
#define synth_1to1_real_stereo_sse INT123_synth_1to1_real_stereo_sse
#define synth_1to1_real_x86_64 INT123_synth_1to1_real_x86_64
#define synth_1to1_real_stereo_x86_64 INT123_synth_1to1_real_stereo_x86_64
#define synth_1to1_real_avx INT123_synth_1to1_real_avx
#define synth_1to1_fltst_avx INT123_synth_1to1_fltst_avx
#define synth_1to1_real_altivec INT123_synth_1to1_real_altivec
#define synth_1to1_fltst_altivec INT123_synth_1to1_fltst_altivec
#define synth_1to1_real_neon INT123_synth_1to1_real_neon
#define synth_1to1_real_stereo_neon INT123_synth_1to1_real_stereo_neon
#define synth_1to1_real_neon64 INT123_synth_1to1_real_neon64
#define synth_1to1_fltst_neon64 INT123_synth_1to1_fltst_neon64
#define synth_1to1_real_mono INT123_synth_1to1_real_mono
#define synth_1to1_real_m2s INT123_synth_1to1_real_m2s
#define synth_2to1_real INT123_synth_2to1_real
#define synth_2to1_real_i386 INT123_synth_2to1_real_i386
#define synth_2to1_real_mono INT123_synth_2to1_real_mono
#define synth_2to1_real_m2s INT123_synth_2to1_real_m2s
#define synth_4to1_real INT123_synth_4to1_real
#define synth_4to1_real_i386 INT123_synth_4to1_real_i386
#define synth_4to1_real_mono INT123_synth_4to1_real_mono
#define synth_4to1_real_m2s INT123_synth_4to1_real_m2s
#define synth_ntom_real INT123_synth_ntom_real
#define synth_ntom_real_mono INT123_synth_ntom_real_mono
#define synth_ntom_real_m2s INT123_synth_ntom_real_m2s
#define synth_1to1_s32 INT123_synth_1to1_s32
#define synth_1to1_s32_i386 INT123_synth_1to1_s32_i386
#define synth_1to1_s32_sse INT123_synth_1to1_s32_sse
#define synth_1to1_s32_stereo_sse INT123_synth_1to1_s32_stereo_sse
#define synth_1to1_s32_x86_64 INT123_synth_1to1_s32_x86_64
#define synth_1to1_s32_stereo_x86_64 INT123_synth_1to1_s32_stereo_x86_64
#define synth_1to1_s32_avx INT123_synth_1to1_s32_avx
#define synth_1to1_s32_stereo_avx INT123_synth_1to1_s32_stereo_avx
#define synth_1to1_s32_altivec INT123_synth_1to1_s32_altivec
#define synth_1to1_s32_stereo_altivec INT123_synth_1to1_s32_stereo_altivec
#define synth_1to1_s32_neon INT123_synth_1to1_s32_neon
#define synth_1to1_s32_stereo_neon INT123_synth_1to1_s32_stereo_neon
#define synth_1to1_s32_neon64 INT123_synth_1to1_s32_neon64
#define synth_1to1_s32st_neon64 INT123_synth_1to1_s32st_neon64
#define synth_1to1_s32_mono INT123_synth_1to1_s32_mono
#define synth_1to1_s32_m2s INT123_synth_1to1_s32_m2s
#define synth_2to1_s32 INT123_synth_2to1_s32
#define synth_2to1_s32_i386 INT123_synth_2to1_s32_i386
#define synth_2to1_s32_mono INT123_synth_2to1_s32_mono
#define synth_2to1_s32_m2s INT123_synth_2to1_s32_m2s
#define synth_4to1_s32 INT123_synth_4to1_s32
#define synth_4to1_s32_i386 INT123_synth_4to1_s32_i386
#define synth_4to1_s32_mono INT123_synth_4to1_s32_mono
#define synth_4to1_s32_m2s INT123_synth_4to1_s32_m2s
#define synth_ntom_s32 INT123_synth_ntom_s32
#define synth_ntom_s32_mono INT123_synth_ntom_s32_mono
#define synth_ntom_s32_m2s INT123_synth_ntom_s32_m2s
#define dct64 INT123_dct64
#define dct64_i386 INT123_dct64_i386
#define dct64_altivec INT123_dct64_altivec
#define dct64_i486 INT123_dct64_i486
#define dct36 INT123_dct36
#define dct36_3dnow INT123_dct36_3dnow
#define dct36_3dnowext INT123_dct36_3dnowext
#define dct36_x86_64 INT123_dct36_x86_64
#define dct36_sse INT123_dct36_sse
#define dct36_avx INT123_dct36_avx
#define dct36_neon INT123_dct36_neon
#define dct36_neon64 INT123_dct36_neon64
#define synth_ntom_set_step INT123_synth_ntom_set_step
#define ntom_val INT123_ntom_val
#define ntom_frame_outsamples INT123_ntom_frame_outsamples
#define ntom_frmouts INT123_ntom_frmouts
#define ntom_ins2outs INT123_ntom_ins2outs
#define ntom_frameoff INT123_ntom_frameoff
#define init_layer3 INT123_init_layer3
#define init_layer3_gainpow2 INT123_init_layer3_gainpow2
#define init_layer3_stuff INT123_init_layer3_stuff
#define init_layer12 INT123_init_layer12
#define init_layer12_table INT123_init_layer12_table
#define init_layer12_stuff INT123_init_layer12_stuff
#define init_costabs INT123_init_costabs
#define make_decode_tables INT123_make_decode_tables
#define make_decode_tables_mmx INT123_make_decode_tables_mmx
#define init_layer3_gainpow2_mmx INT123_init_layer3_gainpow2_mmx
#define init_layer12_table_mmx INT123_init_layer12_table_mmx
#define make_conv16to8_table INT123_make_conv16to8_table
#define do_layer3 INT123_do_layer3
#define do_layer2 INT123_do_layer2
#define do_layer1 INT123_do_layer1
#define do_equalizer INT123_do_equalizer
#define dither_table_init INT123_dither_table_init
#define frame_dither_init INT123_frame_dither_init
#define invalidate_format INT123_invalidate_format
#define frame_init INT123_frame_init
#define frame_init_par INT123_frame_init_par
#define frame_outbuffer INT123_frame_outbuffer
#define frame_output_format INT123_frame_output_format
#define frame_buffers INT123_frame_buffers
#define frame_reset INT123_frame_reset
#define frame_buffers_reset INT123_frame_buffers_reset
#define frame_exit INT123_frame_exit
#define frame_index_find INT123_frame_index_find
#define frame_index_setup INT123_frame_index_setup
#define do_volume INT123_do_volume
#define do_rva INT123_do_rva
#define frame_gapless_init INT123_frame_gapless_init
#define frame_gapless_realinit INT123_frame_gapless_realinit
#define frame_gapless_update INT123_frame_gapless_update
#define frame_gapless_bytify INT123_frame_gapless_bytify
#define frame_gapless_ignore INT123_frame_gapless_ignore
#define frame_expect_outsamples INT123_frame_expect_outsamples
#define frame_skip INT123_frame_skip
#define frame_ins2outs INT123_frame_ins2outs
#define frame_outs INT123_frame_outs
#define frame_expect_outsampels INT123_frame_expect_outsampels
#define frame_offset INT123_frame_offset
#define frame_set_frameseek INT123_frame_set_frameseek
#define frame_set_seek INT123_frame_set_seek
#define frame_tell_seek INT123_frame_tell_seek
#define frame_fill_toc INT123_frame_fill_toc
#define getcpuflags INT123_getcpuflags
#define icy2utf8 INT123_icy2utf8
#define init_icy INT123_init_icy
#define clear_icy INT123_clear_icy
#define reset_icy INT123_reset_icy
#define init_id3 INT123_init_id3
#define exit_id3 INT123_exit_id3
#define reset_id3 INT123_reset_id3
#define id3_link INT123_id3_link
#define parse_new_id3 INT123_parse_new_id3
#define id3_to_utf8 INT123_id3_to_utf8
#define fi_init INT123_fi_init
#define fi_exit INT123_fi_exit
#define fi_resize INT123_fi_resize
#define fi_add INT123_fi_add
#define fi_set INT123_fi_set
#define fi_reset INT123_fi_reset
#define decode_update INT123_decode_update
#define decoder_synth_bytes INT123_decoder_synth_bytes
#define samples_to_bytes INT123_samples_to_bytes
#define bytes_to_samples INT123_bytes_to_samples
#define outblock_bytes INT123_outblock_bytes
#define postprocess_buffer INT123_postprocess_buffer
#define open_fixed_pre INT123_open_fixed_pre
#define open_fixed_post INT123_open_fixed_post
#define frame_cpu_opt INT123_frame_cpu_opt
#define set_synth_functions INT123_set_synth_functions
#define dectype INT123_dectype
#define defdec INT123_defdec
#define decclass INT123_decclass
#define read_frame_init INT123_read_frame_init
#define frame_bitrate INT123_frame_bitrate
#define frame_freq INT123_frame_freq
#define read_frame_recover INT123_read_frame_recover
#define read_frame INT123_read_frame
#define set_pointer INT123_set_pointer
#define position_info INT123_position_info
#define compute_bpf INT123_compute_bpf
#define time_to_frame INT123_time_to_frame
#define get_songlen INT123_get_songlen
#define bc_prepare INT123_bc_prepare
#define bc_cleanup INT123_bc_cleanup
#define bc_poolsize INT123_bc_poolsize
#define bc_fill INT123_bc_fill
#define open_stream INT123_open_stream
#define open_stream_handle INT123_open_stream_handle
#define open_feed INT123_open_feed
#define feed_more INT123_feed_more
#define feed_forget INT123_feed_forget
#define feed_set_pos INT123_feed_set_pos
#define open_bad INT123_open_bad
#define open_module INT123_open_module
#define close_module INT123_close_module
#define list_modules INT123_list_modules
#define buffer_init INT123_buffer_init
#define buffer_exit INT123_buffer_exit
#define buffer_sync_param INT123_buffer_sync_param
#define buffer_open INT123_buffer_open
#define buffer_encodings INT123_buffer_encodings
#define buffer_formats INT123_buffer_formats
#define buffer_start INT123_buffer_start
#define buffer_ndrain INT123_buffer_ndrain
#define buffer_stop INT123_buffer_stop
#define buffer_close INT123_buffer_close
#define buffer_continue INT123_buffer_continue
#define buffer_ignore_lowmem INT123_buffer_ignore_lowmem
#define buffer_drain INT123_buffer_drain
#define buffer_end INT123_buffer_end
#define buffer_pause INT123_buffer_pause
#define buffer_drop INT123_buffer_drop
#define buffer_write INT123_buffer_write
#define buffer_fill INT123_buffer_fill
#define xfermem_init INT123_xfermem_init
#define xfermem_init_writer INT123_xfermem_init_writer
#define xfermem_init_reader INT123_xfermem_init_reader
#define xfermem_get_freespace INT123_xfermem_get_freespace
#define xfermem_get_usedspace INT123_xfermem_get_usedspace
#define xfermem_getcmd INT123_xfermem_getcmd
#define xfermem_getcmds INT123_xfermem_getcmds
#define xfermem_putcmd INT123_xfermem_putcmd
#define xfermem_writer_block INT123_xfermem_writer_block
#define xfermem_write INT123_xfermem_write
#define xfermem_done INT123_xfermem_done
#define au_open INT123_au_open
#define cdr_open INT123_cdr_open
#define raw_open INT123_raw_open
#define wav_open INT123_wav_open
#define wav_write INT123_wav_write
#define wav_close INT123_wav_close
#define au_close INT123_au_close
#define raw_close INT123_raw_close
#define cdr_formats INT123_cdr_formats
#define au_formats INT123_au_formats
#define raw_formats INT123_raw_formats
#define wav_formats INT123_wav_formats
#define wav_drain INT123_wav_drain
#define stringlists_add INT123_stringlists_add
#define check_neon INT123_check_neon
#define dct64_3dnow INT123_dct64_3dnow
#define dct64_3dnowext INT123_dct64_3dnowext
#define dct64_avx INT123_dct64_avx
#define dct64_real_avx INT123_dct64_real_avx
#define dct64_mmx INT123_dct64_mmx
#define dct64_MMX INT123_dct64_MMX
#define dct64_neon INT123_dct64_neon
#define dct64_neon64 INT123_dct64_neon64
#define dct64_real_neon64 INT123_dct64_real_neon64
#define dct64_real_neon INT123_dct64_real_neon
#define dct64_sse INT123_dct64_sse
#define dct64_real_sse INT123_dct64_real_sse
#define dct64_x86_64 INT123_dct64_x86_64
#define dct64_real_x86_64 INT123_dct64_real_x86_64
#define do_equalizer_3dnow INT123_do_equalizer_3dnow
#define synth_1to1_3dnow_asm INT123_synth_1to1_3dnow_asm
#define synth_1to1_arm_asm INT123_synth_1to1_arm_asm
#define synth_1to1_arm_accurate_asm INT123_synth_1to1_arm_accurate_asm
#define synth_1to1_i586_asm INT123_synth_1to1_i586_asm
#define synth_1to1_i586_asm_dither INT123_synth_1to1_i586_asm_dither
#define synth_1to1_MMX INT123_synth_1to1_MMX
#define synth_1to1_neon_asm INT123_synth_1to1_neon_asm
#define synth_1to1_neon64_asm INT123_synth_1to1_neon64_asm
#define synth_1to1_neon64_accurate_asm INT123_synth_1to1_neon64_accurate_asm
#define synth_1to1_real_neon64_asm INT123_synth_1to1_real_neon64_asm
#define synth_1to1_s32_neon64_asm INT123_synth_1to1_s32_neon64_asm
#define synth_1to1_neon_accurate_asm INT123_synth_1to1_neon_accurate_asm
#define synth_1to1_real_neon_asm INT123_synth_1to1_real_neon_asm
#define synth_1to1_s32_neon_asm INT123_synth_1to1_s32_neon_asm
#define synth_1to1_sse_accurate_asm INT123_synth_1to1_sse_accurate_asm
#define synth_1to1_real_sse_asm INT123_synth_1to1_real_sse_asm
#define synth_1to1_s32_sse_asm INT123_synth_1to1_s32_sse_asm
#define synth_1to1_s_avx_asm INT123_synth_1to1_s_avx_asm
#define synth_1to1_s_avx_accurate_asm INT123_synth_1to1_s_avx_accurate_asm
#define synth_1to1_real_s_avx_asm INT123_synth_1to1_real_s_avx_asm
#define synth_1to1_s32_s_avx_asm INT123_synth_1to1_s32_s_avx_asm
#define synth_1to1_s_neon_asm INT123_synth_1to1_s_neon_asm
#define synth_1to1_s_neon64_asm INT123_synth_1to1_s_neon64_asm
#define synth_1to1_s_neon64_accurate_asm INT123_synth_1to1_s_neon64_accurate_asm
#define synth_1to1_real_s_neon64_asm INT123_synth_1to1_real_s_neon64_asm
#define synth_1to1_s32_s_neon64_asm INT123_synth_1to1_s32_s_neon64_asm
#define synth_1to1_s_neon_accurate_asm INT123_synth_1to1_s_neon_accurate_asm
#define synth_1to1_real_s_neon_asm INT123_synth_1to1_real_s_neon_asm
#define synth_1to1_s32_s_neon_asm INT123_synth_1to1_s32_s_neon_asm
#define synth_1to1_s_sse_accurate_asm INT123_synth_1to1_s_sse_accurate_asm
#define synth_1to1_real_s_sse_asm INT123_synth_1to1_real_s_sse_asm
#define synth_1to1_s32_s_sse_asm INT123_synth_1to1_s32_s_sse_asm
#define synth_1to1_s_x86_64_asm INT123_synth_1to1_s_x86_64_asm
#define synth_1to1_s_x86_64_accurate_asm INT123_synth_1to1_s_x86_64_accurate_asm
#define synth_1to1_real_s_x86_64_asm INT123_synth_1to1_real_s_x86_64_asm
#define synth_1to1_s32_s_x86_64_asm INT123_synth_1to1_s32_s_x86_64_asm
#define synth_1to1_x86_64_asm INT123_synth_1to1_x86_64_asm
#define synth_1to1_x86_64_accurate_asm INT123_synth_1to1_x86_64_accurate_asm
#define synth_1to1_real_x86_64_asm INT123_synth_1to1_real_x86_64_asm
#define synth_1to1_s32_x86_64_asm INT123_synth_1to1_s32_x86_64_asm
#define costab_mmxsse INT123_costab_mmxsse
#define make_decode_tables_mmx_asm INT123_make_decode_tables_mmx_asm
#ifndef HAVE_STRERROR
#define strerror INT123_strerror
#endif
#endif

View File

@@ -1,7 +1,5 @@
# Module for non-recursive mpg123 build system.
EXTRA_DIST += src/libmpg123/mpg123.h.in
EXTRA_PROGRAMS += src/libmpg123/testcpu
src_libmpg123_testcpu_DEPENDENCIES = src/libmpg123/getcpuflags.$(OBJEXT)
src_libmpg123_testcpu_SOURCES = src/libmpg123/testcpu.c
@@ -20,9 +18,13 @@ src_libmpg123_calctables_LDADD = @LIBM@
# Necessary?
#CLEANFILES += src/libmpg123/*.a
if BUILD_LIBMPG123
lib_LTLIBRARIES += src/libmpg123/libmpg123.la
nodist_include_HEADERS += src/libmpg123/mpg123.h
include_HEADERS += src/libmpg123/mpg123.h
endif
if NEED_FMT123
include_HEADERS += src/libmpg123/fmt123.h
endif
src_libmpg123_libmpg123_la_CFLAGS = @LIB_CFLAGS@
@@ -66,6 +68,7 @@ src_libmpg123_libmpg123_la_SOURCES = \
src/libmpg123/optimize.h \
src/libmpg123/optimize.c \
src/libmpg123/readers.c \
src/libmpg123/lfs_wrap.h \
src/libmpg123/costabs.h \
src/libmpg123/tabinit.c \
src/libmpg123/libmpg123.c \
@@ -110,7 +113,6 @@ src_libmpg123_libmpg123_la_SOURCES = \
#SYNTH16 synth.c
#SYNTH32 synth_s32.c
#SYNTHREAL synth_real.c
#LFS_ALIAS lfs_alias.c
#LFS_WRAP lfs_wrap.c
#ICY icy.c icy2utf8.c
#FEATURE feature.c
@@ -206,10 +208,6 @@ if HAVE_SYNTHREAL
src_libmpg123_libmpg123_la_SOURCES += src/libmpg123/synth_real.c
endif
if HAVE_LFS_ALIAS
src_libmpg123_libmpg123_la_SOURCES += src/libmpg123/lfs_alias.c
endif
if HAVE_LFS_WRAP
src_libmpg123_libmpg123_la_SOURCES += src/libmpg123/lfs_wrap.c
endif
@@ -538,8 +536,7 @@ AVX_OBJS = $(AVX_SRCS:.S=.@OBJEXT@)
ASM_DEPS = \
src/libmpg123/mangle.h \
$(top_builddir)/src/config.h \
src/intsym.h
$(top_builddir)/src/config.h
$(AVX_OBJS): %.@OBJEXT@: %.S $(ASM_DEPS)
$(CPP) $(DEFAULT_INCLUDES) $(INCLUDES) -DASMALIGN_BALIGN $< | @YASM@ - @YASMFLAGS@ @YASM_FORMAT@ -o $@

View File

@@ -1,8 +1,11 @@
/*
abi_align: An attempt to avoid breakage because of mixing
compilers with different alignment.
abi_align: ABI and alignment stuff for library builds.
copyright 1995-2015 by the mpg123 project
Original use was the definitions for avoiding breakage because of mixing
compilers with different alignment. Then, the switchery for building
DLLs got lumped in.
copyright 1995-2023 by the mpg123 project
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
@@ -16,6 +19,12 @@
#include "config.h"
// Building any of our libs on/for Windows needs this before
// including the main API header (define MPG123_EXPORT).
#if defined(WIN32) && defined(DYNAMIC_BUILD)
#define BUILD_MPG123_DLL
#endif
/* ABI conformance for other compilers.
mpg123 needs 16byte-aligned (or more) stack for SSE and friends.
gcc provides that, but others don't necessarily. */

View File

@@ -40,9 +40,9 @@ static double ispow[8207]; // scale with SCALE_POW43
static double aa_ca[8],aa_cs[8];
static double win[4][36];
static double win1[4][36];
double COS9[9]; /* dct36_3dnow wants to use that */
double INT123_COS9[9]; /* INT123_dct36_3dnow wants to use that */
static double COS6_1,COS6_2;
double tfcos36[9]; /* dct36_3dnow wants to use that */
double INT123_tfcos36[9]; /* INT123_dct36_3dnow wants to use that */
static double tfcos12[3];
static double cos9[3],cos18[3];
@@ -117,7 +117,7 @@ static void print_value( int fixed, double fixed_scale
if(fixed)
printf("%ld;\n", (long)(DOUBLE_TO_REAL(fixed_scale*val)));
else
printf("%15.8e;\n", val);
printf("%15.8ef;\n", val);
}
// I feal uneasy about inf appearing as literal.
@@ -143,7 +143,7 @@ static void print_array( int statick, int fixed, double fixed_scale
, statick ? "static " : "", name, count );
return;
}
size_t block = 72/17;
size_t block = 72/18;
size_t i = 0;
if(name)
printf( "%sconst%s real %s[%zu] = \n", statick ? "static " : ""
@@ -157,7 +157,7 @@ static void print_array( int statick, int fixed, double fixed_scale
printf( "%s%c%11ld", i ? "," : "", j ? ' ' : '\t'
, (long)(DOUBLE_TO_REAL(fixed_scale*tab[i])) );
else for(size_t j=0; j<line; ++j, ++i)
printf("%s%c%15.8e", i ? "," : "", j ? ' ' : '\t', limit_val(tab[i]));
printf("%s%c%15.8ef", i ? "," : "", j ? ' ' : '\t', limit_val(tab[i]));
printf("\n");
}
printf("%s}%s\n", indent, name ? ";" : "");
@@ -303,10 +303,10 @@ void printer(int calc, char *arg)
print_array(1, fixed, 1., "", "aa_cs", ASIZE(aa_cs), aa_cs, calc);
print_array2d(fixed, 1., "win", 4, 36, win, calc);
print_array2d(fixed, 1., "win1", 4, 36, win1, calc);
print_array(0, fixed, 1., "", "COS9", ASIZE(COS9), COS9, calc);
print_array(0, fixed, 1., "", "INT123_COS9", ASIZE(INT123_COS9), INT123_COS9, calc);
print_value(fixed, 1., "COS6_1", COS6_1, calc);
print_value(fixed, 1., "COS6_2", COS6_2, calc);
print_array(0, fixed, 1., "", "tfcos36", ASIZE(tfcos36), tfcos36, calc);
print_array(0, fixed, 1., "", "INT123_tfcos36", ASIZE(INT123_tfcos36), INT123_tfcos36, calc);
print_array(1, fixed, 1., "", "tfcos12", ASIZE(tfcos12), tfcos12, calc);
print_array(1, fixed, 1., "", "cos9", ASIZE(cos9), cos9, calc);
print_array(1, fixed, 1., "", "cos18", ASIZE(cos18), cos18, calc);
@@ -385,9 +385,9 @@ int main(int argc, char **argv)
printf(" %s", argv[i]);
printf("\n");
init_costabs();
init_layer12();
init_layer3();
INT123_init_costabs();
INT123_init_layer12();
INT123_init_layer3();
printf("\n#if defined(RUNTIME_TABLES)\n");
printer(1, argv[1]);

View File

@@ -18,12 +18,12 @@
#endif
.text
GLOBAL_SYMBOL ASM_NAME(check_neon)
GLOBAL_SYMBOL ASM_NAME(INT123_check_neon)
#ifdef __ELF__
.type ASM_NAME(check_neon), %function
.type ASM_NAME(INT123_check_neon), %function
#endif
ALIGN4
ASM_NAME(check_neon):
ASM_NAME(INT123_check_neon):
#ifdef __aarch64__
orr v0.16b, v0.16b, v0.16b
ret

View File

@@ -30,9 +30,9 @@
#include "mangle.h"
.globl ASM_NAME(dct36_3dnow)
/* .type ASM_NAME(dct36_3dnow),@function */
ASM_NAME(dct36_3dnow):
.globl ASM_NAME(INT123_dct36_3dnow)
/* .type ASM_NAME(INT123_dct36_3dnow),@function */
ASM_NAME(INT123_dct36_3dnow):
pushl %ebp
movl %esp,%ebp
// Not entirely sure about this PIC_GLOBAL_PTR here, but this is highly
@@ -50,12 +50,12 @@ ASM_NAME(dct36_3dnow):
#ifdef PIC_GLOBAL_PTR
#define _COS9_ 0(%edi)
#define _tfcos36_ 0(%eax)
mov GLOBAL_VAR_PTR(tfcos36), %eax
mov GLOBAL_VAR_PTR(COS9), %edi
mov GLOBAL_VAR_PTR(INT123_tfcos36), %eax
mov GLOBAL_VAR_PTR(INT123_COS9), %edi
mov %eax, -4(%ebp)
#else
#define _COS9_ GLOBAL_VAR(COS9)
#define _tfcos36_ GLOBAL_VAR(tfcos36)
#define _COS9_ GLOBAL_VAR(INT123_COS9)
#define _tfcos36_ GLOBAL_VAR(INT123_tfcos36)
#endif
movl 8(%ebp),%eax
@@ -551,11 +551,11 @@ ASM_NAME(dct36_3dnow):
#if defined(PIC) && defined(__APPLE__)
.section __IMPORT,__pointers,non_lazy_symbol_pointers
L_tfcos36:
.indirect_symbol ASM_NAME(tfcos36)
L_INT123_tfcos36:
.indirect_symbol ASM_NAME(INT123_tfcos36)
.long 0
L_COS9:
.indirect_symbol ASM_NAME(COS9)
L_INT123_COS9:
.indirect_symbol ASM_NAME(INT123_COS9)
.long 0
#endif

View File

@@ -43,9 +43,9 @@
.text
ALIGN32
.globl ASM_NAME(dct36_3dnowext)
/* .type ASM_NAME(dct36_3dnowext), @function */
ASM_NAME(dct36_3dnowext):
.globl ASM_NAME(INT123_dct36_3dnowext)
/* .type ASM_NAME(INT123_dct36_3dnowext), @function */
ASM_NAME(INT123_dct36_3dnowext):
pushl %ebp
movl %esp, %ebp
// Not entirely sure about this PIC_GLOBAL_PTR here, but this is highly
@@ -63,12 +63,12 @@ ASM_NAME(dct36_3dnowext):
#ifdef PIC_GLOBAL_PTR
#define _COS9_ 0(%edi)
#define _tfcos36_ 0(%eax)
mov GLOBAL_VAR_PTR(tfcos36), %eax
mov GLOBAL_VAR_PTR(COS9), %edi
mov GLOBAL_VAR_PTR(INT123_tfcos36), %eax
mov GLOBAL_VAR_PTR(INT123_COS9), %edi
mov %eax, -4(%ebp)
#else
#define _COS9_ GLOBAL_VAR(COS9)
#define _tfcos36_ GLOBAL_VAR(tfcos36)
#define _COS9_ GLOBAL_VAR(INT123_COS9)
#define _tfcos36_ GLOBAL_VAR(INT123_tfcos36)
#endif
movl 8(%ebp), %eax
@@ -557,15 +557,15 @@ ASM_NAME(dct36_3dnowext):
popl %esi
leave
ret
/* .size ASM_NAME(dct36_3dnowext), .-ASM_NAME(dct36_3dnowext) */
/* .size ASM_NAME(INT123_dct36_3dnowext), .-ASM_NAME(INT123_dct36_3dnowext) */
#if defined(PIC) && defined(__APPLE__)
.section __IMPORT,__pointers,non_lazy_symbol_pointers
L_tfcos36:
.indirect_symbol ASM_NAME(tfcos36)
L_INT123_tfcos36:
.indirect_symbol ASM_NAME(INT123_tfcos36)
.long 0
L_COS9:
.indirect_symbol ASM_NAME(COS9)
L_INT123_COS9:
.indirect_symbol ASM_NAME(INT123_COS9)
.long 0
#endif

View File

@@ -69,8 +69,8 @@ dct36_avx_sign:
.long 0x80000000,0x80000000,0x80000000,0x80000000
.text
ALIGN16
.globl ASM_NAME(dct36_avx)
ASM_NAME(dct36_avx):
.globl ASM_NAME(INT123_dct36_avx)
ASM_NAME(INT123_dct36_avx):
#ifdef IS_MSABI
push %rbp
mov %rsp, %rbp

View File

@@ -47,11 +47,11 @@ dct36_neon_COS9:
.word 0x3f3504f3
ALIGN4
GLOBAL_SYMBOL ASM_NAME(dct36_neon)
GLOBAL_SYMBOL ASM_NAME(INT123_dct36_neon)
#ifdef __ELF__
.type ASM_NAME(dct36_neon), %function
.type ASM_NAME(INT123_dct36_neon), %function
#endif
ASM_NAME(dct36_neon):
ASM_NAME(INT123_dct36_neon):
push {r4-r5, lr}
vpush {q4-q7}
ldr r4, [sp, #76]

View File

@@ -44,11 +44,11 @@ dct36_aarch64_COS9:
.text
ALIGN4
.globl ASM_NAME(dct36_neon64)
.globl ASM_NAME(INT123_dct36_neon64)
#ifdef __ELF__
.type ASM_NAME(dct36_neon64), %function
.type ASM_NAME(INT123_dct36_neon64), %function
#endif
ASM_NAME(dct36_neon64):
ASM_NAME(INT123_dct36_neon64):
adrp x5, AARCH64_PCREL_HI(dct36_aarch64_COS9)
add x5, x5, AARCH64_PCREL_LO(dct36_aarch64_COS9)
cmeq v28.16b, v28.16b, v28.16b

View File

@@ -61,8 +61,8 @@ dct36_sse_sign:
.long 0x80000000,0x80000000,0x80000000,0x80000000
.text
ALIGN16
.globl ASM_NAME(dct36_sse)
ASM_NAME(dct36_sse):
.globl ASM_NAME(INT123_dct36_sse)
ASM_NAME(INT123_dct36_sse):
push %ebp
mov %esp, %ebp
and $-16, %esp

View File

@@ -72,8 +72,8 @@ dct36_x86_64_sign:
.long 0x80000000,0x80000000,0x80000000,0x80000000
.text
ALIGN16
.globl ASM_NAME(dct36_x86_64)
ASM_NAME(dct36_x86_64):
.globl ASM_NAME(INT123_dct36_x86_64)
ASM_NAME(INT123_dct36_x86_64):
#ifdef IS_MSABI
push %rbp
mov %rsp, %rbp

View File

@@ -1,5 +1,5 @@
/*
dct64.c: DCT64, the plain C version
INT123_dct64.c: DCT64, the plain C version
copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
@@ -19,7 +19,7 @@
#include "mpg123lib_intern.h"
void dct64(real *out0,real *out1,real *samples)
void INT123_dct64(real *out0,real *out1,real *samples)
{
real bufs[64];
@@ -30,7 +30,7 @@ void dct64(real *out0,real *out1,real *samples)
b1 = samples;
bs = bufs;
costab = pnts[0]+16;
costab = INT123_pnts[0]+16;
b2 = b1 + 32;
for(i=15;i>=0;i--)
@@ -39,7 +39,7 @@ void dct64(real *out0,real *out1,real *samples)
*bs++ = REAL_MUL((*--b2 - *b1++), *--costab);
b1 = bufs;
costab = pnts[1]+8;
costab = INT123_pnts[1]+8;
b2 = b1 + 16;
{
@@ -57,7 +57,7 @@ void dct64(real *out0,real *out1,real *samples)
}
bs = bufs;
costab = pnts[2];
costab = INT123_pnts[2];
b2 = b1 + 8;
for(j=2;j;j--)
@@ -75,7 +75,7 @@ void dct64(real *out0,real *out1,real *samples)
}
b1 = bufs;
costab = pnts[3];
costab = INT123_pnts[3];
b2 = b1 + 4;
for(j=4;j;j--)
@@ -92,7 +92,7 @@ void dct64(real *out0,real *out1,real *samples)
b2 += 8;
}
bs = bufs;
costab = pnts[4];
costab = INT123_pnts[4];
for(j=8;j;j--)
{

View File

@@ -14,9 +14,9 @@
#include "mangle.h"
.globl ASM_NAME(dct64_3dnow)
/* .type ASM_NAME(dct64_3dnow),@function */
ASM_NAME(dct64_3dnow):
.globl ASM_NAME(INT123_dct64_3dnow)
/* .type ASM_NAME(INT123_dct64_3dnow),@function */
ASM_NAME(INT123_dct64_3dnow):
subl $256,%esp
pushl %ebp
pushl %edi
@@ -37,10 +37,10 @@ ASM_NAME(dct64_3dnow):
/* 1 */
#ifdef PIC_GLOBAL_PTR
movl GLOBAL_VAR_PTR(pnts),%eax
movl GLOBAL_VAR_PTR(INT123_pnts),%eax
movl (%eax),%eax
#else
movl GLOBAL_VAR(pnts),%eax
movl GLOBAL_VAR(INT123_pnts),%eax
#endif
movq 0(%edi),%mm0
movq %mm0,%mm1
@@ -141,10 +141,10 @@ ASM_NAME(dct64_3dnow):
/* 2 */
#ifdef PIC_GLOBAL_PTR
movl GLOBAL_VAR_PTR(pnts),%eax
movl GLOBAL_VAR_PTR(INT123_pnts),%eax
movl 4(%eax),%eax
#else
movl 4+GLOBAL_VAR(pnts),%eax
movl 4+GLOBAL_VAR(INT123_pnts),%eax
#endif
/* 0,14 */
movq 0(%ebx),%mm0
@@ -249,10 +249,10 @@ ASM_NAME(dct64_3dnow):
/* 3 */
#ifdef PIC_GLOBAL_PTR
movl GLOBAL_VAR_PTR(pnts),%eax
movl GLOBAL_VAR_PTR(INT123_pnts),%eax
movl 8(%eax),%eax
#else
movl 8+GLOBAL_VAR(pnts),%eax
movl 8+GLOBAL_VAR(INT123_pnts),%eax
#endif
movq 0(%eax),%mm0
movq 8(%eax),%mm1
@@ -355,10 +355,10 @@ ASM_NAME(dct64_3dnow):
/* 4 */
#ifdef PIC_GLOBAL_PTR
movl GLOBAL_VAR_PTR(pnts),%eax
movl GLOBAL_VAR_PTR(INT123_pnts),%eax
movl 12(%eax),%eax
#else
movl 12+GLOBAL_VAR(pnts),%eax
movl 12+GLOBAL_VAR(INT123_pnts),%eax
#endif
movq 0(%eax),%mm0
/* 0 */
@@ -470,10 +470,10 @@ ASM_NAME(dct64_3dnow):
movd %eax,%mm1
pi2fd %mm1,%mm1
#ifdef PIC_GLOBAL_PTR
movl GLOBAL_VAR_PTR(pnts),%eax
movl GLOBAL_VAR_PTR(INT123_pnts),%eax
movl 16(%eax),%eax
#else
movl 16+GLOBAL_VAR(pnts),%eax
movl 16+GLOBAL_VAR(INT123_pnts),%eax
#endif
movd 0(%eax),%mm2
/* 1.0 | cos0 */
@@ -741,8 +741,8 @@ ASM_NAME(dct64_3dnow):
#if defined(PIC) && defined(__APPLE__)
.section __IMPORT,__pointers,non_lazy_symbol_pointers
L_pnts:
.indirect_symbol ASM_NAME(pnts)
L_INT123_pnts:
.indirect_symbol ASM_NAME(INT123_pnts)
.long 0
#endif

View File

@@ -37,9 +37,9 @@ x_plus_minus_3dnow:
.text
ALIGN32
.globl ASM_NAME(dct64_3dnowext)
/* .type ASM_NAME(dct64_3dnowext), @function */
ASM_NAME(dct64_3dnowext):
.globl ASM_NAME(INT123_dct64_3dnowext)
/* .type ASM_NAME(INT123_dct64_3dnowext), @function */
ASM_NAME(INT123_dct64_3dnowext):
pushl %ebp
movl %esp, %ebp
pushl %edi
@@ -57,9 +57,9 @@ ASM_NAME(dct64_3dnowext):
movl 8(%ebp),%esi
movl 12(%ebp),%edi
#if defined(PIC) && defined(__APPLE__)
movl GLOBAL_VAR_PTR(costab_mmxsse),%ebx
movl GLOBAL_VAR_PTR(INT123_costab_mmxsse),%ebx
#else
leal GLOBAL_VAR(costab_mmxsse),%ebx
leal GLOBAL_VAR(INT123_costab_mmxsse),%ebx
#endif
leal -268(%ebp),%ecx
movq (%eax), %mm0
@@ -723,12 +723,12 @@ ASM_NAME(dct64_3dnowext):
popl %edi
leave
ret
/* .size ASM_NAME(dct64_3dnowext), .-ASM_NAME(dct64_3dnowext) */
/* .size ASM_NAME(INT123_dct64_3dnowext), .-ASM_NAME(INT123_dct64_3dnowext) */
#if defined(PIC) && defined(__APPLE__)
.section __IMPORT,__pointers,non_lazy_symbol_pointers
L_costab_mmxsse:
.indirect_symbol ASM_NAME(costab_mmxsse)
L_INT123_costab_mmxsse:
.indirect_symbol ASM_NAME(INT123_costab_mmxsse)
.long 0
#endif

View File

@@ -1,5 +1,5 @@
/*
dct64_altivec.c: Discrete Cosine Tansform (DCT) for Altivec
INT123_dct64_altivec.c: Discrete Cosine Tansform (DCT) for Altivec
copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
@@ -24,7 +24,7 @@
#include <altivec.h>
#endif
void dct64_altivec(real *out0,real *out1,real *samples)
void INT123_dct64_altivec(real *out0,real *out1,real *samples)
{
ALIGNED(16) real bufs[32];
@@ -37,7 +37,7 @@ void dct64_altivec(real *out0,real *out1,real *samples)
vector float vbs9,vbs10,vbs11,vbs12,vbs13,vbs14,vbs15,vbs16;
vector float vzero;
b1 = samples;
costab = pnts[0];
costab = INT123_pnts[0];
vzero = vec_xor(vzero,vzero);
#ifdef __APPLE__
@@ -93,7 +93,7 @@ void dct64_altivec(real *out0,real *out1,real *samples)
vbs5 = vec_perm(vbs5,vbs5,vinvert);
costab = pnts[1];
costab = INT123_pnts[1];
v1 = vec_perm(vbs4,vbs4,vinvert);
vbs9 = vec_add(vbs1,v1);
@@ -114,7 +114,7 @@ void dct64_altivec(real *out0,real *out1,real *samples)
vbs16 = vec_madd(v8,v5,vzero);
costab = pnts[2];
costab = INT123_pnts[2];
v1 = vec_perm(vbs10,vbs10,vinvert);
v5 = vec_perm(vbs14,vbs14,vinvert);
@@ -140,7 +140,7 @@ void dct64_altivec(real *out0,real *out1,real *samples)
vbs8 = vec_perm(vbs8,vbs8,vinvert);
costab = pnts[3];
costab = INT123_pnts[3];
#ifdef __APPLE__
vperm1 = (vector unsigned char)(0,1,2,3,4,5,6,7,16,17,18,19,20,21,22,23);
@@ -189,7 +189,7 @@ void dct64_altivec(real *out0,real *out1,real *samples)
vbs16 = vec_perm(v3,v5,vperm4);
costab = pnts[4];
costab = INT123_pnts[4];
v1 = vec_lde(0,costab);
#ifdef __APPLE__

View File

@@ -58,8 +58,8 @@ costab_avx:
.long 0
.text
ALIGN16
.globl ASM_NAME(dct64_avx)
ASM_NAME(dct64_avx):
.globl ASM_NAME(INT123_dct64_avx)
ASM_NAME(INT123_dct64_avx):
#ifdef IS_MSABI
push %rbp
mov %rsp, %rbp

View File

@@ -58,8 +58,8 @@ costab_avx:
.long 0
.text
ALIGN16
.globl ASM_NAME(dct64_real_avx)
ASM_NAME(dct64_real_avx):
.globl ASM_NAME(INT123_dct64_real_avx)
ASM_NAME(INT123_dct64_real_avx):
#ifdef IS_MSABI
push %rbp
mov %rsp, %rbp

View File

@@ -1,5 +1,5 @@
/*
dct64_i386.c: DCT64, a C variant for i386
INT123_dct64_i386.c: DCT64, a C variant for i386
copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
@@ -10,7 +10,7 @@
* Discrete Cosine Tansform (DCT) for subband synthesis
* optimized for machines with no auto-increment.
* The performance is highly compiler dependend. Maybe
* the dct64.c version for 'normal' processor may be faster
* the INT123_dct64.c version for 'normal' processor may be faster
* even for Intel processors.
*/
@@ -19,7 +19,7 @@
static void dct64_1(real *out0,real *out1,real *b1,real *b2,real *samples)
{
{
register const real *costab = pnts[0];
register const real *costab = INT123_pnts[0];
b1[0x00] = samples[0x00] + samples[0x1F];
b1[0x01] = samples[0x01] + samples[0x1E];
@@ -65,7 +65,7 @@ static void dct64_1(real *out0,real *out1,real *b1,real *b2,real *samples)
{
register const real *costab = pnts[1];
register const real *costab = INT123_pnts[1];
b2[0x00] = b1[0x00] + b1[0x0F];
b2[0x01] = b1[0x01] + b1[0x0E];
@@ -111,7 +111,7 @@ static void dct64_1(real *out0,real *out1,real *b1,real *b2,real *samples)
}
{
register const real *costab = pnts[2];
register const real *costab = INT123_pnts[2];
b1[0x00] = b2[0x00] + b2[0x07];
b1[0x07] = REAL_MUL(b2[0x00] - b2[0x07], costab[0]);
@@ -151,8 +151,8 @@ static void dct64_1(real *out0,real *out1,real *b1,real *b2,real *samples)
}
{
register real const cos0 = pnts[3][0];
register real const cos1 = pnts[3][1];
register real const cos0 = INT123_pnts[3][0];
register real const cos1 = INT123_pnts[3][1];
b2[0x00] = b1[0x00] + b1[0x03];
b2[0x03] = REAL_MUL(b1[0x00] - b1[0x03], cos0);
@@ -196,7 +196,7 @@ static void dct64_1(real *out0,real *out1,real *b1,real *b2,real *samples)
}
{
register real const cos0 = pnts[4][0];
register real const cos0 = INT123_pnts[4][0];
b1[0x00] = b2[0x00] + b2[0x01];
b1[0x01] = REAL_MUL(b2[0x00] - b2[0x01], cos0);
@@ -325,10 +325,10 @@ static void dct64_1(real *out0,real *out1,real *b1,real *b2,real *samples)
}
/*
* the call via dct64 is a trick to force GCC to use
* the call via INT123_dct64 is a trick to force GCC to use
* (new) registers for the b1,b2 pointer to the bufs[xx] field
*/
void dct64_i386(real *a,real *b,real *c)
void INT123_dct64_i386(real *a,real *b,real *c)
{
real bufs[0x40];
dct64_1(a,b,bufs,bufs+0x20,c);

View File

@@ -1,5 +1,5 @@
/*
dct64_i486.c: DCT64, a plain C variant for i486
INT123_dct64_i486.c: DCT64, a plain C variant for i486
copyright 1998-2006 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
@@ -314,10 +314,10 @@ void dct64_1_486(int *out0,int *out1,int *b1,int *b2)
/*
* the call via dct64 is a trick to force GCC to use
* the call via INT123_dct64 is a trick to force GCC to use
* (new) registers for the b1,b2 pointer to the bufs[xx] field
*/
void dct64_i486(int *a,int *b,real *samples)
void INT123_dct64_i486(int *a,int *b,real *samples)
{
int bufs[64];
int i;

View File

@@ -11,12 +11,12 @@
.text
ALIGN32
.globl ASM_NAME(dct64_mmx)
ASM_NAME(dct64_mmx):
.globl ASM_NAME(INT123_dct64_mmx)
ASM_NAME(INT123_dct64_mmx):
xorl %ecx,%ecx
.globl ASM_NAME(dct64_MMX)
ASM_NAME(dct64_MMX):
.globl ASM_NAME(INT123_dct64_MMX)
ASM_NAME(INT123_dct64_MMX):
pushl %ebx
pushl %esi
pushl %edi
@@ -33,9 +33,9 @@ ASM_NAME(dct64_MMX):
movl 276(%esp),%edi
flds 4(%eax)
#ifdef PIC_GLOBAL_PTR
movl GLOBAL_VAR_PTR(costab_mmxsse),%ebx
movl GLOBAL_VAR_PTR(INT123_costab_mmxsse),%ebx
#else
leal GLOBAL_VAR(costab_mmxsse),%ebx
leal GLOBAL_VAR(INT123_costab_mmxsse),%ebx
#endif
fadds 120(%eax)
orl %ecx,%ecx
@@ -817,8 +817,8 @@ ASM_NAME(dct64_MMX):
#if defined(PIC) && defined(__APPLE__)
.section __IMPORT,__pointers,non_lazy_symbol_pointers
L_costab_mmxsse:
.indirect_symbol ASM_NAME(costab_mmxsse)
L_INT123_costab_mmxsse:
.indirect_symbol ASM_NAME(INT123_costab_mmxsse)
.long 0
#endif

View File

@@ -51,11 +51,11 @@ costab_arm:
.word 1060439283
.word 1060439283
ALIGN4
GLOBAL_SYMBOL ASM_NAME(dct64_neon)
GLOBAL_SYMBOL ASM_NAME(INT123_dct64_neon)
#ifdef __ELF__
.type ASM_NAME(dct64_neon), %function
.type ASM_NAME(INT123_dct64_neon), %function
#endif
ASM_NAME(dct64_neon):
ASM_NAME(INT123_dct64_neon):
vpush {q4-q7}
adr r3, costab_arm

View File

@@ -49,11 +49,11 @@ costab_neon_aarch64:
.word 1060439283
.text
ALIGN4
.globl ASM_NAME(dct64_neon64)
.globl ASM_NAME(INT123_dct64_neon64)
#ifdef __ELF__
.type ASM_NAME(dct64_neon64), %function
.type ASM_NAME(INT123_dct64_neon64), %function
#endif
ASM_NAME(dct64_neon64):
ASM_NAME(INT123_dct64_neon64):
add x3, x2, #64
adrp x4, AARCH64_PCREL_HI(costab_neon_aarch64)
add x4, x4, AARCH64_PCREL_LO(costab_neon_aarch64)

View File

@@ -49,11 +49,11 @@ costab_neon_aarch64:
.word 1060439283
.text
ALIGN4
.globl ASM_NAME(dct64_real_neon64)
.globl ASM_NAME(INT123_dct64_real_neon64)
#ifdef __ELF__
.type ASM_NAME(dct64_real_neon64), %function
.type ASM_NAME(INT123_dct64_real_neon64), %function
#endif
ASM_NAME(dct64_real_neon64):
ASM_NAME(INT123_dct64_real_neon64):
add x3, x2, #64
adrp x4, AARCH64_PCREL_HI(costab_neon_aarch64)
add x4, x4, AARCH64_PCREL_LO(costab_neon_aarch64)

View File

@@ -51,11 +51,11 @@ costab_arm:
.word 1060439283
.word 1060439283
ALIGN4
GLOBAL_SYMBOL ASM_NAME(dct64_real_neon)
GLOBAL_SYMBOL ASM_NAME(INT123_dct64_real_neon)
#ifdef __ELF__
.type ASM_NAME(dct64_real_neon), %function
.type ASM_NAME(INT123_dct64_real_neon), %function
#endif
ASM_NAME(dct64_real_neon):
ASM_NAME(INT123_dct64_real_neon):
vpush {q4-q7}
adr r3, costab_arm

View File

@@ -36,8 +36,8 @@ mask:
.text
ALIGN16
.globl ASM_NAME(dct64_sse)
ASM_NAME(dct64_sse):
.globl ASM_NAME(INT123_dct64_sse)
ASM_NAME(INT123_dct64_sse):
pushl %ebp
movl %esp, %ebp
@@ -78,9 +78,9 @@ ASM_NAME(dct64_sse):
subps %xmm1, %xmm4
#ifdef PIC_GLOBAL_PTR
mov GLOBAL_VAR_PTR(costab_mmxsse), %ecx
mov GLOBAL_VAR_PTR(INT123_costab_mmxsse), %ecx
#else
lea GLOBAL_VAR(costab_mmxsse), %ecx
lea GLOBAL_VAR(INT123_costab_mmxsse), %ecx
#endif
mulps (%ecx), %xmm7
mulps 16(%ecx), %xmm6
@@ -464,8 +464,8 @@ ASM_NAME(dct64_sse):
#if defined(PIC) && defined(__APPLE__)
.section __IMPORT,__pointers,non_lazy_symbol_pointers
L_costab_mmxsse:
.indirect_symbol ASM_NAME(costab_mmxsse)
L_INT123_costab_mmxsse:
.indirect_symbol ASM_NAME(INT123_costab_mmxsse)
.long 0
#endif

View File

@@ -36,8 +36,8 @@ mask:
.text
ALIGN16
.globl ASM_NAME(dct64_real_sse)
ASM_NAME(dct64_real_sse):
.globl ASM_NAME(INT123_dct64_real_sse)
ASM_NAME(INT123_dct64_real_sse):
pushl %ebp
movl %esp, %ebp
@@ -78,9 +78,9 @@ ASM_NAME(dct64_real_sse):
subps %xmm1, %xmm4
#ifdef PIC_GLOBAL_PTR
mov GLOBAL_VAR_PTR(costab_mmxsse), %eax
mov GLOBAL_VAR_PTR(INT123_costab_mmxsse), %eax
#else
lea GLOBAL_VAR(costab_mmxsse), %eax
lea GLOBAL_VAR(INT123_costab_mmxsse), %eax
#endif
mulps (%eax), %xmm7
mulps 16(%eax), %xmm6
@@ -409,8 +409,8 @@ ASM_NAME(dct64_real_sse):
#if defined(PIC) && defined(__APPLE__)
.section __IMPORT,__pointers,non_lazy_symbol_pointers
L_costab_mmxsse:
.indirect_symbol ASM_NAME(costab_mmxsse)
L_INT123_costab_mmxsse:
.indirect_symbol ASM_NAME(INT123_costab_mmxsse)
.long 0
#endif

View File

@@ -34,7 +34,7 @@
.data
#endif
ALIGN32
ASM_NAME(costab_x86_64):
ASM_NAME(INT123_costab_x86_64):
.long 1056974725
.long 1057056395
.long 1057223771
@@ -69,8 +69,8 @@ ASM_NAME(costab_x86_64):
.long 0
.text
ALIGN16
.globl ASM_NAME(dct64_x86_64)
ASM_NAME(dct64_x86_64):
.globl ASM_NAME(INT123_dct64_x86_64)
ASM_NAME(INT123_dct64_x86_64):
#ifdef IS_MSABI /* should save xmm6-15 */
movq %rcx, ARG0
subq $168, %rsp /* stack alignment + 10 xmm registers */
@@ -86,7 +86,7 @@ ASM_NAME(dct64_x86_64):
movaps %xmm15, 144(%rsp)
#endif
leaq ASM_NAME(costab_x86_64)(%rip), %rcx
leaq ASM_NAME(INT123_costab_x86_64)(%rip), %rcx
MOVUAPS (ARG2), %xmm15
MOVUAPS 16(ARG2), %xmm14

View File

@@ -34,7 +34,7 @@
.data
#endif
ALIGN32
ASM_NAME(costab_x86_64):
ASM_NAME(INT123_costab_x86_64):
.long 1056974725
.long 1057056395
.long 1057223771
@@ -69,8 +69,8 @@ ASM_NAME(costab_x86_64):
.long 0
.text
ALIGN16
.globl ASM_NAME(dct64_real_x86_64)
ASM_NAME(dct64_real_x86_64):
.globl ASM_NAME(INT123_dct64_real_x86_64)
ASM_NAME(INT123_dct64_real_x86_64):
#ifdef IS_MSABI /* should save xmm6-15 */
movq %rcx, ARG0
subq $168, %rsp /* stack alignment + 10 xmm registers */
@@ -86,7 +86,7 @@ ASM_NAME(dct64_real_x86_64):
movaps %xmm15, 144(%rsp)
#endif
leaq ASM_NAME(costab_x86_64)(%rip), %rcx
leaq ASM_NAME(INT123_costab_x86_64)(%rip), %rcx
MOVUAPS (ARG2), %xmm15
MOVUAPS 16(ARG2), %xmm14

View File

@@ -4,7 +4,7 @@
This file is strongly tied with optimize.h concerning the synth functions.
Perhaps one should restructure that a bit.
copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis, taking WRITE_SAMPLE from decode.c
*/
@@ -30,7 +30,7 @@
#define NTOM_MAX 8 /* maximum allowed factor for upsampling */
#define NTOM_MAX_FREQ 96000 /* maximum frequency to upsample to / downsample from */
#define NTOM_MUL (32768)
void ntom_set_ntom(mpg123_handle *fr, off_t num);
void INT123_ntom_set_ntom(mpg123_handle *fr, int64_t num);
#endif
/* Let's collect all possible synth functions here, for an overview.
@@ -39,84 +39,84 @@ void ntom_set_ntom(mpg123_handle *fr, off_t num);
#ifndef NO_16BIT
/* The signed-16bit-producing variants. */
int synth_1to1 (real*, int, mpg123_handle*, int);
int synth_1to1_dither (real*, int, mpg123_handle*, int);
int synth_1to1_i386 (real*, int, mpg123_handle*, int);
int synth_1to1_i586 (real*, int, mpg123_handle*, int);
int synth_1to1_i586_dither(real*, int, mpg123_handle*, int);
int synth_1to1_mmx (real*, int, mpg123_handle*, int);
int synth_1to1_3dnow (real*, int, mpg123_handle*, int);
int synth_1to1_sse (real*, int, mpg123_handle*, int);
int synth_1to1_stereo_sse (real*, real*, mpg123_handle*);
int synth_1to1_3dnowext (real*, int, mpg123_handle*, int);
int synth_1to1_altivec (real*, int, mpg123_handle*, int);
int synth_1to1_stereo_altivec(real*, real*, mpg123_handle*);
int synth_1to1_x86_64 (real*, int, mpg123_handle*, int);
int synth_1to1_stereo_x86_64(real*, real*, mpg123_handle*);
int synth_1to1_avx (real*, int, mpg123_handle*, int);
int synth_1to1_stereo_avx (real*, real*, mpg123_handle*);
int synth_1to1_arm (real*, int, mpg123_handle*, int);
int synth_1to1_neon (real*, int, mpg123_handle*, int);
int synth_1to1_stereo_neon(real*, real*, mpg123_handle*);
int synth_1to1_neon64 (real*, int, mpg123_handle*, int);
int synth_1to1_stereo_neon64(real*, real*, mpg123_handle*);
int INT123_synth_1to1 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_dither (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_i586 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_i586_dither(real*, int, mpg123_handle*, int);
int INT123_synth_1to1_mmx (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_3dnow (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_sse (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_stereo_sse (real*, real*, mpg123_handle*);
int INT123_synth_1to1_3dnowext (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_altivec (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_stereo_altivec(real*, real*, mpg123_handle*);
int INT123_synth_1to1_x86_64 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_stereo_x86_64(real*, real*, mpg123_handle*);
int INT123_synth_1to1_avx (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_stereo_avx (real*, real*, mpg123_handle*);
int INT123_synth_1to1_arm (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_neon (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_stereo_neon(real*, real*, mpg123_handle*);
int INT123_synth_1to1_neon64 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_stereo_neon64(real*, real*, mpg123_handle*);
/* This is different, special usage in layer3.c only.
Hence, the name... and now forget about it.
Never use it outside that special portion of code inside layer3.c! */
int absynth_1to1_i486(real*, int, mpg123_handle*, int);
int INT123_absynth_1to1_i486(real*, int, mpg123_handle*, int);
/* These mono/stereo converters use one of the above for the grunt work. */
int synth_1to1_mono (real*, mpg123_handle*);
int synth_1to1_m2s(real*, mpg123_handle*);
int INT123_synth_1to1_mono (real*, mpg123_handle*);
int INT123_synth_1to1_m2s(real*, mpg123_handle*);
/* Sample rate decimation comes in less flavours. */
#ifndef NO_DOWNSAMPLE
int synth_2to1 (real*, int, mpg123_handle*, int);
int synth_2to1_dither (real*, int, mpg123_handle*, int);
int synth_2to1_i386 (real*, int, mpg123_handle*, int);
int synth_2to1_mono (real*, mpg123_handle*);
int synth_2to1_m2s(real*, mpg123_handle*);
int synth_4to1 (real *,int, mpg123_handle*, int);
int synth_4to1_dither (real *,int, mpg123_handle*, int);
int synth_4to1_i386 (real*, int, mpg123_handle*, int);
int synth_4to1_mono (real*, mpg123_handle*);
int synth_4to1_m2s(real*, mpg123_handle*);
int INT123_synth_2to1 (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_dither (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_mono (real*, mpg123_handle*);
int INT123_synth_2to1_m2s(real*, mpg123_handle*);
int INT123_synth_4to1 (real *,int, mpg123_handle*, int);
int INT123_synth_4to1_dither (real *,int, mpg123_handle*, int);
int INT123_synth_4to1_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_mono (real*, mpg123_handle*);
int INT123_synth_4to1_m2s(real*, mpg123_handle*);
#endif
#ifndef NO_NTOM
/* NtoM is really just one implementation. */
int synth_ntom (real *,int, mpg123_handle*, int);
int synth_ntom_mono (real *, mpg123_handle *);
int synth_ntom_m2s (real *, mpg123_handle *);
int INT123_synth_ntom (real *,int, mpg123_handle*, int);
int INT123_synth_ntom_mono (real *, mpg123_handle *);
int INT123_synth_ntom_m2s (real *, mpg123_handle *);
#endif
#endif
#ifndef NO_8BIT
/* The 8bit-producing variants. */
/* There are direct 8-bit synths and wrappers over a possibly optimized 16bit one. */
int synth_1to1_8bit (real*, int, mpg123_handle*, int);
int synth_1to1_8bit_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_8bit (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_8bit_i386 (real*, int, mpg123_handle*, int);
#ifndef NO_16BIT
int synth_1to1_8bit_wrap (real*, int, mpg123_handle*, int);
int synth_1to1_8bit_mono (real*, mpg123_handle*);
int INT123_synth_1to1_8bit_wrap (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_8bit_mono (real*, mpg123_handle*);
#endif
int synth_1to1_8bit_m2s(real*, mpg123_handle*);
int INT123_synth_1to1_8bit_m2s(real*, mpg123_handle*);
#ifndef NO_16BIT
int synth_1to1_8bit_wrap_mono (real*, mpg123_handle*);
int synth_1to1_8bit_wrap_m2s(real*, mpg123_handle*);
int INT123_synth_1to1_8bit_wrap_mono (real*, mpg123_handle*);
int INT123_synth_1to1_8bit_wrap_m2s(real*, mpg123_handle*);
#endif
#ifndef NO_DOWNSAMPLE
int synth_2to1_8bit (real*, int, mpg123_handle*, int);
int synth_2to1_8bit_i386 (real*, int, mpg123_handle*, int);
int synth_2to1_8bit_mono (real*, mpg123_handle*);
int synth_2to1_8bit_m2s(real*, mpg123_handle*);
int synth_4to1_8bit (real*, int, mpg123_handle*, int);
int synth_4to1_8bit_i386 (real*, int, mpg123_handle*, int);
int synth_4to1_8bit_mono (real*, mpg123_handle*);
int synth_4to1_8bit_m2s(real*, mpg123_handle*);
int INT123_synth_2to1_8bit (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_8bit_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_8bit_mono (real*, mpg123_handle*);
int INT123_synth_2to1_8bit_m2s(real*, mpg123_handle*);
int INT123_synth_4to1_8bit (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_8bit_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_8bit_mono (real*, mpg123_handle*);
int INT123_synth_4to1_8bit_m2s(real*, mpg123_handle*);
#endif
#ifndef NO_NTOM
int synth_ntom_8bit (real*, int, mpg123_handle*, int);
int synth_ntom_8bit_mono (real*, mpg123_handle*);
int synth_ntom_8bit_m2s(real*, mpg123_handle*);
int INT123_synth_ntom_8bit (real*, int, mpg123_handle*, int);
int INT123_synth_ntom_8bit_mono (real*, mpg123_handle*);
int INT123_synth_ntom_8bit_m2s(real*, mpg123_handle*);
#endif
#endif
@@ -124,153 +124,153 @@ int synth_ntom_8bit_m2s(real*, mpg123_handle*);
#ifndef NO_REAL
/* The real-producing variants. */
int synth_1to1_real (real*, int, mpg123_handle*, int);
int synth_1to1_real_i386 (real*, int, mpg123_handle*, int);
int synth_1to1_real_sse (real*, int, mpg123_handle*, int);
int synth_1to1_real_stereo_sse (real*, real*, mpg123_handle*);
int synth_1to1_real_x86_64 (real*, int, mpg123_handle*, int);
int synth_1to1_real_stereo_x86_64(real*, real*, mpg123_handle*);
int synth_1to1_real_avx (real*, int, mpg123_handle*, int);
int synth_1to1_fltst_avx (real*, real*, mpg123_handle*);
int synth_1to1_real_altivec (real*, int, mpg123_handle*, int);
int synth_1to1_fltst_altivec(real*, real*, mpg123_handle*);
int synth_1to1_real_neon (real*, int, mpg123_handle*, int);
int synth_1to1_real_stereo_neon(real*, real*, mpg123_handle*);
int synth_1to1_real_neon64 (real*, int, mpg123_handle*, int);
int synth_1to1_fltst_neon64(real*, real*, mpg123_handle*);
int synth_1to1_real_mono (real*, mpg123_handle*);
int synth_1to1_real_m2s(real*, mpg123_handle*);
int INT123_synth_1to1_real (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_real_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_real_sse (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_real_stereo_sse (real*, real*, mpg123_handle*);
int INT123_synth_1to1_real_x86_64 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_real_stereo_x86_64(real*, real*, mpg123_handle*);
int INT123_synth_1to1_real_avx (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_fltst_avx (real*, real*, mpg123_handle*);
int INT123_synth_1to1_real_altivec (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_fltst_altivec(real*, real*, mpg123_handle*);
int INT123_synth_1to1_real_neon (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_real_stereo_neon(real*, real*, mpg123_handle*);
int INT123_synth_1to1_real_neon64 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_fltst_neon64(real*, real*, mpg123_handle*);
int INT123_synth_1to1_real_mono (real*, mpg123_handle*);
int INT123_synth_1to1_real_m2s(real*, mpg123_handle*);
#ifndef NO_DOWNSAMPLE
int synth_2to1_real (real*, int, mpg123_handle*, int);
int synth_2to1_real_i386 (real*, int, mpg123_handle*, int);
int synth_2to1_real_mono (real*, mpg123_handle*);
int synth_2to1_real_m2s(real*, mpg123_handle*);
int synth_4to1_real (real*, int, mpg123_handle*, int);
int synth_4to1_real_i386 (real*, int, mpg123_handle*, int);
int synth_4to1_real_mono (real*, mpg123_handle*);
int synth_4to1_real_m2s(real*, mpg123_handle*);
int INT123_synth_2to1_real (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_real_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_real_mono (real*, mpg123_handle*);
int INT123_synth_2to1_real_m2s(real*, mpg123_handle*);
int INT123_synth_4to1_real (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_real_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_real_mono (real*, mpg123_handle*);
int INT123_synth_4to1_real_m2s(real*, mpg123_handle*);
#endif
#ifndef NO_NTOM
int synth_ntom_real (real*, int, mpg123_handle*, int);
int synth_ntom_real_mono (real*, mpg123_handle*);
int synth_ntom_real_m2s(real*, mpg123_handle*);
int INT123_synth_ntom_real (real*, int, mpg123_handle*, int);
int INT123_synth_ntom_real_mono (real*, mpg123_handle*);
int INT123_synth_ntom_real_m2s(real*, mpg123_handle*);
#endif
#endif
#ifndef NO_32BIT
/* 32bit integer */
int synth_1to1_s32 (real*, int, mpg123_handle*, int);
int synth_1to1_s32_i386 (real*, int, mpg123_handle*, int);
int synth_1to1_s32_sse (real*, int, mpg123_handle*, int);
int synth_1to1_s32_stereo_sse (real*, real*, mpg123_handle*);
int synth_1to1_s32_x86_64 (real*, int, mpg123_handle*, int);
int synth_1to1_s32_stereo_x86_64(real*, real*, mpg123_handle*);
int synth_1to1_s32_avx (real*, int, mpg123_handle*, int);
int synth_1to1_s32_stereo_avx (real*, real*, mpg123_handle*);
int synth_1to1_s32_altivec (real*, int, mpg123_handle*, int);
int synth_1to1_s32_stereo_altivec(real*, real*, mpg123_handle*);
int synth_1to1_s32_neon (real*, int, mpg123_handle*, int);
int synth_1to1_s32_stereo_neon(real*, real*, mpg123_handle*);
int synth_1to1_s32_neon64 (real*, int, mpg123_handle*, int);
int synth_1to1_s32st_neon64(real*, real*, mpg123_handle*);
int synth_1to1_s32_mono (real*, mpg123_handle*);
int synth_1to1_s32_m2s(real*, mpg123_handle*);
int INT123_synth_1to1_s32 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_sse (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_stereo_sse (real*, real*, mpg123_handle*);
int INT123_synth_1to1_s32_x86_64 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_stereo_x86_64(real*, real*, mpg123_handle*);
int INT123_synth_1to1_s32_avx (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_stereo_avx (real*, real*, mpg123_handle*);
int INT123_synth_1to1_s32_altivec (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_stereo_altivec(real*, real*, mpg123_handle*);
int INT123_synth_1to1_s32_neon (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_stereo_neon(real*, real*, mpg123_handle*);
int INT123_synth_1to1_s32_neon64 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32st_neon64(real*, real*, mpg123_handle*);
int INT123_synth_1to1_s32_mono (real*, mpg123_handle*);
int INT123_synth_1to1_s32_m2s(real*, mpg123_handle*);
#ifndef NO_DOWNSAMPLE
int synth_2to1_s32 (real*, int, mpg123_handle*, int);
int synth_2to1_s32_i386 (real*, int, mpg123_handle*, int);
int synth_2to1_s32_mono (real*, mpg123_handle*);
int synth_2to1_s32_m2s(real*, mpg123_handle*);
int synth_4to1_s32 (real*, int, mpg123_handle*, int);
int synth_4to1_s32_i386 (real*, int, mpg123_handle*, int);
int synth_4to1_s32_mono (real*, mpg123_handle*);
int synth_4to1_s32_m2s(real*, mpg123_handle*);
int INT123_synth_2to1_s32 (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_s32_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_s32_mono (real*, mpg123_handle*);
int INT123_synth_2to1_s32_m2s(real*, mpg123_handle*);
int INT123_synth_4to1_s32 (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_s32_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_s32_mono (real*, mpg123_handle*);
int INT123_synth_4to1_s32_m2s(real*, mpg123_handle*);
#endif
#ifndef NO_NTOM
int synth_ntom_s32 (real*, int, mpg123_handle*, int);
int synth_ntom_s32_mono (real*, mpg123_handle*);
int synth_ntom_s32_m2s(real*, mpg123_handle*);
int INT123_synth_ntom_s32 (real*, int, mpg123_handle*, int);
int INT123_synth_ntom_s32_mono (real*, mpg123_handle*);
int INT123_synth_ntom_s32_m2s(real*, mpg123_handle*);
#endif
#endif
#endif /* FIXED */
/* Inside these synth functions, some dct64 variants may be used.
/* Inside these synth functions, some INT123_dct64 variants may be used.
The special optimized ones that only appear in assembler code are not mentioned here.
And, generally, these functions are only employed in a matching synth function. */
void dct64 (real *,real *,real *);
void dct64_i386 (real *,real *,real *);
void dct64_altivec(real *,real *,real *);
void dct64_i486(int*, int* , real*); /* Yeah, of no use outside of synth_i486.c .*/
void INT123_dct64 (real *,real *,real *);
void INT123_dct64_i386 (real *,real *,real *);
void INT123_dct64_altivec(real *,real *,real *);
void INT123_dct64_i486(int*, int* , real*); /* Yeah, of no use outside of synth_i486.c .*/
/* This is used by the layer 3 decoder, one generic function and 3DNow variants. */
void dct36 (real *,real *,real *,const real *,real *);
void dct36_3dnow (real *,real *,real *,const real *,real *);
void dct36_3dnowext(real *,real *,real *,const real *,real *);
void dct36_x86_64 (real *,real *,real *,const real *,real *);
void dct36_sse (real *,real *,real *,const real *,real *);
void dct36_avx (real *,real *,real *,const real *,real *);
void dct36_neon (real *,real *,real *,const real *,real *);
void dct36_neon64 (real *,real *,real *,const real *,real *);
void INT123_dct36 (real *,real *,real *,const real *,real *);
void INT123_dct36_3dnow (real *,real *,real *,const real *,real *);
void INT123_dct36_3dnowext(real *,real *,real *,const real *,real *);
void INT123_dct36_x86_64 (real *,real *,real *,const real *,real *);
void INT123_dct36_sse (real *,real *,real *,const real *,real *);
void INT123_dct36_avx (real *,real *,real *,const real *,real *);
void INT123_dct36_neon (real *,real *,real *,const real *,real *);
void INT123_dct36_neon64 (real *,real *,real *,const real *,real *);
/* Tools for NtoM resampling synth, defined in ntom.c . */
int synth_ntom_set_step(mpg123_handle *fr); /* prepare ntom decoding */
unsigned long ntom_val(mpg123_handle *fr, off_t frame); /* compute ntom_val for frame offset */
int INT123_synth_ntom_set_step(mpg123_handle *fr); /* prepare ntom decoding */
unsigned long INT123_ntom_val(mpg123_handle *fr, int64_t frame); /* compute INT123_ntom_val for frame offset */
/* Frame and sample offsets. */
#ifndef NO_NTOM
/*
Outsamples of _this_ frame.
To be exact: The samples to be expected from the next frame decode (using the current ntom_val). When you already decoded _this_ frame, this is the number of samples to be expected from the next one.
To be exact: The samples to be expected from the next frame decode (using the current INT123_ntom_val). When you already decoded _this_ frame, this is the number of samples to be expected from the next one.
*/
off_t ntom_frame_outsamples(mpg123_handle *fr);
int64_t INT123_ntom_frame_outsamples(mpg123_handle *fr);
/* Total out/insample offset. */
off_t ntom_frmouts(mpg123_handle *fr, off_t frame);
off_t ntom_ins2outs(mpg123_handle *fr, off_t ins);
off_t ntom_frameoff(mpg123_handle *fr, off_t soff);
int64_t INT123_ntom_frmouts(mpg123_handle *fr, int64_t frame);
int64_t INT123_ntom_ins2outs(mpg123_handle *fr, int64_t ins);
int64_t INT123_ntom_frameoff(mpg123_handle *fr, int64_t soff);
#endif
/* Initialization of any static data that majy be needed at runtime.
Make sure you call these once before it is too late. */
#ifndef NO_LAYER3
#ifdef RUNTIME_TABLES
void init_layer3(void);
void INT123_init_layer3(void);
#endif
real init_layer3_gainpow2(mpg123_handle *fr, int i);
void init_layer3_stuff(mpg123_handle *fr, real (*gainpow2)(mpg123_handle *fr, int i));
real INT123_init_layer3_gainpow2(mpg123_handle *fr, int i);
void INT123_init_layer3_stuff(mpg123_handle *fr, real (*gainpow2)(mpg123_handle *fr, int i));
#endif
#ifndef NO_LAYER12
#ifdef RUNTIME_TABLES
void init_layer12(void);
void INT123_init_layer12(void);
#endif
real* init_layer12_table(mpg123_handle *fr, real *table, int m);
void init_layer12_stuff(mpg123_handle *fr, real* (*init_table)(mpg123_handle *fr, real *table, int m));
real* INT123_init_layer12_table(mpg123_handle *fr, real *table, int m);
void INT123_init_layer12_stuff(mpg123_handle *fr, real* (*init_table)(mpg123_handle *fr, real *table, int m));
#endif
#ifdef RUNTIME_TABLES
void init_costabs(void);
void INT123_init_costabs(void);
#else
const
#endif
extern real *pnts[5]; /* costab.h provides, dct64 needs */
extern real *INT123_pnts[5]; /* costab.h provides, INT123_dct64 needs */
/* Runtime (re)init functions; needed more often. */
void make_decode_tables(mpg123_handle *fr); /* For every volume change. */
/* Stuff needed after updating synth setup (see set_synth_functions()). */
void INT123_make_decode_tables(mpg123_handle *fr); /* For every volume change. */
/* Stuff needed after updating synth setup (see INT123_set_synth_functions()). */
#ifdef OPT_MMXORSSE
/* Special treatment for mmx-like decoders, these functions go into the slots below. */
void make_decode_tables_mmx(mpg123_handle *fr);
void INT123_make_decode_tables_mmx(mpg123_handle *fr);
#ifndef NO_LAYER3
real init_layer3_gainpow2_mmx(mpg123_handle *fr, int i);
real INT123_init_layer3_gainpow2_mmx(mpg123_handle *fr, int i);
#endif
#ifndef NO_LAYER12
real* init_layer12_table_mmx(mpg123_handle *fr, real *table, int m);
real* INT123_init_layer12_table_mmx(mpg123_handle *fr, real *table, int m);
#endif
#endif
#ifndef NO_8BIT
/* Needed when switching to 8bit output. */
int make_conv16to8_table(mpg123_handle *fr);
int INT123_make_conv16to8_table(mpg123_handle *fr);
#endif
/* These are the actual workers.
@@ -278,15 +278,15 @@ int make_conv16to8_table(mpg123_handle *fr);
The synth functions defined above are called from inside the layer handlers. */
#ifndef NO_LAYER3
int do_layer3(mpg123_handle *fr);
int INT123_do_layer3(mpg123_handle *fr);
#endif
#ifndef NO_LAYER2
int do_layer2(mpg123_handle *fr);
int INT123_do_layer2(mpg123_handle *fr);
#endif
#ifndef NO_LAYER1
int do_layer1(mpg123_handle *fr);
int INT123_do_layer1(mpg123_handle *fr);
#endif
/* There's an 3DNow counterpart in asm. */
void do_equalizer(real *bandPtr,int channel, real equalizer[2][32]);
void INT123_do_equalizer(real *bandPtr,int channel, real equalizer[2][32]);
#endif

View File

@@ -1,3 +1,2 @@
/* Hack to allow building the same code with and without libtool. */
#include "intsym.h"
#include "dither_impl.h"

View File

@@ -18,6 +18,6 @@ enum mpg123_noise_type
};
void mpg123_noise(float* table, size_t count, enum mpg123_noise_type noisetype);
void dither_table_init(float *dithertable);
void INT123_dither_table_init(float *dithertable);
#endif

View File

@@ -113,7 +113,7 @@ void mpg123_noise(float* table, size_t count, enum mpg123_noise_type noisetype)
}
/* Generate white noise and shape it with a high pass filter. */
void dither_table_init(float *dithertable)
void INT123_dither_table_init(float *dithertable)
{
highpass_tpdf_noise(dithertable, DITHERSIZE);
}

View File

@@ -9,7 +9,7 @@
#include "mpg123lib_intern.h"
void do_equalizer(real *bandPtr,int channel, real equalizer[2][32])
void INT123_do_equalizer(real *bandPtr,int channel, real equalizer[2][32])
{
int i;
for(i=0;i<32;i++)

View File

@@ -10,10 +10,10 @@
.text
ALIGN4
.globl ASM_NAME(do_equalizer_3dnow)
/* .type ASM_NAME(do_equalizer_3dnow),@function */
.globl ASM_NAME(INT123_do_equalizer_3dnow)
/* .type ASM_NAME(INT123_do_equalizer_3dnow),@function */
/* void do_equalizer(real *bandPtr,int channel, real equalizer[2][32]); */
ASM_NAME(do_equalizer_3dnow):
ASM_NAME(INT123_do_equalizer_3dnow):
pushl %esi
pushl %ebx
/* bandPtr */

View File

@@ -1,7 +1,7 @@
/*
format: routines to deal with audio (output) format
copyright 2008-20 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2008-23 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis, starting with parts of the old audio.c, with only faintly manage to show now
@@ -223,7 +223,7 @@ eend:
/* match constraints against supported audio formats, store possible setup in frame
return: -1: error; 0: no format change; 1: format change */
int frame_output_format(mpg123_handle *fr)
int INT123_frame_output_format(mpg123_handle *fr)
{
struct audioformat nf;
int f0=0;
@@ -232,7 +232,7 @@ int frame_output_format(mpg123_handle *fr)
int try_float = (p->flags & MPG123_FLOAT_FALLBACK) ? 0 : 1;
/* initialize new format, encoding comes later */
nf.channels = fr->stereo;
mdebug("native frame format: %d ch @ %ld Hz", fr->stereo, frame_freq(fr));
mdebug("native frame format: %d ch @ %ld Hz", fr->stereo, INT123_frame_freq(fr));
// I intended the forcing stuff to be weaved into the format support table,
// but this probably will never happen, as this would change library behaviour.
// One could introduce an additional effective format table that takes for
@@ -287,30 +287,30 @@ int frame_output_format(mpg123_handle *fr)
}
#endif
// Native decoder rate first.
if(enc_chan_fit(p, frame_freq(fr)>>p->down_sample, &nf, f0, f2, try_float))
if(enc_chan_fit(p, INT123_frame_freq(fr)>>p->down_sample, &nf, f0, f2, try_float))
goto end;
// Then downsamplings.
if(p->flags & MPG123_AUTO_RESAMPLE && p->down_sample < 2)
{
if(enc_chan_fit( p, frame_freq(fr)>>(p->down_sample+1), &nf
if(enc_chan_fit( p, INT123_frame_freq(fr)>>(p->down_sample+1), &nf
, f0, f2, try_float ))
goto end;
if(p->down_sample < 1 && enc_chan_fit( p, frame_freq(fr)>>2, &nf
if(p->down_sample < 1 && enc_chan_fit( p, INT123_frame_freq(fr)>>2, &nf
, f0, f2, try_float ))
goto end;
}
// And again the whole deal with float fallback.
if(!try_float)
{
if(enc_chan_fit(p, frame_freq(fr)>>p->down_sample, &nf, f0, f2, TRUE))
if(enc_chan_fit(p, INT123_frame_freq(fr)>>p->down_sample, &nf, f0, f2, TRUE))
goto end;
// Then downsamplings.
if(p->flags & MPG123_AUTO_RESAMPLE && p->down_sample < 2)
{
if(enc_chan_fit( p, frame_freq(fr)>>(p->down_sample+1), &nf
if(enc_chan_fit( p, INT123_frame_freq(fr)>>(p->down_sample+1), &nf
, f0, f2, TRUE ))
goto end;
if(p->down_sample < 1 && enc_chan_fit( p, frame_freq(fr)>>2, &nf
if(p->down_sample < 1 && enc_chan_fit( p, INT123_frame_freq(fr)>>2, &nf
, f0, f2, TRUE ))
goto end;
}
@@ -320,7 +320,7 @@ int frame_output_format(mpg123_handle *fr)
if( p->flags & MPG123_AUTO_RESAMPLE && fr->p.down_sample == 0)
{
int i;
int rn = rate2num(p, frame_freq(fr));
int rn = rate2num(p, INT123_frame_freq(fr));
int rrn;
if(rn < 0) return 0;
/* Try higher rates first. */
@@ -352,9 +352,9 @@ int frame_output_format(mpg123_handle *fr)
(p->flags & MPG123_FORCE_MONO ? "mono, " : "") )
, ( p->flags & MPG123_FORCE_FLOAT ? "float, " :
(p->flags & MPG123_FORCE_8BIT ? "8bit, " : "") )
, frame_freq(fr)>>p->down_sample
, frame_freq(fr)>>(p->down_sample ? p->down_sample : 1)
, frame_freq(fr)>>2 );
, INT123_frame_freq(fr)>>p->down_sample
, INT123_frame_freq(fr)>>(p->down_sample ? p->down_sample : 1)
, INT123_frame_freq(fr)>>2 );
/* if(NOQUIET && p->verbose <= 1) print_capabilities(fr); */
fr->err = MPG123_BAD_OUTFORMAT;
@@ -549,7 +549,7 @@ int attribute_align_arg mpg123_fmt_support(mpg123_pars *mp, long rate, int encod
}
/* Call this one to ensure that any valid format will be something different than this. */
void invalidate_format(struct audioformat *af)
void INT123_invalidate_format(struct audioformat *af)
{
af->encoding = 0;
af->rate = 0;
@@ -557,25 +557,25 @@ void invalidate_format(struct audioformat *af)
}
/* Number of bytes the decoder produces. */
off_t decoder_synth_bytes(mpg123_handle *fr, off_t s)
int64_t INT123_decoder_synth_bytes(mpg123_handle *fr, int64_t s)
{
return s * fr->af.dec_encsize * fr->af.channels;
}
/* Samples/bytes for output buffer after post-processing. */
/* take into account: channels, bytes per sample -- NOT resampling!*/
off_t samples_to_bytes(mpg123_handle *fr , off_t s)
int64_t INT123_samples_to_bytes(mpg123_handle *fr , int64_t s)
{
return s * fr->af.encsize * fr->af.channels;
}
off_t bytes_to_samples(mpg123_handle *fr , off_t b)
int64_t INT123_bytes_to_samples(mpg123_handle *fr , int64_t b)
{
return b / fr->af.encsize / fr->af.channels;
}
/* Number of bytes needed for decoding _and_ post-processing. */
off_t outblock_bytes(mpg123_handle *fr, off_t s)
int64_t INT123_outblock_bytes(mpg123_handle *fr, int64_t s)
{
int encsize = (fr->af.encoding & MPG123_ENC_24)
? 4 /* Intermediate 32 bit. */
@@ -636,7 +636,7 @@ static void conv_s16_to_u16(struct outbuffer *buf)
#ifndef NO_REAL
static void conv_s16_to_f32(struct outbuffer *buf)
{
ssize_t i;
ptrdiff_t i;
int16_t *in = (int16_t*) buf->data;
float *out = (float*) buf->data;
size_t count = buf->fill/sizeof(int16_t);
@@ -662,7 +662,7 @@ static void conv_s16_to_f32(struct outbuffer *buf)
#ifndef NO_32BIT
static void conv_s16_to_s32(struct outbuffer *buf)
{
ssize_t i;
ptrdiff_t i;
int16_t *in = (int16_t*) buf->data;
int32_t *out = (int32_t*) buf->data;
size_t count = buf->fill/sizeof(int16_t);
@@ -699,7 +699,7 @@ void swap_endian(struct outbuffer *buf, int block)
}
}
void postprocess_buffer(mpg123_handle *fr)
void INT123_postprocess_buffer(mpg123_handle *fr)
{
/*
This caters for the final output formats that are never produced by

View File

@@ -1,7 +1,7 @@
/*
frame: Heap of routines dealing with the core mpg123 data structure.
copyright 2008-2021 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2008-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
@@ -68,12 +68,12 @@ static void frame_default_pars(mpg123_pars *mp)
mp->freeformat_framesize = -1;
}
void frame_init(mpg123_handle *fr)
void INT123_frame_init(mpg123_handle *fr)
{
frame_init_par(fr, NULL);
INT123_frame_init_par(fr, NULL);
}
void frame_init_par(mpg123_handle *fr, mpg123_pars *mp)
void INT123_frame_init_par(mpg123_handle *fr, mpg123_pars *mp)
{
fr->own_buffer = TRUE;
fr->buffer.data = NULL;
@@ -98,37 +98,34 @@ void frame_init_par(mpg123_handle *fr, mpg123_pars *mp)
#ifdef OPT_CPU_FLAGS
wrap_getcpuflags(&(fr->cpu_flags));
#endif
fr->cpu_opts.type = defdec();
fr->cpu_opts.class = decclass(fr->cpu_opts.type);
fr->cpu_opts.type = INT123_defdec();
fr->cpu_opts.class = INT123_decclass(fr->cpu_opts.type);
#ifndef NO_NTOM
/* these two look unnecessary, check guarantee for synth_ntom_set_step (in control_generic, even)! */
fr->ntom_val[0] = NTOM_MUL>>1;
fr->ntom_val[1] = NTOM_MUL>>1;
/* these two look unnecessary, check guarantee for INT123_synth_ntom_set_step (in control_generic, even)! */
fr->INT123_ntom_val[0] = NTOM_MUL>>1;
fr->INT123_ntom_val[1] = NTOM_MUL>>1;
fr->ntom_step = NTOM_MUL;
#endif
/* unnecessary: fr->buffer.size = fr->buffer.fill = 0; */
mpg123_reset_eq(fr);
init_icy(&fr->icy);
init_id3(fr);
/* frame_outbuffer is missing... */
/* frame_buffers is missing... that one needs cpu opt setting! */
/* after these... frame_reset is needed before starting full decode */
invalidate_format(&fr->af);
fr->rdat.r_read = NULL;
fr->rdat.r_lseek = NULL;
INT123_init_icy(&fr->icy);
INT123_init_id3(fr);
/* INT123_frame_outbuffer is missing... */
/* INT123_frame_buffers is missing... that one needs cpu opt setting! */
/* after these... INT123_frame_reset is needed before starting full decode */
INT123_invalidate_format(&fr->af);
fr->rdat.iohandle = NULL;
fr->rdat.r_read_handle = NULL;
fr->rdat.r_lseek_handle = NULL;
fr->rdat.r_read64 = NULL;
fr->rdat.r_lseek64 = NULL;
fr->rdat.cleanup_handle = NULL;
fr->wrapperdata = NULL;
fr->wrapperclean = NULL;
fr->decoder_change = 1;
fr->err = MPG123_OK;
if(mp == NULL) frame_default_pars(&fr->p);
else memcpy(&fr->p, mp, sizeof(struct mpg123_pars_struct));
#ifndef NO_FEEDER
bc_prepare(&fr->rdat.buffer, fr->p.feedpool, fr->p.feedbuffer);
INT123_bc_prepare(&fr->rdat.buffer, fr->p.feedpool, fr->p.feedbuffer);
#endif
fr->down_sample = 0; /* Initialize to silence harmless errors when debugging. */
@@ -136,10 +133,10 @@ void frame_init_par(mpg123_handle *fr, mpg123_pars *mp)
frame_fixed_reset(fr); /* Reset only the fixed data, dynamic buffers are not there yet! */
fr->synth = NULL;
fr->synth_mono = NULL;
fr->make_decode_tables = NULL;
fr->INT123_make_decode_tables = NULL;
#ifdef FRAME_INDEX
fi_init(&fr->index);
frame_index_setup(fr); /* Apply the size setting. */
INT123_fi_init(&fr->index);
INT123_frame_index_setup(fr); /* Apply the size setting. */
#endif
#ifndef NO_MOREINFO
fr->pinfo = NULL;
@@ -149,7 +146,7 @@ void frame_init_par(mpg123_handle *fr, mpg123_pars *mp)
#ifdef OPT_DITHER
/* Also, only allocate the memory for the table on demand.
In future, one could create special noise for different sampling frequencies(?). */
int frame_dither_init(mpg123_handle *fr)
int INT123_frame_dither_init(mpg123_handle *fr)
{
/* run-time dither noise table generation */
if(fr->dithernoise == NULL)
@@ -157,7 +154,7 @@ int frame_dither_init(mpg123_handle *fr)
fr->dithernoise = malloc(sizeof(float)*DITHERSIZE);
if(fr->dithernoise == NULL) return 0;
dither_table_init(fr->dithernoise);
INT123_dither_table_init(fr->dithernoise);
}
return 1;
}
@@ -187,7 +184,7 @@ int attribute_align_arg mpg123_reset_eq(mpg123_handle *mh)
return MPG123_OK;
}
int frame_outbuffer(mpg123_handle *fr)
int INT123_frame_outbuffer(mpg123_handle *fr)
{
size_t size = fr->outblock;
if(!fr->own_buffer)
@@ -243,19 +240,19 @@ int attribute_align_arg mpg123_replace_buffer(mpg123_handle *mh, void *data, siz
}
#ifdef FRAME_INDEX
int frame_index_setup(mpg123_handle *fr)
int INT123_frame_index_setup(mpg123_handle *fr)
{
int ret = MPG123_ERR;
if(fr->p.index_size >= 0)
{ /* Simple fixed index. */
fr->index.grow_size = 0;
ret = fi_resize(&fr->index, (size_t)fr->p.index_size);
ret = INT123_fi_resize(&fr->index, (size_t)fr->p.index_size);
}
else
{ /* A growing index. We give it a start, though. */
fr->index.grow_size = (size_t)(- fr->p.index_size);
if(fr->index.size < fr->index.grow_size)
ret = fi_resize(&fr->index, fr->index.grow_size);
ret = INT123_fi_resize(&fr->index, fr->index.grow_size);
else
ret = MPG123_OK; /* We have minimal size already... and since growing is OK... */
}
@@ -272,7 +269,7 @@ static void frame_decode_buffers_reset(mpg123_handle *fr)
memset(fr->rawbuffs, 0, fr->rawbuffss);
}
int frame_buffers(mpg123_handle *fr)
int INT123_frame_buffers(mpg123_handle *fr)
{
int buffssize = 0;
debug1("frame %p buffer", (void*)fr);
@@ -445,7 +442,7 @@ int frame_buffers(mpg123_handle *fr)
return 0;
}
int frame_buffers_reset(mpg123_handle *fr)
int INT123_frame_buffers_reset(mpg123_handle *fr)
{
fr->buffer.fill = 0; /* hm, reset buffer fill... did we do a flush? */
fr->bsnum = 0;
@@ -477,7 +474,7 @@ static void frame_free_toc(mpg123_handle *fr)
}
/* Just copy the Xing TOC over... */
int frame_fill_toc(mpg123_handle *fr, unsigned char* in)
int INT123_frame_fill_toc(mpg123_handle *fr, unsigned char* in)
{
if(fr->xing_toc == NULL) fr->xing_toc = malloc(100);
if(fr->xing_toc != NULL)
@@ -498,13 +495,13 @@ int frame_fill_toc(mpg123_handle *fr, unsigned char* in)
/* Prepare the handle for a new track.
Reset variables, buffers... */
int frame_reset(mpg123_handle* fr)
int INT123_frame_reset(mpg123_handle* fr)
{
frame_buffers_reset(fr);
INT123_frame_buffers_reset(fr);
frame_fixed_reset(fr);
frame_free_toc(fr);
#ifdef FRAME_INDEX
fi_reset(&fr->index);
INT123_fi_reset(&fr->index);
#endif
return 0;
@@ -514,7 +511,7 @@ int frame_reset(mpg123_handle* fr)
static void frame_fixed_reset(mpg123_handle *fr)
{
frame_icy_reset(fr);
open_bad(fr);
INT123_open_bad(fr);
fr->to_decode = FALSE;
fr->to_ignore = FALSE;
fr->metaflags = 0;
@@ -552,7 +549,7 @@ static void frame_fixed_reset(mpg123_handle *fr)
fr->fresh = 1;
fr->new_format = 0;
#ifdef GAPLESS
frame_gapless_init(fr,-1,0,0);
INT123_frame_gapless_init(fr,-1,0,0);
fr->lastoff = 0;
fr->firstoff = 0;
#endif
@@ -563,8 +560,8 @@ static void frame_fixed_reset(mpg123_handle *fr)
#ifdef OPT_DITHER
fr->ditherindex = 0;
#endif
reset_id3(fr);
reset_icy(&fr->icy);
INT123_reset_id3(fr);
INT123_reset_icy(&fr->icy);
/* ICY stuff should go into icy.c, eh? */
#ifndef NO_ICY
fr->icy.interval = 0;
@@ -597,7 +594,7 @@ static void frame_free_buffers(mpg123_handle *fr)
if(fr->layerscratch != NULL) free(fr->layerscratch);
}
void frame_exit(mpg123_handle *fr)
void INT123_frame_exit(mpg123_handle *fr)
{
if(fr->buffer.rdata != NULL)
{
@@ -608,7 +605,7 @@ void frame_exit(mpg123_handle *fr)
frame_free_buffers(fr);
frame_free_toc(fr);
#ifdef FRAME_INDEX
fi_exit(&fr->index);
INT123_fi_exit(&fr->index);
#endif
#ifdef OPT_DITHER
if(fr->dithernoise != NULL)
@@ -617,16 +614,10 @@ void frame_exit(mpg123_handle *fr)
fr->dithernoise = NULL;
}
#endif
exit_id3(fr);
clear_icy(&fr->icy);
/* Clean up possible mess from LFS wrapper. */
if(fr->wrapperclean != NULL)
{
fr->wrapperclean(fr->wrapperdata);
fr->wrapperdata = NULL;
}
INT123_exit_id3(fr);
INT123_clear_icy(&fr->icy);
#ifndef NO_FEEDER
bc_cleanup(&fr->rdat.buffer);
INT123_bc_cleanup(&fr->rdat.buffer);
#endif
}
@@ -662,10 +653,10 @@ int attribute_align_arg mpg123_set_moreinfo( mpg123_handle *mh
- guess wildly from mean framesize and offset of first frame / beginning of file.
*/
static off_t frame_fuzzy_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame)
static int64_t frame_fuzzy_find(mpg123_handle *fr, int64_t want_frame, int64_t* get_frame)
{
/* Default is to go to the beginning. */
off_t ret = fr->audio_start;
int64_t ret = fr->audio_start;
*get_frame = 0;
/* But we try to find something better. */
@@ -681,12 +672,12 @@ static off_t frame_fuzzy_find(mpg123_handle *fr, off_t want_frame, off_t* get_fr
if(toc_entry > 99) toc_entry = 99;
/* Now estimate back what frame we get. */
*get_frame = (off_t) ((double)toc_entry/100. * fr->track_frames);
*get_frame = (int64_t) ((double)toc_entry/100. * fr->track_frames);
fr->state_flags &= ~FRAME_ACCURATE;
fr->silent_resync = 1;
/* Question: Is the TOC for whole file size (with/without ID3) or the "real" audio data only?
ID3v1 info could also matter. */
ret = (off_t) ((double)fr->xing_toc[toc_entry]/256.* fr->rdat.filelen);
ret = (int64_t) ((double)fr->xing_toc[toc_entry]/256.* fr->rdat.filelen);
}
else if(fr->mean_framesize > 0)
{ /* Just guess with mean framesize (may be exact with CBR files). */
@@ -694,26 +685,28 @@ static off_t frame_fuzzy_find(mpg123_handle *fr, off_t want_frame, off_t* get_fr
fr->state_flags &= ~FRAME_ACCURATE; /* Fuzzy! */
fr->silent_resync = 1;
*get_frame = want_frame;
ret = (off_t) (fr->audio_start+fr->mean_framesize*want_frame);
ret = (int64_t) (fr->audio_start+fr->mean_framesize*want_frame);
}
debug5("fuzzy: want %li of %li, get %li at %li B of %li B",
(long)want_frame, (long)fr->track_frames, (long)*get_frame, (long)ret, (long)(fr->rdat.filelen-fr->audio_start));
debug5("fuzzy: want %" PRIi64 " of %" PRIi64
", get %" PRIi64 " at %" PRIi64 " B of %" PRIi64 " B"
, want_frame, fr->track_frames, *get_frame, ret
, (fr->rdat.filelen-fr->audio_start));
return ret;
}
/*
find the best frame in index just before the wanted one, seek to there
then step to just before wanted one with read_frame
then step to just before wanted one with INT123_read_frame
do not care tabout the stuff that was in buffer but not played back
everything that left the decoder is counted as played
Decide if you want low latency reaction and accurate timing info or stable long-time playback with buffer!
*/
off_t frame_index_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame)
int64_t INT123_frame_index_find(mpg123_handle *fr, int64_t want_frame, int64_t* get_frame)
{
/* default is file start if no index position */
off_t gopos = 0;
int64_t gopos = 0;
*get_frame = 0;
#ifdef FRAME_INDEX
/* Possibly use VBRI index, too? I'd need an example for this... */
@@ -751,13 +744,13 @@ off_t frame_index_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame)
#ifdef FRAME_INDEX
}
#endif
debug2("index: 0x%lx for frame %li", (unsigned long)gopos, (long) *get_frame);
debug2("index: 0x%" PRIx64 " for frame %" PRIi64, (uint64_t)gopos, *get_frame);
return gopos;
}
off_t frame_ins2outs(mpg123_handle *fr, off_t ins)
int64_t INT123_frame_ins2outs(mpg123_handle *fr, int64_t ins)
{
off_t outs = 0;
int64_t outs = 0;
switch(fr->down_sample)
{
case 0:
@@ -768,7 +761,7 @@ off_t frame_ins2outs(mpg123_handle *fr, off_t ins)
outs = ins>>fr->down_sample;
break;
# ifndef NO_NTOM
case 3: outs = ntom_ins2outs(fr, ins); break;
case 3: outs = INT123_ntom_ins2outs(fr, ins); break;
# endif
default: if(NOQUIET)
merror( "Bad down_sample (%i) ... should not be possible!!"
@@ -777,9 +770,9 @@ off_t frame_ins2outs(mpg123_handle *fr, off_t ins)
return outs;
}
off_t frame_outs(mpg123_handle *fr, off_t num)
int64_t INT123_frame_outs(mpg123_handle *fr, int64_t num)
{
off_t outs = 0;
int64_t outs = 0;
switch(fr->down_sample)
{
case 0:
@@ -790,7 +783,7 @@ off_t frame_outs(mpg123_handle *fr, off_t num)
outs = (fr->spf>>fr->down_sample)*num;
break;
#ifndef NO_NTOM
case 3: outs = ntom_frmouts(fr, num); break;
case 3: outs = INT123_ntom_frmouts(fr, num); break;
#endif
default: if(NOQUIET)
merror( "Bad down_sample (%i) ... should not be possible!!"
@@ -801,9 +794,9 @@ off_t frame_outs(mpg123_handle *fr, off_t num)
/* Compute the number of output samples we expect from this frame.
This is either simple spf() or a tad more elaborate for ntom. */
off_t frame_expect_outsamples(mpg123_handle *fr)
int64_t INT123_frame_expect_outsamples(mpg123_handle *fr)
{
off_t outs = 0;
int64_t outs = 0;
switch(fr->down_sample)
{
case 0:
@@ -814,7 +807,7 @@ off_t frame_expect_outsamples(mpg123_handle *fr)
outs = fr->spf>>fr->down_sample;
break;
#ifndef NO_NTOM
case 3: outs = ntom_frame_outsamples(fr); break;
case 3: outs = INT123_ntom_frame_outsamples(fr); break;
#endif
default: if(NOQUIET)
merror( "Bad down_sample (%i) ... should not be possible!!"
@@ -823,9 +816,9 @@ off_t frame_expect_outsamples(mpg123_handle *fr)
return outs;
}
off_t frame_offset(mpg123_handle *fr, off_t outs)
int64_t INT123_frame_offset(mpg123_handle *fr, int64_t outs)
{
off_t num = 0;
int64_t num = 0;
switch(fr->down_sample)
{
case 0:
@@ -836,7 +829,7 @@ off_t frame_offset(mpg123_handle *fr, off_t outs)
num = outs/(fr->spf>>fr->down_sample);
break;
#ifndef NO_NTOM
case 3: num = ntom_frameoff(fr, outs); break;
case 3: num = INT123_ntom_frameoff(fr, outs); break;
#endif
default: if(NOQUIET)
error("Bad down_sample ... should not be possible!!");
@@ -846,9 +839,9 @@ off_t frame_offset(mpg123_handle *fr, off_t outs)
#ifdef GAPLESS
/* input in _input_ samples */
void frame_gapless_init(mpg123_handle *fr, off_t framecount, off_t bskip, off_t eskip)
void INT123_frame_gapless_init(mpg123_handle *fr, int64_t framecount, int64_t bskip, int64_t eskip)
{
debug3("frame_gapless_init: given %"OFF_P" frames, skip %"OFF_P" and %"OFF_P, (off_p)framecount, (off_p)bskip, (off_p)eskip);
debug3("INT123_frame_gapless_init: given %"PRIi64" frames, skip %"PRIi64" and %"PRIi64, framecount, bskip, eskip);
fr->gapless_frames = framecount;
if(fr->gapless_frames > 0 && bskip >=0 && eskip >= 0)
{
@@ -860,40 +853,42 @@ void frame_gapless_init(mpg123_handle *fr, off_t framecount, off_t bskip, off_t
fr->begin_os = 0;
fr->end_os = 0;
fr->fullend_os = 0;
debug2("frame_gapless_init: from %"OFF_P" to %"OFF_P" samples", (off_p)fr->begin_s, (off_p)fr->end_s);
debug2("INT123_frame_gapless_init: from %"PRIi64" to %"PRIi64" samples", fr->begin_s, fr->end_s);
}
void frame_gapless_realinit(mpg123_handle *fr)
void INT123_frame_gapless_realinit(mpg123_handle *fr)
{
fr->begin_os = frame_ins2outs(fr, fr->begin_s);
fr->end_os = frame_ins2outs(fr, fr->end_s);
fr->begin_os = INT123_frame_ins2outs(fr, fr->begin_s);
fr->end_os = INT123_frame_ins2outs(fr, fr->end_s);
if(fr->gapless_frames > 0)
fr->fullend_os = frame_ins2outs(fr, fr->gapless_frames*fr->spf);
fr->fullend_os = INT123_frame_ins2outs(fr, fr->gapless_frames*fr->spf);
else fr->fullend_os = 0;
debug4("frame_gapless_realinit: from %"OFF_P" to %"OFF_P" samples (%"OFF_P", %"OFF_P")", (off_p)fr->begin_os, (off_p)fr->end_os, (off_p)fr->fullend_os, (off_p)fr->gapless_frames);
debug4("INT123_frame_gapless_realinit: from %"PRIi64" to %"PRIi64" samples (%"PRIi64", %"PRIi64")"
, fr->begin_os, fr->end_os, fr->fullend_os, fr->gapless_frames);
}
/* At least note when there is trouble... */
void frame_gapless_update(mpg123_handle *fr, off_t total_samples)
void INT123_frame_gapless_update(mpg123_handle *fr, int64_t total_samples)
{
off_t gapless_samples = fr->gapless_frames*fr->spf;
int64_t gapless_samples = fr->gapless_frames*fr->spf;
if(fr->gapless_frames < 1) return;
debug2("gapless update with new sample count %"OFF_P" as opposed to known %"OFF_P, (off_p)total_samples, (off_p)gapless_samples);
debug2("gapless update with new sample count %"PRIi64" as opposed to known %"PRIi64, total_samples, gapless_samples);
if(NOQUIET && total_samples != gapless_samples)
fprintf(stderr, "\nWarning: Real sample count %"OFF_P" differs from given gapless sample count %"OFF_P". Frankenstein stream?\n"
, (off_p)total_samples, (off_p)gapless_samples);
fprintf(stderr, "\nWarning: Real sample count %" PRIi64
" differs from given gapless sample count %" PRIi64
". Frankenstein stream?\n", total_samples, gapless_samples);
if(gapless_samples > total_samples)
{
if(NOQUIET)
merror( "End sample count smaller than gapless end! (%"OFF_P
" < %"OFF_P"). Disabling gapless mode from now on."
, (off_p)total_samples, (off_p)fr->end_s );
merror( "End sample count smaller than gapless end! (%" PRIi64
" < %"PRIi64"). Disabling gapless mode from now on."
, total_samples, fr->end_s );
/* This invalidates the current position... but what should I do? */
frame_gapless_init(fr, -1, 0, 0);
frame_gapless_realinit(fr);
INT123_frame_gapless_init(fr, -1, 0, 0);
INT123_frame_gapless_realinit(fr);
fr->lastframe = -1;
fr->lastoff = 0;
}
@@ -902,9 +897,9 @@ void frame_gapless_update(mpg123_handle *fr, off_t total_samples)
#endif
/* Compute the needed frame to ignore from, for getting accurate/consistent output for intended firstframe. */
static off_t ignoreframe(mpg123_handle *fr)
static int64_t ignoreframe(mpg123_handle *fr)
{
off_t preshift = fr->p.preframes;
int64_t preshift = fr->p.preframes;
/* Layer 3 _really_ needs at least one frame before. */
if(fr->lay==3 && preshift < 1) preshift = 1;
/* Layer 1 & 2 reall do not need more than 2. */
@@ -917,64 +912,68 @@ static off_t ignoreframe(mpg123_handle *fr)
Seek to frame offset 1 may be just seek to 200 samples offset in output since the beginning of first frame is delay/padding.
Hm, is that right? OK for the padding stuff, but actually, should the decoder delay be better totally hidden or not?
With gapless, even the whole frame position could be advanced further than requested (since Homey don't play dat). */
void frame_set_frameseek(mpg123_handle *fr, off_t fe)
void INT123_frame_set_frameseek(mpg123_handle *fr, int64_t fe)
{
fr->firstframe = fe;
#ifdef GAPLESS
if(fr->p.flags & MPG123_GAPLESS && fr->gapless_frames > 0)
{
/* Take care of the beginning... */
off_t beg_f = frame_offset(fr, fr->begin_os);
int64_t beg_f = INT123_frame_offset(fr, fr->begin_os);
if(fe <= beg_f)
{
fr->firstframe = beg_f;
fr->firstoff = fr->begin_os - frame_outs(fr, beg_f);
fr->firstoff = fr->begin_os - INT123_frame_outs(fr, beg_f);
}
else fr->firstoff = 0;
/* The end is set once for a track at least, on the frame_set_frameseek called in get_next_frame() */
/* The end is set once for a track at least, on the INT123_frame_set_frameseek called in get_next_frame() */
if(fr->end_os > 0)
{
fr->lastframe = frame_offset(fr,fr->end_os);
fr->lastoff = fr->end_os - frame_outs(fr, fr->lastframe);
fr->lastframe = INT123_frame_offset(fr,fr->end_os);
fr->lastoff = fr->end_os - INT123_frame_outs(fr, fr->lastframe);
} else {fr->lastframe = -1; fr->lastoff = 0; }
} else { fr->firstoff = fr->lastoff = 0; fr->lastframe = -1; }
#endif
fr->ignoreframe = ignoreframe(fr);
#ifdef GAPLESS
debug5("frame_set_frameseek: begin at %li frames and %li samples, end at %li and %li; ignore from %li",
(long) fr->firstframe, (long) fr->firstoff,
(long) fr->lastframe, (long) fr->lastoff, (long) fr->ignoreframe);
debug5("INT123_frame_set_frameseek: begin at %" PRIi64 " frames and %" PRIi64
" samples, end at %" PRIi64 " and %" PRIi64 "; ignore from %" PRIi64,
fr->firstframe, fr->firstoff
, fr->lastframe, fr->lastoff, fr->ignoreframe);
#else
debug3("frame_set_frameseek: begin at %li frames, end at %li; ignore from %li",
(long) fr->firstframe, (long) fr->lastframe, (long) fr->ignoreframe);
debug3("INT123_frame_set_frameseek: begin at %" PRIi64 " frames, end at %" PRIi64
"; ignore from %" PRIi64
, fr->firstframe, fr->lastframe, fr->ignoreframe);
#endif
}
void frame_skip(mpg123_handle *fr)
void INT123_frame_skip(mpg123_handle *fr)
{
#ifndef NO_LAYER3
if(fr->lay == 3) set_pointer(fr, 1, 512);
if(fr->lay == 3) INT123_set_pointer(fr, 1, 512);
#endif
}
/* Sample accurate seek prepare for decoder. */
/* This gets unadjusted output samples and takes resampling into account */
void frame_set_seek(mpg123_handle *fr, off_t sp)
void INT123_frame_set_seek(mpg123_handle *fr, int64_t sp)
{
fr->firstframe = frame_offset(fr, sp);
debug1("frame_set_seek: from %"OFF_P, fr->num);
fr->firstframe = INT123_frame_offset(fr, sp);
debug1("INT123_frame_set_seek: from %" PRIi64, fr->num);
#ifndef NO_NTOM
if(fr->down_sample == 3) ntom_set_ntom(fr, fr->firstframe);
if(fr->down_sample == 3) INT123_ntom_set_ntom(fr, fr->firstframe);
#endif
fr->ignoreframe = ignoreframe(fr);
#ifdef GAPLESS /* The sample offset is used for non-gapless mode, too! */
fr->firstoff = sp - frame_outs(fr, fr->firstframe);
debug5("frame_set_seek: begin at %li frames and %li samples, end at %li and %li; ignore from %li",
(long) fr->firstframe, (long) fr->firstoff,
(long) fr->lastframe, (long) fr->lastoff, (long) fr->ignoreframe);
fr->firstoff = sp - INT123_frame_outs(fr, fr->firstframe);
debug5("INT123_frame_set_seek: begin at %" PRIi64 " frames and %" PRIi64
" samples, end at %" PRIi64 " and %" PRIi64 "; ignore from %" PRIi64,
fr->firstframe, fr->firstoff
, fr->lastframe, fr->lastoff, fr->ignoreframe);
#else
debug3("frame_set_seek: begin at %li frames, end at %li; ignore from %li",
(long) fr->firstframe, (long) fr->lastframe, (long) fr->ignoreframe);
debug3("INT123_frame_set_seek: begin at %" PRIi64 " frames, end at %" PRIi64
"; ignore from %" PRIi64
, fr->firstframe, fr->lastframe, fr->ignoreframe);
#endif
}
@@ -997,7 +996,7 @@ int attribute_align_arg mpg123_volume(mpg123_handle *mh, double vol)
if(vol >= 0) mh->p.outscale = vol;
else mh->p.outscale = 0.;
do_rva(mh);
INT123_do_rva(mh);
return MPG123_OK;
}
@@ -1024,7 +1023,7 @@ static int get_rva(mpg123_handle *fr, double *peak, double *gain)
}
/* adjust the volume, taking both fr->outscale and rva values into account */
void do_rva(mpg123_handle *fr)
void INT123_do_rva(mpg123_handle *fr)
{
double peak = 0;
double gain = 0;
@@ -1050,7 +1049,7 @@ void do_rva(mpg123_handle *fr)
debug3("changing scale value from %f to %f (peak estimated to %f)", fr->lastscale != -1 ? fr->lastscale : fr->p.outscale, newscale, (double) (newscale*peak));
fr->lastscale = newscale;
/* It may be too early, actually. */
if(fr->make_decode_tables != NULL) fr->make_decode_tables(fr); /* the actual work */
if(fr->INT123_make_decode_tables != NULL) fr->INT123_make_decode_tables(fr); /* the actual work */
}
}
@@ -1064,7 +1063,7 @@ int attribute_align_arg mpg123_getvolume(mpg123_handle *mh, double *base, double
return MPG123_OK;
}
off_t attribute_align_arg mpg123_framepos(mpg123_handle *mh)
int64_t attribute_align_arg mpg123_framepos64(mpg123_handle *mh)
{
if(mh == NULL) return MPG123_ERR;

View File

@@ -1,7 +1,7 @@
/*
frame: Central data structures and opmitization hooks.
copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
@@ -24,7 +24,7 @@
#ifdef OPT_DITHER
#include "dither.h"
int frame_dither_init(mpg123_handle *fr);
int INT123_frame_dither_init(mpg123_handle *fr);
#endif
/* max = 1728 */
@@ -56,7 +56,7 @@ struct audioformat
long rate;
};
void invalidate_format(struct audioformat *af);
void INT123_invalidate_format(struct audioformat *af);
struct mpg123_pars_struct
{
@@ -151,7 +151,7 @@ struct mpg123_handle_struct
#ifndef NO_NTOM
/* decode_ntom */
unsigned long ntom_val[2];
unsigned long INT123_ntom_val[2];
unsigned long ntom_step;
#endif
/* special i486 fun */
@@ -188,7 +188,7 @@ struct mpg123_handle_struct
func_synth_stereo synth_stereo;
func_synth_mono synth_mono;
/* Yes, this function is runtime-switched, too. */
void (*make_decode_tables)(mpg123_handle *fr); /* That is the volume control. */
void (*INT123_make_decode_tables)(mpg123_handle *fr); /* That is the volume control. */
int stereo; /* I _think_ 1 for mono and 2 for stereo */
int jsbound;
@@ -220,10 +220,10 @@ struct mpg123_handle_struct
int framesize; /* computed framesize */
int freesize; /* free format frame size */
enum mpg123_vbr vbr; /* 1 if variable bitrate was detected */
off_t num; /* frame offset ... */
off_t input_offset; /* byte offset of this frame in input stream */
off_t playnum; /* playback offset... includes repetitions, reset at seeks */
off_t audio_start; /* The byte offset in the file where audio data begins. */
int64_t num; /* frame offset ... */
int64_t input_offset; /* byte offset of this frame in input stream */
int64_t playnum; /* playback offset... includes repetitions, reset at seeks */
int64_t audio_start; /* The byte offset in the file where audio data begins. */
int state_flags;
char silent_resync; /* Do not complain for the next n resyncs. */
unsigned char* xing_toc; /* The seek TOC from Xing header. */
@@ -250,10 +250,10 @@ struct mpg123_handle_struct
} rva;
/* input data */
off_t track_frames;
off_t track_samples;
int64_t track_frames;
int64_t track_samples;
double mean_framesize;
off_t mean_frames;
int64_t mean_frames;
int fsizeold;
int ssize;
unsigned int bitreservoir;
@@ -277,18 +277,18 @@ struct mpg123_handle_struct
size_t outblock; /* number of bytes that this frame produces (upper bound) */
int to_decode; /* this frame holds data to be decoded */
int to_ignore; /* the same, somehow */
off_t firstframe; /* start decoding from here */
off_t lastframe; /* last frame to decode (for gapless or num_frames limit) */
off_t ignoreframe; /* frames to decode but discard before firstframe */
int64_t firstframe; /* start decoding from here */
int64_t lastframe; /* last frame to decode (for gapless or num_frames limit) */
int64_t ignoreframe; /* frames to decode but discard before firstframe */
#ifdef GAPLESS
off_t gapless_frames; /* frame count for the gapless part */
off_t firstoff; /* number of samples to ignore from firstframe */
off_t lastoff; /* number of samples to use from lastframe */
off_t begin_s; /* overall begin offset in samples */
off_t begin_os;
off_t end_s; /* overall end offset in samples */
off_t end_os;
off_t fullend_os; /* gapless_frames translated to output samples */
int64_t gapless_frames; /* frame count for the gapless part */
int64_t firstoff; /* number of samples to ignore from firstframe */
int64_t lastoff; /* number of samples to use from lastframe */
int64_t begin_s; /* overall begin offset in samples */
int64_t begin_os;
int64_t end_s; /* overall end offset in samples */
int64_t end_os;
int64_t fullend_os; /* gapless_frames translated to output samples */
#endif
unsigned int crc; /* Well, I need a safe 16bit type, actually. But wider doesn't hurt. */
struct reader *rd; /* pointer to the reading functions */
@@ -342,8 +342,6 @@ struct mpg123_handle_struct
/* A place for storing additional data for the large file wrapper.
This is cruft! */
void *wrapperdata;
/* A callback used to properly destruct the wrapper data. */
void (*wrapperclean)(void*);
int enc_delay;
int enc_padding;
#ifndef NO_MOREINFO
@@ -352,27 +350,27 @@ struct mpg123_handle_struct
};
/* generic init, does not include dynamic buffers */
void frame_init(mpg123_handle *fr);
void frame_init_par(mpg123_handle *fr, mpg123_pars *mp);
void INT123_frame_init(mpg123_handle *fr);
void INT123_frame_init_par(mpg123_handle *fr, mpg123_pars *mp);
/* output buffer and format */
int frame_outbuffer(mpg123_handle *fr);
int frame_output_format(mpg123_handle *fr);
int INT123_frame_outbuffer(mpg123_handle *fr);
int INT123_frame_output_format(mpg123_handle *fr);
int frame_buffers(mpg123_handle *fr); /* various decoder buffers, needed once */
int frame_reset(mpg123_handle* fr); /* reset for next track */
int frame_buffers_reset(mpg123_handle *fr);
void frame_exit(mpg123_handle *fr); /* end, free all buffers */
int INT123_frame_buffers(mpg123_handle *fr); /* various decoder buffers, needed once */
int INT123_frame_reset(mpg123_handle* fr); /* reset for next track */
int INT123_frame_buffers_reset(mpg123_handle *fr);
void INT123_frame_exit(mpg123_handle *fr); /* end, free all buffers */
/* Index functions... */
/* Well... print it... */
int mpg123_print_index(mpg123_handle *fr, FILE* out);
/* Find a seek position in index. */
off_t frame_index_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame);
int64_t INT123_frame_index_find(mpg123_handle *fr, int64_t want_frame, int64_t* get_frame);
/* Apply index_size setting. */
int frame_index_setup(mpg123_handle *fr);
int INT123_frame_index_setup(mpg123_handle *fr);
void do_volume(mpg123_handle *fr, double factor);
void do_rva(mpg123_handle *fr);
void INT123_do_volume(mpg123_handle *fr, double factor);
void INT123_do_rva(mpg123_handle *fr);
/* samples per frame ...
Layer I
@@ -396,20 +394,20 @@ MPEG 2.5
// The value is needed for mpg123_getstate() in any build.
#define GAPLESS_DELAY 529
#ifdef GAPLESS
void frame_gapless_init(mpg123_handle *fr, off_t framecount, off_t bskip, off_t eskip);
void frame_gapless_realinit(mpg123_handle *fr);
void frame_gapless_update(mpg123_handle *mh, off_t total_samples);
void INT123_frame_gapless_init(mpg123_handle *fr, int64_t framecount, int64_t bskip, int64_t eskip);
void INT123_frame_gapless_realinit(mpg123_handle *fr);
void INT123_frame_gapless_update(mpg123_handle *mh, int64_t total_samples);
/*void frame_gapless_position(mpg123_handle* fr);
void frame_gapless_bytify(mpg123_handle *fr);
void frame_gapless_ignore(mpg123_handle *fr, off_t frames);*/
void INT123_frame_gapless_bytify(mpg123_handle *fr);
void INT123_frame_gapless_ignore(mpg123_handle *fr, int64_t frames);*/
/* void frame_gapless_buffercheck(mpg123_handle *fr); */
#endif
/* Number of samples the decoding of the current frame should yield. */
off_t frame_expect_outsamples(mpg123_handle *fr);
int64_t INT123_frame_expect_outsamples(mpg123_handle *fr);
/* Skip this frame... do some fake action to get away without actually decoding it. */
void frame_skip(mpg123_handle *fr);
void INT123_frame_skip(mpg123_handle *fr);
/*
Seeking core functions:
@@ -418,14 +416,14 @@ void frame_skip(mpg123_handle *fr);
- get leading frame offset for output sample offset
The offsets are "unadjusted"/internal; resampling is being taken care of.
*/
off_t frame_ins2outs(mpg123_handle *fr, off_t ins);
off_t frame_outs(mpg123_handle *fr, off_t num);
int64_t INT123_frame_ins2outs(mpg123_handle *fr, int64_t ins);
int64_t INT123_frame_outs(mpg123_handle *fr, int64_t num);
/* This one just computes the expected sample count for _this_ frame. */
off_t frame_expect_outsampels(mpg123_handle *fr);
off_t frame_offset(mpg123_handle *fr, off_t outs);
void frame_set_frameseek(mpg123_handle *fr, off_t fe);
void frame_set_seek(mpg123_handle *fr, off_t sp);
off_t frame_tell_seek(mpg123_handle *fr);
int64_t INT123_frame_expect_outsampels(mpg123_handle *fr);
int64_t INT123_frame_offset(mpg123_handle *fr, int64_t outs);
void INT123_frame_set_frameseek(mpg123_handle *fr, int64_t fe);
void INT123_frame_set_seek(mpg123_handle *fr, int64_t sp);
int64_t INT123_frame_tell_seek(mpg123_handle *fr);
/* Take a copy of the Xing VBR TOC for fuzzy seeking. */
int frame_fill_toc(mpg123_handle *fr, unsigned char* in);
int INT123_frame_fill_toc(mpg123_handle *fr, unsigned char* in);
#endif

View File

@@ -1,7 +1,7 @@
/*
sampleadjust: gapless sample offset math
copyright 1995-2012 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 1995-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
This is no stand-alone header, precisely to be able to fool it into using fake handle types for testing the math.
@@ -11,9 +11,9 @@
#ifdef GAPLESS
/* From internal sample number to external. */
static off_t sample_adjust(mpg123_handle *mh, off_t x)
static int64_t sample_adjust(mpg123_handle *mh, int64_t x)
{
off_t s;
int64_t s;
if(mh->p.flags & MPG123_GAPLESS)
{
/* It's a bit tricky to do this computation for the padding samples.
@@ -35,9 +35,9 @@ static off_t sample_adjust(mpg123_handle *mh, off_t x)
}
/* from external samples to internal */
static off_t sample_unadjust(mpg123_handle *mh, off_t x)
static int64_t sample_unadjust(mpg123_handle *mh, int64_t x)
{
off_t s;
int64_t s;
if(mh->p.flags & MPG123_GAPLESS)
{
s = x + mh->begin_os;
@@ -74,24 +74,29 @@ static void frame_buffercheck(mpg123_handle *fr)
if(fr->lastframe > -1 && fr->num >= fr->lastframe)
{
/* There can be more than one frame of padding at the end, so we ignore the whole frame if we are beyond lastframe. */
off_t byteoff = (fr->num == fr->lastframe) ? samples_to_bytes(fr, fr->lastoff) : 0;
if((off_t)fr->buffer.fill > byteoff)
int64_t byteoff = (fr->num == fr->lastframe) ? INT123_samples_to_bytes(fr, fr->lastoff) : 0;
if((int64_t)fr->buffer.fill > byteoff)
{
fr->buffer.fill = byteoff;
}
if(VERBOSE3) fprintf(stderr, "\nNote: Cut frame %"OFF_P" buffer on end of stream to %"OFF_P" samples, fill now %"SIZE_P" bytes.\n", (off_p)fr->num, (off_p)(fr->num == fr->lastframe ? fr->lastoff : 0), (size_p)fr->buffer.fill);
if(VERBOSE3)
fprintf(stderr, "\nNote: Cut frame %" PRIi64 " buffer on end of stream to %"
PRIi64 " samples, fill now %"SIZE_P" bytes.\n"
, fr->num, (fr->num == fr->lastframe ? fr->lastoff : 0), (size_p)fr->buffer.fill);
}
/* The first interesting frame: Skip some leading samples. */
if(fr->firstoff && fr->num == fr->firstframe)
{
off_t byteoff = samples_to_bytes(fr, fr->firstoff);
if((off_t)fr->buffer.fill > byteoff)
int64_t byteoff = INT123_samples_to_bytes(fr, fr->firstoff);
if((int64_t)fr->buffer.fill > byteoff)
{
fr->buffer.fill -= byteoff;
/* buffer.p != buffer.data only for own buffer */
debug6("cutting %li samples/%li bytes on begin, own_buffer=%i at %p=%p, buf[1]=%i",
(long)fr->firstoff, (long)byteoff, fr->own_buffer, (void*)fr->buffer.p, (void*)fr->buffer.data, ((short*)fr->buffer.p)[2]);
debug6("cutting %" PRIi64 " samples/%" PRIi64
" bytes on begin, own_buffer=%i at %p=%p, buf[1]=%i"
, fr->firstoff, byteoff, fr->own_buffer
, (void*)fr->buffer.p, (void*)fr->buffer.data, ((short*)fr->buffer.p)[2]);
if(fr->own_buffer) fr->buffer.p = fr->buffer.data + byteoff;
else memmove(fr->buffer.data, fr->buffer.data + byteoff, fr->buffer.fill);
debug3("done cutting, buffer at %p =? %p, buf[1]=%i",
@@ -99,7 +104,10 @@ static void frame_buffercheck(mpg123_handle *fr)
}
else fr->buffer.fill = 0;
if(VERBOSE3) fprintf(stderr, "\nNote: Cut frame %"OFF_P" buffer on beginning of stream by %"OFF_P" samples, fill now %"SIZE_P" bytes.\n", (off_p)fr->num, (off_p)fr->firstoff, (size_p)fr->buffer.fill);
if(VERBOSE3)
fprintf(stderr, "\nNote: Cut frame %" PRIi64
" buffer on beginning of stream by %" PRIi64 " samples, fill now %zu bytes.\n"
, fr->num, fr->firstoff, fr->buffer.fill);
/* We can only reach this frame again by seeking. And on seeking, firstoff will be recomputed.
So it is safe to null it here (and it makes the if() decision abort earlier). */
fr->firstoff = 0;

View File

@@ -20,9 +20,9 @@
.text
ALIGN4
.globl ASM_NAME(getcpuflags)
/* .type ASM_NAME(getcpuflags),@function */
ASM_NAME(getcpuflags):
.globl ASM_NAME(INT123_getcpuflags)
/* .type ASM_NAME(INT123_getcpuflags),@function */
ASM_NAME(INT123_getcpuflags):
pushl %ebp
movl %esp,%ebp
pushl %edx

View File

@@ -42,7 +42,9 @@ struct cpuflags
#endif
};
unsigned int getcpuflags(struct cpuflags* cf);
unsigned int INT123_getcpuflags(struct cpuflags* cf);
#if ((defined OPT_X86) || (defined OPT_X86_64) || (defined OPT_NEON) || (defined OPT_NEON64)) && (defined OPT_MULTI)
#ifdef WANT_GETCPUFLAGS
#include <string.h>
@@ -51,12 +53,10 @@ unsigned int getcpuflags(struct cpuflags* cf);
static unsigned int wrap_getcpuflags(struct cpuflags* cf)
{
memset(cf, 0, sizeof(*cf));
return getcpuflags(cf);
return INT123_getcpuflags(cf);
}
#endif
#if ((defined OPT_X86) || (defined OPT_X86_64) || (defined OPT_NEON) || (defined OPT_NEON64)) && (defined OPT_MULTI)
// We really evaluate the CPU flags.
#define OPT_CPU_FLAGS

View File

@@ -11,7 +11,7 @@
#include "mpg123lib_intern.h"
#include "getcpuflags.h"
extern void check_neon(void);
extern void INT123_check_neon(void);
#ifndef _M_ARM
static sigjmp_buf jmpbuf;
@@ -28,7 +28,7 @@ static void mpg123_arm_catch_sigill(int sig)
#endif
}
unsigned int getcpuflags(struct cpuflags* cf)
unsigned int INT123_getcpuflags(struct cpuflags* cf)
{
#ifndef _M_ARM
struct sigaction act, act_old;
@@ -40,7 +40,7 @@ unsigned int getcpuflags(struct cpuflags* cf)
cf->has_neon = 0;
if(!sigsetjmp(jmpbuf, 1)) {
check_neon();
INT123_check_neon();
cf->has_neon = 1;
}
@@ -50,7 +50,7 @@ unsigned int getcpuflags(struct cpuflags* cf)
if (!setjmp(jmpbuf)) {
signal(SIGILL, mpg123_arm_catch_sigill);
check_neon();
INT123_check_neon();
cf->has_neon = 1;
}

View File

@@ -10,8 +10,8 @@
.text
ALIGN4
.globl ASM_NAME(getcpuflags)
ASM_NAME(getcpuflags):
.globl ASM_NAME(INT123_getcpuflags)
ASM_NAME(INT123_getcpuflags):
push %rbp
mov %rsp, %rbp
push %rbx

View File

@@ -1,30 +1,29 @@
/*
icy: Puny code to pretend for a serious ICY data structure.
copyright 2007-2015 by the mpg123 project
copyright 2007-2023 by the mpg123 project
-= free software under the terms of the LGPL 2.1 =-
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
#include "intsym.h"
#include "icy.h"
void init_icy(struct icy_meta *icy)
void INT123_init_icy(struct icy_meta *icy)
{
icy->data = NULL;
}
void clear_icy(struct icy_meta *icy)
void INT123_clear_icy(struct icy_meta *icy)
{
if(icy->data != NULL) free(icy->data);
init_icy(icy);
INT123_init_icy(icy);
}
void reset_icy(struct icy_meta *icy)
void INT123_reset_icy(struct icy_meta *icy)
{
clear_icy(icy);
init_icy(icy);
INT123_clear_icy(icy);
INT123_init_icy(icy);
}
/*void set_icy(struct icy_meta *icy, char* new_data)
{

Some files were not shown because too many files have changed in this diff Show More