mpg123: Import upstream release 1.32.5.

This commit is contained in:
Alexandre Julliard 2024-02-17 18:07:34 +01:00
parent fa42210c49
commit 3881edf6f3
42 changed files with 252 additions and 268 deletions

2
configure vendored
View file

@ -13572,7 +13572,7 @@ then :
MPG123_PE_LIBS=mpg123 MPG123_PE_LIBS=mpg123
if ${MPG123_PE_CFLAGS:+false} : if ${MPG123_PE_CFLAGS:+false} :
then : then :
MPG123_PE_CFLAGS="-I\$(top_srcdir)/libs/mpg123/src/libmpg123" MPG123_PE_CFLAGS="-I\$(top_srcdir)/libs/mpg123/src/include"
else $as_nop else $as_nop
enable_mpg123=no enable_mpg123=no
fi fi

View file

@ -1186,7 +1186,7 @@ WINE_EXTLIB_FLAGS(JPEG, jpeg, jpeg, "-I\$(top_srcdir)/libs/jpeg")
WINE_EXTLIB_FLAGS(JXR, jxr, jxr, "-I\$(top_srcdir)/libs/jxr/jxrgluelib -I\$(top_srcdir)/libs/jxr/image/sys") WINE_EXTLIB_FLAGS(JXR, jxr, jxr, "-I\$(top_srcdir)/libs/jxr/jxrgluelib -I\$(top_srcdir)/libs/jxr/image/sys")
WINE_EXTLIB_FLAGS(LCMS2, lcms2, lcms2, "-I\$(top_srcdir)/libs/lcms2/include") WINE_EXTLIB_FLAGS(LCMS2, lcms2, lcms2, "-I\$(top_srcdir)/libs/lcms2/include")
WINE_EXTLIB_FLAGS(LDAP, ldap, ldap, "-I\$(top_srcdir)/libs/ldap/include") WINE_EXTLIB_FLAGS(LDAP, ldap, ldap, "-I\$(top_srcdir)/libs/ldap/include")
WINE_EXTLIB_FLAGS(MPG123, mpg123, mpg123, "-I\$(top_srcdir)/libs/mpg123/src/libmpg123") WINE_EXTLIB_FLAGS(MPG123, mpg123, mpg123, "-I\$(top_srcdir)/libs/mpg123/src/include")
WINE_EXTLIB_FLAGS(MUSL, musl, musl) WINE_EXTLIB_FLAGS(MUSL, musl, musl)
WINE_EXTLIB_FLAGS(PNG, png, "png \$(ZLIB_PE_LIBS)", "-I\$(top_srcdir)/libs/png") WINE_EXTLIB_FLAGS(PNG, png, "png \$(ZLIB_PE_LIBS)", "-I\$(top_srcdir)/libs/png")
WINE_EXTLIB_FLAGS(TIFF, tiff, "tiff \$(ZLIB_PE_LIBS)", "-I\$(top_srcdir)/libs/tiff/libtiff") WINE_EXTLIB_FLAGS(TIFF, tiff, "tiff \$(ZLIB_PE_LIBS)", "-I\$(top_srcdir)/libs/tiff/libtiff")

View file

@ -134,9 +134,6 @@
/* Define to 1 if you have the `mx' library (-lmx). */ /* Define to 1 if you have the `mx' library (-lmx). */
/* #undef HAVE_LIBMX */ /* #undef HAVE_LIBMX */
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the <linux/soundcard.h> header file. */ /* Define to 1 if you have the <linux/soundcard.h> header file. */
/* #undef HAVE_LINUX_SOUNDCARD_H */ /* #undef HAVE_LINUX_SOUNDCARD_H */
@ -439,7 +436,7 @@
#define PACKAGE_NAME "mpg123" #define PACKAGE_NAME "mpg123"
/* Define to the full name and version of this package. */ /* Define to the full name and version of this package. */
#define PACKAGE_STRING "mpg123 1.32.2" #define PACKAGE_STRING "mpg123 1.32.5"
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "mpg123" #define PACKAGE_TARNAME "mpg123"
@ -448,7 +445,7 @@
#define PACKAGE_URL "" #define PACKAGE_URL ""
/* Define to the version of this package. */ /* Define to the version of this package. */
#define PACKAGE_VERSION "1.32.2" #define PACKAGE_VERSION "1.32.5"
/* Define to only include portable library API (no off_t, no internal I/O). */ /* Define to only include portable library API (no off_t, no internal I/O). */
/* #undef PORTABLE_API */ /* #undef PORTABLE_API */
@ -459,21 +456,9 @@
/* Define for calculating tables at runtime. */ /* Define for calculating tables at runtime. */
/* #undef RUNTIME_TABLES */ /* #undef RUNTIME_TABLES */
/* The size of `int32_t', as computed by sizeof. */
#define SIZEOF_INT32_T 4
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* The size of `off_t', as computed by sizeof. */ /* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 4 #define SIZEOF_OFF_T 4
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
/* The size of `ssize_t', as computed by sizeof. */
#define SIZEOF_SSIZE_T 4
/* Define to 1 if all of the C90 standard headers exist (not just the ones /* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */ backward compatibility; new code need not use it. */
@ -492,7 +477,7 @@
/* #undef USE_YASM_FOR_AVX */ /* #undef USE_YASM_FOR_AVX */
/* Version number of package */ /* Version number of package */
#define VERSION "1.32.2" #define VERSION "1.32.5"
/* Define to use Win32 named pipes */ /* Define to use Win32 named pipes */
#define WANT_WIN32_FIFO 1 #define WANT_WIN32_FIFO 1
@ -535,30 +520,3 @@
#ifndef __cplusplus #ifndef __cplusplus
/* #undef inline */ /* #undef inline */
#endif #endif
/* Define to `short' if <sys/types.h> does not define. */
/* #undef int16_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef int32_t */
/* Define to `long long' if <sys/types.h> does not define. */
/* #undef int64_t */
/* Define to `long' if <sys/types.h> does not define. */
/* #undef ptrdiff_t */
/* Define to `unsigned long' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to `long' if <sys/types.h> does not define. */
/* #undef ssize_t */
/* Define to `unsigned short' if <sys/types.h> does not define. */
/* #undef uint16_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef uint32_t */
/* Define to `unsigned long' if <sys/types.h> does not define. */
/* #undef uintptr_t */

View file

@ -4,7 +4,7 @@
public domain (or LGPL / GPL, if you like that more;-) public domain (or LGPL / GPL, if you like that more;-)
generated by debugdef.pl, what was generated by debugdef.pl, what was
trivially written by Thomas Orgis <thomas@orgis.org> trivially written by Thomas Orgis <thomas@orgis.org>
You decide to define DEBUG or not and write debug("foo") or You decide to define DEBUG or not and write debug("foo") or
mdebug("foo: %s", message) and variants with more arguments and this mdebug("foo: %s", message) and variants with more arguments and this
is converted to an elaborate call to fprintf(stderr, ...) that prints your is converted to an elaborate call to fprintf(stderr, ...) that prints your
@ -45,7 +45,7 @@
#ifndef NO_WARNING #ifndef NO_WARNING
#define mwarning(s, ...) debug_print("warning", s, __VA_ARGS__) #define mwarning(s, ...) debug_print("warning", s, __VA_ARGS__)
#else #else
#define mwarning(s, ...) #define mwarning(s, ...)
#endif #endif
#define warning(s) mwarning("%s", s) #define warning(s) mwarning("%s", s)

View file

@ -94,7 +94,7 @@ static inline int16_t ftoi16(float x)
/* This is the old new mpg123 WRITE_SAMPLE, fixed for newer GCC by MPlayer folks. /* This is the old new mpg123 WRITE_SAMPLE, fixed for newer GCC by MPlayer folks.
Makes a huge difference on old machines. */ Makes a huge difference on old machines. */
#if WORDS_BIGENDIAN #if WORDS_BIGENDIAN
#define MANTISSA_OFFSET 1 #define MANTISSA_OFFSET 1
#else #else
#define MANTISSA_OFFSET 0 #define MANTISSA_OFFSET 0
@ -124,10 +124,10 @@ static inline int16_t ftoi16(float x)
else { *(samples) = REAL_TO_SHORT_ACCURATE(sum); } else { *(samples) = REAL_TO_SHORT_ACCURATE(sum); }
/* /*
32bit signed 32bit signed
We do clipping with the same old borders... but different conversion. We do clipping with the same old borders... but different conversion.
We see here that we need extra work for non-16bit output... we optimized for 16bit. We see here that we need extra work for non-16bit output... we optimized for 16bit.
-0x7fffffff-1 is the minimum 32 bit signed integer value expressed so that MSVC -0x7fffffff-1 is the minimum 32 bit signed integer value expressed so that MSVC
does not give a compile time warning. does not give a compile time warning.
*/ */
#define WRITE_S32_SAMPLE(samples,sum,clip) \ #define WRITE_S32_SAMPLE(samples,sum,clip) \

View file

@ -39,7 +39,7 @@
#include <shlwapi.h> #include <shlwapi.h>
#endif #endif
#include "debug.h" #include "../common/debug.h"
#ifndef WINDOWS_UWP #ifndef WINDOWS_UWP

View file

@ -21,10 +21,8 @@
#include <errno.h> #include <errno.h>
#ifdef HAVE_STDLIB_H
/* realloc, size_t */ /* realloc, size_t */
#include <stdlib.h> #include <stdlib.h>
#endif
#include <stddef.h> #include <stddef.h>
@ -48,16 +46,10 @@
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h> #include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h> #include <stdint.h>
#endif
/* We want SIZE_MAX, etc. */ /* We want SIZE_MAX, etc. */
#ifdef HAVE_LIMITS_H
#include <limits.h> #include <limits.h>
#endif
#ifndef SIZE_MAX #ifndef SIZE_MAX
#define SIZE_MAX ((size_t)-1) #define SIZE_MAX ((size_t)-1)
@ -85,26 +77,11 @@
#define INT32_MIN (-INT32_MAX - 1) #define INT32_MIN (-INT32_MAX - 1)
#endif #endif
#ifndef OFF_MAX
#undef OFF_MIN
#if SIZEOF_OFF_T == 4
#define OFF_MAX INT32_MAX
#define OFF_MIN INT32_MIN
#elif SIZEOF_OFF_T == 8
#define OFF_MAX INT64_MAX
#define OFF_MIN INT64_MIN
#else
#error "Unexpected width of off_t."
#endif
#endif
// Add two values (themselves assumed to be < limit), saturating to given limit. // Add two values (themselves assumed to be < limit), saturating to given limit.
#define SATURATE_ADD(inout, add, limit) inout = (limit-add >= inout) ? inout+add : limit; #define SATURATE_ADD(inout, add, limit) inout = (limit-add >= inout) ? inout+add : limit;
#define SATURATE_SUB(inout, sub, limit) inout = (limit+sub >= inout) ? inout-sub : limit; #define SATURATE_SUB(inout, sub, limit) inout = (limit+sub >= inout) ? inout-sub : limit;
#ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif
#ifdef HAVE_STRINGS_H #ifdef HAVE_STRINGS_H
#include <strings.h> #include <strings.h>
#endif #endif
@ -150,29 +127,6 @@ const char *INT123_strerror(int errnum);
and returns NULL on NULL input instead of crashing. */ and returns NULL on NULL input instead of crashing. */
char* INT123_compat_strdup(const char *s); char* INT123_compat_strdup(const char *s);
/* If we have the size checks enabled, try to derive some sane printfs.
Simple start: Use max integer type and format if long is not big enough.
I am hesitating to use %ll without making sure that it's there... */
#if (defined SIZEOF_OFF_T) && (SIZEOF_OFF_T > SIZEOF_LONG) && (defined PRIiMAX)
# define OFF_P PRIiMAX
typedef intmax_t off_p;
#else
# define OFF_P "li"
typedef long off_p;
#endif
#if (defined SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > SIZEOF_LONG) && (defined PRIuMAX) && (defined PRIiMAX)
# define SIZE_P PRIuMAX
typedef uintmax_t size_p;
# define SSIZE_P PRIiMAX
typedef intmax_t ssize_p;
#else
# define SIZE_P "lu"
typedef unsigned long size_p;
# define SSIZE_P "ld"
typedef long ssize_p;
#endif
/* Get an environment variable, possibly converted to UTF-8 from wide string. /* Get an environment variable, possibly converted to UTF-8 from wide string.
The return value is a copy that you shall free. */ The return value is a copy that you shall free. */
char *INT123_compat_getenv(const char* name); char *INT123_compat_getenv(const char* name);
@ -200,7 +154,6 @@ FILE* INT123_compat_fdopen(int fd, const char *mode);
int INT123_compat_close(int infd); int INT123_compat_close(int infd);
int INT123_compat_fclose(FILE* stream); int INT123_compat_fclose(FILE* stream);
/** /**
* Setting binary mode on a descriptor, where necessary. * Setting binary mode on a descriptor, where necessary.
* We do not bother with errors. This has to work. * We do not bother with errors. This has to work.
@ -326,10 +279,15 @@ size_t INT123_unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *st
#define normal mpg123_normal #define normal mpg123_normal
#endif #endif
#include "true.h" #include "../common/true.h"
#if (!defined(WIN32) || defined (__CYGWIN__)) && defined(HAVE_SIGNAL_H) #if (!defined(WIN32) || defined (__CYGWIN__)) && defined(HAVE_SIGNAL_H)
void (*INT123_catchsignal(int signum, void(*handler)(int)))(int); void (*INT123_catchsignal(int signum, void(*handler)(int)))(int);
#endif #endif
// Some ancient toolchains miss the documented errno value.
#if defined(_WIN32) && !defined(EOVERFLOW)
#define EOVERFLOW 132
#endif
#endif #endif

View file

@ -26,7 +26,7 @@
#include <locale.h> #include <locale.h>
#endif #endif
#include "debug.h" #include "../common/debug.h"
/* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */ /* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */
void *INT123_safe_realloc(void *ptr, size_t size) void *INT123_safe_realloc(void *ptr, size_t size)

View file

@ -47,13 +47,13 @@ enum mpg123_enc_enum
/* 0000 0000 0100 0000 Some 16 bit integer encoding. */ /* 0000 0000 0100 0000 Some 16 bit integer encoding. */
, MPG123_ENC_16 = 0x040 , MPG123_ENC_16 = 0x040
/* 0100 0000 0000 0000 Some 24 bit integer encoding. */ /* 0100 0000 0000 0000 Some 24 bit integer encoding. */
, MPG123_ENC_24 = 0x4000 , MPG123_ENC_24 = 0x4000
/* 0000 0001 0000 0000 Some 32 bit integer encoding. */ /* 0000 0001 0000 0000 Some 32 bit integer encoding. */
, MPG123_ENC_32 = 0x100 , MPG123_ENC_32 = 0x100
/* 0000 0000 1000 0000 Some signed integer encoding. */ /* 0000 0000 1000 0000 Some signed integer encoding. */
, MPG123_ENC_SIGNED = 0x080 , MPG123_ENC_SIGNED = 0x080
/* 0000 1110 0000 0000 Some float encoding. */ /* 0000 1110 0000 0000 Some float encoding. */
, MPG123_ENC_FLOAT = 0xe00 , MPG123_ENC_FLOAT = 0xe00
/* 0000 0000 1101 0000 signed 16 bit */ /* 0000 0000 1101 0000 signed 16 bit */
, MPG123_ENC_SIGNED_16 = (MPG123_ENC_16|MPG123_ENC_SIGNED|0x10) , MPG123_ENC_SIGNED_16 = (MPG123_ENC_16|MPG123_ENC_SIGNED|0x10)
/* 0000 0000 0110 0000 unsigned 16 bit */ /* 0000 0000 0110 0000 unsigned 16 bit */
@ -156,4 +156,3 @@ struct mpg123_fmt
/** @} */ /** @} */
#endif #endif

View file

@ -19,15 +19,15 @@
*/ */
#define MPG123_API_VERSION 48 #define MPG123_API_VERSION 48
/** library patch level at client build time */ /** library patch level at client build time */
#define MPG123_PATCHLEVEL 0 #define MPG123_PATCHLEVEL 2
#ifndef MPG123_EXPORT #ifndef MPG123_EXPORT
/** Defines needed for MS Visual Studio(tm) DLL builds. /** Defines needed for MS Visual Studio(tm) DLL builds.
* Every public function must be prefixed with MPG123_EXPORT. When building * Every public function must be prefixed with MPG123_EXPORT. When building
* the DLL ensure to define BUILD_MPG123_DLL. This makes the function accessible * the DLL ensure to define BUILD_MPG123_DLL. This makes the function accessible
* for clients and includes it in the import library which is created together * for clients and includes it in the import library which is created together
* with the DLL. When consuming the DLL ensure to define LINK_MPG123_DLL which * with the DLL. When consuming the DLL ensure to define LINK_MPG123_DLL which
* imports the functions from the DLL. * imports the functions from the DLL.
*/ */
#ifdef BUILD_MPG123_DLL #ifdef BUILD_MPG123_DLL
/* The dll exports. */ /* The dll exports. */
@ -233,7 +233,7 @@ enum mpg123_parms
MPG123_RVA, /**< one of the RVA choices above (integer) */ MPG123_RVA, /**< one of the RVA choices above (integer) */
MPG123_DOWNSPEED, /**< play a frame N times (integer) */ MPG123_DOWNSPEED, /**< play a frame N times (integer) */
MPG123_UPSPEED, /**< play every Nth frame (integer) */ MPG123_UPSPEED, /**< play every Nth frame (integer) */
MPG123_START_FRAME, /**< start with this frame (skip frames before that, integer) */ MPG123_START_FRAME, /**< start with this frame (skip frames before that, integer) */
MPG123_DECODE_FRAMES, /**< decode only this number of frames (integer) */ MPG123_DECODE_FRAMES, /**< decode only this number of frames (integer) */
MPG123_ICY_INTERVAL, /**< Stream contains ICY metadata with this interval (integer). MPG123_ICY_INTERVAL, /**< Stream contains ICY metadata with this interval (integer).
Make sure to set this _before_ opening a stream.*/ Make sure to set this _before_ opening a stream.*/
@ -582,7 +582,7 @@ MPG123_EXPORT const char* mpg123_current_decoder(mpg123_handle *mh);
/** @} */ /** @} */
/** \defgroup mpg123_output mpg123 output audio format /** \defgroup mpg123_output mpg123 output audio format
* *
* Functions to get and select the format of the decoded audio. * Functions to get and select the format of the decoded audio.
* *
@ -631,14 +631,14 @@ MPG123_EXPORT void mpg123_encodings(const int **list, size_t *number);
* \return positive size of encoding in bytes, 0 on invalid encoding. */ * \return positive size of encoding in bytes, 0 on invalid encoding. */
MPG123_EXPORT int mpg123_encsize(int encoding); MPG123_EXPORT int mpg123_encsize(int encoding);
/** Configure a mpg123 handle to accept no output format at all, /** Configure a mpg123 handle to accept no output format at all,
* use before specifying supported formats with mpg123_format * use before specifying supported formats with mpg123_format
* \param mh handle * \param mh handle
* \return MPG123_OK on success * \return MPG123_OK on success
*/ */
MPG123_EXPORT int mpg123_format_none(mpg123_handle *mh); MPG123_EXPORT int mpg123_format_none(mpg123_handle *mh);
/** Configure mpg123 handle to accept all formats /** Configure mpg123 handle to accept all formats
* (also any custom rate you may set) -- this is default. * (also any custom rate you may set) -- this is default.
* \param mh handle * \param mh handle
* \return MPG123_OK on success * \return MPG123_OK on success
@ -667,12 +667,12 @@ MPG123_EXPORT int mpg123_format( mpg123_handle *mh
MPG123_EXPORT int mpg123_format2( mpg123_handle *mh MPG123_EXPORT int mpg123_format2( mpg123_handle *mh
, long rate, int channels, int encodings ); , long rate, int channels, int encodings );
/** Check to see if a specific format at a specific rate is supported /** Check to see if a specific format at a specific rate is supported
* by mpg123_handle. * by mpg123_handle.
* \param mh handle * \param mh handle
* \param rate sampling rate * \param rate sampling rate
* \param encoding encoding * \param encoding encoding
* \return 0 for no support (that includes invalid parameters), MPG123_STEREO, * \return 0 for no support (that includes invalid parameters), MPG123_STEREO,
* MPG123_MONO or MPG123_STEREO|MPG123_MONO. */ * MPG123_MONO or MPG123_STEREO|MPG123_MONO. */
MPG123_EXPORT int mpg123_format_support( mpg123_handle *mh MPG123_EXPORT int mpg123_format_support( mpg123_handle *mh
, long rate, int encoding ); , long rate, int encoding );
@ -837,10 +837,10 @@ MPG123_EXPORT int mpg123_read(mpg123_handle *mh
MPG123_EXPORT int mpg123_feed( mpg123_handle *mh MPG123_EXPORT int mpg123_feed( mpg123_handle *mh
, const unsigned char *in, size_t size ); , const unsigned char *in, size_t size );
/** Decode MPEG Audio from inmemory to outmemory. /** Decode MPEG Audio from inmemory to outmemory.
* This is very close to a drop-in replacement for old mpglib. * This is very close to a drop-in replacement for old mpglib.
* When you give zero-sized output buffer the input will be parsed until * When you give zero-sized output buffer the input will be parsed until
* decoded data is available. This enables you to get MPG123_NEW_FORMAT (and query it) * decoded data is available. This enables you to get MPG123_NEW_FORMAT (and query it)
* without taking decoded data. * without taking decoded data.
* Think of this function being the union of mpg123_read() and mpg123_feed() (which it actually is, sort of;-). * Think of this function being the union of mpg123_read() and mpg123_feed() (which it actually is, sort of;-).
* You can actually always decide if you want those specialized functions in separate steps or one call this one here. * You can actually always decide if you want those specialized functions in separate steps or one call this one here.
@ -973,7 +973,7 @@ MPG123_EXPORT int64_t mpg123_framepos64(mpg123_handle *mh);
* just use the position defined for the samples you get out of the decoder;-) * just use the position defined for the samples you get out of the decoder;-)
* The general usage is modelled after stdlib's ftell() and fseek(). * The general usage is modelled after stdlib's ftell() and fseek().
* Especially, the whence parameter for the seek functions has the same meaning * Especially, the whence parameter for the seek functions has the same meaning
* as the one for fseek() and needs the same constants from stdlib.h: * as the one for fseek() and needs the same constants from stdlib.h:
* *
* - SEEK_SET: set position to (or near to) specified offset * - SEEK_SET: set position to (or near to) specified offset
* - SEEK_CUR: change position by offset from now * - SEEK_CUR: change position by offset from now
@ -1084,7 +1084,7 @@ MPG123_EXPORT int64_t mpg123_seek64( mpg123_handle *mh
* \param whence one of SEEK_SET, SEEK_CUR or SEEK_END * \param whence one of SEEK_SET, SEEK_CUR or SEEK_END
* (Offset for SEEK_END is always effectively negative since API * (Offset for SEEK_END is always effectively negative since API
* version 48, was inverted from lseek() usage since ever before.) * version 48, was inverted from lseek() usage since ever before.)
* \param input_offset The position it expects to be at the * \param input_offset The position it expects to be at the
* next time data is fed to mpg123_decode(). * next time data is fed to mpg123_decode().
* \return The resulting offset >= 0 or error/message code * \return The resulting offset >= 0 or error/message code
*/ */
@ -1310,7 +1310,7 @@ MPG123_EXPORT double mpg123_geteq2(mpg123_handle *mh, int channel, int band);
*/ */
MPG123_EXPORT int mpg123_reset_eq(mpg123_handle *mh); MPG123_EXPORT int mpg123_reset_eq(mpg123_handle *mh);
/** Set the absolute output volume including the RVA setting, /** Set the absolute output volume including the RVA setting,
* vol<0 just applies (a possibly changed) RVA setting. * vol<0 just applies (a possibly changed) RVA setting.
* \param mh handle * \param mh handle
* \param vol volume value (linear factor) * \param vol volume value (linear factor)
@ -1327,14 +1327,14 @@ MPG123_EXPORT int mpg123_volume_change(mpg123_handle *mh, double change);
/** Adjust output volume including the RVA setting by chosen amount /** Adjust output volume including the RVA setting by chosen amount
* \param mh handle * \param mh handle
* \param change volume adjustment in decibels (limited to +/- 60 dB) * \param db volume adjustment in decibels (limited to +/- 60 dB)
* \return MPG123_OK on success * \return MPG123_OK on success
*/ */
MPG123_EXPORT int mpg123_volume_change_db(mpg123_handle *mh, double db); MPG123_EXPORT int mpg123_volume_change_db(mpg123_handle *mh, double db);
/** Return current volume setting, the actual value due to RVA, and the RVA /** Return current volume setting, the actual value due to RVA, and the RVA
* adjustment itself. It's all as double float value to abstract the sample * adjustment itself. It's all as double float value to abstract the sample
* format. The volume values are linear factors / amplitudes (not percent) * format. The volume values are linear factors / amplitudes (not percent)
* and the RVA value is in decibels. * and the RVA value is in decibels.
* \param mh handle * \param mh handle
* \param base return address for base volume (linear factor) * \param base return address for base volume (linear factor)
@ -1629,7 +1629,7 @@ MPG123_EXPORT int mpg123_getstate2( mpg123_handle *mh
/** Data structure for storing strings in a safer way than a standard C-String. /** Data structure for storing strings in a safer way than a standard C-String.
* Can also hold a number of null-terminated strings. */ * Can also hold a number of null-terminated strings. */
typedef struct typedef struct
{ {
char* p; /**< pointer to the string data */ char* p; /**< pointer to the string data */
size_t size; /**< raw number of bytes allocated */ size_t size; /**< raw number of bytes allocated */
@ -2003,10 +2003,10 @@ MPG123_EXPORT char* mpg123_icy2utf8(const char* icy_text);
* - Influence behaviour of library _during_ initialization of handle (MPG123_VERBOSE). * - Influence behaviour of library _during_ initialization of handle (MPG123_VERBOSE).
* - Use one set of parameters for multiple handles. * - Use one set of parameters for multiple handles.
* *
* The functions for handling mpg123_pars (mpg123_par() and mpg123_fmt() * The functions for handling mpg123_pars (mpg123_par() and mpg123_fmt()
* family) directly return a fully qualified mpg123 error code, the ones * family) directly return a fully qualified mpg123 error code, the ones
* operating on full handles normally MPG123_OK or MPG123_ERR, storing the * operating on full handles normally MPG123_OK or MPG123_ERR, storing the
* specific error code itseld inside the handle. * specific error code itseld inside the handle.
* *
* @{ * @{
*/ */
@ -2037,15 +2037,15 @@ MPG123_EXPORT mpg123_pars *mpg123_new_pars(int *error);
*/ */
MPG123_EXPORT void mpg123_delete_pars(mpg123_pars* mp); MPG123_EXPORT void mpg123_delete_pars(mpg123_pars* mp);
/** Configure mpg123 parameters to accept no output format at all, /** Configure mpg123 parameters to accept no output format at all,
* use before specifying supported formats with mpg123_format * use before specifying supported formats with mpg123_format
* \param mp parameter handle * \param mp parameter handle
* \return MPG123_OK on success * \return MPG123_OK on success
*/ */
MPG123_EXPORT int mpg123_fmt_none(mpg123_pars *mp); MPG123_EXPORT int mpg123_fmt_none(mpg123_pars *mp);
/** Configure mpg123 parameters to accept all formats /** Configure mpg123 parameters to accept all formats
* (also any custom rate you may set) -- this is default. * (also any custom rate you may set) -- this is default.
* \param mp parameter handle * \param mp parameter handle
* \return MPG123_OK on success * \return MPG123_OK on success
*/ */
@ -2081,7 +2081,7 @@ MPG123_EXPORT int mpg123_fmt2(mpg123_pars *mp
* \param mp parameter handle * \param mp parameter handle
* \param rate sampling rate * \param rate sampling rate
* \param encoding encoding * \param encoding encoding
* \return 0 for no support (that includes invalid parameters), MPG123_STEREO, * \return 0 for no support (that includes invalid parameters), MPG123_STEREO,
* MPG123_MONO or MPG123_STEREO|MPG123_MONO. */ * MPG123_MONO or MPG123_STEREO|MPG123_MONO. */
MPG123_EXPORT int mpg123_fmt_support(mpg123_pars *mp, long rate, int encoding); MPG123_EXPORT int mpg123_fmt_support(mpg123_pars *mp, long rate, int encoding);
@ -2179,7 +2179,7 @@ MPG123_EXPORT size_t mpg123_outblock(mpg123_handle *mh);
#ifndef MPG123_PORTABLE_API #ifndef MPG123_PORTABLE_API
/** Replace low-level stream access functions; read and lseek as known in POSIX. /** Replace low-level stream access functions; read and lseek as known in POSIX.
* You can use this to make any fancy file opening/closing yourself, * You can use this to make any fancy file opening/closing yourself,
* using mpg123_open_fd() to set the file descriptor for your read/lseek * using mpg123_open_fd() to set the file descriptor for your read/lseek
* (doesn't need to be a "real" file descriptor...). * (doesn't need to be a "real" file descriptor...).
* Setting a function to NULL means that just a call to POSIX read/lseek is * Setting a function to NULL means that just a call to POSIX read/lseek is

View file

@ -203,16 +203,6 @@ void INT123_dct64_i386 (real *,real *,real *);
void INT123_dct64_altivec(real *,real *,real *); void INT123_dct64_altivec(real *,real *,real *);
void INT123_dct64_i486(int*, int* , real*); /* Yeah, of no use outside of synth_i486.c .*/ void INT123_dct64_i486(int*, int* , real*); /* Yeah, of no use outside of synth_i486.c .*/
/* This is used by the layer 3 decoder, one generic function and 3DNow variants. */
void INT123_dct36 (real *,real *,real *,const real *,real *);
void INT123_dct36_3dnow (real *,real *,real *,const real *,real *);
void INT123_dct36_3dnowext(real *,real *,real *,const real *,real *);
void INT123_dct36_x86_64 (real *,real *,real *,const real *,real *);
void INT123_dct36_sse (real *,real *,real *,const real *,real *);
void INT123_dct36_avx (real *,real *,real *,const real *,real *);
void INT123_dct36_neon (real *,real *,real *,const real *,real *);
void INT123_dct36_neon64 (real *,real *,real *,const real *,real *);
/* Tools for NtoM resampling synth, defined in ntom.c . */ /* Tools for NtoM resampling synth, defined in ntom.c . */
int INT123_synth_ntom_set_step(mpg123_handle *fr); /* prepare ntom decoding */ int INT123_synth_ntom_set_step(mpg123_handle *fr); /* prepare ntom decoding */
unsigned long INT123_ntom_val(mpg123_handle *fr, int64_t frame); /* compute INT123_ntom_val for frame offset */ unsigned long INT123_ntom_val(mpg123_handle *fr, int64_t frame); /* compute INT123_ntom_val for frame offset */
@ -232,6 +222,13 @@ int64_t INT123_ntom_frameoff(mpg123_handle *fr, int64_t soff);
/* Initialization of any static data that majy be needed at runtime. /* Initialization of any static data that majy be needed at runtime.
Make sure you call these once before it is too late. */ Make sure you call these once before it is too late. */
#ifndef NO_LAYER3 #ifndef NO_LAYER3
#ifdef OPT_THE_DCT36
// Set the current dct36 function choice. The pointers themselves are to static functions.
void INT123_dct36_choose(mpg123_handle *fr);
int INT123_dct36_match(mpg123_handle *fr, enum optdec t);
#endif
#ifdef RUNTIME_TABLES #ifdef RUNTIME_TABLES
void INT123_init_layer3(void); void INT123_init_layer3(void);
#endif #endif

View file

@ -7,7 +7,7 @@
*/ */
#include "config.h" #include "config.h"
#include "compat.h" #include "../compat/compat.h"
#include "dither.h" #include "dither.h"
static const uint32_t init_seed = 2463534242UL; static const uint32_t init_seed = 2463534242UL;

View file

@ -26,8 +26,8 @@
*/ */
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "sample.h" #include "../common/sample.h"
#include "debug.h" #include "../common/debug.h"
/* static int chans[NUM_CHANNELS] = { 1 , 2 }; */ /* static int chans[NUM_CHANNELS] = { 1 , 2 }; */
static const long my_rates[MPG123_RATES] = /* only the standard rates */ static const long my_rates[MPG123_RATES] = /* only the standard rates */
@ -686,7 +686,7 @@ static void conv_s16_to_s32(struct outbuffer *buf)
#endif #endif
#endif #endif
#include "swap_bytes_impl.h" #include "../common/swap_bytes_impl.h"
void swap_endian(struct outbuffer *buf, int block) void swap_endian(struct outbuffer *buf, int block)
{ {

View file

@ -9,7 +9,7 @@
#define WANT_GETCPUFLAGS #define WANT_GETCPUFLAGS
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "getcpuflags.h" #include "getcpuflags.h"
#include "debug.h" #include "../common/debug.h"
static void frame_fixed_reset(mpg123_handle *fr); static void frame_fixed_reset(mpg123_handle *fr);
@ -193,13 +193,12 @@ int INT123_frame_outbuffer(mpg123_handle *fr)
{ {
fr->err = MPG123_BAD_BUFFER; fr->err = MPG123_BAD_BUFFER;
if(NOQUIET) if(NOQUIET)
merror( "have external buffer of size %"SIZE_P", need %"SIZE_P merror("have external buffer of size %zu, need %zu", fr->buffer.size, size);
, (size_p)fr->buffer.size, (size_p)size );
return MPG123_ERR; return MPG123_ERR;
} }
} }
debug1("need frame buffer of %"SIZE_P, (size_p)size); debug1("need frame buffer of %zu", size);
if(fr->buffer.rdata != NULL && fr->buffer.size != size) if(fr->buffer.rdata != NULL && fr->buffer.size != size)
{ {
free(fr->buffer.rdata); free(fr->buffer.rdata);
@ -222,7 +221,7 @@ int INT123_frame_outbuffer(mpg123_handle *fr)
int attribute_align_arg mpg123_replace_buffer(mpg123_handle *mh, void *data, size_t size) int attribute_align_arg mpg123_replace_buffer(mpg123_handle *mh, void *data, size_t size)
{ {
debug2("replace buffer with %p size %"SIZE_P, data, (size_p)size); debug2("replace buffer with %p size %zu", data, size);
if(mh == NULL) return MPG123_BAD_HANDLE; if(mh == NULL) return MPG123_BAD_HANDLE;
/* Will accept any size, the error comes later... */ /* Will accept any size, the error comes later... */
if(data == NULL) if(data == NULL)

View file

@ -167,11 +167,9 @@ struct mpg123_handle_struct
{ {
#ifdef OPT_MULTI #ifdef OPT_MULTI
#ifndef NO_LAYER3 #ifdef OPT_THE_DCT36
#if (defined OPT_3DNOW_VINTAGE || defined OPT_3DNOWEXT_VINTAGE || defined OPT_SSE || defined OPT_X86_64 || defined OPT_AVX || defined OPT_NEON || defined OPT_NEON64)
void (*the_dct36)(real *,real *,real *,const real *,real *); void (*the_dct36)(real *,real *,real *,const real *,real *);
#endif #endif
#endif
#endif #endif
enum optdec type; enum optdec type;

View file

@ -7,7 +7,7 @@
This is no stand-alone header, precisely to be able to fool it into using fake handle types for testing the math. This is no stand-alone header, precisely to be able to fool it into using fake handle types for testing the math.
*/ */
#include "debug.h" #include "../common/debug.h"
#ifdef GAPLESS #ifdef GAPLESS
/* From internal sample number to external. */ /* From internal sample number to external. */
@ -81,8 +81,8 @@ static void frame_buffercheck(mpg123_handle *fr)
} }
if(VERBOSE3) if(VERBOSE3)
fprintf(stderr, "\nNote: Cut frame %" PRIi64 " buffer on end of stream to %" fprintf(stderr, "\nNote: Cut frame %" PRIi64 " buffer on end of stream to %"
PRIi64 " samples, fill now %"SIZE_P" bytes.\n" PRIi64 " samples, fill now %zu bytes.\n"
, fr->num, (fr->num == fr->lastframe ? fr->lastoff : 0), (size_p)fr->buffer.fill); , fr->num, (fr->num == fr->lastframe ? fr->lastoff : 0), fr->buffer.fill);
} }
/* The first interesting frame: Skip some leading samples. */ /* The first interesting frame: Skip some leading samples. */

View file

@ -13,7 +13,7 @@
#define _MPG123_GETBITS_H_ #define _MPG123_GETBITS_H_
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "debug.h" #include "../common/debug.h"
#define backbits(fr,nob) ((void)( \ #define backbits(fr,nob) ((void)( \
fr->bits_avail += nob, \ fr->bits_avail += nob, \

View file

@ -10,7 +10,7 @@
#ifndef NO_ICY #ifndef NO_ICY
#include "compat.h" #include "../compat/compat.h"
#include "mpg123.h" #include "mpg123.h"
struct icy_meta struct icy_meta

View file

@ -28,7 +28,7 @@
#include "config.h" #include "config.h"
/* Includes string and stdlib headers... */ /* Includes string and stdlib headers... */
#include "compat.h" #include "../compat/compat.h"
/* ThOr: too lazy for this type check; also we use char/short all around anyway. /* ThOr: too lazy for this type check; also we use char/short all around anyway.
Of cource, it would be the proper way to use _these_ kind of types all around. */ Of cource, it would be the proper way to use _these_ kind of types all around. */

View file

@ -85,7 +85,7 @@
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "id3.h" #include "id3.h"
#include "debug.h" #include "../common/debug.h"
#ifndef NO_ID3V2 /* Only the main parsing routine will always be there. */ #ifndef NO_ID3V2 /* Only the main parsing routine will always be there. */
@ -352,7 +352,7 @@ static void store_id3_text(mpg123_string *sb, unsigned char *source, size_t sour
} }
memcpy(sb->p, source, source_size); memcpy(sb->p, source, source_size);
sb->fill = source_size; sb->fill = source_size;
debug1("stored undecoded ID3 text of size %"SIZE_P, (size_p)source_size); debug1("stored undecoded ID3 text of size %zu", source_size);
return; return;
} }
@ -567,7 +567,7 @@ static void process_comment(mpg123_handle *fr, enum frame_types tt, unsigned cha
if(realsize < (size_t)(descr-realdata)) if(realsize < (size_t)(descr-realdata))
{ {
if(NOQUIET) error1("Invalid frame size of %"SIZE_P" (too small for anything).", (size_p)realsize); if(NOQUIET) error1("Invalid frame size of %zu (too small for anything).", realsize);
return; return;
} }
if(encoding > mpg123_id3_enc_max) if(encoding > mpg123_id3_enc_max)
@ -622,8 +622,8 @@ static void process_comment(mpg123_handle *fr, enum frame_types tt, unsigned cha
if(VERBOSE4) /* Do _not_ print the verbatim text: The encoding might be funny! */ if(VERBOSE4) /* Do _not_ print the verbatim text: The encoding might be funny! */
{ {
fprintf(stderr, "Note: ID3 comm/uslt desc of length %"SIZE_P".\n", (size_p)xcom->description.fill); fprintf(stderr, "Note: ID3 comm/uslt desc of length %zu.\n", xcom->description.fill);
fprintf(stderr, "Note: ID3 comm/uslt text of length %"SIZE_P".\n", (size_p)xcom->text.fill); fprintf(stderr, "Note: ID3 comm/uslt text of length %zu.\n", xcom->text.fill);
} }
/* Look out for RVA info only when we really deal with a straight comment. */ /* Look out for RVA info only when we really deal with a straight comment. */
if(tt == comment && localcom.description.fill > 0) if(tt == comment && localcom.description.fill > 0)

View file

@ -8,7 +8,7 @@
*/ */
#include "index.h" #include "index.h"
#include "debug.h" #include "../common/debug.h"
/* The next expected frame offset, one step ahead. */ /* The next expected frame offset, one step ahead. */
static int64_t fi_next(struct frame_index *fi) static int64_t fi_next(struct frame_index *fi)
@ -124,7 +124,7 @@ int INT123_fi_set(struct frame_index *fi, int64_t *offsets, int64_t step, size_t
void INT123_fi_reset(struct frame_index *fi) void INT123_fi_reset(struct frame_index *fi)
{ {
debug1("reset with size %"SIZE_P, (size_p)fi->size); debug1("reset with size %zu", fi->size);
fi->fill = 0; fi->fill = 0;
fi->step = 1; fi->step = 1;
fi->next = fi_next(fi); fi->next = fi_next(fi);

View file

@ -21,7 +21,7 @@
*/ */
#include "config.h" #include "config.h"
#include "compat.h" #include "../compat/compat.h"
struct frame_index struct frame_index
{ {

View file

@ -10,7 +10,7 @@
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "getbits.h" #include "getbits.h"
#include "debug.h" #include "../common/debug.h"
/* /*
Allocation value is not allowed to be 15. Initially, libmad showed me the Allocation value is not allowed to be 15. Initially, libmad showed me the

View file

@ -21,9 +21,17 @@
#include "huffman.h" #include "huffman.h"
#endif #endif
#include "getbits.h" #include "getbits.h"
#include "debug.h" #include "../common/debug.h"
/* Predeclare the assembly routines, only called from wrappers here. */
void INT123_dct36_3dnow (real *,real *,real *,const real *,real *);
void INT123_dct36_3dnowext(real *,real *,real *,const real *,real *);
void INT123_dct36_x86_64 (real *,real *,real *,const real *,real *);
void INT123_dct36_sse (real *,real *,real *,const real *,real *);
void INT123_dct36_avx (real *,real *,real *,const real *,real *);
void INT123_dct36_neon (real *,real *,real *,const real *,real *);
void INT123_dct36_neon64 (real *,real *,real *,const real *,real *);
/* define CUT_SFB21 if you want to cut-off the frequency above 16kHz */ /* define CUT_SFB21 if you want to cut-off the frequency above 16kHz */
#if 0 #if 0
@ -1256,10 +1264,7 @@ static void III_antialias(real xr[SBLIMIT][SSLIMIT],struct gr_info_s *gr_info)
Mathematics of Computation, Volume 32, Number 141, January 1978, Mathematics of Computation, Volume 32, Number 141, January 1978,
Pages 175-199 Pages 175-199
*/ */
static void INT123_dct36(real *inbuf,real *o1,real *o2,const real *wintab,real *tsbuf)
/* Calculation of the inverse MDCT
used to be static without 3dnow - does that really matter? */
void INT123_dct36(real *inbuf,real *o1,real *o2,const real *wintab,real *tsbuf)
{ {
real tmp[18]; real tmp[18];
@ -1449,6 +1454,105 @@ void INT123_dct36(real *inbuf,real *o1,real *o2,const real *wintab,real *tsbuf)
} }
} }
// Wrap the assembly routine calls into C functions that serve as jump target to satisfy
// indirect branch protection if the toolchain enables that. Otherwise, we'd need to anticipate
// that in the assembly (and ensure assemblers support endbr64 and friends).
// Loss of efficiency:
// In the case of one static optimization choice, we do not have that problem.
#ifdef OPT_THE_DCT36
#define DCT36_WRAP(asmfunc) \
static void asmfunc ## _wrap(real *inbuf,real *o1,real *o2,const real *wintab,real *tsbuf) \
{ \
asmfunc(inbuf, o1, o2, wintab, tsbuf); \
}
#ifdef OPT_SSE
DCT36_WRAP(INT123_dct36_sse)
#endif
#ifdef OPT_3DNOWEXT_VINTAGE
DCT36_WRAP(INT123_dct36_3dnowext)
#endif
#ifdef OPT_3DNOW_VINTAGE
DCT36_WRAP(INT123_dct36_3dnow)
#endif
#ifdef OPT_X86_64
DCT36_WRAP(INT123_dct36_x86_64)
#endif
#ifdef OPT_AVX
DCT36_WRAP(INT123_dct36_avx)
#endif
#ifdef OPT_NEON
DCT36_WRAP(INT123_dct36_neon)
#endif
#ifdef OPT_NEON64
DCT36_WRAP(INT123_dct36_neon64)
#endif
int INT123_dct36_match(mpg123_handle *fr, enum optdec t)
{
#ifdef OPT_SSE
if(t == sse && fr->cpu_opts.the_dct36 == INT123_dct36_sse_wrap)
return 1;
#endif
#ifdef OPT_3DNOWEXT_VINTAGE
if(t == dreidnowext_vintage && fr->cpu_opts.the_dct36 == INT123_dct36_3dnowext_wrap)
return 1;
#endif
#ifdef OPT_3DNOW_VINTAGE
if(t == dreidnow_vintage && fr->cpu_opts.the_dct36 == INT123_dct36_3dnow_wrap)
return 1;
#endif
return 0;
}
void INT123_dct36_choose(mpg123_handle *fr)
{
switch(fr->cpu_opts.type)
{
#ifdef OPT_SSE
case sse:
fr->cpu_opts.the_dct36 = INT123_dct36_sse_wrap;
break;
#endif
#ifdef OPT_3DNOWEXT_VINTAGE
case dreidnowext_vintage:
fr->cpu_opts.the_dct36 = INT123_dct36_3dnowext_wrap;
break;
#endif
#ifdef OPT_3DNOW_VINTAGE
case dreidnow_vintage:
fr->cpu_opts.the_dct36 = INT123_dct36_3dnow_wrap;
break;
#endif
#ifdef OPT_AVX
case avx:
fr->cpu_opts.the_dct36 = INT123_dct36_avx_wrap;
break;
#endif
#ifdef OPT_X86_64
case x86_64:
fr->cpu_opts.the_dct36 = INT123_dct36_x86_64_wrap;
break;
#endif
#ifdef OPT_NEON
case neon:
fr->cpu_opts.the_dct36 = INT123_dct36_neon_wrap;
break;
#endif
#ifdef OPT_NEON64
case neon:
fr->cpu_opts.the_dct36 = INT123_dct36_neon64_wrap;
break;
#endif
default:
fr->cpu_opts.the_dct36 = INT123_dct36;
}
}
#endif
/* new DCT12 */ /* new DCT12 */
static void dct12(real *in,real *rawout1,real *rawout2,register const real *wi,register real *ts) static void dct12(real *in,real *rawout1,real *rawout2,register const real *wi,register real *ts)

View file

@ -32,19 +32,35 @@
#endif #endif
// For correct MPG123_EXPORT. // For correct MPG123_EXPORT.
#include "abi_align.h" #include "../common/abi_align.h"
// Need the full header with non-portable API, for the bare mpg123_open*() // Need the full header with non-portable API, for the bare mpg123_open*()
// declarations. But no renaming shenanigans. // declarations. But no renaming shenanigans.
#include "mpg123.h" #include "mpg123.h"
#include "lfs_wrap.h" #include "lfs_wrap.h"
#include "abi_align.h" #include "../common/abi_align.h"
#include "compat.h" #include "../compat/compat.h"
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include "debug.h" #ifndef OFF_MAX
#undef OFF_MIN
#if SIZEOF_OFF_T == 4
#define OFF_MAX INT32_MAX
#define OFF_MIN INT32_MIN
#elif SIZEOF_OFF_T == 8
#define OFF_MAX INT64_MAX
#define OFF_MIN INT64_MIN
#else
#error "Unexpected width of off_t."
#endif
#endif
// A paranoid check that someone did not define a wrong SIZEOF_OFF_T at configure time.
typedef unsigned char MPG123_STATIC_ASSERT[(SIZEOF_OFF_T == sizeof(off_t)) ? 1 : -1];
#include "../common/debug.h"
// We do not want to expose this publicly, but it is cleaner to have it also defined // We do not want to expose this publicly, but it is cleaner to have it also defined
// as portable API to offer the legacy function wrapper over. It's an undocumented // as portable API to offer the legacy function wrapper over. It's an undocumented
@ -90,7 +106,7 @@ struct wrap_data
off_t (*r_lseek)(int, off_t, int); off_t (*r_lseek)(int, off_t, int);
mpg123_ssize_t (*r_h_read)(void *, void *, size_t); mpg123_ssize_t (*r_h_read)(void *, void *, size_t);
off_t (*r_h_lseek)(void*, off_t, int); off_t (*r_h_lseek)(void*, off_t, int);
#if LFS_LARGEFILE_64 #ifdef LFS_LARGEFILE_64
mpg123_ssize_t (*r_read_64) (int, void *, size_t); mpg123_ssize_t (*r_read_64) (int, void *, size_t);
off64_t (*r_lseek_64)(int, off64_t, int); off64_t (*r_lseek_64)(int, off64_t, int);
mpg123_ssize_t (*r_h_read_64)(void *, void *, size_t); mpg123_ssize_t (*r_h_read_64)(void *, void *, size_t);
@ -175,7 +191,7 @@ static struct wrap_data* wrap_get(mpg123_handle *mh, int force_alloc)
whd->r_lseek = NULL; whd->r_lseek = NULL;
whd->r_h_read = NULL; whd->r_h_read = NULL;
whd->r_h_lseek = NULL; whd->r_h_lseek = NULL;
#if LFS_LARGEFILE_64 #ifdef LFS_LARGEFILE_64
whd->r_read_64 = NULL; whd->r_read_64 = NULL;
whd->r_lseek_64 = NULL; whd->r_lseek_64 = NULL;
whd->r_h_read_64 = NULL; whd->r_h_read_64 = NULL;

View file

@ -7,19 +7,19 @@
*/ */
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "version.h" #include "../version.h"
#include "icy2utf8.h" #include "icy2utf8.h"
#include "gapless.h" #include "gapless.h"
/* Want accurate rounding function regardless of decoder setup. */ /* Want accurate rounding function regardless of decoder setup. */
#define FORCE_ACCURATE #define FORCE_ACCURATE
#include "sample.h" #include "../common/sample.h"
#include "parse.h" #include "parse.h"
#ifndef PORTABLE_API #ifndef PORTABLE_API
#include "lfs_wrap.h" #include "lfs_wrap.h"
#endif #endif
#include "debug.h" #include "../common/debug.h"
#define SEEKFRAME(mh) ((mh)->ignoreframe < 0 ? 0 : (mh)->ignoreframe) #define SEEKFRAME(mh) ((mh)->ignoreframe < 0 ? 0 : (mh)->ignoreframe)
@ -648,9 +648,10 @@ int attribute_align_arg mpg123_open_handle(mpg123_handle *mh, void *iohandle)
#ifndef PORTABLE_API #ifndef PORTABLE_API
ret = INT123_wrap_open( mh, iohandle, NULL, -1 ret = INT123_wrap_open( mh, iohandle, NULL, -1
, mh->p.timeout, mh->p.flags & MPG123_QUIET ); , mh->p.timeout, mh->p.flags & MPG123_QUIET );
iohandle = ret == LFS_WRAP_NONE ? iohandle : mh->wrapperdata;
if(ret >= 0) if(ret >= 0)
#endif #endif
ret = INT123_open_stream_handle(mh, ret == LFS_WRAP_NONE ? iohandle : mh->wrapperdata); ret = INT123_open_stream_handle(mh, iohandle);
return ret; return ret;
} }
@ -911,7 +912,8 @@ static void decode_the_frame(mpg123_handle *fr)
if(fr->buffer.fill < needed_bytes) if(fr->buffer.fill < needed_bytes)
{ {
if(VERBOSE2) if(VERBOSE2)
fprintf(stderr, "Note: broken frame %li, filling up with %"SIZE_P" zeroes, from %"SIZE_P"\n", (long)fr->num, (size_p)(needed_bytes-fr->buffer.fill), (size_p)fr->buffer.fill); fprintf( stderr, "Note: broken frame %li, filling up with %zu zeroes, from %zu\n"
, (long)fr->num, (needed_bytes-fr->buffer.fill), fr->buffer.fill );
/* /*
One could do a loop with individual samples instead... but zero is zero One could do a loop with individual samples instead... but zero is zero
@ -931,7 +933,7 @@ static void decode_the_frame(mpg123_handle *fr)
else else
{ {
if(NOQUIET) if(NOQUIET)
error2("I got _more_ bytes than expected (%"SIZE_P" / %"SIZE_P"), that should not be possible!", (size_p)fr->buffer.fill, (size_p)needed_bytes); error2("I got _more_ bytes than expected (%zu / %zu), that should not be possible!", fr->buffer.fill, needed_bytes);
} }
} }
#endif #endif

View file

@ -15,9 +15,9 @@
#include "config.h" /* Load this before _anything_ */ #include "config.h" /* Load this before _anything_ */
#include "abi_align.h" #include "../common/abi_align.h"
#include "compat.h" #include "../compat/compat.h"
// Only portable API plays a role in the library itself, outside of lfs_wrap.c. // 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. // Also, we need to ensure no suffix renaming for the primary implementations.
@ -230,12 +230,6 @@ static inline int32_t scale_rounded(int32_t x, int shift)
#endif #endif
#ifndef REAL_IS_FIXED
# if (defined SIZEOF_INT32_T) && (SIZEOF_INT32_T != 4)
# error "Bad 32bit types!!!"
# endif
#endif
#ifndef DOUBLE_TO_REAL #ifndef DOUBLE_TO_REAL
# define DOUBLE_TO_REAL(x) (real)(x) # define DOUBLE_TO_REAL(x) (real)(x)
#endif #endif
@ -284,7 +278,7 @@ static inline int32_t scale_rounded(int32_t x, int shift)
now: factor on minimum frame buffer size (which takes upsampling into account) */ now: factor on minimum frame buffer size (which takes upsampling into account) */
#define AUDIOBUFSIZE 2 #define AUDIOBUFSIZE 2
#include "true.h" #include "../common/true.h"
#define MAX_NAME_SIZE 81 #define MAX_NAME_SIZE 81
#define SBLIMIT 32 #define SBLIMIT 32

View file

@ -8,7 +8,7 @@
#define SAFE_NTOM /* Do not depend on int64_t*int64_t with big values still being in the range... */ #define SAFE_NTOM /* Do not depend on int64_t*int64_t with big values still being in the range... */
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "debug.h" #include "../common/debug.h"
int INT123_synth_ntom_set_step(mpg123_handle *fr) int INT123_synth_ntom_set_step(mpg123_handle *fr)
{ {

View file

@ -12,7 +12,7 @@
#define WANT_GETCPUFLAGS #define WANT_GETCPUFLAGS
#include "mpg123lib_intern.h" /* includes optimize.h */ #include "mpg123lib_intern.h" /* includes optimize.h */
#include "getcpuflags.h" #include "getcpuflags.h"
#include "debug.h" #include "../common/debug.h"
/* Ugly macros to build conditional synth function array values. */ /* Ugly macros to build conditional synth function array values. */
@ -160,8 +160,8 @@ static enum optdec sse_or_vintage(mpg123_handle *fr)
enum optdec type; enum optdec type;
type = sse_vintage; type = sse_vintage;
# ifdef OPT_SSE # ifdef OPT_SSE
# ifdef OPT_MULTI # ifdef OPT_THE_DCT36
if(fr->cpu_opts.the_dct36 == INT123_dct36_sse) if(INT123_dct36_match(fr, sse))
# endif # endif
type = sse; type = sse;
# endif # endif
@ -192,7 +192,7 @@ static int find_dectype(mpg123_handle *fr)
type = dreidnowext; type = dreidnowext;
# ifdef OPT_3DNOWEXT_VINTAGE # ifdef OPT_3DNOWEXT_VINTAGE
# ifdef OPT_MULTI # ifdef OPT_MULTI
if(fr->cpu_opts.the_dct36 == INT123_dct36_3dnowext) if(INT123_dct36_match(fr, dreidnowext_vintage))
# endif # endif
type = dreidnowext_vintage; type = dreidnowext_vintage;
# endif # endif
@ -210,7 +210,7 @@ static int find_dectype(mpg123_handle *fr)
type = dreidnow; type = dreidnow;
# ifdef OPT_3DNOW_VINTAGE # ifdef OPT_3DNOW_VINTAGE
# ifdef OPT_MULTI # ifdef OPT_MULTI
if(fr->cpu_opts.the_dct36 == INT123_dct36_3dnow) if(INT123_dct36_match(fr, dreidnow_vintage))
# endif # endif
type = dreidnow_vintage; type = dreidnow_vintage;
# endif # endif
@ -503,13 +503,6 @@ int INT123_frame_cpu_opt(mpg123_handle *fr, const char* cpu)
#endif #endif
fr->cpu_opts.type = nodec; fr->cpu_opts.type = nodec;
#ifdef OPT_MULTI
#ifndef NO_LAYER3
#if (defined OPT_3DNOW_VINTAGE || defined OPT_3DNOWEXT_VINTAGE || defined OPT_SSE || defined OPT_X86_64 || defined OPT_AVX || defined OPT_NEON || defined OPT_NEON64)
fr->cpu_opts.the_dct36 = INT123_dct36;
#endif
#endif
#endif
/* covers any i386+ cpu; they actually differ only in the INT123_synth_1to1 function, mostly... */ /* covers any i386+ cpu; they actually differ only in the INT123_synth_1to1 function, mostly... */
#ifdef OPT_X86 #ifdef OPT_X86
if(cpu_i586(fr->cpu_flags)) if(cpu_i586(fr->cpu_flags))
@ -523,11 +516,6 @@ int INT123_frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{ {
chosen = dn_sse; chosen = dn_sse;
fr->cpu_opts.type = sse; fr->cpu_opts.type = sse;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
/* if(cpu_fast_sse(fr->cpu_flags)) */ fr->cpu_opts.the_dct36 = INT123_dct36_sse;
# endif
#endif
# ifndef NO_16BIT # ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_sse; fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_sse;
# ifdef ACCURATE_ROUNDING # ifdef ACCURATE_ROUNDING
@ -590,11 +578,6 @@ int INT123_frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{ {
chosen = dn_dreidnowext_vintage; chosen = dn_dreidnowext_vintage;
fr->cpu_opts.type = dreidnowext_vintage; fr->cpu_opts.type = dreidnowext_vintage;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.the_dct36 = INT123_dct36_3dnowext;
# endif
#endif
# ifndef NO_16BIT # ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_3dnowext; fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_3dnowext;
# endif # endif
@ -619,11 +602,6 @@ int INT123_frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{ {
chosen = dn_dreidnow_vintage; chosen = dn_dreidnow_vintage;
fr->cpu_opts.type = dreidnow_vintage; fr->cpu_opts.type = dreidnow_vintage;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.the_dct36 = INT123_dct36_3dnow;
# endif
#endif
# ifndef NO_16BIT # ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_3dnow; fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_3dnow;
# endif # endif
@ -723,11 +701,6 @@ int INT123_frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{ {
chosen = "x86-64 (AVX)"; chosen = "x86-64 (AVX)";
fr->cpu_opts.type = avx; fr->cpu_opts.type = avx;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.the_dct36 = INT123_dct36_avx;
# endif
#endif
# ifndef NO_16BIT # ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_avx; fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_avx;
fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_avx; fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_avx;
@ -749,11 +722,6 @@ int INT123_frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{ {
chosen = "x86-64 (SSE)"; chosen = "x86-64 (SSE)";
fr->cpu_opts.type = x86_64; fr->cpu_opts.type = x86_64;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.the_dct36 = INT123_dct36_x86_64;
# endif
#endif
# ifndef NO_16BIT # ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_x86_64; fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_x86_64;
fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_x86_64; fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_x86_64;
@ -796,11 +764,6 @@ int INT123_frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{ {
chosen = dn_neon; chosen = dn_neon;
fr->cpu_opts.type = neon; fr->cpu_opts.type = neon;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.the_dct36 = INT123_dct36_neon;
# endif
#endif
# ifndef NO_16BIT # ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_neon; fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_neon;
fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_neon; fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_neon;
@ -834,11 +797,6 @@ int INT123_frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{ {
chosen = dn_neon64; chosen = dn_neon64;
fr->cpu_opts.type = neon64; fr->cpu_opts.type = neon64;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.the_dct36 = INT123_dct36_neon64;
# endif
#endif
# ifndef NO_16BIT # ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_neon64; fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_neon64;
fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_neon64; fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_neon64;
@ -897,6 +855,10 @@ int INT123_frame_cpu_opt(mpg123_handle *fr, const char* cpu)
# endif # endif
# endif # endif
#ifdef OPT_THE_DCT36
INT123_dct36_choose(fr);
#endif
#ifdef OPT_DITHER #ifdef OPT_DITHER
if(done && dithered) if(done && dithered)
{ {

View file

@ -364,19 +364,16 @@ extern const int INT123_costab_mmxsse[];
#endif #endif
#endif #endif
/*
Now come two blocks of standard definitions for multi-decoder mode and single-decoder mode.
Most stuff is so automatic that it's indeed generated by some inline shell script.
Remember to use these scripts when possible, instead of direct repetitive hacking.
*/
#ifdef OPT_MULTI #ifdef OPT_MULTI
# define defopt nodec # define defopt nodec
# ifndef NO_LAYER3
# if (defined OPT_3DNOW_VINTAGE || defined OPT_3DNOWEXT_VINTAGE || defined OPT_SSE || defined OPT_X86_64 || defined OPT_AVX || defined OPT_NEON || defined OPT_NEON64) # if (defined OPT_3DNOW_VINTAGE || defined OPT_3DNOWEXT_VINTAGE || defined OPT_SSE || defined OPT_X86_64 || defined OPT_AVX || defined OPT_NEON || defined OPT_NEON64)
# define OPT_THE_DCT36
# define opt_dct36(fr) ((fr)->cpu_opts.the_dct36) # define opt_dct36(fr) ((fr)->cpu_opts.the_dct36)
# endif # endif
# endif
#endif /* OPT_MULTI else */ #endif /* OPT_MULTI else */

View file

@ -30,7 +30,7 @@
#include "mpeghead.h" #include "mpeghead.h"
#include "debug.h" #include "../common/debug.h"
#define bsbufid(fr) (fr)->bsbuf==(fr)->bsspace[0] ? 0 : ((fr)->bsbuf==fr->bsspace[1] ? 1 : ( (fr)->bsbuf==(fr)->bsspace[0]+512 ? 2 : ((fr)->bsbuf==fr->bsspace[1]+512 ? 3 : -1) ) ) #define bsbufid(fr) (fr)->bsbuf==(fr)->bsspace[0] ? 0 : ((fr)->bsbuf==fr->bsspace[1] ? 1 : ( (fr)->bsbuf==(fr)->bsspace[0]+512 ? 2 : ((fr)->bsbuf==fr->bsspace[1]+512 ? 3 : -1) ) )

View file

@ -11,7 +11,7 @@
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "debug.h" #include "../common/debug.h"
static int stream_init(mpg123_handle *fr); static int stream_init(mpg123_handle *fr);
static int64_t get_fileinfo(mpg123_handle *); static int64_t get_fileinfo(mpg123_handle *);
@ -526,7 +526,7 @@ static struct buffy* bc_alloc(struct bufferchain *bc, size_t size)
buf->next = NULL; /* That shall be set to a sensible value later. */ buf->next = NULL; /* That shall be set to a sensible value later. */
buf->size = 0; buf->size = 0;
--bc->pool_fill; --bc->pool_fill;
debug2("bc_alloc: picked %p from pool (fill now %"SIZE_P")", (void*)buf, (size_p)bc->pool_fill); debug2("bc_alloc: picked %p from pool (fill now %zu)", (void*)buf, bc->pool_fill);
return buf; return buf;
} }
else return buffy_new(size, bc->bufblock); else return buffy_new(size, bc->bufblock);

View file

@ -10,9 +10,9 @@
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "config.h" #include "config.h"
#include "mpg123.h" #include "mpg123.h"
#include "compat.h" #include "../compat/compat.h"
#include <string.h> #include <string.h>
#include "debug.h" #include "../common/debug.h"
mpg123_string* attribute_align_arg mpg123_new_string(const char *val) mpg123_string* attribute_align_arg mpg123_new_string(const char *val)
{ {

View file

@ -10,8 +10,8 @@
#ifdef OPT_GENERIC_DITHER #ifdef OPT_GENERIC_DITHER
#define FORCE_ACCURATE #define FORCE_ACCURATE
#endif #endif
#include "sample.h" #include "../common/sample.h"
#include "debug.h" #include "../common/debug.h"
/* /*
Part 1: All synth functions that produce signed short. Part 1: All synth functions that produce signed short.

View file

@ -7,8 +7,8 @@
*/ */
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "sample.h" #include "../common/sample.h"
#include "debug.h" #include "../common/debug.h"
/* /*
Part 2: All synth functions that produce 8bit output. Part 2: All synth functions that produce 8bit output.

View file

@ -7,8 +7,8 @@
*/ */
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "sample.h" #include "../common/sample.h"
#include "debug.h" #include "../common/debug.h"
#ifdef REAL_IS_FIXED #ifdef REAL_IS_FIXED
#error "Do not build this file with fixed point math!" #error "Do not build this file with fixed point math!"

View file

@ -7,8 +7,8 @@
*/ */
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "sample.h" #include "../common/sample.h"
#include "debug.h" #include "../common/debug.h"
#ifdef REAL_IS_FIXED #ifdef REAL_IS_FIXED
#error "Do not build this file with fixed point math!" #error "Do not build this file with fixed point math!"

View file

@ -7,7 +7,7 @@
*/ */
#include "mpg123lib_intern.h" #include "mpg123lib_intern.h"
#include "debug.h" #include "../common/debug.h"
// The (normally precomputed) cos tables. // The (normally precomputed) cos tables.
#include "costabs.h" #include "costabs.h"

View file

@ -16,7 +16,7 @@
// only single spaces as separator to ease parsing by build scripts // only single spaces as separator to ease parsing by build scripts
#define MPG123_MAJOR 1 #define MPG123_MAJOR 1
#define MPG123_MINOR 32 #define MPG123_MINOR 32
#define MPG123_PATCH 2 #define MPG123_PATCH 5
// Don't get too wild with that to avoid confusing m4. No brackets. // 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. // Also, it should fit well into a sane file name for the tarball.
#define MPG123_SUFFIX "" #define MPG123_SUFFIX ""