mpg123-1.32.6

This commit is contained in:
Ozkan Sezer
2024-04-18 23:56:32 +03:00
parent 73caa15ce9
commit 304bf5b276
18 changed files with 130 additions and 23 deletions

View File

@@ -37,6 +37,9 @@
/* Define if FIFO support is enabled. */
#undef FIFO
/* System setup enforces 64 bit offsets where 32 bit would be native. */
#undef FORCED_OFF_64
/* Define if frame index should be used. */
#undef FRAME_INDEX

View File

@@ -6,6 +6,9 @@
initially written by Shane Wegner
*/
// Just to trigger recompilation on reconfigure (with differing --host).
#include "config.h"
char *genre_table[] =
{
"Blues",

View File

@@ -25,7 +25,7 @@
// Only activate the explicit largefile stuff here. The rest of the code shall
// work with abstract 64 bit offsets, or just plain default off_t (possibly
// using _FILE_OFFSET_BYTES magic).
// using _FILE_OFFSET_BITS magic).
// Note that this macro does not influence normal off_t-using code.
#ifdef LFS_LARGEFILE_64
#define _LARGEFILE64_SOURCE
@@ -208,10 +208,13 @@ static struct wrap_data* wrap_get(mpg123_handle *mh, int force_alloc)
/* After settling the data... start with some simple wrappers. */
// The fist block of wrappers is always present, using the native off_t width.
// (Exception: If explicitly disabled using FORCED_OFF_64.)
// A second block mirrors that in case of sizeof(off_t)==4 with _32 suffix.
// A third block follows if 64 bit off_t is available with _64 suffix, just aliasing
// the int64_t functions.
#ifndef FORCED_OFF_64
#define OFF_CONV(value, variable, handle) \
if((value) >= OFF_MIN && (value) <= OFF_MAX) \
variable = (off_t)(value); \
@@ -399,6 +402,8 @@ int attribute_align_arg mpg123_position( mpg123_handle *mh, off_t INT123_frame_o
return MPG123_OK;
}
#endif // FORCED_OFF_64
// _32 aliases only for native 32 bit off_t
// Will compilers be smart enough to optimize away the extra function call?
#if SIZEOF_OFF_T == 4
@@ -523,6 +528,10 @@ int attribute_align_arg mpg123_position_32( mpg123_handle *mh, off_t INT123_fram
#define OFF64 off_t
#endif
#ifndef FORCED_OFF_64
// When 64 bit offsets are enforced, libmpg123.c defines the _64 functions directly.
// There is no actual wrapper work, anyway.
int attribute_align_arg mpg123_open_64(mpg123_handle *mh, const char *path)
{
return mpg123_open(mh, path);
@@ -543,6 +552,8 @@ int attribute_align_arg mpg123_open_handle_64(mpg123_handle *mh, void *iohandle)
{
return mpg123_open_handle(mh, iohandle);
}
#endif
int attribute_align_arg mpg123_framebyframe_decode_64(mpg123_handle *mh, OFF64 *num, unsigned char **audio, size_t *bytes)
{
@@ -860,6 +871,13 @@ static mpg123_ssize_t fallback_read(int fd, void *buf, size_t count)
return read(fd, buf, count);
}
// In forced 64 bit offset mode, the only definitions of these are
// the _64 ones.
#ifdef FORCED_OFF_64
#define mpg123_replace_reader mpg123_replace_reader_64
#define mpg123_replace_reader_handle mpg123_replace_reader_handle_64
#endif
/* Reader replacement prepares the hidden handle storage for next mpg123_open_fd() or plain mpg123_open(). */
int attribute_align_arg mpg123_replace_reader(mpg123_handle *mh, mpg123_ssize_t (*r_read) (int, void *, size_t), off_t (*r_lseek)(int, off_t, int) )
{
@@ -978,6 +996,8 @@ int attribute_align_arg mpg123_replace_reader_handle_64(mpg123_handle *mh, mpg12
#elif SIZEOF_OFF_T == 8
// If 64 bit off_t is enforced, libmpg123.c already defines the _64 functions.
#ifndef FORCED_OFF_64
int attribute_align_arg mpg123_replace_reader_64(mpg123_handle *mh, mpg123_ssize_t (*r_read) (int, void *, size_t), off_t (*r_lseek)(int, off_t, int) )
{
return mpg123_replace_reader(mh, r_read, r_lseek);
@@ -987,5 +1007,6 @@ int attribute_align_arg mpg123_replace_reader_handle_64(mpg123_handle *mh, mpg12
{
return mpg123_replace_reader_handle(mh, r_read, r_lseek, cleanup);
}
#endif
#endif

View File

@@ -560,6 +560,15 @@ double attribute_align_arg mpg123_geteq2(mpg123_handle *mh, int channel, int ban
}
#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)
{
@@ -579,7 +588,9 @@ int attribute_align_arg mpg123_open(mpg123_handle *mh, const char *path)
// 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.
int INT123_open_fixed_pre(mpg123_handle *mh, int channels, int encoding)
// Update: The open routines are just alias calls now, since the conversion to
// int64_t internally.
static int INT123_open_fixed_pre(mpg123_handle *mh, int channels, int encoding)
{
if(!mh)
return MPG123_BAD_HANDLE;
@@ -590,7 +601,7 @@ int INT123_open_fixed_pre(mpg123_handle *mh, int channels, int encoding)
return err;
}
int INT123_open_fixed_post(mpg123_handle *mh, int channels, int encoding)
static int INT123_open_fixed_post(mpg123_handle *mh, int channels, int encoding)
{
if(!mh)
return MPG123_BAD_HANDLE;
@@ -637,7 +648,7 @@ int attribute_align_arg mpg123_open_fd(mpg123_handle *mh, int fd)
ret = INT123_open_stream_handle(mh, mh->wrapperdata);
return ret;
}
#endif
#endif // PORTABLE_API
int attribute_align_arg mpg123_open_handle(mpg123_handle *mh, void *iohandle)
{

View File

@@ -323,9 +323,6 @@ int64_t INT123_outblock_bytes(mpg123_handle *fr, int64_t s);
/* Postprocessing format conversion of freshly decoded buffer. */
void INT123_postprocess_buffer(mpg123_handle *fr);
int INT123_open_fixed_pre(mpg123_handle *mh, int channels, int encoding);
int INT123_open_fixed_post(mpg123_handle *mh, int channels, int encoding);
/* If networking is enabled and we really mean internal networking, the timeout_read function is available. */
#if defined (NETWORK) && !defined (WANT_WIN32_SOCKETS)
/* Does not work with win32 */

View File

@@ -2038,8 +2038,10 @@ type attribute_align_arg name(long inrate, long outrate, type io) \
}
#if SIZEOF_OFF_T == 8
#ifndef FORCED_OFF_64
resample_total_alias(off_t, syn123_resample_total, syn123_resample_total64)
resample_total_alias(off_t, syn123_resample_intotal, syn123_resample_intotal64)
#endif
resample_total_alias(off_t, syn123_resample_total_64, syn123_resample_total64)
resample_total_alias(off_t, syn123_resample_intotal_64, syn123_resample_intotal64)
#elif SIZEOF_OFF_T == 4

View File

@@ -1,5 +1,6 @@
/* Just printing out ID3 tags with plain data from libmpg123 and explicitly called conversion routine. */
#include "config.h"
#include "../compat/compat.h"
#include <mpg123.h>
#include "../common/debug.h"

View File

@@ -3,10 +3,12 @@
//#define _FILE_OFFSET_BITS 64
//#define _FILE_OFFSET_BITS 32
#define SYN123_PORTABLE_API
#include "config.h"
#include <syn123.h>
#include <inttypes.h>
#ifdef SYN123_PORTABLE_API
typedef int64_t synoff;
typedef int64_t synprint;

View File

@@ -8,6 +8,7 @@
arguments: decoder preframes testfile.mpeg
*/
#include "config.h"
#include <mpg123.h>
#include <stdio.h>
#include <fcntl.h>

View File

@@ -1,3 +1,4 @@
#include "config.h"
#include "../compat/compat.h"
#include <mpg123.h>
#include "../common/debug.h"

View File

@@ -1,3 +1,4 @@
#include "config.h"
#define SYN123_PORTABLE_API
#include <syn123.h>
#include <out123.h>

View File

@@ -8,6 +8,7 @@
arguments: decoder testfile.mpeg
*/
#include "config.h"
#include <mpg123.h>
#include "../compat/compat.h"

View File

@@ -1,3 +1,4 @@
#include "config.h"
#include "syn123.h"
#include <math.h>
#include <stdio.h>

View File

@@ -16,7 +16,7 @@
// only single spaces as separator to ease parsing by build scripts
#define MPG123_MAJOR 1
#define MPG123_MINOR 32
#define MPG123_PATCH 5
#define MPG123_PATCH 6
// 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 ""