Compare commits

...

10 Commits

Author SHA1 Message Date
223b8df2a3 add build scripts for Android NDK toolchain 2026-03-02 09:15:36 +01:00
fd02142b4e cc for android: do not compile buffer.c and xfermem.c with NOXFERMEM 2026-03-02 09:11:48 +01:00
Ozkan Sezer
2eb4320e16 mpg123-1.33.4 2025-12-21 11:00:24 +03:00
Ozkan Sezer
69118bb8bf mpg123-1.33.3 2025-10-06 12:01:02 +03:00
Ozkan Sezer
b4abae51e1 mpg123-1.33.2 2025-08-11 08:15:30 +03:00
Ozkan Sezer
03c8b9e94d mpg123-1.33.1 2025-07-28 15:55:02 +03:00
Ozkan Sezer
8a25bb2e73 mpg123-1.33.0 2025-06-08 01:15:50 +03:00
Ozkan Sezer
426f60d4f4 mpg123 1.33.0-dev+20250607022201 2025-06-07 10:51:56 +03:00
Ozkan Sezer
bf2eba7bc0 mpg123 1.33.0-dev+20250525022201 2025-05-25 20:40:02 +03:00
Ozkan Sezer
22dadfaa3c mpg123-1.32.10 2024-12-15 10:28:28 +03:00
94 changed files with 1122 additions and 624 deletions

View File

@@ -14,9 +14,11 @@ out ovbious syntax errors that make compilers cry do not land here.
Current maintainers with various sorts of contributions:
Thomas Orgis <thomas@orgis.org>
Taihei Momma <tmkk@mac.com>
Past maintainers mainly for MS Windows platform:
Patrick Dehne <patrick@steidle.net>
Jonathan Yong <10walls@gmail.com>
Taihei Momma <tmkk@mac.com>
Co-initiator of the revived mpg123 project, but not that involved anymore:
Nicholas J Humfrey <njh@ecs.soton.ac.uk>

116
INSTALL
View File

@@ -7,20 +7,22 @@ You really need:
- a C99 compiler (moderate C99 support)
- an (UNIX-like) operating system with standard tools; MinGW32 and
- an (UNIX-like) operating system with standard tools; mingw-w64 and
Cygwin are working for Microsoft Windows, too. We also have users happily
on OS/2.
playing on OS/2.
- For the library only, you may get lucky with MSVC++ using CMake and
ports/cmake as source directory. You can also use CMake on other
ports/cmake as source directory. You can also use CMake on UNIX-like
platforms for a full build, but its main purpose is for portability
where autotools don't do the trick.
- For other exotic platforms, also see ports/
- There used to be some additional ports in ports/, now there is a single
CMake structure there that handles most systems that cannot use autotools
to at least build the decoder library.
- If building from direct source code repository checkout, as opposed to
a release or snapshot tarball, you need GNU autotools installed
(see Developer Build below).
(see Developer Build below) or have cmake present for ports/cmake/.
You want:
@@ -32,6 +34,11 @@ You want:
1. Build
Note: If you want the full range of output modules, you might
run into cirucular dependencies, as pulseaudio or SDL might also
want to use parts of the mpg123 distribution. You can split the
build avoid that circle.
There is one main supported way to get your mpg123 installation
consisting of
@@ -51,6 +58,43 @@ This way is the usual GNU 3-step procedure:
make
make install
If you want to separate components (for avoiding circular dependencies,
for example), you can split things at various points. Either you build
all libraries and programs first, then all output modules via
# Build programs and libs only.
./configure --disable-components --enable-programs \
--enable-libmpg123 --enable-libsyn123 --enable-libout123 \
--with-default-audio=$OUTPUT_MODULES
make && make install
# Build packges relying on mpg123 libraries.
# After that, build out123 modules with external dependencies
./configure --disable-components --enable-libout123-modules \
--with-audio=$OUTPUT_MODULES
make && make install
or you can build each component individually, or just separate out the
problematic modules by
# Build all components, but dummy output only.
./configure --with-audio=dummy,$SAFE_MODULES \
--with-default-audio=$OUTPUT_MODULES
make && install
# Build other packages, like SDL, pulse.
# After that, build output modules depending on those.
# Without --with-audio, auto-detection will build a list.
./configure --disable-components --enable-libout123-modules \
--with-audio=$UNSAFE_MODULES
make && make install
The variables OUTPUT_MODULES, SAFE_MOULES, and UNSAFE_MODULES are
supposed to contain comma-separated lists of output modules like
"oss,pulse,alsa,jack". You need to give a full list when building
libout123 without modules to setup the default search order. Without
this, it won't find modules automatically without specifying one with
mpg123 -o $module. There is no module registry, just a simple build-time
list and the option to specify a module at runtime.
Run
./configure --help
@@ -116,38 +160,57 @@ libraries, specify it as a target:
You can then find the library itself under src/lib*123/.libs (libtool
likes to hide things there).
Alternatively, you can use --disable-components and --enable-foo for
building only component foo (like libmpg123).
4. Exotic platforms
See the ports/ directory for some help for building at least libmpg123
without the UNIX shell / autotools. The main strategy is to write
a config.h to replace what configure would generate and then have a
correct listing of all source files involved in that configuration
(there are optional files for different decoder choices, for example).
There used to be (and still are in revsion control history) special
ports for some platforms or language bindings in the ports/ directory.
Then compile objects, link.
Right now, there is only ports/cmake for an alternate CMake-based
build, mainly for libmpg123 itself, but also libsyn123 and possibly
the full set if the platform is UNIX-like.
Instead of manually curated MSVC project files, there is a CMake port
now in ports/cmake to build mpg123 with the MS compilers. It might be
helpful for other platforms, too. But the main build system for
POSIX-like systems is the autotools one.
If autotools and also ports/cmake do not do the trick, you need to
construct a src/config.h and build and gather the object files you want.
The autotools input files should help here, too.
4a. Microsoft Windows
4a. Preparing Win32 binary packages.
Under Windows, you can use Cygwin, MSYS2 or probably also the WSL
environment to build mpg123 binaries. If you want binaries that
work nicely stand-alone, and also at least being able to force correct
printout of UTF-8 text using chcp 65001 and mpg123 --utf8, the MSYS2
UCRT64 shell and accompanying toolchain seem to work (see MSYS2
documentation on how to set up, it is not that hard).
Caution: You should make sure to use some gcc >= 4.2.0, even if it's
still the experimental package for MinGW32.
This helps preventing incompatibilities between generated DLL files and
other compilers (it's about stack alignment).
To generate a set of binary builds matching the erstwhile official mpg123
binaries, run
Get MinGW/MSYS installed, run the MSYS shell.
Enter the mpg123 source directory.
Execute sh ./windows-builds.sh .
sh ./windows-builds.sh x86
or
sh ./windows-builds.sh x86_64
(optionally followed by a number to indicate the count of parallel make
tasks).
After some time, you should have some relevant files under releases/
(or releases\, for Windows people;-).
You don't just get one build -- there are several variants, corresponding
to what usually is to be found under http://mpg123.org/download/win32 .
to what usually was to be found under https://mpg123.org/download/win32/ and
https://mpg123.org/download/win64/ .
Notet hat, depending on you msys/mingw variant, you might have to copy
libwinpthread-1.dll to the respective release directory. This is a quirk
of the toolchain which insists on linking in a threading runtime. You
might be able to statically link it in with some extra magic.
You can also run this script on a Linux host with mingw-w64 cross toolchain
installed, with arguments x86-cross and x86_64-cross.
5. Note on large file support
@@ -164,6 +227,11 @@ your app.
In both large-file and normal mode, the library should just work for
your app.
In the meantime a portable API with fixed 64 bit integers (and some irony
on top) also was added. You can limit yourself to that api by defining
MPG123_PORTABLE_API in client code.
6. Security
If you consider installing the mpg123 binary or any program using

79
NEWS
View File

@@ -1,3 +1,82 @@
1.33.4
------
- mpg123: In terminal control, ignore 7-bit escape sequences to avoid spurious
actions, e.g. when hitting cursor keys. Inspired by Peter Tirsek.
- ports/cmake: Avoid possibly conflicting use of SIZEOF_OFF_T CMake variable
when embedding mpg123 with other projects using cmake and different off_t
semantics. (bug 382)
1.33.3
------
- libmpg123:
-- Fix build with newer toolchain on Android by using __ANDROID__ macro (bug 380).
-- Consolidate and more consistently use .rodata switch in macro.
1.33.2
------
- libmpg123:
-- Do not modify raw ID3v2 data while parsing (bug 379). This used to be fine
before MPG123_STORE_RAW_ID3 got introduced. Not anymore.
1.33.1
------
- INSTALL updated with hints for Windows, mainly.
- Finally formatted README. Maybe do it in Markdown sometime, as that's
the fashion.
- build:
-- The ports/cmake only installs manpages for BUILD_PROGRAMS now.
-- The configure gives better hint if pkg-config was missing during generation
(bug 378).
- mpg123:
-- Replace usage of signal() in terminal code with our sigaction() wrapper
to fix repeated handling for --sigusr1 and --sigusr2, which got subtly
broken on Linux + glibc by a feature test macro change in mpg123 1.31.
1.33.0
------
- mpg123
-- Fix printout of filenames at end (convert/limit text encoding).
-- Treat HTTP header encoding as unknown/ASCII and formally convert to UTF-8.
-- Make --continue mode work with --random.
-- Handle possible failure of __wgetmainargs on Windows (bug 375).
- mpg123-id3dump: Fix up command line arg handling for Windows.
- out123
-- Finally give zero exit code when generating sounds, not indicating
spurious failure.
- build:
-- Use CCASFLAGS for assembler tests, to enable builds that enable instruction
sets that way (bug 377).
-- PIC for compat libs (convenience libs used during build) only if building
shared libs (github PR 17 by Wouter Wijsman).
- compat:
-- Map strtok use to strtok_r or strtok_s (MS platforms), if possible.
users only in control_generic and libout123 so far. Out123 itself uses mytok.
Shall fix bug 376 (build with MSVC again).
-- Enable build on PSP by merging in the hotfix of opmitting signal code
(github PR 18 by Wouter Wijsman).
- libout123
-- modules/win32: Align waveOutGetDevCapsA to WAVEOUTCAPSA, in anticipation
of some UNICODE change.
- libmpg123
-- API version 49 with added mpg123_open_handle64(), mpg123_open64(), and
mpg123_open_fixed64() that are not subject to largefile renaming. This
means you can still access internal I/O with MPG123_PORTABLE_API. The
code has been there before, anyway.
-- With MPG123_PORTABLE_API, mpg123_open_handle() is hidden now (use
mpg123_open_handle64() instead).
-- more silence on errors (sideband limit message)
1.32.10
------
- scripts/tag_lyrics.py: fix for python3 (thanks to cclauss,
github PR 16)
- libout123: Use strtok_r() to avoid conflicts multithreaded contexts
(both sides should avoid plain strtok()! Debian-bug 1089543).
- libmpg123:
-- Un-break DLL builds that need I/O functions defined in libmpg123.c
(like mpg123_open(), bug 374).
- ports/cmake: More fixup to also produce .pc files with Libs.private.
1.32.9
------
- libmpg123:

View File

@@ -2,6 +2,16 @@ Changes in libmpg123 libtool interface versions. Next to the version
the mpg123 release where its changes first appeared to the public
is given.
49.0.49 (mpg123 1.33)
- Added mpg123_open_handle64() as clearly portable match for
mpg123_reader64(). It is just mpg123_open_handle() without
code path for non-portable API.
- Remove mpg123_open_handle() and renamed variants from builds
with MPG123_PORTABLE_API. Code must switch to
mpg123_open_handle64() there if MPG123_API_VERSION >= 49!
- Added mpg123_open64() and mpg123_open_fixed64() as portable
variants of mpg123_open() and mpg123_open_fixed().
48.0.48 (mpg123 1.32)
- Added mpg123_distversion() and mpg123_libversion().
- Added mpg123_reader64() and the other int64_t-based functions:

241
README
View File

@@ -1,41 +1,56 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
* mpg123 - MPEG 1.0/2.0/2.5 audio player *
* README for version 1.x.y, dated at 14.06.2009 *
* README for version 1.x.y, dated at 29.06.2025 *
* *
* ...still the fastest MPEG audio player for UNIX ;) *
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
(This file has very long lines - die-hard terminal nostalgists can be satisfied by `fmt -s -w 75 < README | less`. I think it's better to let the reader's preference rule than to preformat the stuff to some arbitrary width.)
0. Stuff
For building/installation info see INSTALL.
The mpg123 project was started by Michel Hipp and is now being maintained by Thomas Orgis and Nicholas J. Humfrey, who initiated the Sourceforge project.
The source code contains contributions from quite a few people - see AUTHORS for more info.
It is Open Source software licensed mostly under the LGPL with some parts restricted to GPL. See COPYING for details.
As for every mp3 player, some of mpg123's functionality may be covered by patents in a country where these are valid. See PATENTS for details.
The mpg123 project was started by Michel Hipp and is now being maintained
by Thomas Orgis. The source code contains contributions from quite a few
people - see AUTHORS for more info.
It is Open Source software licensed mostly under the LGPL v2.1, COPYING
for details. Patents on MPEG audio used to be an issue, but around 2017
the last patents should have expired. I'm no lawyer, that is just my
opinion, of course. Get your own to make sure (opinion or lawyer, whatever
you prefer).
Project's official website URL is
http://mpg123.org
(or http://mpg123.orgis.org as fallback address if there is a problem with the DNS forwarding)
https://mpg123.org
(or https://mpg123.orgis.org as fallback address if there is a problem
with the DNS forwarding)
for the traditional home page and
http://sourceforge.net/projects/mpg123
https://sourceforge.net/projects/mpg123
for sourceforge.net based services like download mirrors, mailing lists and bug/feature trackers.
Please use the sourceforge download mirrors when possible to minimize load on the mpg123.org server.
for sourceforge.net based services like download mirrors, mailing lists
and bug/feature trackers.
1. Introduction
This is a console based decoder/player for mono/stereo mpeg audio files, probably more familiar as MP3 or MP2 files.
It's focus is speed. We still need some low-end benchmarks for the current version, but playback should be possible even on i486 CPUs. There is hand-optimized assembly code for i586, MMX, 3DNow, SEE and 3DNowExt instructions, while generic code runs on a variety of different platforms and CPUs.
It can play MPEG1.0/2.0/2.5 layer I, II, II (1, 2, 3;-) files (VBR files are fine, too) and produce output on a number of different ways: raw data to stdout and different sound systems depending on your platform (see INSTALL).
Most tested are Linux on x86 and Alpha/AXP and MacOSX on ppc as the environments the current developers work in.
We are always thankful for user reports on success (and failure) on any platform!
This is a console based decoder/player for mono/stereo mpeg audio files,
probably more familiar as MP3 or MP2 files.
It's focus is speed. We still need some low-end benchmarks for the
current version, but playback should be possible even on i486 CPUs. There
is hand-optimized assembly code for i586, MMX, 3DNow, SEE and 3DNowExt
instructions, while generic code runs on a variety of different platforms
and CPUs.
It can play MPEG1.0/2.0/2.5 layer I, II, II (1, 2, 3;-) files (VBR files
are fine, too) and produce output on a number of different ways: raw
data to stdout and different sound systems depending on your platform
(see INSTALL).
Most tested are Linux on x86 and Alpha/AXP and MacOSX on ppc as the
environments the current developers work in.
We are always thankful for user reports on success (and failure) on
any platform!
2. Contact
@@ -44,7 +59,7 @@ short:
mpg123-devel@lists.sourceforge.net
mpg123-users@lists.sourceforge.net
or
or
maintainer@mpg123.org
long: see doc/CONTACT
@@ -56,7 +71,8 @@ Please consult the manpage mpg123(1). Some starter info follows.
3.1 Simple Console Usage
Mpg123 is a console program - normally it just plays a list of files you specify on command line and that's it. See the included manpage or
Mpg123 is a console program - normally it just plays a list of files
you specify on command line and that's it. See the included manpage or
mpg123 --help
@@ -64,15 +80,22 @@ or, for the full story,
mpg123 --longhelp
on command line syntax/options. I encourage you to check out the --gapless and --rva-album/--rva-mix options:-)
on command line syntax/options. I encourage you to check out the --gapless
and --rva-album/--rva-mix options:-)
In the simple "mpg123 file1.mp3 file2.mp3" mode, the only thing you can do to interact is to press Ctrl+C to skip to next track or end the whole playback if pressing it twice.
In the simple "mpg123 file1.mp3 file2.mp3" mode, the only thing you can
do to interact is to press Ctrl+C to skip to next track or end the whole
playback if pressing it twice.
Note that this Ctrl+C behaviour is special to this mode; when any of the following is activated, Ctrl+C will just kill the program like you would expect normally (this changed from earlier versions).
Note that this Ctrl+C behaviour is special to this mode; when any of
the following is activated, Ctrl+C will just kill the program like you
would expect normally (this changed from earlier versions).
3.2 Advanced Console Usage
You can specify the option -C to enable a terminal control interface enabling to influence playback on current title/playlist by pressing some key:
You can specify the option -C to enable a terminal control interface
enabling to influence playback on current title/playlist by pressing
some key:
-= terminal control keys =-
[s] or [ ] interrupt/restart playback (i.e. '(un)pause')
[f] next track
@@ -98,7 +121,8 @@ You can specify the option -C to enable a terminal control interface enabling to
[c] or [C] pitch up (small step, big step)
[x] or [X] pitch down (small step, big step)
[w] reset pitch to zero
[k] print out current position in playlist and track, for the benefit of some external tool to store bookmarks
[k] print out current position in playlist and track, for the benefit
of some external tool to store bookmarks
[h] this help
[q] quit
@@ -106,41 +130,76 @@ You can change these bindings to key to your liking by modifying term.h .
Note: This interface needs not to be available on _every_ platform/build.
Another note: The volume up and down is performed by changing the scale factor (like the -f parameter) ... so the audio is scaled digitally in the given range of the output format (usually 16bits). That means the lowering the volume will decrease the dynamic range and possibly lessen the quality while increasing volume can in fact increase the dynamic range and thus make it better, if you deal with a silent source and no clipping is necessary.
It is a good idea to use RVA values stored in the file for adjusting low volume files, though - mpg123 handles that in addition to your volume setting.
Another note: The volume up and down is performed by changing the scale
factor (like the -f parameter) ... so the audio is scaled digitally in
the given range of the output format (usually 16bits). That means the
lowering the volume will decrease the dynamic range and possibly lessen
the quality while increasing volume can in fact increase the dynamic
range and thus make it better, if you deal with a silent source and no
clipping is necessary.
It is a good idea to use RVA values stored in the file for adjusting
low volume files, though - mpg123 handles that in addition to your
volume setting.
3.3 Control Interface for Frontends
There used to be several interfaces for frontends left over from that past, but only one of them remains for the present and future:
There used to be several interfaces for frontends left over from that
past, but only one of them remains for the present and future:
The Generic Control Interface
It contains of communication of textual messages via standard input to mpg123 and responses to standard output unless the -s switch for output of audio data on stdout is used - then the responses come via stderr.
It contains of communication of textual messages via standard input to
mpg123 and responses to standard output unless the -s switch for output
of audio data on stdout is used - then the responses come via stderr.
See doc/README.remote for usage.
4. Speed
mpg123 is fast. Any faster software player is probably based on some hacked mpg123;-)
MPlayer included mpg123 source code in it's mp3lib and we have to be thankful for the MPlayer folks adding SSE, 3DNowExt and AltiVec optimizations over the years, which we were able to backport.
mpg123 is fast. Any faster software player is probably based on some
hacked mpg123;-)
MPlayer included mpg123 source code in it's mp3lib and we have to
be thankful for the MPlayer folks adding SSE, 3DNowExt and AltiVec
optimizations over the years, which we were able to backport.
mpg123 includes the AltiVec optimization since version 0.61 and the SSE and 3DNowExt optimizations since 0.66 .
Also, version 0.66 adds the merged x86 optimization build, which includes every applicable optimization for x86 cpus except the one for i486, wich is a bit special.
mpg123 includes the AltiVec optimization since version 0.61 and the SSE
and 3DNowExt optimizations since 0.66 .
Also, version 0.66 adds the merged x86 optimization build, which includes
every applicable optimization for x86 cpus except the one for i486,
wich is a bit special.
Now mpg123 catched up with MPlayer's mp3lib concerning decoding speed on my Pentium M (which supports SSE):
Decoding a certain album (Queensryche's Rage for Order) to /dev/null took 22.4s user time with mpg123-0.66 compared to 24.7s with MPlayer-1.0rc1 .
Now mpg123 catched up with MPlayer's mp3lib concerning decoding speed
on my Pentium M (which supports SSE):
Decoding a certain album (Queensryche's Rage for Order) to /dev/null took
22.4s user time with mpg123-0.66 compared to 24.7s with MPlayer-1.0rc1 .
Also, beginning with mpg123 1.8.0, there are fresh x86-64 SSE
optimizations (provided by Taihei Monma) which make mpg123 the fastest
MPEG audio decoder in my knowledge also on current 64bit x86 systems.
Manual optimizations continued with AVX probably being the last vector
instruction set that makes sense to implement the decoder for.
In 2025, a Core i7-10710U CPU needs 5.97 s for Queensryche's Rage for
Order with the AVX decoder, 6.01 s with x86-64 (SSE) and 9.05 s with
generic C code from the Ubuntu 22.04 build of mpg123 1.29.3.
Also, beginning with mpg123 1.8.0, there are fresh x86-64 SSE optimizations (provided by Taihei Monma) which make mpg123 the fastest MPEG audio decoder in my knowledge also on current 64bit x86 systems.
5. Accuracy
The mpg123 engine is able to decode in full compliance to ISO/IEC 11172-3, for all three layers, using floating point or integer math (the latter since 1.8.1).
Accuracy of 16bit output depends on specific optimization in use and compile-time choice about the rounding mode (which is performance relevant).
The mpg123 engine is able to decode in full compliance to ISO/IEC 11172-3,
for all three layers, using floating point or integer math (the latter
since 1.8.1).
Accuracy of 16bit output depends on specific optimization in use and
compile-time choice about the rounding mode (which is performance
relevant).
The ISO test suite is incorporated in the mpg123 subversion repository under svn://orgis.org/mpg123/test, nightly tests of a build (with high-quality 16bit rounding) are published on the mpg123 website.
The ISO test suite is incorporated in the mpg123 subversion repository
under svn://orgis.org/mpg123/test, nightly tests of a build (with
high-quality 16bit rounding) are published on the mpg123 website.
Dithered 16bit output is available as an option (the --cpu choices ending with _dither). See
Dithered 16bit output is available as an option (the --cpu choices ending
with _dither). See
http://dither123.dyndns.org
@@ -148,57 +207,103 @@ on the whereabouts.
6. History
A looooong time ago (mid-90s), Michael Hipp wrote some initial mpg123 and made it _the_ Unix console mp3 player in the following years.
The exact date of birth is fuzzy in human memory, but according to the master himself (Michael) mpg123 started in 1994 as an MP2 player which a year later, 1995, gained MP3 ability.
The core decoder files have mostly 1995 as their birth year listed, so one can say that mpg123 as the layer1,2,3 player was born in 1995.
In any case, that is a looooong time ago for a media player - especially for one that is still alive!
A looooong time ago (mid-90s), Michael Hipp wrote some initial mpg123
and made it _the_ Unix console mp3 player in the following years.
The exact date of birth is fuzzy in human memory, but according to the
master himself (Michael) mpg123 started in 1994 as an MP2 player which
a year later, 1995, gained MP3 ability.
The core decoder files have mostly 1995 as their birth year listed,
so one can say that mpg123 as the layer1,2,3 player was born in 1995.
In any case, that is a looooong time ago for a media player - especially
for one that is still alive!
This is the historic description:
This isn't a new player. It's a fully rewritten version originally based
This isn't a new player. It's a fully rewritten version originally
based
on the mpegaudio (FHG-version) package. The DCT algorithm in the
synthesis filter is a rewritten version of the DCT first seen in the maplay
package, which was written by Tobias Bading (bading@cs.tu-berlin.de). The
rewrite was necessary, because the GPL may not allow this copyright mix.
The mpegaudio package was written by various people from the MPEG/audio
software simulation group. The maplay is under GPL .. You can find the
original source code and the mpegaudio package on: ftp.tnt.uni-hannover.de.
synthesis filter is a rewritten version of the DCT first seen
in the maplay
package, which was written by Tobias Bading
(bading@cs.tu-berlin.de). The
rewrite was necessary, because the GPL may not allow this
copyright mix.
The mpegaudio package was written by various people from the
MPEG/audio
software simulation group. The maplay is under GPL .. You can
find the
original source code and the mpegaudio package on:
ftp.tnt.uni-hannover.de.
Especially layer3.c common.c and mpg123.h is based on the dist10 package.
Especially layer3.c common.c and mpg123.h is based on the
dist10 package.
The code is fully rewritten but I'm using sometimes the
same variable names or similar function names as in the
original package.
In the current layer3.c I'm using a DCT36 first seen in Jeff Tsay's
In the current layer3.c I'm using a DCT36 first seen in Jeff
Tsay's
(ctsay@pasteur.eecs.berkeley.edu) maplay 1.2+ package. His code is
under GPL .. I also tried the enhancement from Mikko Tommila. His
code is also in layer3.c (but it's disabled at the moment, because
it was slightly slower than the unrolled 9 point DCT (at least on
_my_ system)). Theoretically it should be faster. You may try it on
it was slightly slower than the unrolled 9 point DCT (at least on
_my_ system)). Theoretically it should be faster. You may try
it on
your system.
Well, that's how it started...
Official development ceased due to the typical lack-of-time syndrome around 2002 and the free-floating patches began to seize the day.
Official development ceased due to the typical lack-of-time syndrome
around 2002 and the free-floating patches began to seize the day.
But before that, Michael wrote or rewrote the essential code; others contributed their bits.
But before that, Michael wrote or rewrote the essential code; others
contributed their bits.
The main message is:
Code is copyrighted by Michael Hipp, who made it free software under the terms of the LGPL 2.1.
Code is copyrighted by Michael Hipp, who made it free software under
the terms of the LGPL 2.1.
Please see doc/ROAD_TO_LGPL, COPYING and AUTHORS for details on that. Note that the only notable legacy non-LGPL file was the old alsa output that didn't work with alsa 0.9/1.0 anymore.
Also, there has been a libao output in the betas 0.60 for a short period. Libao being generally problematic for us because of its GPL license, this output is not distributed anymore in the release packages. There is now a new, LGPLed alsa output that made both the old alsa and libao obsolete for our purposes.
So, the distributed mpg123 releases actually only contain LGPL code, but you get the other files from our subversion repository if you checkout the trunk / version tags.
Please see doc/ROAD_TO_LGPL, COPYING and AUTHORS for details on that. Note
that the only notable legacy non-LGPL file was the old alsa output that
didn't work with alsa 0.9/1.0 anymore.
Also, there has been a libao output in the betas 0.60 for a short
period. Libao being generally problematic for us because of its
GPL license, this output is not distributed anymore in the release
packages. There is now a new, LGPLed alsa output that made both the old
alsa and libao obsolete for our purposes.
So, the distributed mpg123 releases actually only contain LGPL code, but
you get the other files from our subversion repository if you checkout
the trunk / version tags.
There has been quite some confusion about the licensing and "freeness" of mpg123 in the past.
The initial "free for private use, ask me when you want to do something commercial" license caused some people to avoid mpg123 and even to write a replacement mimicking the interface but using a different decoding engine - what was not actively developed for too long but entered the "free" software sections.
There has been quite some confusion about the licensing and "freeness"
of mpg123 in the past.
The initial "free for private use, ask me when you want to do something
commercial" license caused some people to avoid mpg123 and even to write
a replacement mimicking the interface but using a different decoding
engine - what was not actively developed for too long but entered the
"free" software sections.
The Debian (non-free section) and Gentoo distributions cared about the last stable and the last development release of mpg123 over the years with mainly applying security fixes. Thanks go to the distribution maintainers for not letting it alone to bitrot over the years.
The Debian (non-free section) and Gentoo distributions cared about the
last stable and the last development release of mpg123 over the years
with mainly applying security fixes. Thanks go to the distribution
maintainers for not letting it alone to bitrot over the years.
Thomas Orgis started to hack on mpg123 in 2004 while working on his personal audio experience with mixplayd and later DerMixD, utilizing the generic control interface. In Feb 2005, he crammed control interface improvements together with Debian's r19 fixes and released the personal fork/patch named mpg123-thor.
Little later that year, Nicholas J. Humphrey independently created the sourceforge project and released an autotooled 0.59r under official GPL flag with Debian and MacOSX fixes.
In the beginning of 2006, Thomas finally decided that he could work "officially" on mpg123 and contacted Michael Hipp for taking over maintainership.
Michael was all-positive about letting mpg123 really live again (and perhaps see version 1.0 some time;-) and also pointed at the sourceforge project that didn't see much activity since the initial release.
A lot of emails and some weeks later there was the two-developer team of Nicholas and Thomas working on merging their mpg123 variants as well as adding some features and fixes to let it shine again.
Thomas Orgis started to hack on mpg123 in 2004 while working on his
personal audio experience with mixplayd and later DerMixD, utilizing
the generic control interface. In Feb 2005, he crammed control interface
improvements together with Debian's r19 fixes and released the personal
fork/patch named mpg123-thor.
Little later that year, Nicholas J. Humphrey independently created the
sourceforge project and released an autotooled 0.59r under official GPL
flag with Debian and MacOSX fixes.
In the beginning of 2006, Thomas finally decided that he could work
"officially" on mpg123 and contacted Michael Hipp for taking over
maintainership.
Michael was all-positive about letting mpg123 really live again (and
perhaps see version 1.0 some time;-) and also pointed at the sourceforge
project that didn't see much activity since the initial release.
A lot of emails and some weeks later there was the two-developer team
of Nicholas and Thomas working on merging their mpg123 variants as well
as adding some features and fixes to let it shine again.
And there we are now...

23
build_arm.sh Normal file
View File

@@ -0,0 +1,23 @@
#export TOOLCHAIN=/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64
export TOOLCHAIN=/c/Users/david/AppData/Local/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64
export TARGET=armv7a-linux-androideabi
#export TARGET=x86_64-linux-android
export API=21
export AR=$TOOLCHAIN/bin/llvm-ar
export AS=$TOOLCHAIN/bin/llvm-as
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export LD=$TOOLCHAIN/bin/ld
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$TOOLCHAIN/bin/llvm-strip
export CFLAGS=-DNOXFERMEM
./configure --host $TARGET --with-audio=dummy --with-cpu=arm_fpu --prefix=$(pwd)/install
make
make install
# add NOXFERMEM ifdefs to buffer.c and xfermem.c
# see https://android.googlesource.com/platform/external/mpg123/+/refs/heads/master/src/buffer.c
#
# run 'make' with MSYS2, not Chocolatey make -> avoid 'C:/Program Files/' style SHELL

25
build_win.sh Normal file
View File

@@ -0,0 +1,25 @@
#export TOOLCHAIN=/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64
export TOOLCHAIN=/c/Users/david/AppData/Local/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64
#export TARGET=armv7a-linux-androideabi
#export TARGET2=arm-linux-androideabi
export TARGET=x86_64-linux-android
#export TARGET2=x86_64-linux-android
export API=21
export AR=$TOOLCHAIN/bin/llvm-ar
export AS=$TOOLCHAIN/bin/llvm-as
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export LD=$TOOLCHAIN/bin/ld
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$TOOLCHAIN/bin/llvm-strip
export CFLAGS=-DNOXFERMEM
#--with-cpu=arm_fpu
./configure --host $TARGET --with-audio=dummy --prefix=$(pwd)/install-files
make
make install
# add NOXFERMEM ifdefs to buffer.c and xfermem.c
# see https://android.googlesource.com/platform/external/mpg123/+/refs/heads/master/src/buffer.c
# run 'make' with MSYS2, not Chocolatey make -> avoid 'C:/Program Files/' style SHELL

342
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for mpg123 1.32.9.
# Generated by GNU Autoconf 2.71 for mpg123 1.33.4.
#
# Report bugs to <maintainer@mpg123.org>.
#
@@ -621,8 +621,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='mpg123'
PACKAGE_TARNAME='mpg123'
PACKAGE_VERSION='1.32.9'
PACKAGE_STRING='mpg123 1.32.9'
PACKAGE_VERSION='1.33.4'
PACKAGE_STRING='mpg123 1.33.4'
PACKAGE_BUGREPORT='maintainer@mpg123.org'
PACKAGE_URL=''
@@ -858,9 +858,6 @@ PULSE_LIBS
PULSE_CFLAGS
JACK_LIBS
JACK_CFLAGS
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
HAVE_ARM_FALSE
HAVE_ARM_TRUE
HAVE_GETCPUFLAGS_ARM_FALSE
@@ -1012,6 +1009,9 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
AM_BACKSLASH
AM_DEFAULT_VERBOSITY
AM_DEFAULT_V
@@ -1157,6 +1157,9 @@ with_network
ac_precious_vars='build_alias
host_alias
target_alias
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
CC
CFLAGS
LDFLAGS
@@ -1166,9 +1169,6 @@ CCAS
CCASFLAGS
CPP
LT_SYS_LIBRARY_PATH
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
JACK_CFLAGS
JACK_LIBS
PULSE_CFLAGS
@@ -1727,7 +1727,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures mpg123 1.32.9 to adapt to many kinds of systems.
\`configure' configures mpg123 1.33.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1798,7 +1798,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of mpg123 1.32.9:";;
short | recursive ) echo "Configuration of mpg123 1.33.4:";;
esac
cat <<\_ACEOF
@@ -1877,7 +1877,8 @@ Optional Features:
--disable-layer1 no layer I decoding
--disable-layer2 no layer II decoding
--disable-layer3 no layer III decoding
--enable-portable only build portable API (no off_t, no internal I/O)
--enable-portable only build portable API (no off_t, no internal I/O
-- and no end-user programs)
--disable-largefile to not attempt to use 64 bit file offsets internally
--disable-feature_report
Disable feature report function
@@ -1979,6 +1980,11 @@ Optional Packages:
default, but can be used for HTTP, too.
Some influential environment variables:
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
@@ -1991,11 +1997,6 @@ Some influential environment variables:
CPP C preprocessor
LT_SYS_LIBRARY_PATH
User-defined run-time library search path.
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
JACK_CFLAGS C compiler flags for JACK, overriding pkg-config
JACK_LIBS linker flags for JACK, overriding pkg-config
PULSE_CFLAGS
@@ -2076,7 +2077,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
mpg123 configure 1.32.9
mpg123 configure 1.33.4
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2621,7 +2622,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by mpg123 $as_me 1.32.9, which was
It was created by mpg123 $as_me 1.33.4, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3390,8 +3391,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
LIBMPG123_VERSION=48:3:48
LIBOUT123_VERSION=5:1:5
LIBMPG123_VERSION=49:4:49
LIBOUT123_VERSION=5:2:5
LIBSYN123_VERSION=2:3:2
@@ -3991,7 +3992,7 @@ fi
# Define the identity of the package.
PACKAGE='mpg123'
VERSION='1.32.9'
VERSION='1.33.4'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -4097,6 +4098,140 @@ fi
ac_config_headers="$ac_config_headers src/config.h"
if test 2 -lt "$(grep "PKG_"CHECK_MODULES "$0"|wc -l)"; then
as_fn_error $? "Pkg-config was absent when generating this configure script.
Re-run autoreconf with pkg-config installed top get a working one." "$LINENO" 5
fi
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_PKG_CONFIG+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
printf "%s\n" "$PKG_CONFIG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
fi
if test -z "$ac_cv_path_PKG_CONFIG"; then
ac_pt_PKG_CONFIG=$PKG_CONFIG
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_ac_pt_PKG_CONFIG+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $ac_pt_PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
if test -n "$ac_pt_PKG_CONFIG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test "x$ac_pt_PKG_CONFIG" = x; then
PKG_CONFIG=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
PKG_CONFIG=$ac_pt_PKG_CONFIG
fi
else
PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
fi
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=0.9.0
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
PKG_CONFIG=""
fi
fi
# You get strange symptoms like jack module build failing because the AC_C_CONST failed to detect the working const support.
# In that case, the test failed because -Werror, not because no const there...
@@ -17131,7 +17266,7 @@ fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if .balign is present" >&5
printf %s "checking if .balign is present... " >&6; }
echo '.balign 4' > conftest.s
if $CCAS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
if $CCAS $CCASFLAGS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
@@ -17151,7 +17286,7 @@ if test x"$asmalign_exp" = xunknown; then
printf %s "checking if .align takes 2-exponent... " >&6; }
asmalign_exp="no"
echo '.align 3' > conftest.s
if $CCAS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
if $CCAS $CCASFLAGS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
asmalign_exp="yes"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
@@ -17198,7 +17333,7 @@ printf %s "checking if assembler supports AVX instructions... " >&6; }
avx_support="no"
echo '.text' > conftest.s
echo 'vaddps %ymm0,%ymm0,%ymm0' >> conftest.s
if $CCAS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
if $CCAS $CCASFLAGS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
avx_support="yes"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
@@ -17722,8 +17857,6 @@ printf "%s\n" "$ac_cv_header_wincon_h" >&6; }
if test "x$ac_cv_header_wincon_h" = "xyes"
then :
else $as_nop
printf "%s\n" "#define HAVE_WINCON_H 1" >>confdefs.h
fi
@@ -17789,6 +17922,7 @@ then :
fi
# strtok_s for MSVCRT, not the C11 variant
ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror"
if test "x$ac_cv_func_strerror" = xyes
then :
@@ -17807,6 +17941,18 @@ then :
printf "%s\n" "#define HAVE_USELOCALE 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "strtok_r" "ac_cv_func_strtok_r"
if test "x$ac_cv_func_strtok_r" = xyes
then :
printf "%s\n" "#define HAVE_STRTOK_R 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "strtok_s" "ac_cv_func_strtok_s"
if test "x$ac_cv_func_strtok_s" = xyes
then :
printf "%s\n" "#define HAVE_STRTOK_S 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale"
@@ -18783,137 +18929,6 @@ if test "x$build_libout123" = xyes && ! echo "$check_modules" | grep -qw dummy;
check_modules="$check_modules dummy"
fi
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_PKG_CONFIG+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
printf "%s\n" "$PKG_CONFIG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
fi
if test -z "$ac_cv_path_PKG_CONFIG"; then
ac_pt_PKG_CONFIG=$PKG_CONFIG
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_ac_pt_PKG_CONFIG+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $ac_pt_PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
if test -n "$ac_pt_PKG_CONFIG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test "x$ac_pt_PKG_CONFIG" = x; then
PKG_CONFIG=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
PKG_CONFIG=$ac_pt_PKG_CONFIG
fi
else
PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
fi
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=0.9.0
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
PKG_CONFIG=""
fi
fi
# Now go through the modules to check and do the chores.
for m in $check_modules
do
@@ -22453,7 +22468,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by mpg123 $as_me 1.32.9, which was
This file was extended by mpg123 $as_me 1.33.4, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -22521,7 +22536,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
mpg123 config.status 1.32.9
mpg123 config.status 1.33.4
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
@@ -24222,11 +24237,18 @@ fi
default_offset_bits=`expr "$ac_cv_sizeof_off_t" "*" "8"`
if test "x$build_programs" = xyes && ! test "x$portable_api" = xyes; then
build_mpg123_programs=yes
else
build_mpg123_programs=no
fi
echo "
$PACKAGE_NAME $PACKAGE_VERSION
Install path ............ $prefix
Components .............. $components
Main mpg123 program(s)... $build_mpg123_programs
CPU Optimization ........ $cpu_type
Compiler Optimization ... $with_optimization"
if test x"$use_yasm_for_avx" = xyes; then

View File

@@ -80,6 +80,13 @@ dnl Testing with 1.14.
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_HEADERS([src/config.h])
dnl You tell me how quoting this normally would work to avoid expansion!
if test 2 -lt "$(grep "PKG_"CHECK_MODULES "$0"|wc -l)"; then
AC_MSG_ERROR([Pkg-config was absent when generating this configure script.
Re-run autoreconf with pkg-config installed top get a working one.])
fi
dnl For some reason, this has to be after the check above.
PKG_PROG_PKG_CONFIG([])
# You get strange symptoms like jack module build failing because the AC_C_CONST failed to detect the working const support.
# In that case, the test failed because -Werror, not because no const there...
@@ -1209,7 +1216,7 @@ dnl ############## Assembler, compiler properties
# extended to use balign if present
AC_MSG_CHECKING([if .balign is present])
echo '.balign 4' > conftest.s
if $CCAS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
if $CCAS $CCASFLAGS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
AC_MSG_RESULT([yes])
AC_DEFINE(ASMALIGN_BALIGN, 1, [ Define if .balign is present. ])
@@ -1224,7 +1231,7 @@ if test x"$asmalign_exp" = xunknown; then
AC_MSG_CHECKING([if .align takes 2-exponent])
asmalign_exp="no"
echo '.align 3' > conftest.s
if $CCAS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
if $CCAS $CCASFLAGS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
asmalign_exp="yes"
AC_MSG_RESULT([yes])
else
@@ -1263,7 +1270,7 @@ if test x"$avx_support" = xunknown; then
avx_support="no"
echo '.text' > conftest.s
echo 'vaddps %ymm0,%ymm0,%ymm0' >> conftest.s
if $CCAS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
if $CCAS $CCASFLAGS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
avx_support="yes"
AC_MSG_RESULT([yes])
else
@@ -1331,7 +1338,7 @@ dnl ############## LFS stuff
portable_api=no
AC_ARG_ENABLE(portable,
[AS_HELP_STRING( [--enable-portable], [only build portable API (no off_t, no internal I/O)])],
[AS_HELP_STRING( [--enable-portable], [only build portable API (no off_t, no internal I/O -- and no end-user programs)])],
[
if test "x$enableval" = xyes; then
portable_api="yes"
@@ -1471,7 +1478,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
void *v = &ReadConsoleInput;
])],[ac_cv_header_wincon_h=yes],[ac_cv_header_wincon_h=no])
AC_MSG_RESULT([$ac_cv_header_wincon_h])
AS_IF([test "x$ac_cv_header_wincon_h" = "xyes"],[],[AC_DEFINE([HAVE_WINCON_H],[1],[Define to 1 if you have the <wincon.h> header file.])])
AS_IF([test "x$ac_cv_header_wincon_h" = "xyes"],[AC_DEFINE([HAVE_WINCON_H],[1],[Define to 1 if you have the <wincon.h> header file.])],[])
term_type=none
if test "x$ac_cv_sys_posix_termios" = "xyes"; then
@@ -1491,7 +1498,8 @@ AC_CHECK_FUNCS( sched_setscheduler setuid getuid)
# Check for setpriority
AC_CHECK_FUNCS( setpriority )
AC_CHECK_FUNCS( strerror strerror_l uselocale )
# strtok_s for MSVCRT, not the C11 variant
AC_CHECK_FUNCS( strerror strerror_l uselocale strtok_r strtok_s)
AC_CHECK_FUNCS( setlocale nl_langinfo mbstowcs wcstombs wcswidth iswprint )
@@ -1925,8 +1933,6 @@ if test "x$build_libout123" = xyes && ! echo "$check_modules" | grep -qw dummy;
check_modules="$check_modules dummy"
fi
PKG_PROG_PKG_CONFIG([])
# Now go through the modules to check and do the chores.
for m in $check_modules
do
@@ -2953,11 +2959,18 @@ dnl ############## Display Message
default_offset_bits=`expr "$ac_cv_sizeof_off_t" "*" "8"`
if test "x$build_programs" = xyes && ! test "x$portable_api" = xyes; then
build_mpg123_programs=yes
else
build_mpg123_programs=no
fi
echo "
$PACKAGE_NAME $PACKAGE_VERSION
Install path ............ $prefix
Components .............. $components
Main mpg123 program(s)... $build_mpg123_programs
CPU Optimization ........ $cpu_type
Compiler Optimization ... $with_optimization"
if test x"$use_yasm_for_avx" = xyes; then

View File

@@ -141,9 +141,10 @@ is the number of entry starting at 1. A value of 0 is the default and means play
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.
This interacts fine with \-\-random since version 1.33, but not \-\-shuffle, as that destroys the notion of a stable position in the playlist.
.TP
\fB\-\-loop \fItimes\fR
for looping track(s) a certain number of times, < 0 means infinite loop (not with \-\-random!).
for playing track(s) a certain number of times in a loop, < 0 means infinite loop.
.TP
.BR \-\-keep\-open
For remote control mode: Keep loaded file open after reaching end.
@@ -228,7 +229,7 @@ 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
Forces reopen of the audiodevice after every track.
.TP
.BR \-\-cpu\ \fIdecoder\-type
Selects a certain decoder (optimized for specific CPU), for example i586 or MMX.

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.32.9
Version: 1.33.4
Release: 1
URL: http://www.mpg123.org/
License: GPL

View File

@@ -53,18 +53,8 @@ install(
"${CMAKE_CURRENT_BINARY_DIR}/libsyn123.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
if(BUILD_LIBOUT123)
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/../../man1/mpg123.1"
"${CMAKE_CURRENT_SOURCE_DIR}/../../man1/out123.1"
DESTINATION "${CMAKE_INSTALL_MANDIR}")
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/libout123.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/../../man1/out123.1"
DESTINATION "${CMAKE_INSTALL_MANDIR}")
endif()

View File

@@ -41,6 +41,14 @@ function(check_m)
check_function_exists(sin HAVE_M)
endfunction(check_m)
check_m()
# Cargo coding the check if there is a library rt, possibly providing
# a canary symbol. I am not sure if this logic really mirrors what
# autotools does.
function(check_rt)
set(CMAKE_REQUIRED_LIBRARIES rt)
check_function_exists(clock_gettime HAVE_RT)
endfunction(check_rt)
check_rt()
check_function_exists(atoll HAVE_ATOLL)
check_function_exists(getaddrinfo HAVE_IPV6)
@@ -59,14 +67,16 @@ 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(strtok_r HAVE_STRTOK_R)
check_function_exists(strtok_s HAVE_STRTOK_S)
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_type_size(off_t SIZEOF_OFF_T)
check_type_size(off_t MPG123_SIZEOF_OFF_T)
if(SIZEOF_OFF_T LESS 8)
if(MPG123_SIZEOF_OFF_T LESS 8)
check_function_exists(lseek64 LFS_LARGEFILE_64)
if(LFS_LARGEFILE_64)
@@ -446,7 +456,18 @@ if(UNIX AND NOT PORTABLE_API)
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/")
endif()
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/../../../man1/mpg123.1"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../man1/out123.1"
DESTINATION "${CMAKE_INSTALL_MANDIR}")
endif()
endif()
configure_file(config.cmake.h.in config.h)
set(LIBMPG123_LIBS "${LIBMPG123_LIBS}" PARENT_SCOPE)
set(LIBOUT123_LIBS "${LIBOUT123_LIBS}" PARENT_SCOPE)
set(LIBSYN123_LIBS "${LIBSYN123_LIBS}" PARENT_SCOPE)

View File

@@ -2,12 +2,18 @@ set(TARGET compat)
add_library(${TARGET} OBJECT
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/compat/compat.c"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/compat/compat_str.c")
set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
if(BUILD_SHARED_LIBS)
set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
add_library(${TARGET}_dl OBJECT
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/compat/compat_dl.c")
set_target_properties(${TARGET}_dl PROPERTIES POSITION_INDEPENDENT_CODE ON)
if(BUILD_SHARED_LIBS)
set_target_properties(${TARGET}_dl PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
add_library(${TARGET}_str OBJECT
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/compat/compat_str.c")
set_target_properties(${TARGET}_str PROPERTIES POSITION_INDEPENDENT_CODE ON)
if(BUILD_SHARED_LIBS)
set_target_properties(${TARGET}_str PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()

View File

@@ -43,6 +43,8 @@
#cmakedefine HAVE_SIGNAL_H 1
#cmakedefine HAVE_STRERROR 1
#cmakedefine HAVE_STRERROR_L 1
#cmakedefine HAVE_STRTOK_R 1
#cmakedefine HAVE_STRTOK_S 1
#cmakedefine HAVE_FORK 1
#cmakedefine HAVE_EXECVP 1
#cmakedefine HAVE_CTERMID 1
@@ -144,7 +146,7 @@
#define PKGLIBDIR "@CMAKE_INSTALL_LIBDIR@/@PROJECT_NAME@"
// CMake leaves it emtpy for non-existing type. Autoconf sets it to 0.
#define SIZEOF_OFF_T (@SIZEOF_OFF_T@+0)
#define SIZEOF_OFF_T (@MPG123_SIZEOF_OFF_T@+0)
#cmakedefine STDERR_FILENO @STDERR_FILENO@
#cmakedefine STDIN_FILENO @STDIN_FILENO@

View File

@@ -235,6 +235,13 @@ else()
target_sources(${TARGET} PRIVATE ${PLATFORM_SOURCES})
endif()
if(HAVE_M)
string(APPEND LIBMPG123_LIBS " -lm")
endif()
if(WANT_WIN32_UNICODE)
string(APPEND LIBMPG123_LIBS " -lshlwapi")
endif()
set(LIBMPG123_LIBS "${LIBMPG123_LIBS}" PARENT_SCOPE)
target_link_libraries(${TARGET} PRIVATE
$<$<BOOL:${HAVE_M}>:m>
$<$<BOOL:${WANT_WIN32_UNICODE}>:shlwapi>)

View File

@@ -18,9 +18,24 @@ add_library(${TARGET}
set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME out123)
if(HAVE_UNIX_DL)
string(APPEND LIBOUT123_LIBS " -ldl")
endif()
if(HAVE_M)
string(APPEND LIBOUT123_LIBS " -lm")
endif()
if(HAVE_RT)
string(APPEND LIBOUT123_LIBS " -lrt")
endif()
if(WANT_WIN32_UNICODE)
string(APPEND LIBOUT123_LIBS " -lshlwapi")
endif()
set(LIBOUT123_LIBS "${LIBOUT123_LIBS}" PARENT_SCOPE)
target_link_libraries(${TARGET} PRIVATE
$<TARGET_NAME_IF_EXISTS:defaultmodule>
$<$<BOOL:${HAVE_UNIX_DL}>:dl>
$<$<BOOL:${HAVE_M}>:m>
$<$<BOOL:${HAVE_RT}>:rt>
$<$<BOOL:${WANT_WIN32_UNICODE}>:shlwapi>)
target_include_directories(${TARGET} INTERFACE

View File

@@ -19,9 +19,12 @@ target_include_directories(${TARGET} INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
if(HAVE_M)
string(APPEND LIBSYN123_LIBS " -lm")
endif()
set(LIBSYN123_LIBS "${LIBSYN123_LIBS}" PARENT_SCOPE)
target_link_libraries(${TARGET} PRIVATE
$<$<BOOL:${HAVE_M}>:m>
$<$<BOOL:${WANT_WIN32_UNICODE}>:shlwapi>)
$<$<BOOL:${HAVE_M}>:m>)
install(TARGETS ${TARGET} EXPORT targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/"

View File

@@ -20,10 +20,10 @@ TEXT_DESC = ''
# get workdir from first arg or use current dir
if (len(sys.argv) > 1):
fname = sys.argv[1]
print "fname=" + fname
print("fname=" + fname)
else:
print 'Give me at least a file name to work on, plus the lyrics from stdin'
print 'Optionally, you can provide the language (3 lowercase letters) of the lyrics and a description'
print('Give me at least a file name to work on, plus the lyrics from stdin')
print('Optionally, you can provide the language (3 lowercase letters) of the lyrics and a description')
sys.exit()
if (len(sys.argv) > 2):
@@ -32,7 +32,7 @@ if (len(sys.argv) > 2):
if (len(sys.argv) > 3):
TEXT_DESC = sys.argv[3]
print "reading lyrics from standard input ..."
print("reading lyrics from standard input ...")
lyrics = sys.stdin.read().strip()
@@ -41,25 +41,25 @@ for enc in ('utf8','iso-8859-1','iso-8859-15','cp1252','cp1251','latin1'):
try:
lyrics = lyrics.decode(enc)
TEXT_DESC = TEXT_DESC.decode(enc)
print enc,
print(enc, end=" ")
break
except:
pass
print "Adding lyrics to " + fname
print "Language: " + TEXT_LANG
print "Description: " + TEXT_DESC
print("Adding lyrics to " + fname)
print("Language: " + TEXT_LANG)
print("Description: " + TEXT_DESC)
# create ID3 tag if not exists
try:
tags = ID3(fname)
except ID3NoHeaderError:
print "Adding ID3 header;",
print("Adding ID3 header;", end=" ")
tags = ID3()
# remove old unsychronized lyrics
if len(tags.getall(u"USLT::'"+TEXT_LANG+"'")) != 0:
print "Removing Lyrics."
print("Removing Lyrics.")
tags.delall(u"USLT::'"+TEXT_LANG+"'")
#tags.save(fname) # hm, why?
@@ -68,9 +68,9 @@ if len(tags.getall(u"USLT::'"+TEXT_LANG+"'")) != 0:
# USLT frames are present
#tags[u"USLT::'eng'"] = (USLT(encoding=3, lang=u'eng', desc=u'desc', text=lyrics))
tags[u"USLT::'"+TEXT_LANG+"'"] = (USLT(encoding=3, lang=TEXT_LANG, desc=TEXT_DESC, text=lyrics))
print 'Added USLT frame to', fname
print('Added USLT frame to', fname)
tags.save(fname)
print 'Done'
print('Done')

View File

@@ -512,7 +512,7 @@ size_t INT123_unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *st
}
#ifndef NO_CATCHSIGNAL
#if (!defined(WIN32) || defined (__CYGWIN__)) && defined(HAVE_SIGNAL_H)
#if (!defined(WIN32) || defined (__CYGWIN__)) && !defined(__PSP__) && defined(HAVE_SIGNAL_H)
void (*INT123_catchsignal(int signum, void(*handler)(int)))(int)
{
struct sigaction new_sa;

View File

@@ -110,8 +110,17 @@
typedef unsigned char byte;
// Annoying hackery to select a safe strtok variant. MS decided to call their strtok_r strtok_s, while
// C11 declares another strtok_s with different prototype. Thanks to you all.
#ifdef HAVE_STRTOK_R
#define INT123_compat_strtok(a, b, c) strtok_r((a), (b), (c))
#endif
#if (defined(_UCRT) || defined(_MSC_VER) || (defined(__MINGW32__) || defined(__MINGW64__)) || (defined(__WATCOMC__) && defined(__NT__))) && !defined(__CYGWIN__)
#define MPG123_COMPAT_MSVCRT_IO
#ifndef INT123_compat_strtok
#define INT123_compat_strtok(a, b, c) strtok_s((a), (b), (c))
#endif
#endif
#if defined(MPG123_COMPAT_MSVCRT_IO)
@@ -150,6 +159,11 @@ typedef unsigned char byte;
#include <io.h>
#endif
#ifndef INT123_compat_strtok
#warning "no safe strtok found"
#define INT123_compat_strtok(a, b, c) strtok((a), (b))
#endif
/* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */
void *INT123_safe_realloc(void *ptr, size_t size);
// Also freeing ptr if result is NULL. You can do

View File

@@ -49,9 +49,9 @@
#include "../common/debug.h"
#include "wpathconv.h"
#ifdef USE_MODULES
#include "wpathconv.h"
/*
This is what I expected the platform-specific dance for dynamic module
support to be. Little did I know about the peculiarities of (long)

View File

@@ -244,6 +244,12 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strtok_r' function. */
#undef HAVE_STRTOK_R
/* Define to 1 if you have the `strtok_s' function. */
#undef HAVE_STRTOK_S
/* Define to 1 if you have the <sun/audioio.h> header file. */
#undef HAVE_SUN_AUDIOIO_H

View File

@@ -780,8 +780,9 @@ int control_generic (mpg123_handle *fr)
/* commands with arguments */
cmd = NULL;
arg = NULL;
cmd = strtok(comstr," \t"); /* get the main command */
arg = strtok(NULL,""); /* get the args */
char *toksave = NULL;
cmd = INT123_compat_strtok(comstr, " \t", &toksave); /* get the main command */
arg = INT123_compat_strtok(NULL, "", &toksave); /* get the args */
if (cmd && strlen(cmd) && arg && strlen(arg))
{

View File

@@ -13,13 +13,17 @@
/** \file mpg123.h The header file for the libmpg123 MPEG Audio decoder */
/** \defgroup mpg123_h mpg123 header general settings and notes
* @{
*/
/** A macro to check at compile time which set of API functions to expect.
* This must be incremented at least each time a new symbol is added
* to the header.
*/
#define MPG123_API_VERSION 48
#define MPG123_API_VERSION 49
/** library patch level at client build time */
#define MPG123_PATCHLEVEL 3
#define MPG123_PATCHLEVEL 4
#ifndef MPG123_EXPORT
/** Defines needed for MS Visual Studio(tm) DLL builds.
@@ -43,8 +47,10 @@
#endif
#endif
/** Earlier versions of libmpg123 put enums into public API calls,
* thich is not exactly safe. There are ABI rules, but you can use
/** \page enumapi About enum API
*
* Earlier versions of libmpg123 put enums into public API calls,
* which is not exactly safe. There are ABI rules, but you can use
* compiler switches to change the sizes of enums. It is safer not
* to have them in API calls. Thus, the default is to remap calls and
* structs to variants that use plain ints. Define MPG123_ENUM_API to
@@ -53,6 +59,21 @@
* You might want to define this to increase the chance of your binary
* working with an older version of the library. But if that is your goal,
* you should better build with an older version to begin with.
*
* You can avoid renamed symbols by using the non-enum names directly:
*
* - mpg123_param2()
* - mpg123_getparam2()
* - mpg123_feature2()
* - mpg123_eq2()
* - mpg123_geteq2()
* - mpg123_frameinfo2()
* - mpg123_info2()
* - mpg123_getstate2()
* - mpg123_enc_from_id3_2()
* - mpg123_store_utf8_2()
* - mpg123_par2()
* - mpg123_getpar2()
*/
#ifndef MPG123_ENUM_API
@@ -76,7 +97,7 @@
#ifndef MPG123_PORTABLE_API
#include <sys/types.h>
/* A little hack to help MSVC not having ssize_t. */
/** A little hack to help MSVC not having ssize_t. */
#ifdef _MSC_VER
typedef ptrdiff_t mpg123_ssize_t;
#else
@@ -85,26 +106,61 @@ typedef ssize_t mpg123_ssize_t;
#endif
/* Handling of large file offsets.
When client code defines _FILE_OFFSET_BITS, it wants non-default large file support,
and thus functions with added suffix (mpg123_open_64). The default library build provides
wrapper and alias functions to accomodate client code variations (dual-mode library like glibc).
Client code can definie MPG123_NO_LARGENAME and MPG123_LARGESUFFIX, respectively, for disabling
or enforcing the suffixes. If explicit usage of 64 bit offsets is desired, the int64_t API
(functions with 64 suffix without underscore, notablly mpg123_reader64()) can be used since
API version 48 (mpg123 1.32).
When in doubt, use the explicit 64 bit functions and avoid off_t in the API. You can define
MPG123_PORTABLE_API to ensure that. That being said, if you and your compiler do not have
problems with the concept of off_t, just use the normal API and be happy. Both 32 and 64
bit versions will be present where appropriate.
*/
/** \page lfs Handling of large file offsets
*
* When client code defines _FILE_OFFSET_BITS, it wants non-default large file
* support, and thus functions with added suffix (mpg123_open_64). The default
* library build provides wrapper and alias functions to accomodate client code
* variations (dual-mode library like glibc).
*
* Client code can definie MPG123_NO_LARGENAME and MPG123_LARGESUFFIX,
* respectively, for disabling or enforcing the suffixes. You should *not* do
* this, though, unless you *really* want to deal with symbol ABI yourself.
* If explicit usage of 64 bit offsets is desired, the int64_t API
* consisting of functions with 64 suffix without underscore, notably
* mpg123_reader64(), can be used since API version 48 (mpg123 1.32). A matching
* mpg123_open64(), stripped-down mpg123_open_handle_64() is present since API
* version 49 (mpg123 1.33).
*
* When in doubt, use the explicit 64 bit functions and avoid off_t in the API.
* You can define MPG123_PORTABLE_API to ensure that. That being said, if you
* and your compiler do not have problems with the concept of off_t, just use
* the normal AP like the I/O API of the standard C library. Both 32 and 64 bit
* versions of functions will be present where appropriate.
*
* If your toolchain enforces _FILE_OFFSET_BITS also during build of libmpg123,
* only that setting will be supported for client code.
*/
#ifndef MPG123_PORTABLE_API
/*
Now, the renaming of large file aware functions.
By default, it appends underscore _FILE_OFFSET_BITS (so, mpg123_seek_64 for mpg123_seek), if _FILE_OFFSET_BITS is defined. You can force a different suffix via MPG123_LARGESUFFIX (that must include the underscore), or you can just disable the whole mess by defining MPG123_NO_LARGENAME.
/** \page lfs_names Renaming of functions for largefile support
*
* Now, the renaming of large file aware functions.
* By default, it appends underscore _FILE_OFFSET_BITS (so, mpg123_seek_64() for mpg123_seek()),
* if _FILE_OFFSET_BITS is defined. These are the affected API functions:
*
* - mpg123_open_fixed()
* - mpg123_open()
* - mpg123_open_fd()
* - mpg123_open_handle()
* - mpg123_framebyframe_decode()
* - mpg123_decode_frame()
* - mpg123_tell()
* - mpg123_tellframe()
* - mpg123_tell_stream()
* - mpg123_seek()
* - mpg123_feedseek()
* - mpg123_seek_frame()
* - mpg123_timeframe()
* - mpg123_index()
* - mpg123_set_index()
* - mpg123_position()
* - mpg123_length()
* - mpg123_framelength()
* - mpg123_set_filesize()
* - mpg123_replace_reader()
* - mpg123_replace_reader_handle()
* - mpg123_framepos()
*/
#if (!defined MPG123_NO_LARGENAME) && ((defined _FILE_OFFSET_BITS) || (defined MPG123_LARGESUFFIX))
@@ -142,6 +198,8 @@ typedef ssize_t mpg123_ssize_t;
#endif /* largefile hackery */
#endif
/** @} */
#ifdef __cplusplus
extern "C" {
#endif
@@ -280,7 +338,11 @@ enum mpg123_param_flags
* the stream is assumed as non-seekable unless overridden.
*/
,MPG123_FORCE_SEEKABLE = 0x40000 /**< 19th bit: Force the stream to be seekable. */
,MPG123_STORE_RAW_ID3 = 0x80000 /**< store raw ID3 data (even if skipping) */
,MPG123_STORE_RAW_ID3 = 0x80000 /**< Store raw ID3 data (even if skipping).
* Before mpg123 1.33.2 (libmpg123 API 49, patchlevel 4), this has to be combined with
* MPG123_SKIP_ID3 to avoid getting corrupted data due to the ID3 parser inserting
* encoding bytes for its own convenience.
*/
,MPG123_FORCE_ENDIAN = 0x100000 /**< Enforce endianess of output samples.
* This is not reflected in the format codes. If this flag is set along with
* MPG123_BIG_ENDIAN, MPG123_ENC_SIGNED16 means s16be, without
@@ -774,7 +836,7 @@ MPG123_EXPORT int mpg123_open_fixed(mpg123_handle *mh, const char *path
* UTF-8, which also fits any sane modern install of Unix-like systems.
*
* \param mh handle
* \param path filesystem
* \param path filesystem path
* \return MPG123_OK on success
*/
MPG123_EXPORT int mpg123_open(mpg123_handle *mh, const char *path);
@@ -786,17 +848,63 @@ MPG123_EXPORT int mpg123_open(mpg123_handle *mh, const char *path);
* \return MPG123_OK on success
*/
MPG123_EXPORT int mpg123_open_fd(mpg123_handle *mh, int fd);
#endif
/** Use an opaque handle as bitstream input. This works only with the
* replaced I/O from mpg123_replace_reader_handle() or mpg123_reader64()!
* mpg123_close() will call the cleanup callback for your non-NULL
* handle (if you gave one).
* Note that this used to be usable with MPG123_PORTABLE_API defined in
* mpg123 1.32.x and was in fact the only entry point for handle I/O.
* Since mpg123 1.33.0 and API version 49, there is
* mpg123_open_handle64() for the portable case and has to be used
* instead of this function here, even if it _would_ work just fine,
* the inclusion of a largefile-renamed symbol in the portable set was wrong.
*
* \param mh handle
* \param iohandle your handle
* \return MPG123_OK on success
*/
MPG123_EXPORT int mpg123_open_handle(mpg123_handle *mh, void *iohandle);
#endif
/** Open and prepare to decode the specified file by filesystem path.
* This works exactly like mpg123_open() in modern libmpg123, see there
* for more description. This name is not subject to largefile symbol renaming.
* You can also use it with MPG123_PORTABLE_API.
*
* \param mh handle
* \param path filesystem path of your resource
* \return MPG123_OK on success
*/
MPG123_EXPORT int mpg123_open64(mpg123_handle *mh, const char *path);
/** Open a simple MPEG file with fixed properties.
* This is the same as mpg123_open_fixed(), just with a stable
* symbol name for int64_t portable API.
*
* \param mh handle
* \param path filesystem path (see mpg123_open())
* \param channels allowed channel count, either 1 (MPG123_MONO) or
* 2 (MPG123_STEREO), or bitwise or of them, but then you're halfway back to
* calling mpg123_format() again;-)
* \param encoding a definite encoding from enum mpg123_enc_enum
* or a bitmask like for mpg123_format(), defeating the purpose somewhat
*/
MPG123_EXPORT int mpg123_open_fixed64(mpg123_handle *mh, const char *path
, int channels, int encoding);
/** Use an opaque handle as bitstream input. This works only with the
* replaced I/O from mpg123_reader64()!
* mpg123_close() will call the cleanup callback for your non-NULL
* handle (if you gave one).
* This is a simplified variant of mpg123_open_handle() that only
* supports the int64_t API, available with MPG123_PORTABLE_API.
*
* \param mh handle
* \param iohandle your handle
* \return MPG123_OK on success
*/
MPG123_EXPORT int mpg123_open_handle64(mpg123_handle *mh, void *iohandle);
/** Open a new bitstream and prepare for direct feeding
* This works together with mpg123_decode(); you are responsible for reading and feeding the input bitstream.
@@ -1258,6 +1366,7 @@ MPG123_EXPORT int mpg123_eq2( mpg123_handle *mh
/** Set a range of equalizer bands
* \param channel Can be #MPG123_LEFT, #MPG123_RIGHT or
* #MPG123_LEFT|#MPG123_RIGHT for both.
* \param mh handle
* \param a The first equalizer band to set (from 0 to 31)
* \param b The last equalizer band to set (from 0 to 31)
* \param factor The (linear) adjustment factor, 1 being neutral.
@@ -1267,6 +1376,7 @@ MPG123_EXPORT int mpg123_eq_bands( mpg123_handle *mh
, int channel, int a, int b, double factor );
/** Change a range of equalizer bands
* \param mh handle
* \param channel Can be #MPG123_LEFT, #MPG123_RIGHT or
* #MPG123_LEFT|#MPG123_RIGHT for both.
* \param a The first equalizer band to change (from 0 to 31)
@@ -2218,7 +2328,8 @@ MPG123_EXPORT int mpg123_replace_reader_handle( mpg123_handle *mh
/** Set up portable read functions on an opaque handle.
* The handle is a void pointer, so you can pass any data you want...
* mpg123_open_handle() is the call you make to use the I/O defined here.
* mpg123_open64() (since API 49) or mpg123_open_handle() is the call you make
* to use the I/O defined here.
* There is no fallback to internal read/seek here.
* Note: As it would be troublesome to mess with this while having a file open,
* this mpg123_close() is implied here.

View File

@@ -20,7 +20,7 @@
*/
#define OUT123_API_VERSION 5
/** library patch level at client build time */
#define OUT123_PATCHLEVEL 1
#define OUT123_PATCHLEVEL 2
/* We only need size_t definition. */
#include <stddef.h>

View File

@@ -1112,7 +1112,7 @@ void syn123_be2host(void *buf, size_t samplesize, size_t samplecount);
// anywhere, also to avoid using non-standard types like ssize_t.
#if !defined(SYN123_PORTABLE_API) && !defined(SYN123_NO_LARGEFUNC)
/* A little hack to help MSVC not having ssize_t, duplicated in internal header. */
/** A little hack to help MSVC not having ssize_t, duplicated in internal header. */
#ifdef _MSC_VER
#include <stddef.h>
typedef ptrdiff_t syn123_ssize_t;

View File

@@ -30,11 +30,7 @@
void dct36_avx(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf);
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
dct36_avx_COS9:
.long 0x3f5db3d7

View File

@@ -9,11 +9,7 @@
#include "aarch64_defs.h"
#include "mangle.h"
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
dct36_aarch64_COS9:
.word 0x3f5db3d7

View File

@@ -19,11 +19,7 @@
void dct36_sse(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf);
*/
#if !defined ( __APPLE__) && !defined (__OS2__)
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
dct36_sse_COS9:
.long 0x3f5db3d7

View File

@@ -30,11 +30,7 @@
void dct36_x86_64(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf);
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
dct36_x86_64_COS9:
.long 0x3f5db3d7

View File

@@ -22,7 +22,7 @@
#include "mangle.h"
.data
RODATA
ALIGN4
/* .type plus_1f, @object
.size plus_1f, 4 */

View File

@@ -17,11 +17,7 @@
void dct64_avx(short *out0, short *out1, real *samples);
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
costab_avx:
.long 1056974725

View File

@@ -17,11 +17,7 @@
void dct64_real_avx(real *out0, real *out1, real *samples);
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
costab_avx:
.long 1056974725

View File

@@ -8,11 +8,7 @@
#include "mangle.h"
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
costab_neon_aarch64:
.word 1056974725

View File

@@ -9,11 +9,7 @@
#include "aarch64_defs.h"
#include "mangle.h"
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
costab_neon_aarch64:
.word 1056974725

View File

@@ -16,11 +16,7 @@
void dct64_sse(short *out0, short *out1, real *samples);
*/
#if !defined (__APPLE__) && !defined (__OS2__)
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
pnpn:
.long 0

View File

@@ -16,11 +16,7 @@
void dct64_real_sse(real *out0, real *out1, real *samples);
*/
#if !defined ( __APPLE__) && !defined (__OS2__)
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
pnpn:
.long 0

View File

@@ -28,11 +28,7 @@
void dct64_x86_64(short *out0, short *out1, real *samples);
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
ASM_NAME(INT123_costab_x86_64):
.long 1056974725

View File

@@ -28,11 +28,7 @@
void dct64_real_x86_64(real *out0, real *out1, real *samples);
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
ASM_NAME(INT123_costab_x86_64):
.long 1056974725

View File

@@ -688,7 +688,7 @@ static void conv_s16_to_s32(struct outbuffer *buf)
#include "../common/swap_bytes_impl.h"
void swap_endian(struct outbuffer *buf, int block)
static void swap_endian(struct outbuffer *buf, int block)
{
size_t count;

View File

@@ -330,9 +330,9 @@ void INT123_id3_link(mpg123_handle *fr)
Since we can overwrite strings with ID3 update frames, don't free
memory, just grow strings.
*/
static void store_id3_text(mpg123_string *sb, unsigned char *source, size_t source_size, const int noquiet, const int notranslate)
static void store_id3_text(mpg123_string *sb, unsigned char encoding, unsigned char *source
, size_t source_size, const int noquiet, const int notranslate)
{
unsigned char encoding;
if(sb) // Always overwrite, even with nothing.
sb->fill = 0;
if(!source_size)
@@ -345,25 +345,25 @@ static void store_id3_text(mpg123_string *sb, unsigned char *source, size_t sour
if(notranslate)
{
/* Future: Add a path for ID3 errors. */
if(!mpg123_grow_string(sb, source_size))
if(!mpg123_grow_string(sb, source_size+1))
{
if(noquiet) error("Cannot resize target string, out of memory?");
return;
}
memcpy(sb->p, source, source_size);
sb->fill = source_size;
debug1("stored undecoded ID3 text of size %zu", source_size);
sb->p[0] = (char)encoding;
memcpy(sb->p+1, source, source_size);
sb->fill = source_size+1;
debug1("stored undecoded ID3 text of size %zu", source_size+1);
return;
}
encoding = source[0];
if(encoding > mpg123_id3_enc_max)
{
if(noquiet)
error1("Unknown text encoding %u, I take no chances, sorry!", encoding);
return;
}
INT123_id3_to_utf8(sb, encoding, source+1, source_size-1, noquiet);
INT123_id3_to_utf8(sb, encoding, source, source_size, noquiet);
if(sb->fill) debug1("UTF-8 string (the first one): %s", sb->p);
else if(noquiet) error("unable to convert string to UTF-8 (out of memory, junk input?)!");
@@ -449,6 +449,11 @@ static void process_text(mpg123_handle *fr, unsigned char *realdata, size_t real
{
/* Text encoding $xx */
/* The text (encoded) ... */
if(realsize < 1)
{
if(NOQUIET) error("Not even an encoding byte?");
return;
}
mpg123_text *t = add_text(fr, id);
if(VERBOSE4) fprintf(stderr, "Note: Storing text from %s encoding\n", enc_name(realdata[0]));
if(t == NULL)
@@ -460,7 +465,8 @@ static void process_text(mpg123_handle *fr, unsigned char *realdata, size_t real
? (char[5]) { t->id[0], t->id[1], t->id[2], t->id[3], 0 }
: "(nil)" );
memcpy(t->id, id, 4);
store_id3_text(&t->text, realdata, realsize, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT);
store_id3_text( &t->text, realdata[0], realdata+1, realsize-1
, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT );
if(VERBOSE4) // Do not print unsanitized text to terminals!
fprintf(stderr, "Note: ID3v2 %c%c%c%c text frame stored\n", id[0], id[1], id[2], id[3]);
}
@@ -577,8 +583,6 @@ static void process_comment(mpg123_handle *fr, enum frame_types tt, unsigned cha
return;
}
memcpy(lang, realdata+1, 3);
/* Now I can abuse a byte from lang for the encoding. */
descr[-1] = encoding;
/* Be careful with finding the end of description, I have to honor encoding here. */
text = next_text(descr, encoding, realsize-(descr-realdata));
if(text == NULL)
@@ -591,14 +595,14 @@ static void process_comment(mpg123_handle *fr, enum frame_types tt, unsigned cha
mpg123_string description;
mpg123_init_string(&description);
// Store the text, with desired encoding, but for comments always a local copy in UTF-8.
store_id3_text( &description, descr-1, text-descr+1
store_id3_text( &description, encoding, descr, text-descr
, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT );
if(tt == comment)
store_id3_text( &localcom.description, descr-1, text-descr+1
store_id3_text( &localcom.description, encoding, descr, text-descr
, NOQUIET, 0 );
if(VERBOSE4)
fprintf( stderr, "Note: Storing comment from %s encoding\n"
, enc_name(realdata[0]) );
, enc_name(encoding) );
xcom = tt == uslt
? add_uslt(fr, lang, &description)
: add_comment(fr, lang, &description);
@@ -616,8 +620,8 @@ static void process_comment(mpg123_handle *fr, enum frame_types tt, unsigned cha
mpg123_move_string(&description, &xcom->description);
}
text[-1] = encoding; /* Byte abusal for encoding... */
store_id3_text(&xcom->text, text-1, realsize+1-(text-realdata), NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT);
store_id3_text( &xcom->text, encoding, text, realsize-(text-realdata)
, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT );
/* Remember: I will probably decode the above (again) for rva comment checking. So no messing around, please. */
if(VERBOSE4) /* Do _not_ print the verbatim text: The encoding might be funny! */
@@ -641,7 +645,8 @@ static void process_comment(mpg123_handle *fr, enum frame_types tt, unsigned cha
if((rva_mode > -1) && (fr->rva.level[rva_mode] <= rva_level))
{
/* Only translate the contents in here where we really need them. */
store_id3_text(&localcom.text, text-1, realsize+1-(text-realdata), NOQUIET, 0);
store_id3_text( &localcom.text, encoding, text, realsize-(text-realdata)
, NOQUIET, 0 );
if(localcom.text.fill > 0)
{
fr->rva.gain[rva_mode] = (float) atof(localcom.text.p);
@@ -689,7 +694,7 @@ static void process_extra(mpg123_handle *fr, unsigned char* realdata, size_t rea
mpg123_init_string(&description);
/* The outside storage gets reencoded to UTF-8 only if not requested otherwise.
Remember that we really need the -1 here to hand in the encoding byte!*/
store_id3_text( &description, descr-1, text-descr+1
store_id3_text( &description, encoding, descr, text-descr
, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT );
xex = add_extra(fr, &description);
if(xex)
@@ -706,10 +711,10 @@ static void process_extra(mpg123_handle *fr, unsigned char* realdata, size_t rea
init_mpg123_text(&localex); /* For our local copy. */
/* Our local copy is always stored in UTF-8! */
store_id3_text(&localex.description, descr-1, text-descr+1, NOQUIET, 0);
store_id3_text(&localex.description, encoding, descr, text-descr, NOQUIET, 0);
/* At first, only store the outside copy of the payload. We may not need the local copy. */
text[-1] = encoding;
store_id3_text(&xex->text, text-1, realsize-(text-realdata)+1, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT);
store_id3_text( &xex->text, encoding, text, realsize-(text-realdata)
, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT );
/* Now check if we would like to interpret this extra info for RVA. */
if(localex.description.fill > 0)
@@ -737,7 +742,8 @@ static void process_extra(mpg123_handle *fr, unsigned char* realdata, size_t rea
if((rva_mode > -1) && (fr->rva.level[rva_mode] <= rva_level))
{
/* Now we need the translated copy of the data. */
store_id3_text(&localex.text, text-1, realsize-(text-realdata)+1, NOQUIET, 0);
store_id3_text( &localex.text, encoding, text, realsize-(text-realdata)
, NOQUIET, 0 );
if(localex.text.fill > 0)
{
if(is_peak)
@@ -794,7 +800,7 @@ static int promote_framename(mpg123_handle *fr, char *id) /* fr because of VERBO
#endif /* NO_ID3V2 */
int store_id3v2( mpg123_handle *fr
static int store_id3v2( mpg123_handle *fr
, unsigned long first4bytes, unsigned char buf[6], unsigned long length )
{
int ret = 1;

View File

@@ -341,7 +341,8 @@ int INT123_do_layer2(mpg123_handle *fr)
if(fr->jsbound > fr->II_sblimit)
{
fprintf(stderr, "Truncating stereo boundary to sideband limit.\n");
if(NOQUIET)
error("Truncating stereo boundary to sideband limit.");
fr->jsbound=fr->II_sblimit;
}

View File

@@ -15,9 +15,7 @@
#define FORCE_ACCURATE
#include "../common/sample.h"
#include "parse.h"
#ifndef PORTABLE_API
#include "lfs_wrap.h"
#endif
#include "../common/debug.h"
@@ -559,18 +557,9 @@ double attribute_align_arg mpg123_geteq2(mpg123_handle *mh, int channel, int ban
return mpg123_geteq(mh, channel, band);
}
#ifndef PORTABLE_API
#ifdef FORCED_OFF_64
// Only _64 symbols for a system-wide enforced _FILE_OFFSET_BITS=64.
#define mpg123_open mpg123_open_64
#define mpg123_open_fixed mpg123_open_fixed_64
#define mpg123_open_fd mpg123_open_fd_64
#define mpg123_open_handle mpg123_open_handle_64
#endif
/* plain file access, no http! */
int attribute_align_arg mpg123_open(mpg123_handle *mh, const char *path)
// LFS wrapper code is so agnostic to it all now that internal I/O is portable
// as long as you do not mix in off_t API.
int attribute_align_arg mpg123_open64(mpg123_handle *mh, const char *path)
{
if(mh == NULL) return MPG123_BAD_HANDLE;
@@ -585,6 +574,24 @@ int attribute_align_arg mpg123_open(mpg123_handle *mh, const char *path)
return ret;
}
#ifndef PORTABLE_API
#ifdef FORCED_OFF_64
// Only _64 symbols for a system-wide enforced _FILE_OFFSET_BITS=64.
#define mpg123_open mpg123_open_64
#define mpg123_open_fixed mpg123_open_fixed_64
#define mpg123_open_fd mpg123_open_fd_64
#define mpg123_open_handle mpg123_open_handle_64
#endif
// This now is agnostic to off_t choice, but still subject to renaming
// for legacy reasons.
int attribute_align_arg mpg123_open(mpg123_handle *mh, const char *path)
{
return mpg123_open64(mh, path);
}
#endif // PORTABLE_API
// The convenience function mpg123_open_fixed() wraps over acual mpg123_open
// and hence needs to have the exact same code in lfs_wrap.c. The flesh is
// in INT123_open_fixed_pre() and INT123_open_fixed_post(), wich are only defined here.
@@ -624,17 +631,28 @@ static int INT123_open_fixed_post(mpg123_handle *mh, int channels, int encoding)
return err;
}
int attribute_align_arg mpg123_open_fixed( mpg123_handle *mh, const char *path
int attribute_align_arg mpg123_open_fixed64( mpg123_handle *mh, const char *path
, int channels, int encoding )
{
int err = INT123_open_fixed_pre(mh, channels, encoding);
if(err == MPG123_OK)
err = mpg123_open(mh, path);
err = mpg123_open64(mh, path);
if(err == MPG123_OK)
err = INT123_open_fixed_post(mh, channels, encoding);
return err;
}
#ifndef PORTABLE_API
// Only to have the modern offset-agnostic open under a fixed name.
int attribute_align_arg mpg123_open_fixed( mpg123_handle *mh, const char *path
, int channels, int encoding )
{
return mpg123_open_fixed64(mh, path, channels, encoding);
}
// Won't define a 'portable' variant of this, as I cannot guess
// properties of the handed-in fd, which in theory, on specific platforms,
// could not support large files.
int attribute_align_arg mpg123_open_fd(mpg123_handle *mh, int fd)
{
if(mh == NULL) return MPG123_BAD_HANDLE;
@@ -650,21 +668,33 @@ int attribute_align_arg mpg123_open_fd(mpg123_handle *mh, int fd)
}
#endif // PORTABLE_API
// Only works with int64 reader setup.
int attribute_align_arg mpg123_open_handle64(mpg123_handle *mh, void *iohandle)
{
if(mh == NULL) return MPG123_BAD_HANDLE;
mpg123_close(mh);
return INT123_open_stream_handle(mh, iohandle);
}
#ifndef PORTABLE_API
// Change from 1.32: No largefile-renamed symbols in a library with strict
// portable API.
// I allow that breaking change since this is far from a standard libmpg123 build.
int attribute_align_arg mpg123_open_handle(mpg123_handle *mh, void *iohandle)
{
if(mh == NULL) return MPG123_BAD_HANDLE;
mpg123_close(mh);
int ret;
#ifndef PORTABLE_API
ret = INT123_wrap_open( mh, iohandle, NULL, -1
, mh->p.timeout, mh->p.flags & MPG123_QUIET );
iohandle = ret == LFS_WRAP_NONE ? iohandle : mh->wrapperdata;
if(ret >= 0)
#endif
ret = INT123_open_stream_handle(mh, iohandle);
return ret;
}
#endif
int attribute_align_arg mpg123_open_feed(mpg123_handle *mh)
{

View File

@@ -84,6 +84,12 @@
#define ASM_VALUE(a) MANGLE_MACROCAT($,a)
#endif
#if !defined(__APPLE__) && !defined (__OS2__)
#define RODATA .section .rodata
#else
#define RODATA .data
#endif
/* Enable position-independent code for certain platforms. */
#if defined(OPT_X86)
@@ -139,7 +145,7 @@ Lpic_base: \
#endif /* PIC variants */
// Apple and Android NDK seem both not to like direct global access.
#if defined(PIC) && (defined(__APPLE__) || defined(ANDROID))
#if defined(PIC) && (defined(__APPLE__) || defined(__ANDROID__))
#define PIC_GLOBAL_PTR
#endif

View File

@@ -21,7 +21,10 @@
// Only portable API plays a role in the library itself, outside of lfs_wrap.c.
// Also, we need to ensure no suffix renaming for the primary implementations.
#define MPG123_PORTABLE_API
// But: The _definition_ of non-portable API needs to be present for those
// primary implementations being exported for DLL builds. Just the largefile
// renaming needs to be skipped!
#define MPG123_NO_LARGENAME
#define MPG123_ENUM_API
#include "mpg123.h"

View File

@@ -1027,7 +1027,7 @@ static const char *mpg123_decoder_list[] =
NULL
};
void check_decoders(void)
static void check_decoders(void)
{
#ifndef OPT_MULTI
/* In non-multi mode, only the full list (one entry) is used. */

View File

@@ -34,11 +34,7 @@
#include "mangle.h"
#ifdef ACCURATE_ROUNDING
#if !defined (__APPLE__) && !defined (__OS2__)
.section .rodata
#else
.data
#endif
RODATA
ALIGN8
max_s16:
.long 1191181824 /* 32767.0 */

View File

@@ -32,10 +32,7 @@
#include "mangle.h"
.data
#if !defined (__APPLE__) && !defined (__OS2__)
.section .rodata
#endif
RODATA
ALIGN8
.LC0:
.long 0x0,0x40dfffc0

View File

@@ -13,10 +13,7 @@
#include "mangle.h"
.data
#if !defined (__APPLE__) && !defined (__OS2__)
.section .rodata
#endif
RODATA
ALIGN8
.LC0:
.long 0x0,0x40dfffc0

View File

@@ -8,11 +8,7 @@
#include "mangle.h"
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
maxmin_s16:
.word 32767

View File

@@ -9,11 +9,7 @@
#include "aarch64_defs.h"
#include "mangle.h"
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
maxmin_s16:
.word 1191181824

View File

@@ -9,11 +9,7 @@
#include "aarch64_defs.h"
#include "mangle.h"
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
scale:
.word 939524096

View File

@@ -9,11 +9,7 @@
#include "aarch64_defs.h"
#include "mangle.h"
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
maxmin_s32:
.word 1191182335

View File

@@ -22,11 +22,7 @@
return value: number of clipped samples
*/
#if !defined ( __APPLE__) && !defined (__OS2__)
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
maxmin_s16:
.long 1191181824 /* 32767.0 */

View File

@@ -20,11 +20,7 @@
return value: number of clipped samples (0)
*/
#if !defined ( __APPLE__) && !defined (__OS2__)
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
scale_sse:
.long 939524096

View File

@@ -22,11 +22,7 @@
return value: number of clipped samples
*/
#if !defined ( __APPLE__) && !defined (__OS2__)
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
scale_s32:
.long 1199570944 /* 65536.0 */

View File

@@ -33,11 +33,7 @@
return value: number of clipped samples
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
maxmin_avx:
.long 1191182335

View File

@@ -33,11 +33,7 @@
return value: number of clipped samples (0)
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
scale_avx:
.long 939524096

View File

@@ -33,11 +33,7 @@
return value: number of clipped samples
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
maxmin_avx:
.long 1191182335

View File

@@ -8,11 +8,7 @@
#include "mangle.h"
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
maxmin_s16:
.word 32767

View File

@@ -9,11 +9,7 @@
#include "aarch64_defs.h"
#include "mangle.h"
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
maxmin_s16:
.word 1191181824

View File

@@ -9,11 +9,7 @@
#include "aarch64_defs.h"
#include "mangle.h"
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
scale:
.word 939524096

View File

@@ -9,11 +9,7 @@
#include "aarch64_defs.h"
#include "mangle.h"
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN16
maxmin_s32:
.word 1191181824

View File

@@ -25,11 +25,7 @@
return value: number of clipped samples
*/
#if !defined ( __APPLE__) && !defined (__OS2__)
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
maxmin_s16:
.long 1191181824 /* 32767.0 */

View File

@@ -24,11 +24,7 @@
return value: number of clipped samples (0)
*/
#if !defined ( __APPLE__) && !defined (__OS2__)
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
scale_sse:
.long 939524096

View File

@@ -25,11 +25,7 @@
return value: number of clipped samples
*/
#if !defined ( __APPLE__) && !defined (__OS2__)
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
scale_s32:
.long 1199570944 /* 65536.0 */

View File

@@ -38,11 +38,7 @@
return value: number of clipped samples
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
ASM_NAME(INT123_maxmin_x86_64):
.long 32767

View File

@@ -37,11 +37,7 @@
return value: number of clipped samples
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
ASM_NAME(INT123_maxmin_s16):
.long 1191181824

View File

@@ -35,11 +35,7 @@
return value: number of clipped samples (0)
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
ASM_NAME(INT123_scale_x86_64):
.long 939524096

View File

@@ -38,11 +38,7 @@
return value: number of clipped samples
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
ASM_NAME(INT123_scale_s32):
.long 1199570944

View File

@@ -38,11 +38,7 @@
return value: number of clipped samples
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
ASM_NAME(INT123_maxmin_x86_64):
.long 32767

View File

@@ -37,11 +37,7 @@
return value: number of clipped samples
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
ASM_NAME(INT123_maxmin_s16):
.long 1191181824

View File

@@ -35,11 +35,7 @@
return value: number of clipped samples (0)
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
ASM_NAME(INT123_scale_x86_64):
.long 939524096

View File

@@ -38,11 +38,7 @@
return value: number of clipped samples
*/
#ifndef __APPLE__
.section .rodata
#else
.data
#endif
RODATA
ALIGN32
ASM_NAME(INT123_scale_s32):
.long 1199570944

View File

@@ -10,7 +10,7 @@
#include "mangle.h"
.data
RODATA
ALIGN32
.globl ASM_NAME(INT123_costab_mmxsse)
ASM_NAME(INT123_costab_mmxsse):

View File

@@ -1,3 +1,4 @@
#ifndef NOXFERMEM
/*
buffer.c: output buffer
@@ -1016,3 +1017,4 @@ int buffer_loop(out123_handle *ao)
intflag = FALSE; /* Any possible harm by _not_ ensuring that the flag is cleared here? */
}
}
#endif

View File

@@ -1,7 +1,7 @@
/*
audio: audio output interface
copyright ?-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright ?-2024 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
*/
@@ -455,11 +455,12 @@ out123_open(out123_handle *ao, const char* driver, const char* device)
}
/* Now loop over the list of possible modules to find one that works. */
nextname = strtok(modnames, ",");
char *toksave = NULL;
nextname = INT123_compat_strtok(modnames, ",", &toksave);
while(!ao->open && nextname)
{
char *curname = nextname;
nextname = strtok(NULL, ",");
nextname = INT123_compat_strtok(NULL, ",", &toksave);
check_output_module(ao, curname, device, !nextname);
if(ao->open)
{

View File

@@ -129,7 +129,8 @@ static int open_sndio(out123_handle *ao)
hdl = sio_open(ao->device /* NULL is fine */, SIO_PLAY, 0);
if (hdl == NULL)
{
error("Got nothing from sio_open(). ");
if(!AOQUIET)
error("Got nothing from sio_open(). ");
return -1;
}
@@ -152,7 +153,8 @@ static int open_sndio(out123_handle *ao)
hdl = sio_open(ao->device, SIO_PLAY, 0);
if(hdl == NULL)
{
error("Re-opening of device for channel guessing failed.");
if(!AOQUIET)
error("Re-opening of device for channel guessing failed.");
return -1;
}
par.pchan = guess_channels(hdl);

View File

@@ -172,7 +172,7 @@ static int get_formats_win32(out123_handle *ao)
int ret = 0;
UINT dev_id = dev_select(ao);
MMRESULT mr = waveOutGetDevCaps(dev_id, &caps, sizeof(caps));
MMRESULT mr = waveOutGetDevCapsA(dev_id, &caps, sizeof(caps));
if(mr != MMSYSERR_NOERROR)
return 0; /* no formats? */
@@ -367,7 +367,7 @@ static int enumerate_win32( out123_handle *ao, int (*store_device)(void *devlist
for(i = 0; i < devices; i++){
memset(id, 0, sizeof(id));
memset(&caps, 0, sizeof(caps));
mr = waveOutGetDevCaps(i, &caps, sizeof(caps));
mr = waveOutGetDevCapsA(i, &caps, sizeof(caps));
if (mr != MMSYSERR_NOERROR) {
switch(mr) {
case MMSYSERR_BADDEVICEID:

View File

@@ -1,3 +1,4 @@
#ifndef NOXFERMEM
/*
xfermem: unidirectional fast pipe
@@ -302,3 +303,4 @@ int INT123_xfermem_write(txfermem *xf, void *buffer, size_t bytes)
? -1
: 0;
}
#endif

View File

@@ -59,6 +59,7 @@ size_t utf8outstr(char **dest, const char *source, int to_terminal);
// If count is >= 0, it is used instead of strlen(source), enabling
// processing of data without closing zero byte.
// Returns 0 if all went well, as do the others following.
// On error, the dest memory is freed and the pointer nulled.
int unknown2utf8(char **dest, const char *source, int count);
// Wrapper around the above for printing the string to some stream.
// Return value is directly from fprintf or also -1 if there was trouble

View File

@@ -364,7 +364,11 @@ int main(int argc, char **argv)
int i, result;
mpg123_handle* m;
#if defined(WANT_WIN32_UNICODE)
win32_cmdline_utf8(&argc,&argv);
if(win32_cmdline_utf8(&argc,&argv) != 0)
{
error("Cannot convert command line to UTF8!");
return 1;
}
#endif
progname = argv[0];
@@ -428,9 +432,9 @@ int main(int argc, char **argv)
mpg123_delete(m);
mpg123_exit();
if(errors) error1("Encountered %i errors along the way.", errors);
return errors != 0;
#if defined(WANT_WIN32_UNICODE)
win32_cmdline_free(argc,argv);
#endif
if(errors) error1("Encountered %i errors along the way.", errors);
return errors != 0;
}

View File

@@ -1431,9 +1431,17 @@ int main(int sys_argc, char ** sys_argv)
print_outstr(stderr, filename, 0, stderr_is_term);
fprintf(stderr, " ...\n");
if(filept->htd.icy_name.fill)
fprintf(stderr, "ICY-NAME: %s\n", filept->htd.icy_name.p);
{
fprintf(stderr, "ICY-NAME: ");
print_outstr(stderr, filept->htd.icy_name.p, 1, stderr_is_term);
fprintf(stderr, "\n");
}
if(filept->htd.icy_url.fill)
fprintf(stderr, "ICY-URL: %s\n", filept->htd.icy_url.p);
{
fprintf(stderr, "ICY-URL: ");
print_outstr(stderr, filept->htd.icy_url.p, 1, stderr_is_term);
fprintf(stderr, "\n");
}
}
#if !defined(GENERIC)
{
@@ -1515,7 +1523,9 @@ int main(int sys_argc, char ** sys_argv)
fprintf(stderr, "This was a Frankenstein track.\n");
position_info(mh, 0, ao, NULL, NULL, &secs, NULL, NULL, NULL);
fprintf(stderr,"[%d:%02d] Decoding of %s finished.\n", (int)(secs / 60), ((int)secs) % 60, filename);
fprintf(stderr,"[%d:%02d] Decoding of ", (int)(secs / 60), ((int)secs) % 60);
print_outstr(stderr, filename, 0, stderr_is_term);
fprintf(stderr," finished.\n");
}
else if(param.verbose) fprintf(stderr, "\n");

View File

@@ -1,7 +1,7 @@
/*
out123: stream data from libmpg123 or libsyn123 to an audio output device
copyright 1995-2023 by the mpg123 project,
copyright 1995-2025 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
@@ -1630,7 +1630,10 @@ int main(int sys_argc, char ** sys_argv)
}
if(strcmp(signal_source, "file"))
{
had_something = 1;
generate = TRUE;
}
else
input = open_next_file(argc, argv, 1);

View File

@@ -34,6 +34,14 @@
enum playlist_type { UNKNOWN = 0, M3U, PLS, NO_LIST };
enum playflag
{
PL_IS_UTF8 = 1 // if we really know the contents are UTF-8-encooded
, PL_HIT_END = 2
, PL_STDIN_USED = 4 // If the playlist itself or an input file was '-' (stdin not usable for terminal.).
, PL_NO_RANDOM = 8
};
typedef struct listitem
{
char* url; /* the filename */
@@ -56,10 +64,7 @@ typedef struct playlist_struct
mpg123_string linebuf;
mpg123_string dir;
enum playlist_type type;
int is_utf8; /* if we really know the contents are UTF-8-encooded */
int hit_end;
// If the playlist itself or an input file was '-' (stdin not usable for terminal.).
int stdin_used;
unsigned int flags;
} playlist_struct;
/* one global instance... add a pointer to this to every function definition and you have OO-style... */
@@ -97,7 +102,7 @@ void prepare_playlist(int argc, char** argv, int args_utf8, int *is_utf8)
mpg123_free_string(&pl.linebuf);
mpg123_free_string(&pl.dir);
if(is_utf8)
*is_utf8 = pl.is_utf8;
*is_utf8 = (pl.flags & PL_IS_UTF8) != 0;
}
/* Return a random number >= 0 and < n */
@@ -142,9 +147,9 @@ char *get_next_file(void)
}
else
{
/* Handle looping first, but only if there is a random track selection
presently active (see playlist_jump() for interaction). */
if(!(pl.num && ((pl.loop > 0 && --pl.loop) || pl.loop < 0)))
// Handle looping first, but only if there is a random track selection
// Also applies to continue mode.
if(!(pl.num && ((pl.loop > 0 && --pl.loop) || pl.loop < 0)) && !(pl.flags & PL_NO_RANDOM))
{
/* Randomly select the next track. */
do /* limiting randomness: don't repeat too early */
@@ -157,6 +162,7 @@ char *get_next_file(void)
newitem = &pl.list[pl.pos];
pl.num = pl.pos+1;
pl.flags &= ~PL_NO_RANDOM; // The random blocking works only once.
}
/* "-" is STDIN, "" is dumb, NULL is nothing */
@@ -168,7 +174,7 @@ char *get_next_file(void)
}
else
{
pl.hit_end = TRUE;
pl.flags |= PL_HIT_END;
return NULL;
}
}
@@ -179,7 +185,7 @@ size_t playlist_pos(size_t *total, long *loop)
*total = pl.fill;
if(loop)
*loop = pl.loop;
return pl.hit_end ? pl.fill+1 : pl.num;
return pl.flags & PL_HIT_END ? pl.fill+1 : pl.num;
}
void playlist_jump(mpg123_ssize_t incr)
@@ -286,23 +292,23 @@ static void init_playlist(void)
pl.fill = 0;
pl.pos = 0;
pl.num = 0;
if(APPFLAG(MPG123APP_CONTINUE) && param.listentry > 0)
pl.pos = param.listentry - 1;
pl.list = NULL;
pl.alloc_step = 10;
mpg123_init_string(&pl.dir);
mpg123_init_string(&pl.linebuf);
pl.type = UNKNOWN;
pl.is_utf8 = FALSE;
pl.hit_end = FALSE;
pl.flags = 0;
pl.loop = param.loop;
pl.stdin_used = FALSE;
if(APPFLAG(MPG123APP_CONTINUE) && param.listentry > 0)
{
pl.pos = param.listentry - 1;
pl.flags |= PL_NO_RANDOM; // Skip random selection for first track.
}
}
int playlist_stdin(void)
{
return pl.stdin_used;
return (pl.flags & PL_STDIN_USED) != 0;
}
/*
@@ -314,7 +320,10 @@ static int add_next_file (int argc, char *argv[], int args_utf8)
{
int firstline = 0;
pl.is_utf8 = args_utf8;
if(args_utf8)
pl.flags |= PL_IS_UTF8;
else
pl.flags &= ~PL_IS_UTF8;
/* hack for url that has been detected as track, not playlist */
if(pl.type == NO_LIST) return 0;
@@ -343,7 +352,7 @@ static int add_next_file (int argc, char *argv[], int args_utf8)
if (param.listname || pl.file)
{
size_t line_offset = 0;
pl.is_utf8 = 0; // Playlist files in env encoding (HTTP lists should be ASCII-clean).
pl.flags &= ~PL_IS_UTF8; // Playlist files in env encoding (HTTP lists should be ASCII-clean).
if(!pl.file)
{
pl.file = stream_open(param.listname);
@@ -352,7 +361,7 @@ static int add_next_file (int argc, char *argv[], int args_utf8)
firstline = 1; /* just opened */
if(pl.file->fd == STDIN_FILENO)
{
pl.stdin_used = TRUE;
pl.flags |= PL_STDIN_USED;
param.listname = NULL;
}
}
@@ -393,7 +402,7 @@ static int add_next_file (int argc, char *argv[], int args_utf8)
}
}
char *ptmp = NULL;
outstr(&ptmp, pl.file->htd.content_type.p, 0, stderr_is_term);
outstr(&ptmp, pl.file->htd.content_type.p, 1, stderr_is_term);
error1( "Unknown playlist MIME type %s; maybe "PACKAGE_NAME
" can support it in future if you report this to the maintainer."
, PSTR(ptmp) );
@@ -671,7 +680,7 @@ static int add_to_playlist(char* new_entry, char freeit)
if(pl.fill < pl.size)
{
if(!strcmp(new_entry, "-") || !strcmp(new_entry, "/dev/stdin"))
pl.stdin_used = TRUE;
pl.flags |= PL_STDIN_USED;
pl.list[pl.fill].freeit = freeit;
pl.list[pl.fill].url = new_entry;
pl.list[pl.fill].playcount = 0;

View File

@@ -317,6 +317,17 @@ static int stream_parse_headers(struct stream *sd, mpg123_string *location)
{
break; // This is the content separator line.
}
{ // Convert from unknown/ASCII encoding to UTF-8. Play safe.
char *buf = NULL;
if(unknown2utf8(&buf, line.p, -1))
{
error("failed converting HTTP header line");
continue;
}
// Avoiding extra allocation here would be nice. mpg123_adopt_string()?
mpg123_set_string(&line, buf);
free(buf);
}
// React to HTTP error codes, but do not enforce an OK being sent as Shoutcast
// only produces very minimal headers, not even a HTTP response code.
// Well, ICY 200 OK could be there, but then we got other headers to know

View File

@@ -589,8 +589,34 @@ static void term_handle_key(mpg123_handle *fr, out123_handle *ao, char val)
static void term_handle_input(mpg123_handle *fr, out123_handle *ao, int do_delay)
{
char val;
if(term_get_key(playstate==STATE_STOPPED, do_delay, &val))
if(term_get_key(playstate==STATE_STOPPED, do_delay ? 1 : 0, &val))
{
// Crude ignoring of 7-bit escape sequences. 8-bit ones you better really handle
// in the terminal and do not pass on. The idea is that pressing cursor keys
// that contain plain characters in the triggered escape sequences should
// not confuse mpg123 terminal control At the same time, the user pressing
// ESC on its own should not confuse mpg123 into starting a sequence.
// So the assumption is quick succession of the bytes for real sequences.
// If the sequence has been ignoret, return, as this has been handled. Come
// back for real control.
if(val == 0x1b) // ESC, get next key, if any
{
int seq_len = 1;
if(term_get_key(FALSE, -1, &val))
{
++seq_len;
if(val == 'Z') // SCI, single character to drop, if any
term_get_key(FALSE, -1, &val);
else if(val == '[') // sequence begin
{
while(term_get_key(FALSE, -1, &val) && strchr("0123456789;", val))
++seq_len;
} // else simple single-character escape
}
mdebug("dropped escape sequence of length %d", seq_len);
return;
} else
mdebug("got key: %02x", val);
term_handle_key(fr, ao, val);
}
}

View File

@@ -112,10 +112,10 @@ static int term_setup_detail(struct termios *pattern)
{
mdebug("setup on fd %d", term_fd);
/* One might want to use sigaction instead. */
signal(SIGCONT, term_sigcont);
signal(SIGUSR1, term_sigusr);
signal(SIGUSR2, term_sigusr);
INT123_catchsignal(SIGCONT, term_sigcont);
INT123_catchsignal(SIGUSR1, term_sigusr);
INT123_catchsignal(SIGUSR2, term_sigusr);
struct termios tio = *pattern;
tio.c_lflag &= ~(ICANON|ECHO);
tio.c_cc[VMIN] = 1;
@@ -207,7 +207,7 @@ int term_get_key(int stopped, int do_delay, char *val)
}
t.tv_sec=0;
t.tv_usec=(do_delay) ? 10*1000 : 0;
t.tv_usec = do_delay==1 ? 10*1000 : (do_delay==-1 ? 1*1000 : 0);
FD_ZERO(&r);
FD_SET(term_fd,&r);

View File

@@ -98,7 +98,7 @@ int term_get_key(int stopped, int do_delay, char *val){
if(input == NULL || input == INVALID_HANDLE_VALUE)
return 0;
while(WaitForSingleObject(input, stopped ? INFINITE : (do_delay ? 10 : 0)) == WAIT_OBJECT_0){
while(WaitForSingleObject(input, stopped ? INFINITE : (do_delay==1 ? 10 : (do_delay==-1 ? 1 : 0))) == WAIT_OBJECT_0){
do_delay = 0;
if(!ReadConsoleInput(input, &record, 1, &res))
return 0;

View File

@@ -43,7 +43,7 @@ int term_setup(void);
void term_restore(void);
/** Check for and return a key press event.
* \param do_delay Wait for up to 10 ms for a key event if true.
* \param do_delay Wait for up to 10 ms for key event if 1, for 1 ms if -1, without delay for 0.
* \param val address to store character to
* \return 1 if there is a key, 0 if not
*/

View File

@@ -15,8 +15,8 @@
// only single spaces as separator to ease parsing by build scripts
#define MPG123_MAJOR 1
#define MPG123_MINOR 32
#define MPG123_PATCH 9
#define MPG123_MINOR 33
#define MPG123_PATCH 4
// Don't get too wild with that to avoid confusing m4. No brackets.
// Also, it should fit well into a sane file name for the tarball.
#define MPG123_SUFFIX ""

View File

@@ -22,6 +22,7 @@ void __cdecl __declspec(dllimport) __wgetmainargs (
int win32_cmdline_utf8(int * argc, char *** argv)
{
int argcounter;
int nargc;
wchar_t **argv_wide;
wchar_t **env;
char *argvptr;
@@ -31,9 +32,21 @@ int win32_cmdline_utf8(int * argc, char *** argv)
if(argv == NULL || argc == NULL) return -1;
startup.newmode = 0;
__wgetmainargs(argc, &argv_wide,&env,1, &startup);
nargc = -1;
argv_wide = NULL;
env = NULL;
__wgetmainargs(&nargc, &argv_wide,&env,1, &startup);
if (nargc == -1 || argv_wide == NULL || env == NULL) {
error("Cannot allocate memory for wide command line.");
return -1;
}
*argc = nargc;
*argv = (char **)calloc(sizeof (char *), *argc);
if(*argv == NULL){ error("Cannot allocate memory for command line."); return -1; }
if(*argv == NULL)
{
error("Cannot allocate memory for UTF-8 command line.");
return -1;
}
for(argcounter = 0; argcounter < *argc; argcounter++)
{

View File

@@ -9,6 +9,7 @@ if test -z "$build_type"; then
echo "Please specify a build type as argument, one of:"
echo "x86, x86_64, x86-cross, x86_64-cross"
echo "Optionally set a number of parallel make processes as second argument."
echo "A third argument might override the list of output modules to build."
exit 1
fi
@@ -23,6 +24,8 @@ build_procs=$2
# -D__MINGW_USE_VC2005_COMPAT=1 use 64bit time internally for 32bit, so XP and earlier don't get into
# missing _time32 errors
modules=${3:-win32_wasapi,win32}
echo "build type: $build_type"
case $build_type in
x86)
@@ -55,8 +58,7 @@ temp="$PWD/tmp"
final="$PWD/releases"
txt="README COPYING NEWS"
# let's try with modules
opts="LDFLAGS=-static-libgcc"
#opts="--with-audio=win32 --disable-modules"
opts="--with-audio=$modules LDFLAGS=-static-libgcc"
# Get the version for the build from version.h.
major=$(grep '#define MPG123_MAJOR' src/version.h | cut -f 3 -d ' ')