mpg123-1.31.3

This commit is contained in:
Ozkan Sezer
2023-03-21 14:40:24 +03:00
parent ca2c1da3f4
commit 89d671ef14
20 changed files with 136 additions and 84 deletions

14
NEWS
View File

@@ -1,3 +1,17 @@
1.31.3
------
- build:
-- Fix --disable-8bit.
-- Fall back to generic decoder if no yasm for MSVC (bug 346).
-- Fix some pedantic compiler warnings, avoid breaking libtool wrappers.
- mpg123:
-- Fix verbose position printout for new resampling outside libmpg123 (where
output rate differs from decoding rate).
- libsyn123:
-- Fix reconfiguration of resampler to avoid double free when reducing
decimator stages to zero (bug 350). Thanks to Youngseok Choi for reporting
this fuzzed issue.
1.31.2 1.31.2
------ ------
- Fix build --with-network=internal only (configure logic error, bug 348). - Fix build --with-network=internal only (configure logic error, bug 348).

24
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for mpg123 1.31.2. # Generated by GNU Autoconf 2.69 for mpg123 1.31.3.
# #
# Report bugs to <maintainer@mpg123.org>. # Report bugs to <maintainer@mpg123.org>.
# #
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='mpg123' PACKAGE_NAME='mpg123'
PACKAGE_TARNAME='mpg123' PACKAGE_TARNAME='mpg123'
PACKAGE_VERSION='1.31.2' PACKAGE_VERSION='1.31.3'
PACKAGE_STRING='mpg123 1.31.2' PACKAGE_STRING='mpg123 1.31.3'
PACKAGE_BUGREPORT='maintainer@mpg123.org' PACKAGE_BUGREPORT='maintainer@mpg123.org'
PACKAGE_URL='' PACKAGE_URL=''
@@ -1687,7 +1687,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # 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. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures mpg123 1.31.2 to adapt to many kinds of systems. \`configure' configures mpg123 1.31.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1758,7 +1758,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of mpg123 1.31.2:";; short | recursive ) echo "Configuration of mpg123 1.31.3:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@@ -1999,7 +1999,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
mpg123 configure 1.31.2 mpg123 configure 1.31.3
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2605,7 +2605,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by mpg123 $as_me 1.31.2, which was It was created by mpg123 $as_me 1.31.3, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
@@ -2961,7 +2961,7 @@ OUTAPI_VERSION=4
OUTLIB_PATCHLEVEL=7 OUTLIB_PATCHLEVEL=7
SYNAPI_VERSION=1 SYNAPI_VERSION=1
SYNLIB_PATCHLEVEL=4 SYNLIB_PATCHLEVEL=5
LIBMPG123_VERSION=$API_VERSION:$LIB_PATCHLEVEL:$API_VERSION LIBMPG123_VERSION=$API_VERSION:$LIB_PATCHLEVEL:$API_VERSION
LIBOUT123_VERSION=$OUTAPI_VERSION:$OUTLIB_PATCHLEVEL:$OUTAPI_VERSION LIBOUT123_VERSION=$OUTAPI_VERSION:$OUTLIB_PATCHLEVEL:$OUTAPI_VERSION
@@ -3564,7 +3564,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='mpg123' PACKAGE='mpg123'
VERSION='1.31.2' VERSION='1.31.3'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@@ -15069,7 +15069,7 @@ $as_echo "#define NO_8BIT 1" >>confdefs.h
fi fi
if test "x$int16" = "xenabled"; then if test "x$int8" = "xenabled"; then
HAVE_SYNTH8_TRUE= HAVE_SYNTH8_TRUE=
HAVE_SYNTH8_FALSE='#' HAVE_SYNTH8_FALSE='#'
else else
@@ -20754,7 +20754,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by mpg123 $as_me 1.31.2, which was This file was extended by mpg123 $as_me 1.31.3, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@@ -20820,7 +20820,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
mpg123 config.status 1.31.2 mpg123 config.status 1.31.3
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View File

@@ -9,7 +9,7 @@ dnl 2.69 at least.
AC_PREREQ([2.69]) AC_PREREQ([2.69])
dnl ############# Initialisation dnl ############# Initialisation
AC_INIT([mpg123], [1.31.2], [maintainer@mpg123.org]) AC_INIT([mpg123], [1.31.3], [maintainer@mpg123.org])
dnl Increment API_VERSION when the API gets changes (new functions). dnl Increment API_VERSION when the API gets changes (new functions).
dnl libmpg123 dnl libmpg123
@@ -22,7 +22,7 @@ OUTLIB_PATCHLEVEL=7
dnl libsyn123 dnl libsyn123
SYNAPI_VERSION=1 SYNAPI_VERSION=1
SYNLIB_PATCHLEVEL=4 SYNLIB_PATCHLEVEL=5
dnl Since we want to be backwards compatible, both sides get set to API_VERSION. dnl Since we want to be backwards compatible, both sides get set to API_VERSION.
LIBMPG123_VERSION=$API_VERSION:$LIB_PATCHLEVEL:$API_VERSION LIBMPG123_VERSION=$API_VERSION:$LIB_PATCHLEVEL:$API_VERSION
@@ -900,7 +900,7 @@ if test "x$int8" = "xdisabled"; then
AC_DEFINE(NO_8BIT, 1, [ Define to disable 8 bit integer output. ]) AC_DEFINE(NO_8BIT, 1, [ Define to disable 8 bit integer output. ])
fi fi
AM_CONDITIONAL([HAVE_SYNTH8], [test "x$int16" = "xenabled"]) AM_CONDITIONAL([HAVE_SYNTH8], [test "x$int8" = "xenabled"])
if test "x$int32" = "xdisabled"; then if test "x$int32" = "xdisabled"; then
AC_DEFINE(NO_32BIT, 1, [ Define to disable 32 bit and 24 bit integer output. ]) AC_DEFINE(NO_32BIT, 1, [ Define to disable 32 bit and 24 bit integer output. ])

View File

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

View File

@@ -71,6 +71,19 @@ add_library(${TARGET}
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<BOOL:${LFS_SENSITIVE}>:lfs_wrap.c>" "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/$<$<BOOL:${LFS_SENSITIVE}>:lfs_wrap.c>"
$<TARGET_OBJECTS:compat>) $<TARGET_OBJECTS:compat>)
if(MSVC)
if(MACHINE MATCHES "x86|amd64")
find_program(YASM_ASSEMBLER yasm)
if(NOT YASM_ASSEMBLER)
message(WARNING "Couldn't find yasm assembler for optimizded decoders. Please set YASM_ASSEMBLER variable")
set(MACHINE generic)
endif()
else()
message(WARNING "Need work to support non-x86 assembly optimizations with MSVC.")
set(MACHINE generic)
endif()
endif()
if(MACHINE STREQUAL "amd64") if(MACHINE STREQUAL "amd64")
if(HAVE_FPU) if(HAVE_FPU)
set(PLATFORM_DEFINITIONS OPT_MULTI OPT_X86_64 OPT_AVX OPT_GENERIC OPT_GENERIC_DITHER) set(PLATFORM_DEFINITIONS OPT_MULTI OPT_X86_64 OPT_AVX OPT_GENERIC OPT_GENERIC_DITHER)
@@ -135,10 +148,6 @@ elseif(MACHINE STREQUAL "x86")
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/dct64_i386.c") "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/dct64_i386.c")
endif() endif()
elseif(MACHINE STREQUAL "arm64") elseif(MACHINE STREQUAL "arm64")
if(MSVC)
set(PLATFORM_DEFINITIONS OPT_GENERIC)
message(WARNING "Cannot use platform-specific assembly sources on MSVC")
else()
set(PLATFORM_DEFINITIONS OPT_MULTI OPT_GENERIC OPT_GENERIC_DITHER OPT_NEON64) set(PLATFORM_DEFINITIONS OPT_MULTI OPT_GENERIC OPT_GENERIC_DITHER OPT_NEON64)
set(PLATFORM_SOURCES set(PLATFORM_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/dct36_neon64.S" "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/dct36_neon64.S"
@@ -160,13 +169,8 @@ elseif(MACHINE STREQUAL "arm64")
target_sources(${TARGET} PRIVATE target_sources(${TARGET} PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/dither.c" "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/dither.c"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/getcpuflags_arm.c") "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/getcpuflags_arm.c")
endif()
elseif(MACHINE STREQUAL "arm32") elseif(MACHINE STREQUAL "arm32")
if(HAVE_FPU) if(HAVE_FPU)
if(MSVC)
set(PLATFORM_DEFINITIONS OPT_GENERIC)
message(WARNING "Cannot use platform-specific assembly sources on MSVC")
else()
set(PLATFORM_DEFINITIONS OPT_MULTI OPT_GENERIC OPT_GENERIC_DITHER OPT_NEON) set(PLATFORM_DEFINITIONS OPT_MULTI OPT_GENERIC OPT_GENERIC_DITHER OPT_NEON)
set(PLATFORM_SOURCES set(PLATFORM_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/dct36_neon.S" "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/dct36_neon.S"
@@ -191,12 +195,7 @@ elseif(MACHINE STREQUAL "arm32")
target_sources(${TARGET} PRIVATE ${PLATFORM_SOURCES}) target_sources(${TARGET} PRIVATE ${PLATFORM_SOURCES})
target_sources(${TARGET} PRIVATE target_sources(${TARGET} PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/dither.c") "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/dither.c")
endif()
else() else()
if(MSVC)
set(PLATFORM_DEFINITIONS OPT_GENERIC)
message(WARNING "Cannot use platform-specific assembly sources on MSVC")
else()
set(PLATFORM_DEFINITIONS OPT_ARM) set(PLATFORM_DEFINITIONS OPT_ARM)
if(ACCURATE_ROUNDING) if(ACCURATE_ROUNDING)
set(PLATFORM_SOURCES set(PLATFORM_SOURCES
@@ -206,7 +205,6 @@ elseif(MACHINE STREQUAL "arm32")
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/synth_arm.S") "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/synth_arm.S")
endif() endif()
target_sources(${TARGET} PRIVATE ${PLATFORM_SOURCES}) target_sources(${TARGET} PRIVATE ${PLATFORM_SOURCES})
endif()
endif() endif()
elseif(MACHINE STREQUAL "generic") elseif(MACHINE STREQUAL "generic")
set(PLATFORM_DEFINITIONS OPT_GENERIC) set(PLATFORM_DEFINITIONS OPT_GENERIC)
@@ -222,11 +220,7 @@ target_compile_definitions(${TARGET} PRIVATE
$<$<BOOL:${HAVE_FPU}>:REAL_IS_FLOAT> $<$<BOOL:${HAVE_FPU}>:REAL_IS_FLOAT>
$<$<NOT:$<BOOL:${HAVE_FPU}>>:REAL_IS_FIXED>) $<$<NOT:$<BOOL:${HAVE_FPU}>>:REAL_IS_FIXED>)
if(MSVC AND MACHINE MATCHES "x86|amd64") if(MSVC AND MACHINE MATCHES "x86|amd64" AND YASM_ASSEMBLER)
find_program(YASM_ASSEMBLER yasm)
if(NOT YASM_ASSEMBLER)
message(FATAL_ERROR "Couldn't find yasm assembler. Please set YASM_ASSEMBLER variable")
endif()
list(TRANSFORM PLATFORM_DEFINITIONS PREPEND /D) list(TRANSFORM PLATFORM_DEFINITIONS PREPEND /D)
foreach(FILE ${PLATFORM_SOURCES}) foreach(FILE ${PLATFORM_SOURCES})
get_filename_component(FILENAME ${FILE} NAME) get_filename_component(FILENAME ${FILE} NAME)

View File

@@ -171,14 +171,15 @@ void print_stat(mpg123_handle *fr, long offset, out123_handle *ao, int draw_bar
static int old_term_width = -1; static int old_term_width = -1;
size_t buffered; size_t buffered;
off_t decoded; off_t decoded;
off_t elapsed; double elapsed;
off_t remain; double remain;
off_t length; double length;
off_t frame; off_t frame;
off_t frames; off_t frames;
off_t rframes; off_t rframes;
int spf; int spf;
double basevol, realvol; double basevol, realvol;
long inrate;
long rate; long rate;
int framesize; int framesize;
struct mpg123_frameinfo mi; struct mpg123_frameinfo mi;
@@ -186,7 +187,7 @@ void print_stat(mpg123_handle *fr, long offset, out123_handle *ao, int draw_bar
char *line = NULL; char *line = NULL;
#ifndef __OS2__ #ifndef __OS2__
#ifndef WIN32 #ifndef _WIN32
#ifndef GENERIC #ifndef GENERIC
/* Only generate new stat line when stderr is ready... don't overfill... */ /* Only generate new stat line when stderr is ready... don't overfill... */
{ {
@@ -204,11 +205,13 @@ void print_stat(mpg123_handle *fr, long offset, out123_handle *ao, int draw_bar
#endif #endif
#endif #endif
#endif #endif
if(mpg123_getformat(fr, &inrate, NULL, NULL))
return;
if(out123_getformat(ao, &rate, NULL, NULL, &framesize)) if(out123_getformat(ao, &rate, NULL, NULL, &framesize))
return; return;
buffered = out123_buffered(ao)/framesize; buffered = out123_buffered(ao)/framesize;
decoded = mpg123_tell(fr); decoded = mpg123_tell(fr);
length = mpg123_length(fr); length = (double)mpg123_length(fr)/inrate;
frame = mpg123_tellframe(fr); frame = mpg123_tellframe(fr);
frames = mpg123_framelength(fr); frames = mpg123_framelength(fr);
spf = mpg123_spf(fr); spf = mpg123_spf(fr);
@@ -222,7 +225,7 @@ void print_stat(mpg123_handle *fr, long offset, out123_handle *ao, int draw_bar
Buffering makes the relationships between the numbers non-trivial. */ Buffering makes the relationships between the numbers non-trivial. */
rframes = frames-frame; rframes = frames-frame;
// May be negative, a countdown. Buffer only confuses in paused (looping) mode, though. // May be negative, a countdown. Buffer only confuses in paused (looping) mode, though.
elapsed = decoded + offset*spf - (paused ? 0 : buffered); elapsed = (double)(decoded + offset*spf)/inrate - (double)(paused ? 0 : buffered)/rate;
remain = elapsed > 0 ? length - elapsed : length; remain = elapsed > 0 ? length - elapsed : length;
if( MPG123_OK == mpg123_info(fr, &mi) if( MPG123_OK == mpg123_info(fr, &mi)
&& MPG123_OK == mpg123_getvolume(fr, &basevol, &realvol, NULL) ) && MPG123_OK == mpg123_getvolume(fr, &basevol, &realvol, NULL) )
@@ -263,8 +266,8 @@ void print_stat(mpg123_handle *fr, long offset, out123_handle *ao, int draw_bar
? malloc(linelen+1) /* Only malloc if it is a really long line. */ ? malloc(linelen+1) /* Only malloc if it is a really long line. */
: linebuf; /* Small buffer on stack is enough. */ : linebuf; /* Small buffer on stack is enough. */
tim[0] = (double)elapsed/rate; tim[0] = elapsed;
tim[1] = (double)remain/rate; tim[1] = remain;
tim[2] = (double)buffered/rate; tim[2] = (double)buffered/rate;
for(ti=0; ti<3; ++ti) for(ti=0; ti<3; ++ti)
{ {

View File

@@ -179,6 +179,10 @@ void compat_binmode(int fd, int enable)
it late to some official APIs, that's still fine with us. it late to some official APIs, that's still fine with us.
*/ */
#ifdef WANT_WIN32_UNICODE
typedef HRESULT (__stdcall *PCA_ptr)( const wchar_t *, const wchar_t*, unsigned long, wchar_t **);
#endif
char* compat_catpath(const char *prefix, const char* path) char* compat_catpath(const char *prefix, const char* path)
{ {
char *ret = NULL; char *ret = NULL;
@@ -193,8 +197,7 @@ char* compat_catpath(const char *prefix, const char* path)
ThOr: I presume this hack is for supporting pre-8 Windows, as ThOr: I presume this hack is for supporting pre-8 Windows, as
from Windows 8 on, this is documented in the API. from Windows 8 on, this is documented in the API.
*/ */
HRESULT (__stdcall *mypac)( const wchar_t *in, const wchar_t* more PCA_ptr mypac = NULL;
, unsigned long flags, wchar_t **out ) = NULL;
HMODULE pathcch = NULL; HMODULE pathcch = NULL;
if(!prefix && !path) if(!prefix && !path)
@@ -207,7 +210,7 @@ char* compat_catpath(const char *prefix, const char* path)
/* Again: I presume this whole fun is to get at PathAllocCombine /* Again: I presume this whole fun is to get at PathAllocCombine
even when pathcch.h is not available (like in MinGW32). */ even when pathcch.h is not available (like in MinGW32). */
if( (pathcch = GetModuleHandleA("kernelbase")) ) if( (pathcch = GetModuleHandleA("kernelbase")) )
mypac = (void *)GetProcAddress(pathcch, "PathAllocCombine"); mypac = (PCA_ptr) GetProcAddress(pathcch, "PathAllocCombine");
if(mypac) /* PATHCCH_ALLOW_LONG_PATH = 1 per API docs */ if(mypac) /* PATHCCH_ALLOW_LONG_PATH = 1 per API docs */
{ {
debug("Actually calling PathAllocCombine!"); debug("Actually calling PathAllocCombine!");

View File

@@ -12,6 +12,8 @@
#include "config.h" #include "config.h"
/* This source file does need _POSIX_SOURCE to get some sigaction. */ /* This source file does need _POSIX_SOURCE to get some sigaction. */
#define _POSIX_SOURCE #define _POSIX_SOURCE
/* Fix pedantic error about w2upath being unused */
#define HIDE_w2upath
#include "compat.h" #include "compat.h"
#ifdef _MSC_VER #ifdef _MSC_VER
@@ -87,7 +89,7 @@ void *compat_dlsym(void *handle, const char *name)
if(!handle) if(!handle)
return NULL; return NULL;
#ifdef WANT_WIN32_UNICODE #ifdef WANT_WIN32_UNICODE
sym = GetProcAddress(handle, name); sym = (void *)(uintptr_t)GetProcAddress(handle, name);
#else #else
sym = dlsym(handle, name); sym = dlsym(handle, name);
#endif #endif

View File

@@ -26,6 +26,7 @@ static wchar_t* u2wpath(const char *upath)
return wpath; return wpath;
} }
#ifndef HIDE_w2upath
/* Convert Windows wide character paths to unix UTF-8. */ /* Convert Windows wide character paths to unix UTF-8. */
static char* w2upath(const wchar_t *wpath) static char* w2upath(const wchar_t *wpath)
{ {
@@ -37,6 +38,7 @@ static char* w2upath(const wchar_t *wpath)
*p = '/'; *p = '/';
return upath; return upath;
} }
#endif
/* An absolute path that is too long and not already marked with /* An absolute path that is too long and not already marked with
\\?\ can be marked as a long one and still work. */ \\?\ can be marked as a long one and still work. */

View File

@@ -26,7 +26,7 @@
#include "out123.h" #include "out123.h"
#include <stdarg.h> #include <stdarg.h>
#include <ctype.h> #include <ctype.h>
#if !defined (WIN32) || defined (__CYGWIN__) #if !defined (_WIN32) || defined (__CYGWIN__)
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
@@ -397,7 +397,7 @@ int control_generic (mpg123_handle *fr)
outstream = stdout; outstream = stdout;
out_is_term = stdout_is_term; out_is_term = stdout_is_term;
} }
#ifndef WIN32 #ifndef _WIN32
setlinebuf(outstream); setlinebuf(outstream);
#else /* perhaps just use setvbuf as it's C89 */ #else /* perhaps just use setvbuf as it's C89 */
/* /*

View File

@@ -499,7 +499,10 @@ static unsigned char pretab_choice[2][22] =
static int III_dequantize_sample(mpg123_handle *fr, real xr[SBLIMIT][SSLIMIT],int *scf, struct gr_info_s *gr_info,int sfreq,int part2bits) static int III_dequantize_sample(mpg123_handle *fr, real xr[SBLIMIT][SSLIMIT],int *scf, struct gr_info_s *gr_info,int sfreq,int part2bits)
{ {
int shift = 1 + gr_info->scalefac_scale; int shift = 1 + gr_info->scalefac_scale;
real *xrpnt = (real *) xr; // Pointer cast to make pedantic compilers happy.
real *xrpnt = (real*)xr;
// Some compiler freaks out over &xr[SBLIMIT][0], which is the same.
real *xrpntlimit = (real*)xr+SBLIMIT*SSLIMIT;
int l[3],l3; int l[3],l3;
int part2remain = gr_info->part2_3_length - part2bits; int part2remain = gr_info->part2_3_length - part2bits;
const short *me; const short *me;
@@ -552,10 +555,10 @@ static int III_dequantize_sample(mpg123_handle *fr, real xr[SBLIMIT][SSLIMIT],in
} }
} }
#define CHECK_XRPNT if(xrpnt >= &xr[SBLIMIT][0]) \ #define CHECK_XRPNT if(xrpnt >= xrpntlimit) \
{ \ { \
if(NOQUIET) \ if(NOQUIET) \
error2("attempted xrpnt overflow (%p !< %p)", (void*) xrpnt, (void*) &xr[SBLIMIT][0]); \ error2("attempted xrpnt overflow (%p !< %p)", (void*) xrpnt, (void*) xrpntlimit); \
return 1; \ return 1; \
} }
@@ -992,7 +995,7 @@ static int III_dequantize_sample(mpg123_handle *fr, real xr[SBLIMIT][SSLIMIT],in
gr_info->maxb = 1; gr_info->maxb = 1;
} }
while(xrpnt < &xr[SBLIMIT][0]) while(xrpnt < xrpntlimit)
*xrpnt++ = DOUBLE_TO_REAL(0.0); *xrpnt++ = DOUBLE_TO_REAL(0.0);
while( part2remain > 16 ) while( part2remain > 16 )

View File

@@ -169,11 +169,10 @@ static void wait_for_buffer(WAVEHDR* hdr, HANDLE hEvent)
static int get_formats_win32(out123_handle *ao) static int get_formats_win32(out123_handle *ao)
{ {
WAVEOUTCAPSA caps; WAVEOUTCAPSA caps;
MMRESULT mr;
int ret = 0; int ret = 0;
UINT dev_id = dev_select(ao); UINT dev_id = dev_select(ao);
mr = waveOutGetDevCaps(dev_id, &caps, sizeof(caps)); MMRESULT mr = waveOutGetDevCaps(dev_id, &caps, sizeof(caps));
if(mr != MMSYSERR_NOERROR) if(mr != MMSYSERR_NOERROR)
return 0; /* no formats? */ return 0; /* no formats? */
@@ -369,6 +368,21 @@ static int enumerate_win32( out123_handle *ao, int (*store_device)(void *devlist
memset(id, 0, sizeof(id)); memset(id, 0, sizeof(id));
memset(&caps, 0, sizeof(caps)); memset(&caps, 0, sizeof(caps));
mr = waveOutGetDevCaps(i, &caps, sizeof(caps)); mr = waveOutGetDevCaps(i, &caps, sizeof(caps));
if (mr != MMSYSERR_NOERROR) {
switch(mr) {
case MMSYSERR_BADDEVICEID:
error("enumerate_win32: Specified device identifier is out of range.");
break;
case MMSYSERR_NODRIVER:
error("enumerate_win32: No device driver is present.");
break;
case MMSYSERR_NOMEM:
error("enumerate_win32: Unable to allocate or lock memory.");
break;
default:
merror("enumerate_win32: Uknown error 0x%x.", mr);
}
}
mdebug("waveOutGetDevCaps mr %x", mr); mdebug("waveOutGetDevCaps mr %x", mr);
snprintf(id, sizeof(id) - 1, "%u", i); snprintf(id, sizeof(id) - 1, "%u", i);
store_device(devlist, id, caps.szPname); store_device(devlist, id, caps.szPname);

View File

@@ -518,7 +518,6 @@ static int close_win32(out123_handle *ao)
static int enumerate_win32( out123_handle *ao, int (*store_device)(void *devlist static int enumerate_win32( out123_handle *ao, int (*store_device)(void *devlist
, const char *name, const char *description), void *devlist ) , const char *name, const char *description), void *devlist )
{ {
int len;
char *pszID = NULL, *pszDesc = NULL; char *pszID = NULL, *pszDesc = NULL;
HRESULT hr = S_OK; HRESULT hr = S_OK;
UINT pcDevices = 0, i = 0; UINT pcDevices = 0, i = 0;
@@ -614,6 +613,7 @@ static int init_win32(out123_handle* ao){
ao->close = close_win32; ao->close = close_win32;
ao->userptr = NULL; ao->userptr = NULL;
ao->enumerate = enumerate_win32; ao->enumerate = enumerate_win32;
ao->deinit = deinit_win32;
/* Success */ /* Success */
return 0; return 0;

View File

@@ -2377,24 +2377,31 @@ syn123_setup_resample( syn123_handle *sh, long inrate, long outrate
} }
rd->stage_history = sth; rd->stage_history = sth;
} }
struct decimator_state *nd = safe_realloc( rd->decim if(decim_stages)
, sizeof(*rd->decim)*decim_stages );
struct lpf4_hist *ndh = safe_realloc( rd->decim_hist
, sizeof(*rd->decim_hist)*decim_stages*channels );
if(nd)
rd->decim = nd;
if(ndh)
rd->decim_hist = ndh;
if(!nd || !ndh)
{ {
perror("cannot allocate decimator state"); struct decimator_state *nd = safe_realloc( rd->decim
err = SYN123_DOOM; , sizeof(*rd->decim)*decim_stages );
goto setup_resample_cleanup; struct lpf4_hist *ndh = safe_realloc( rd->decim_hist
, sizeof(*rd->decim_hist)*decim_stages*channels );
if(nd)
rd->decim = nd;
if(ndh)
rd->decim_hist = ndh;
if(!nd || !ndh)
{
perror("cannot allocate decimator state");
err = SYN123_DOOM;
goto setup_resample_cleanup;
}
} else
{
free(rd->decim); rd->decim = NULL;
free(rd->decim_hist); rd->decim_hist = NULL;
} }
// Link up the common memory blocks after each realloc. // Link up the common memory blocks after each realloc.
for(unsigned int dc=0; dc<decim_stages; ++dc) for(unsigned int dc=0; dc<decim_stages; ++dc)
{ {
rd->decim[dc].ch = ndh+dc*channels; rd->decim[dc].ch = rd->decim_hist+dc*channels;
rd->decim[dc].out_hist = rd->stage_history rd->decim[dc].out_hist = rd->stage_history
? rd->stage_history+(dc+1)*STAGE_HISTORY*channels ? rd->stage_history+(dc+1)*STAGE_HISTORY*channels
: NULL; : NULL;

View File

@@ -18,7 +18,7 @@
/* import DLL symbols on windows */ /* import DLL symbols on windows */
#include "httpget.h" #include "httpget.h"
#if WIN32 #if _WIN32
#include "win32_support.h" #include "win32_support.h"
#endif #endif

View File

@@ -53,6 +53,7 @@ static DWORD wrap_auth(winhttp_handle *nh){
ret = WinHttpSetCredentials(nh->request, WINHTTP_AUTH_TARGET_SERVER, mode, nh->comps.lpszUserName, nh->comps.lpszPassword, NULL); ret = WinHttpSetCredentials(nh->request, WINHTTP_AUTH_TARGET_SERVER, mode, nh->comps.lpszUserName, nh->comps.lpszPassword, NULL);
return GetLastError(); return GetLastError();
} }
return TRUE;
} }
#if DEBUG #if DEBUG
@@ -95,6 +96,7 @@ net123_handle *net123_open_winhttp(const char *url, const char * const *client_h
DWORD headerlen; DWORD headerlen;
const LPCWSTR useragent = MPG123WSTR(PACKAGE_NAME) L"/" MPG123WSTR(PACKAGE_VERSION); const LPCWSTR useragent = MPG123WSTR(PACKAGE_NAME) L"/" MPG123WSTR(PACKAGE_VERSION);
WINHTTP_STATUS_CALLBACK cb; WINHTTP_STATUS_CALLBACK cb;
net123_handle *handle = NULL;
if(!WinHttpCheckPlatform()) if(!WinHttpCheckPlatform())
return NULL; return NULL;
@@ -105,7 +107,7 @@ net123_handle *net123_open_winhttp(const char *url, const char * const *client_h
winhttp_handle *ret = calloc(1, sizeof(winhttp_handle)); winhttp_handle *ret = calloc(1, sizeof(winhttp_handle));
if (!ret) goto cleanup; if (!ret) goto cleanup;
net123_handle *handle = calloc(1, sizeof(net123_handle)); handle = calloc(1, sizeof(net123_handle));
if (!handle) { if (!handle) {
free(ret); free(ret);
goto cleanup; goto cleanup;
@@ -178,7 +180,7 @@ net123_handle *net123_open_winhttp(const char *url, const char * const *client_h
if (!res) { if (!res) {
res = GetLastError(); res = GetLastError();
error1("WinHttpSendRequest failed with %lu", res); error1("WinHttpSendRequest failed with %d", res);
if(res == ERROR_WINHTTP_SECURE_FAILURE){ if(res == ERROR_WINHTTP_SECURE_FAILURE){
res = *(DWORD *)ret->additionalInfo; res = *(DWORD *)ret->additionalInfo;
error("Additionally, the ERROR_WINHTTP_SECURE_FAILURE failed with:"); error("Additionally, the ERROR_WINHTTP_SECURE_FAILURE failed with:");
@@ -221,8 +223,10 @@ net123_handle *net123_open_winhttp(const char *url, const char * const *client_h
cleanup: cleanup:
debug("net123_open error"); debug("net123_open error");
if (urlW) free(urlW); if (urlW) free(urlW);
net123_close(handle); if (handle) {
handle = NULL; net123_close(handle);
handle = NULL;
}
return handle; return handle;
} }

View File

@@ -73,13 +73,14 @@ net123_handle *net123_open_wininet(const char *url, const char * const *client_h
size_t ii; size_t ii;
WINBOOL res; WINBOOL res;
DWORD headerlen; DWORD headerlen;
net123_handle *ret = NULL;
const LPCWSTR useragent = MPG123WSTR(PACKAGE_NAME) L"/" MPG123WSTR(PACKAGE_VERSION); const LPCWSTR useragent = MPG123WSTR(PACKAGE_NAME) L"/" MPG123WSTR(PACKAGE_VERSION);
INTERNET_STATUS_CALLBACK cb; INTERNET_STATUS_CALLBACK cb;
win32_utf8_wide(url, &urlW, NULL); win32_utf8_wide(url, &urlW, NULL);
if(urlW == NULL) goto cleanup; if(urlW == NULL) goto cleanup;
net123_handle *ret = calloc(1, sizeof(net123_handle)); ret = calloc(1, sizeof(net123_handle));
wininet_handle *wh = calloc(1, sizeof(wininet_handle)); wininet_handle *wh = calloc(1, sizeof(wininet_handle));
if(!ret || !wh) if(!ret || !wh)
{ {
@@ -158,7 +159,7 @@ net123_handle *net123_open_wininet(const char *url, const char * const *client_h
if (!res) { if (!res) {
res = GetLastError(); res = GetLastError();
error1("HttpSendRequestW failed with %lu", res); error1("HttpSendRequestW failed with %d", res);
goto cleanup; goto cleanup;
} }
debug("HttpSendRequestW OK"); debug("HttpSendRequestW OK");
@@ -196,8 +197,10 @@ net123_handle *net123_open_wininet(const char *url, const char * const *client_h
cleanup: cleanup:
debug("net123_open error"); debug("net123_open error");
if (urlW) free(urlW); if (urlW) free(urlW);
net123_close(ret); if(ret) {
ret = NULL; net123_close(ret);
ret = NULL;
}
return ret; return ret;
} }
@@ -219,7 +222,7 @@ static size_t net123_read(net123_handle *nh, void *buf, size_t bufsize){
/* is this needed? */ /* is this needed? */
to_copy = bufsize > ULONG_MAX ? ULONG_MAX : bufsize; to_copy = bufsize > ULONG_MAX ? ULONG_MAX : bufsize;
if(!InternetReadFile(wh->request, buf, to_copy, &bytesread)){ if(!InternetReadFile(wh->request, buf, to_copy, &bytesread)){
error1("InternetReadFile exited with %d", GetLastError()); error1("InternetReadFile exited with %ld", GetLastError());
return EOF; return EOF;
} }
return bytesread; return bytesread;

View File

@@ -30,10 +30,10 @@
#include "config.h" #include "config.h"
#include "compat.h" #include "compat.h"
#include <ctype.h> #include <ctype.h>
#if WIN32 #if _WIN32
#include "win32_support.h" #include "win32_support.h"
#endif #endif
#if defined(WIN32) && defined(DYNAMIC_BUILD) #if defined(_WIN32) && defined(DYNAMIC_BUILD)
#define LINK_MPG123_DLL #define LINK_MPG123_DLL
#endif #endif
#include "out123.h" #include "out123.h"
@@ -108,7 +108,9 @@ static int realtime = FALSE;
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
static int w32_priority = 0; static int w32_priority = 0;
#endif #endif
#ifdef HAVE_SETPRIORITY
static int aggressive = FALSE; static int aggressive = FALSE;
#endif
static double preload = 0.2; static double preload = 0.2;
static long outflags = 0; static long outflags = 0;
double preamp = 0.; double preamp = 0.;

View File

@@ -29,7 +29,7 @@
static HANDLE consoleintput = INVALID_HANDLE_VALUE; static HANDLE consoleintput = INVALID_HANDLE_VALUE;
static HANDLE consoleoutput = INVALID_HANDLE_VALUE; static HANDLE consoleoutput = INVALID_HANDLE_VALUE;
static HANDLE getconsoleintput(void){ static HANDLE getconsoleintput(void){
DWORD mode, r; DWORD mode;
if(consoleintput == INVALID_HANDLE_VALUE){ if(consoleintput == INVALID_HANDLE_VALUE){
consoleintput = CreateFileW(L"CONIN$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); consoleintput = CreateFileW(L"CONIN$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if(consoleintput == INVALID_HANDLE_VALUE || consoleintput == NULL) if(consoleintput == INVALID_HANDLE_VALUE || consoleintput == NULL)
@@ -55,7 +55,6 @@ int term_have_fun(int fd, int want_visuals)
return 0; return 0;
} }
static DWORD lastmode;
int term_setup(void) int term_setup(void)
{ {
return 0; return 0;

View File

@@ -99,6 +99,7 @@ ssize_t win32_net_read (int fildes, void *buf, size_t nbyte)
return ret; return ret;
} }
/*
static int get_sock_ch (int sock) static int get_sock_ch (int sock)
{ {
char c; char c;
@@ -108,6 +109,7 @@ static int get_sock_ch (int sock)
return (((int) c)&0xff); return (((int) c)&0xff);
return -1; return -1;
} }
*/
ssize_t win32_net_write (int fildes, const void *buf, size_t nbyte) ssize_t win32_net_write (int fildes, const void *buf, size_t nbyte)
{ {