Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package mpg123 for openSUSE:Factory checked in at 2021-07-13 22:37:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mpg123 (Old) and /work/SRC/openSUSE:Factory/.mpg123.new.2625 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mpg123" Tue Jul 13 22:37:01 2021 rev:23 rq:905828 version:1.28.2 Changes: -------- --- /work/SRC/openSUSE:Factory/mpg123/mpg123.changes 2021-06-11 22:30:16.666089008 +0200 +++ /work/SRC/openSUSE:Factory/.mpg123.new.2625/mpg123.changes 2021-07-13 22:37:17.066201384 +0200 @@ -1,0 +2,38 @@ +Mon Jul 12 10:51:17 UTC 2021 - Luigi Baldoni <aloi...@gmx.com> + +- Update to version 1.28.2 + libout123: + * Complete the fix for bug 314, reopening the device after + format setup failure. + +------------------------------------------------------------------- +Fri Jul 9 14:30:59 UTC 2021 - Luigi Baldoni <aloi...@gmx.com> + +- Update to version 1.28.1 + build: + * Explain --with-default-audio in configure help better. + * Fix build of arm_fpu (regression of configure reorg). + * Re-introduce AC_PROG_C_C99 macro for autoconf 2.69, it's + only obsolete after that. + * Un-break CMake build for botched move of CheckCPUArch.c.in. + libmpg123: + * Make mpg123.h.in usable again with MPG123_NO_CONFIGURE, + for external uses. + * Use predefined MPG123_API_VERSION in mpg123.h.in for the + same. + * Fix an integer constant definition for the most negative 32 + bit number to avoid justified compiler complaints. + libsyn123: + * More support for MPG123_NO_CONFIGURE. + * Optionally use predefined SYN123_API_VERSION in syn123.h.in + for the same. + * Add a cast to silence integer sign warning for offset in + muloffdiv64(). + libout123: + * Pulse module advertises wider format support now, not + just s16. This makes mpg123 -e s24 work with it, not just + out123. + * Optionally use predefined OUT123_API_VERSION in out123.h.in + for non-configure use. + +------------------------------------------------------------------- Old: ---- mpg123-1.28.0.tar.bz2 mpg123-1.28.0.tar.bz2.sig New: ---- mpg123-1.28.2.tar.bz2 mpg123-1.28.2.tar.bz2.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mpg123.spec ++++++ --- /var/tmp/diff_new_pack.xbUvj4/_old 2021-07-13 22:37:17.638196778 +0200 +++ /var/tmp/diff_new_pack.xbUvj4/_new 2021-07-13 22:37:17.642196747 +0200 @@ -18,7 +18,7 @@ %define sover 0 Name: mpg123 -Version: 1.28.0 +Version: 1.28.2 Release: 0 Summary: Console MPEG audio player and decoder library License: LGPL-2.1-only ++++++ mpg123-1.28.0.tar.bz2 -> mpg123-1.28.2.tar.bz2 ++++++ ++++ 2181 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/NEWS new/mpg123-1.28.2/NEWS --- old/mpg123-1.28.0/NEWS 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/NEWS 2021-07-11 09:17:04.000000000 +0200 @@ -1,3 +1,45 @@ +1.28.2 +------ +- libout123 +-- Complete the fix for bug 314, reopening the device after format + setup failure. + +1.28.1 +------ +- build: +-- Explain --with-default-audio in configure help better. +-- Fix build of arm_fpu (regression of configure reorg). +-- Re-introduce AC_PROG_C_C99 macro for autoconf 2.69, it's only + obsolete after that. +-- Un-break CMake build for botched move of CheckCPUArch.c.in (bug 315). +-- Avoid conflict of warning macro with MSVC pragmas in two places. Also + fix UWP build with strerror check and move down inclusion of intsym.h + (bug 316). +-- Disable libout123 (and mpg123, out123) on UWP with cmake to get at least + the decoder lib built (317). +-- Hack around CMake bug(?) with QUERY_HAS_FPU to make ports/cmake also + work in MinGW (bug 318). +- libmpg123: +-- Make mpg123.h.in usable again with MPG123_NO_CONFIGURE, + for external uses (bug 313). +-- Use predefined MPG123_API_VERSION in mpg123.h.in for the same. +-- Better handle the ssize_t situation via typedef mpg123_ssize_t, less + likely to be broken in future MSVC versions. +-- Fix an integer constant definition for the most negative 32 bit numnber to + avoid justified compiler complaints. +- libsyn123: +-- More support for MPG123_NO_CONFIGURE. +-- Optionally use predefined SYN123_API_VERSION in syn123.h.in for the same. +-- Add a cast to silence integer sign warning for offset in muloffdiv64() + (bug 317) +- libout123: +-- Pulse module advertises wider format support now, not + just s16. This makes mpg123 -e s24 work with it, not just out123. +-- Optionally use predefined OUT123_API_VERSION in out123.h.in for + non-configure use. +-- Fix sndio output to properly query device format support and get + default fomat on FreeBSD (bug 314). + 1.28.0 ------ - build: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/configure.ac new/mpg123-1.28.2/configure.ac --- old/mpg123-1.28.0/configure.ac 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/configure.ac 2021-07-11 09:17:04.000000000 +0200 @@ -9,20 +9,20 @@ AC_PREREQ([2.69]) dnl ############# Initialisation -AC_INIT([mpg123], [1.28.0], [maintai...@mpg123.org]) +AC_INIT([mpg123], [1.28.2], [maintai...@mpg123.org]) dnl Increment API_VERSION when the API gets changes (new functions). dnl libmpg123 API_VERSION=46 -LIB_PATCHLEVEL=2 +LIB_PATCHLEVEL=3 dnl libout123 OUTAPI_VERSION=4 -OUTLIB_PATCHLEVEL=0 +OUTLIB_PATCHLEVEL=2 dnl libsyn123 SYNAPI_VERSION=1 -SYNLIB_PATCHLEVEL=3 +SYNLIB_PATCHLEVEL=4 dnl Since we want to be backwards compatible, both sides get set to API_VERSION. LIBMPG123_VERSION=$API_VERSION:$LIB_PATCHLEVEL:$API_VERSION @@ -103,8 +103,8 @@ fi AM_PROG_AS -dnl We really mean C99 here. The specific macro for that is gone. -AC_PROG_CC +dnl For autocinf 2.69, the C99 macro still does something. +AC_PROG_CC_C99 AM_PROG_CC_C_O AC_PROG_CPP AC_PROG_INSTALL @@ -968,32 +968,33 @@ AM_CONDITIONAL([HAVE_LAYER3], [test "x$layer3" = xenabled] ) AC_ARG_WITH([audio], [ - --with-audio=<list of modules> Select a list (or only one) of audio output modules (comma or space separated list). + --with-audio=<list of modules> Select a list (or only one) of audio output modules (comma or space separated list). Choices are: + aix Use AIX as default audio output sub-system + alib Use Alib as default audio output sub-system (for HPUX) + alsa Use ALSA as default audio output sub-system (libasound) + tinyalsa Use ALSA as default audio output sub-system (tinyalsa) + arts Use aRts as default audio output sub-system (KDE sound server) + dummy Use dummy as default audio (when no sound card is available) + esd Use ESoundD as default audio output sub-system + hp Use HP as default audio output sub-system + jack Use JACK as default low-latency audio server + coreaudio Use Mac OS X as default audio output sub-system (CoreAudio) + mint Use MinT as default audio output sub-system (Atari) + nas Use NAS as default audio output (Network Audio System) + os2 Use OS2 as default audio output sub-system + oss Use OSS as default audio output sub-system (/dev/dsp) + portaudio Use PortAudio as default audio output sub-system + pulse Use Pulse audio server as default audio output sub-system + qsa Use QSA as default audio output sub-system + sdl Use SDL as default audio output sub-system (Simple DirectMedia Layer) + sgi Use SGI as default audio output sub-system (IRIX) + sndio Use OpenBSD's sndio as default audio output sub-system + sun Use Sun as default audio output sub-system (/dev/audio) + win32 Use Win32 audio as default audio output sub-system + win32_wasapi Use Win32 wasapi audio as default audio output sub-system ]) AC_ARG_WITH([default-audio], [ - --with-default-audio=aix Use AIX as default audio output sub-system - --with-default-audio=alib Use Alib as default audio output sub-system (for HPUX) - --with-default-audio=alsa Use ALSA as default audio output sub-system (libasound) - --with-default-audio=tinyalsa Use ALSA as default audio output sub-system (tinyalsa) - --with-default-audio=arts Use aRts as default audio output sub-system (KDE sound server) - --with-default-audio=dummy Use dummy as default audio (when no sound card is available) - --with-default-audio=esd Use ESoundD as default audio output sub-system - --with-default-audio=hp Use HP as default audio output sub-system - --with-default-audio=jack Use JACK as default low-latency audio server - --with-default-audio=coreaudio Use Mac OS X as default audio output sub-system (CoreAudio) - --with-default-audio=mint Use MinT as default audio output sub-system (Atari) - --with-default-audio=nas Use NAS as default audio output (Network Audio System) - --with-default-audio=os2 Use OS2 as default audio output sub-system - --with-default-audio=oss Use OSS as default audio output sub-system (/dev/dsp) - --with-default-audio=portaudio Use PortAudio as default audio output sub-system - --with-default-audio=pulse Use Pulse audio server as default audio output sub-system - --with-default-audio=qsa Use QSA as default audio output sub-system - --with-default-audio=sdl Use SDL as default audio output sub-system (Simple DirectMedia Layer) - --with-default-audio=sgi Use SGI as default audio output sub-system (IRIX) - --with-default-audio=sndio Use OpenBSD's sndio as default audio output sub-system - --with-default-audio=sun Use Sun as default audio output sub-system (/dev/audio) - --with-default-audio=win32 Use Win32 audio as default audio output sub-system - --with-default-audio=win32_wasapi Use Win32 wasapi audio as default audio output sub-system + --with-default-audio=<list of modules> Select a list of audio output modules to try at runtime, even if not built right now (comma or space separated). See --with-audio for options. ]) AC_ARG_WITH([optimization], [ @@ -1435,7 +1436,7 @@ ;; arm_fpu) ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MULTI -DOPT_GENERIC -DOPT_GENERIC_DITHER -DOPT_NEON -DREAL_IS_FLOAT" - more_sources="$s_neon$s_dither $s_arm_multi" + more_sources="$s_neon $s_dither $s_arm_multi" ;; neon64) ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_NEON64 -DREAL_IS_FLOAT" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/mpg123.spec new/mpg123-1.28.2/mpg123.spec --- old/mpg123-1.28.0/mpg123.spec 2021-06-05 10:01:02.000000000 +0200 +++ new/mpg123-1.28.2/mpg123.spec 2021-07-12 10:14:14.000000000 +0200 @@ -3,7 +3,7 @@ # - devel packages for alsa, sdl, etc... to build the respective output modules. Summary: The fast console mpeg audio decoder/player. Name: mpg123 -Version: 1.28.0 +Version: 1.28.2 Release: 1 URL: http://www.mpg123.org/ License: GPL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/ports/cmake/CMakeLists.txt new/mpg123-1.28.2/ports/cmake/CMakeLists.txt --- old/mpg123-1.28.0/ports/cmake/CMakeLists.txt 2021-06-05 09:59:49.000000000 +0200 +++ new/mpg123-1.28.2/ports/cmake/CMakeLists.txt 2021-07-11 09:17:04.000000000 +0200 @@ -5,6 +5,13 @@ project(mpg123 VERSION ${MPG123_VERSION} LANGUAGES C ASM) +option(BUILD_LIBOUT123 "build libout123" ON) +if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(WARNING "Output module is not implemented for '${CMAKE_SYSTEM_NAME}' platform.") + message(WARNING "To prevent build errors 'BUILD_LIBOUT123' option is set to OFF.") + set(BUILD_LIBOUT123 OFF) +endif() + include(cmake/search_libs.cmake) include(CMakePackageConfigHelpers) include(GNUInstallDirs) @@ -34,17 +41,29 @@ set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}") set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../../libmpg123.pc.in" libmpg123.pc @ONLY) -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../../libout123.pc.in" libout123.pc @ONLY) +if(BUILD_LIBOUT123) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../../libout123.pc.in" libout123.pc @ONLY) +endif() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../../libsyn123.pc.in" libsyn123.pc @ONLY) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/libmpg123.pc" - "${CMAKE_CURRENT_BINARY_DIR}/libout123.pc" "${CMAKE_CURRENT_BINARY_DIR}/libsyn123.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +if(BUILD_LIBOUT123) install( FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../man1/mpg123.1" "${CMAKE_CURRENT_SOURCE_DIR}/../../man1/out123.1" DESTINATION "${CMAKE_INSTALL_MANDIR}") + + install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/libout123.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + install( + FILES + "${CMAKE_CURRENT_SOURCE_DIR}/../../man1/out123.1" + DESTINATION "${CMAKE_INSTALL_MANDIR}") +endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/ports/cmake/cmake/CheckCPUArch.cmake new/mpg123-1.28.2/ports/cmake/cmake/CheckCPUArch.cmake --- old/mpg123-1.28.0/ports/cmake/cmake/CheckCPUArch.cmake 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/ports/cmake/cmake/CheckCPUArch.cmake 2021-07-11 09:17:04.000000000 +0200 @@ -2,7 +2,7 @@ if(NOT DEFINED HAVE_${VARIABLE}) message(STATUS "Check CPU architecture is ${ARCH}") set(CHECK_CPU_ARCH_DEFINES ${ARCH_DEFINES}) - configure_file(${PROJECT_SOURCE_DIR}/CheckCPUArch.c.in ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c @ONLY) + configure_file(${PROJECT_SOURCE_DIR}/cmake/CheckCPUArch.c.in ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c @ONLY) try_compile(HAVE_${VARIABLE} "${PROJECT_BINARY_DIR}" "${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c") if(HAVE_${VARIABLE}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/ports/cmake/src/CMakeLists.txt new/mpg123-1.28.2/ports/cmake/src/CMakeLists.txt --- old/mpg123-1.28.0/ports/cmake/src/CMakeLists.txt 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/ports/cmake/src/CMakeLists.txt 2021-07-11 09:17:04.000000000 +0200 @@ -39,8 +39,6 @@ check_include_file("unistd.h" HAVE_UNISTD_H) check_include_file("windows.h" HAVE_WINDOWS_H) -check_symbol_exists(strerror "string.h" HAVE_STRERROR) - function(check_m) set(CMAKE_REQUIRED_LIBRARIES m) check_function_exists(sin HAVE_M) @@ -59,6 +57,7 @@ check_function_exists(shmat HAVE_SHMAT) check_function_exists(shmdt HAVE_SHMDT) check_function_exists(shmctl HAVE_SHMCTL) +check_function_exists(strerror HAVE_STRERROR) search_libs(gethostbyname GETHOSTBYNAME_LIB nsl socket network) search_libs(socket SOCKET_LIB socket) @@ -186,7 +185,11 @@ set(NO_ERETURN ON) endif() -cmake_host_system_information(RESULT HAVE_FPU QUERY HAS_FPU) +if(WIN32) + set(HAVE_FPU 1) +else() + cmake_host_system_information(RESULT HAVE_FPU QUERY HAS_FPU) +endif() if(NOT HAVE_FPU) set(NO_SYNTH32 ON) @@ -194,112 +197,114 @@ # Modules -if(CHECK_MODULES) - list(FIND CHECK_MODULES alsa ALSA_REQUIRED) - list(FIND CHECK_MODULES coreaudio COREAUDIO_REQUIRED) - list(FIND CHECK_MODULES pulse PULSE_REQUIRED) - list(FIND CHECK_MODULES jack JACK_REQUIRED) - list(FIND CHECK_MODULES tinyalsa TINYALSA_REQUIRED) - list(FIND CHECK_MODULES win32 WIN32_REQUIRED) - list(FIND CHECK_MODULES win32_wasapi WIN32_WASAPI_REQUIRED) - set(MODULE_NOT_FOUND_MESSAGE "module required but couldn't be found") -endif() - -if(NOT CHECK_MODULES OR NOT ALSA_REQUIRED EQUAL -1) - find_package(ALSA) - if(TARGET ALSA::ALSA) - list(APPEND OUTPUT_MODULES alsa) - elseif(CHECK_MODULES AND NOT ALSA_REQUIRED EQUAL -1) - message(FATAL_ERROR "alsa ${MODULE_NOT_FOUND_MESSAGE}") +if(BUILD_LIBOUT123) + if(CHECK_MODULES) + list(FIND CHECK_MODULES alsa ALSA_REQUIRED) + list(FIND CHECK_MODULES coreaudio COREAUDIO_REQUIRED) + list(FIND CHECK_MODULES pulse PULSE_REQUIRED) + list(FIND CHECK_MODULES jack JACK_REQUIRED) + list(FIND CHECK_MODULES tinyalsa TINYALSA_REQUIRED) + list(FIND CHECK_MODULES win32 WIN32_REQUIRED) + list(FIND CHECK_MODULES win32_wasapi WIN32_WASAPI_REQUIRED) + set(MODULE_NOT_FOUND_MESSAGE "module required but couldn't be found") + endif() + + if(NOT CHECK_MODULES OR NOT ALSA_REQUIRED EQUAL -1) + find_package(ALSA) + if(TARGET ALSA::ALSA) + list(APPEND OUTPUT_MODULES alsa) + elseif(CHECK_MODULES AND NOT ALSA_REQUIRED EQUAL -1) + message(FATAL_ERROR "alsa ${MODULE_NOT_FOUND_MESSAGE}") + endif() endif() -endif() -if(NOT CHECK_MODULES OR NOT COREAUDIO_REQUIRED EQUAL -1) - if(APPLE) - find_library(AUDIO_TOOLBOX AudioToolbox) - list(APPEND OUTPUT_MODULES coreaudio) - elseif(CHECK_MODULES AND NOT COREAUDIO_REQUIRED EQUAL -1) - message(FATAL_ERROR "coreaudio ${MODULE_NOT_FOUND_MESSAGE}") + if(NOT CHECK_MODULES OR NOT COREAUDIO_REQUIRED EQUAL -1) + if(APPLE) + find_library(AUDIO_TOOLBOX AudioToolbox) + list(APPEND OUTPUT_MODULES coreaudio) + elseif(CHECK_MODULES AND NOT COREAUDIO_REQUIRED EQUAL -1) + message(FATAL_ERROR "coreaudio ${MODULE_NOT_FOUND_MESSAGE}") + endif() endif() -endif() -find_package(PkgConfig) -if(PKG_CONFIG_FOUND) - if(NOT CHECK_MODULES OR NOT PULSE_REQUIRED EQUAL -1) - pkg_search_module(PULSE libpulse-simple) - if(PULSE_FOUND) - list(APPEND OUTPUT_MODULES pulse) - elseif(CHECK_MODULES AND NOT PULSE_REQUIRED EQUAL -1) - message(FATAL_ERROR "pulse ${MODULE_NOT_FOUND_MESSAGE}") + find_package(PkgConfig) + if(PKG_CONFIG_FOUND) + if(NOT CHECK_MODULES OR NOT PULSE_REQUIRED EQUAL -1) + pkg_search_module(PULSE libpulse-simple) + if(PULSE_FOUND) + list(APPEND OUTPUT_MODULES pulse) + elseif(CHECK_MODULES AND NOT PULSE_REQUIRED EQUAL -1) + message(FATAL_ERROR "pulse ${MODULE_NOT_FOUND_MESSAGE}") + endif() endif() - endif() - if(NOT CHECK_MODULES OR NOT JACK_REQUIRED EQUAL -1) - pkg_search_module(JACK jack) - if(JACK_FOUND) - list(APPEND OUTPUT_MODULES jack) - elseif(CHECK_MODULES AND NOT JACK_REQUIRED EQUAL -1) - message(FATAL_ERROR "jack ${MODULE_NOT_FOUND_MESSAGE}") + if(NOT CHECK_MODULES OR NOT JACK_REQUIRED EQUAL -1) + pkg_search_module(JACK jack) + if(JACK_FOUND) + list(APPEND OUTPUT_MODULES jack) + elseif(CHECK_MODULES AND NOT JACK_REQUIRED EQUAL -1) + message(FATAL_ERROR "jack ${MODULE_NOT_FOUND_MESSAGE}") + endif() endif() - endif() - if(NOT CHECK_MODULES OR NOT TINYALSA_REQUIRED EQUAL -1) - pkg_search_module(TINYALSA tinyalsa) - if(TINYALSA_FOUND) - list(APPEND OUTPUT_MODULES tinyalsa) - elseif(CHECK_MODULES AND NOT TINYALSA_REQUIRED EQUAL -1) - message(FATAL_ERROR "tinyalsa ${MODULE_NOT_FOUND_MESSAGE}") + if(NOT CHECK_MODULES OR NOT TINYALSA_REQUIRED EQUAL -1) + pkg_search_module(TINYALSA tinyalsa) + if(TINYALSA_FOUND) + list(APPEND OUTPUT_MODULES tinyalsa) + elseif(CHECK_MODULES AND NOT TINYALSA_REQUIRED EQUAL -1) + message(FATAL_ERROR "tinyalsa ${MODULE_NOT_FOUND_MESSAGE}") + endif() endif() endif() -endif() -if(NOT CHECK_MODULES OR NOT WIN32_REQUIRED EQUAL -1) - if(HAVE_WINDOWS_H) - set(WIN32_LIBRARIES winmm) - list(APPEND OUTPUT_MODULES win32) - elseif(CHECK_MODULES AND NOT WIN32_REQUIRED EQUAL -1) - message(FATAL_ERROR "win32 ${MODULE_NOT_FOUND_MESSAGE}") + if(NOT CHECK_MODULES OR NOT WIN32_REQUIRED EQUAL -1) + if(HAVE_WINDOWS_H) + set(WIN32_LIBRARIES winmm) + list(APPEND OUTPUT_MODULES win32) + elseif(CHECK_MODULES AND NOT WIN32_REQUIRED EQUAL -1) + message(FATAL_ERROR "win32 ${MODULE_NOT_FOUND_MESSAGE}") + endif() endif() -endif() -if(NOT CHECK_MODULES OR NOT WIN32_WASAPI_REQUIRED EQUAL -1) - set(WASAPI_INCLUDES "initguid.h" "audioclient.h" "mmdeviceapi.h" "avrt.h") - check_include_files("${WASAPI_INCLUDES}" HAVE_WASAPI) - if(HAVE_WASAPI) - set(WIN32_WASAPI_LIBRARIES ole32 avrt) - list(APPEND OUTPUT_MODULES win32_wasapi) - elseif(CHECK_MODULES AND NOT WIN32_WASAPI_REQUIRED EQUAL -1) - message(FATAL_ERROR "win32_wasapi ${MODULE_NOT_FOUND_MESSAGE}") + if(NOT CHECK_MODULES OR NOT WIN32_WASAPI_REQUIRED EQUAL -1) + set(WASAPI_INCLUDES "initguid.h" "audioclient.h" "mmdeviceapi.h" "avrt.h") + check_include_files("${WASAPI_INCLUDES}" HAVE_WASAPI) + if(HAVE_WASAPI) + set(WIN32_WASAPI_LIBRARIES ole32 avrt) + list(APPEND OUTPUT_MODULES win32_wasapi) + elseif(CHECK_MODULES AND NOT WIN32_WASAPI_REQUIRED EQUAL -1) + message(FATAL_ERROR "win32_wasapi ${MODULE_NOT_FOUND_MESSAGE}") + endif() endif() -endif() -if(CHECK_MODULES) - list(REMOVE_AT CHECK_MODULES - ${ALSA_REQUIRED} - ${COREAUDIO_REQUIRED} - ${PULSE_REQUIRED} - ${JACK_REQUIRED} - ${TINYALSA_REQUIRED} - ${WIN32_REQUIRED} - ${WIN32_WASAPI_REQUIRED}) - list(LENGTH CHECK_MODULES CHECK_MODULES_LENGTH) - if(NOT CHECK_MODULES_LENGTH EQUAL 0) - message(FATAL_ERROR "Dunno how to find modules: ${CHECK_MODULES}") + if(CHECK_MODULES) + list(REMOVE_AT CHECK_MODULES + ${ALSA_REQUIRED} + ${COREAUDIO_REQUIRED} + ${PULSE_REQUIRED} + ${JACK_REQUIRED} + ${TINYALSA_REQUIRED} + ${WIN32_REQUIRED} + ${WIN32_WASAPI_REQUIRED}) + list(LENGTH CHECK_MODULES CHECK_MODULES_LENGTH) + if(NOT CHECK_MODULES_LENGTH EQUAL 0) + message(FATAL_ERROR "Dunno how to find modules: ${CHECK_MODULES}") + endif() endif() -endif() -if(NOT OUTPUT_MODULES) - set(DEFAULT_OUTPUT_MODULE dummy) - set(DEFAULT_OUTPUT_MODULES ${DEFAULT_OUTPUT_MODULE}) -else() - list(GET OUTPUT_MODULES 0 _DEFAULT_OUTPUT_MODULE) - set(DEFAULT_OUTPUT_MODULE ${_DEFAULT_OUTPUT_MODULE} CACHE STRING "Default output module") - if(BUILD_SHARED_LIBS) - string(REPLACE ";" "," DEFAULT_OUTPUT_MODULES "${OUTPUT_MODULES}") - else() + if(NOT OUTPUT_MODULES) + set(DEFAULT_OUTPUT_MODULE dummy) set(DEFAULT_OUTPUT_MODULES ${DEFAULT_OUTPUT_MODULE}) + else() + list(GET OUTPUT_MODULES 0 _DEFAULT_OUTPUT_MODULE) + set(DEFAULT_OUTPUT_MODULE ${_DEFAULT_OUTPUT_MODULE} CACHE STRING "Default output module") + if(BUILD_SHARED_LIBS) + string(REPLACE ";" "," DEFAULT_OUTPUT_MODULES "${OUTPUT_MODULES}") + else() + set(DEFAULT_OUTPUT_MODULES ${DEFAULT_OUTPUT_MODULE}) + endif() + set_property(CACHE DEFAULT_OUTPUT_MODULE PROPERTY STRINGS ${OUTPUT_MODULES}) endif() - set_property(CACHE DEFAULT_OUTPUT_MODULE PROPERTY STRINGS ${OUTPUT_MODULES}) endif() option(ACCURATE_ROUNDING "use rounding instead of fast truncation for integer output, where possible" ON) @@ -362,47 +367,56 @@ add_subdirectory("compat") add_subdirectory("libmpg123") -add_subdirectory("libout123") +if(BUILD_LIBOUT123) + add_subdirectory("libout123") +endif() add_subdirectory("libsyn123") if(UNIX) add_subdirectory("tests") - add_executable(${PROJECT_NAME} - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/audio.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/common.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/sysutil.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/control_generic.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/equalizer.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/getlopt.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/httpget.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/resolver.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/genre.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/mpg123.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/metaprint.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/local.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/playlist.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/streamdump.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/term.c") - target_link_libraries(${PROJECT_NAME} PRIVATE - compat - lib${PROJECT_NAME} - libout123 - libsyn123 - ${GETHOSTBYNAME_LIB} - ${SOCKET_LIB} - $<$<BOOL:${HAVE_M}>:m>) - - add_executable(out123 - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/sysutil.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/getlopt.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/filters.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/local.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/out123.c") - target_link_libraries(out123 PRIVATE - lib${PROJECT_NAME} - libout123 - libsyn123) + if(BUILD_LIBOUT123) + add_executable(${PROJECT_NAME} + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/audio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/common.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/sysutil.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/control_generic.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/equalizer.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/getlopt.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/httpget.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/resolver.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/genre.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/mpg123.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/metaprint.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/local.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/playlist.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/streamdump.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/term.c") + target_link_libraries(${PROJECT_NAME} PRIVATE + compat + lib${PROJECT_NAME} + libout123 + libsyn123 + ${GETHOSTBYNAME_LIB} + ${SOCKET_LIB} + $<$<BOOL:${HAVE_M}>:m>) + + add_executable(out123 + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/sysutil.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/getlopt.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/filters.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/local.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/out123.c") + target_link_libraries(out123 PRIVATE + lib${PROJECT_NAME} + libout123 + libsyn123) + install(TARGETS ${PROJECT_NAME} out123 + EXPORT targets + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/") + endif() add_executable(${PROJECT_NAME}-id3dump "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/mpg123-id3dump.c" @@ -417,7 +431,7 @@ lib${PROJECT_NAME} libsyn123) - install(TARGETS ${PROJECT_NAME} out123 ${PROJECT_NAME}-id3dump ${PROJECT_NAME}-strip + install(TARGETS ${PROJECT_NAME}-id3dump ${PROJECT_NAME}-strip EXPORT targets ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/src/compat/compat.h new/mpg123-1.28.2/src/compat/compat.h --- old/mpg123-1.28.0/src/compat/compat.h 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/src/compat/compat.h 2021-07-11 09:17:04.000000000 +0200 @@ -15,7 +15,6 @@ #define MPG123_COMPAT_H #include "config.h" -#include "intsym.h" /* Disable inline for non-C99 compilers. */ #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L @@ -116,6 +115,9 @@ #endif +// Not too early, leave system headers alone (strerror). +#include "intsym.h" + /* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */ void *safe_realloc(void *ptr, size_t size); // Also freeing ptr if result is NULL. You can do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/src/libmpg123/mpg123.h.in new/mpg123-1.28.2/src/libmpg123/mpg123.h.in --- old/mpg123-1.28.0/src/libmpg123/mpg123.h.in 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/src/libmpg123/mpg123.h.in 2021-07-11 09:17:04.000000000 +0200 @@ -17,7 +17,9 @@ * This should be incremented at least each time a new symbol is added * to the header. */ +#ifndef MPG123_API_VERSION #define MPG123_API_VERSION @API_VERSION@ +#endif #ifndef MPG123_EXPORT /** Defines needed for MS Visual Studio(tm) DLL builds. @@ -41,13 +43,6 @@ #endif #endif -/* This is for Visual Studio, so this header works as distributed in the binary downloads */ -#if defined(_MSC_VER) && !defined(MPG123_DEF_SSIZE_T) -#define MPG123_DEF_SSIZE_T -#include <stddef.h> -typedef ptrdiff_t ssize_t; -#endif - /** Earlier versions of libmpg123 put enums into public API calls, * thich is not exactly safe. There are ABI rules, but you can use * compiler switches to change the sizes of enums. It is safer not @@ -76,9 +71,22 @@ #endif +/* You can use this file directly, avoiding the autoconf replacements. + Might have to set MPG123_NO_LARGENAME, too, in case you have + _FILE_OFFSET_BITS defined where it does not make sense. */ +#ifndef MPG123_NO_CONFIGURE + @INCLUDE_STDLIB_H@ @INCLUDE_SYS_TYPE_H@ +/* A little hack to help MSVC not having ssize_t. */ +#ifdef _MSC_VER +#include <stddef.h> +typedef ptrdiff_t mpg123_ssize_t; +#else +typedef ssize_t mpg123_ssize_t; +#endif + /* You can always enforce largefile hackery by setting MPG123_LARGESUFFIX. */ /* Otherwise, this header disables it if the build system decided so. */ #if !defined(MPG123_LARGESUFFIX) && @BUILD_NO_LARGENAME@ @@ -87,6 +95,8 @@ #endif #endif +#endif /* MPG123_NO_CONFIGURE */ + /* Simplified large file handling. I used to have a check here that prevents building for a library with conflicting large file setup (application that uses 32 bit offsets with library that uses 64 bits). @@ -1959,7 +1969,7 @@ * \return MPG123_OK on success */ MPG123_EXPORT int mpg123_replace_reader( mpg123_handle *mh -, ssize_t (*r_read) (int, void *, size_t) +, mpg123_ssize_t (*r_read) (int, void *, size_t) , off_t (*r_lseek)(int, off_t, int) ); @@ -1978,7 +1988,7 @@ * \return MPG123_OK on success */ MPG123_EXPORT int mpg123_replace_reader_handle( mpg123_handle *mh -, ssize_t (*r_read) (void *, void *, size_t) +, mpg123_ssize_t (*r_read) (void *, void *, size_t) , off_t (*r_lseek)(void *, off_t, int) , void (*cleanup)(void*) ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/src/libmpg123/sample.h new/mpg123-1.28.2/src/libmpg123/sample.h --- old/mpg123-1.28.0/src/libmpg123/sample.h 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/src/libmpg123/sample.h 2021-07-11 09:17:04.000000000 +0200 @@ -155,7 +155,7 @@ #define CONV_SU32(s) \ ( (s >= 0) \ ? ((uint32_t)s + (uint32_t)2147483648UL) \ - : (s == -2147483647-1 /* Work around to prevent a non-conformant MSVC warning/error */ \ + : (s == -2147483647L-1L /* Work around to prevent a non-conformant MSVC warning/error */ \ ? 0 /* Separate because negation would overflow. */ \ : (uint32_t)2147483648UL - (uint32_t)(-s) ) \ ) @@ -171,7 +171,7 @@ ( (u >= 2147483648UL) \ ? (int32_t)((uint32_t)u - (uint32_t)2147483648UL) \ : ((u == 0) \ - ? (int32_t)-2147483648UL \ + ? (int32_t)(-2147483647L-1L) \ : -(int32_t)((uint32_t)2147483648UL - u) ) \ ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/src/libout123/libout123.c new/mpg123-1.28.2/src/libout123/libout123.c --- old/mpg123-1.28.0/src/libout123/libout123.c 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/src/libout123/libout123.c 2021-07-11 09:17:04.000000000 +0200 @@ -978,8 +978,13 @@ debug1("ao->open() = %i", result); if(result >= 0) /* Opening worked, close again. */ ao->close(ao); - else if(ao->deinit) - ao->deinit(ao); /* Failed, ensure that cleanup after init_output() occurs. */ + else + { + if(!AOQUIET) + merror("Module '%s' device open failed.", name); + if(ao->deinit) + ao->deinit(ao); /* Failed, ensure that cleanup after init_output() occurs. */ + } } else if(!AOQUIET) error2("Module '%s' init failed: %i", name, result); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/src/libout123/modules/pulse.c new/mpg123-1.28.2/src/libout123/modules/pulse.c --- old/mpg123-1.28.0/src/libout123/modules/pulse.c 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/src/libout123/modules/pulse.c 2021-07-11 09:17:04.000000000 +0200 @@ -199,8 +199,9 @@ static int get_formats_pulse(out123_handle *ao) { - /* Only implemented Signed 16-bit audio for now */ - return MPG123_ENC_SIGNED_16; + return MPG123_ENC_SIGNED_16 | MPG123_ENC_SIGNED_24 |MPG123_ENC_SIGNED_32 + | MPG123_ENC_FLOAT_32 | MPG123_ENC_ALAW_8 | MPG123_ENC_ULAW_8 + | MPG123_ENC_UNSIGNED_8; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/src/libout123/modules/sndio.c new/mpg123-1.28.2/src/libout123/modules/sndio.c --- old/mpg123-1.28.0/src/libout123/modules/sndio.c 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/src/libout123/modules/sndio.c 2021-07-11 09:17:04.000000000 +0200 @@ -23,78 +23,184 @@ #include "debug.h" -static int open_sndio(out123_handle *ao) +static int sndio_to_mpg123_enc(int sign, int bits) { - struct sio_hdl *hdl; - struct sio_par par; + switch(bits) + { + case 8: + return sign ? MPG123_ENC_SIGNED_8 : MPG123_ENC_UNSIGNED_8; + case 16: + return sign ? MPG123_ENC_SIGNED_16 : MPG123_ENC_UNSIGNED_16; + case 24: + return sign ? MPG123_ENC_SIGNED_24 : MPG123_ENC_UNSIGNED_24; + case 32: + return sign ? MPG123_ENC_SIGNED_32 : MPG123_ENC_UNSIGNED_32; + } + return -1; +} - hdl = sio_open(ao->device /* NULL is fine */, SIO_PLAY, 0); - if (hdl == NULL) - return -1; +static double rate_diff(long a, unsigned int b) +{ + double ar = (double)a; + double br = (double)b; + return ( a>b ? (ar-br)/ar : ( a <= 0 ? 1. : (br-ar)/ar ) ); +} - sio_initpar(&par); - par.rate = ao->rate; - par.pchan = ao->channels; - par.le = SIO_LE_NATIVE; - switch(ao->format) { +static int mpg123_to_sndio_enc(int enc, unsigned int *sig, unsigned int *bits) +{ + switch(enc) { + case -1: + // Query default format only. + break; case MPG123_ENC_SIGNED_32: - par.sig = 1; - par.bits = 32; + *sig = 1; + *bits = 32; break; case MPG123_ENC_UNSIGNED_32: - par.sig = 0; - par.bits = 32; + *sig = 0; + *bits = 32; + break; + case MPG123_ENC_SIGNED_24: + *sig = 1; + *bits = 24; + break; + case MPG123_ENC_UNSIGNED_24: + *sig = 0; + *bits = 24; break; case MPG123_ENC_SIGNED_16: - case -1: /* query mode */ - par.sig = 1; - par.bits = 16; + *sig = 1; + *bits = 16; break; case MPG123_ENC_UNSIGNED_16: - par.sig = 0; - par.bits = 16; + *sig = 0; + *bits = 16; break; case MPG123_ENC_UNSIGNED_8: - par.sig = 0; - par.bits = 8; + *sig = 0; + *bits = 8; break; case MPG123_ENC_SIGNED_8: - par.sig = 1; - par.bits = 8; + *sig = 1; + *bits = 8; break; default: + return -1; + } + return 0; +} + + +// Just check if there seems some support for stereo audio, +// take maximum channel count otherwise. +static unsigned int guess_channels(struct sio_hdl *hdl) +{ + struct sio_cap cap; + unsigned int maxchan = 0; + unsigned int stereo_mask = 0; + unsigned int all_conf = 0; + if(!sio_getcap(hdl, &cap)) + return 0; // Zero is as good as nothing. + // There is no specification of order in pchan[], So no guessing + // about which index for stereo. + for(int ci=0; ci<SIO_NCHAN; ++ci) + { + if(2 == cap.pchan[ci]) + stereo_mask |= 1 << ci; // Maybe even multiple entries, eh? + } + for(unsigned int i=0; i<cap.nconf; ++i) + { + all_conf |= cap.confs[i].pchan; + } + for(int ci=0; ci<SIO_NCHAN; ++ci) + { + if(all_conf & (1 << ci) && cap.pchan[ci] > maxchan) + maxchan = cap.pchan[ci]; + } + mdebug("maximum device channels: %u\n", maxchan); + return all_conf & stereo_mask ? 2 : maxchan; +} + +static int open_sndio(out123_handle *ao) +{ + struct sio_hdl *hdl; + struct sio_par par; + + hdl = sio_open(ao->device /* NULL is fine */, SIO_PLAY, 0); + if (hdl == NULL) + { + error("Got nothing from sio_open(). "); + return -1; + } + + sio_initpar(&par); + + par.le = SIO_LE_NATIVE; + if(ao->format != -1) + { + mdebug("Actually opening with %d channels, rate %ld.", ao->channels, ao->rate); + par.rate = ao->rate; + par.pchan = ao->channels; + } else + { + // Hack around buggy sndio versions up to 1.8.0 that fail to + // neuter the default value before handing to OSS driver. + // Also need to re-open, as sndio likes errors to be fatal. + if(!sio_setpar(hdl, &par)) + { + sio_close(hdl); + hdl = sio_open(ao->device, SIO_PLAY, 0); + if(hdl == NULL) + { + error("Re-opening of device for channel guessing failed."); + return -1; + } + par.pchan = guess_channels(hdl); + } + } + + if(mpg123_to_sndio_enc(ao->format, &par.sig, &par.bits)) + { if (!AOQUIET) - error1("open_sndio: invalid sample format %d", + error1("invalid sample format %d", ao->format); sio_close(hdl); return -1; } - if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par) || - !sio_start(hdl)) { + if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par) + || par.le != SIO_LE_NATIVE ) + { + if(!AOQUIET) + error("parameter setup failure"); sio_close(hdl); return -1; } - if ((par.bits != 8 && par.bits != 16 && par.bits != 32) || - par.le != SIO_LE_NATIVE) { - sio_close(hdl); - return -1; + if(ao->format == -1) // Store default format. + { + ao->format = sndio_to_mpg123_enc(par.sig, par.bits); + ao->rate = par.rate; + ao->channels = par.pchan; } - ao->rate = par.rate; - ao->channels = par.pchan; - switch (par.bits) { - case 8: - ao->format = par.sig ? MPG123_ENC_SIGNED_8 : - MPG123_ENC_UNSIGNED_8; - break; - case 16: - ao->format = par.sig ? MPG123_ENC_SIGNED_16 : - MPG123_ENC_UNSIGNED_16; - break; - case 32: - ao->format = par.sig ? MPG123_ENC_SIGNED_32 : - MPG123_ENC_UNSIGNED_32; - break; + else + { + if( ao->format != sndio_to_mpg123_enc(par.sig, par.bits) + || ao->channels != par.pchan + || rate_diff(ao->rate, par.rate) > 0.005 + ) + { + if(!AOQUIET) + error("format not accepted as given"); + sio_close(hdl); + return -1; + } + if(!sio_start(hdl)) + { + if(!AOQUIET) + error("cannot start"); + sio_close(hdl); + return -1; + } } ao->userptr = hdl; return 0; @@ -102,9 +208,101 @@ static int get_formats_sndio(out123_handle *ao) { - return (MPG123_ENC_SIGNED_32|MPG123_ENC_UNSIGNED_32| - MPG123_ENC_SIGNED_16|MPG123_ENC_UNSIGNED_16| - MPG123_ENC_UNSIGNED_8|MPG123_ENC_SIGNED_8); + struct sio_hdl *hdl = (struct sio_hdl *)ao->userptr; + struct sio_cap cap; + int fmt = 0; + + // Direct querying with sio_setpar()/sio_getpar is too slow, so let's + // learn about the funky bitmask indexing of the capability stuff. + if(!sio_getcap(hdl, &cap)) + { + if(!AOQUIET) + error("failure getting caps"); + return 0; + } + + unsigned int rmask = 0; + for(int ri=0; ri<SIO_NRATE; ++ri) + { + if(ao->rate == cap.rate[ri]) + { + rmask |= 1 << ri; + break; + } + } + if(!rmask) + { + for(int ri=0; ri<SIO_NRATE; ++ri) + { + if(rate_diff(ao->rate, cap.rate[ri]) <= 0.005) + { + rmask |= 1 << ri; + break; + } + } + } + + unsigned int cmask = 0; + for(int ci=0; ci<SIO_NCHAN; ++ci) + { + if(ao->channels == cap.pchan[ci]) + { + cmask |= 1 << ci; + break; + } + } + + if(!rmask || !cmask) + { + // no rate match, do the elaborate check. + debug("cap table does not help, doing elaborate format check"); + static int fmts[] = + { + MPG123_ENC_SIGNED_8, MPG123_ENC_UNSIGNED_8 + , MPG123_ENC_SIGNED_16, MPG123_ENC_UNSIGNED_16 + , MPG123_ENC_SIGNED_24, MPG123_ENC_UNSIGNED_24 + , MPG123_ENC_SIGNED_32, MPG123_ENC_UNSIGNED_32 + }; + + for(int i=0;i<sizeof(fmts)/sizeof(int);i++) + { + struct sio_par par; + sio_initpar(&par); + par.le = SIO_LE_NATIVE; + mpg123_to_sndio_enc(fmts[i], &par.sig, &par.bits); + par.rate = ao->rate; + par.pchan = ao->channels; + if(sio_setpar(hdl, &par) && sio_getpar(hdl, &par)) + { + if( par.le == SIO_LE_NATIVE + && fmts[i] == sndio_to_mpg123_enc(par.sig, par.bits) + && ao->channels == par.pchan + && rate_diff(ao->rate, par.rate) <= 0.005 + ) + fmt |= fmts[i]; + } + } + } else + { + int menc[SIO_NENC]; + for(int ei=0; ei<SIO_NENC; ++ei) + { + if(cap.enc[ei].le != SIO_LE_NATIVE) + menc[ei] = 0; + else + menc[ei] = sndio_to_mpg123_enc(cap.enc[ei].sig, cap.enc[ei].bits); + if(menc[ei] < 0) + menc[ei] = 0; + } + for(unsigned int i=0; i<cap.nconf; ++i) + { + if(cap.confs[i].pchan & cmask && cap.confs[i].rate & rmask) + for(int ei=0; ei<SIO_NENC; ++ei) + if(cap.confs[i].enc & (1<<ei)) + fmt |= menc[ei]; + } + } + return fmt; } static int write_sndio(out123_handle *ao, unsigned char *buf, int len) @@ -127,7 +325,8 @@ { struct sio_hdl *hdl = (struct sio_hdl *)ao->userptr; - sio_close(hdl); + if(hdl) + sio_close(hdl); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/src/libout123/out123.h.in new/mpg123-1.28.2/src/libout123/out123.h.in --- old/mpg123-1.28.0/src/libout123/out123.h.in 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/src/libout123/out123.h.in 2021-07-11 09:17:04.000000000 +0200 @@ -29,7 +29,9 @@ * This should be incremented at least each time a new symbol is added * to the header. */ +#ifndef OUT123_API_VERSION #define OUT123_API_VERSION @OUTAPI_VERSION@ +#endif #ifndef MPG123_EXPORT /** Defines needed for MS Visual Studio(tm) DLL builds. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/src/libsyn123/resample.c new/mpg123-1.28.2/src/libsyn123/resample.c --- old/mpg123-1.28.0/src/libsyn123/resample.c 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/src/libsyn123/resample.c 2021-07-11 09:17:04.000000000 +0200 @@ -2005,7 +2005,7 @@ // First offset is -inrate. // You may want to work it out for yourself. Or trust me;-) int err; - uint64_t vtot = muloffdiv64(outs, vinrate, -vinrate, voutrate, &err, NULL); + uint64_t vtot = muloffdiv64(outs, vinrate, -(int64_t)vinrate, voutrate, &err, NULL); if(err) return SYN123_OVERFLOW; if(vtot == UINT64_MAX) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/src/libsyn123/sampleconv.c new/mpg123-1.28.2/src/libsyn123/sampleconv.c --- old/mpg123-1.28.0/src/libsyn123/sampleconv.c 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/src/libsyn123/sampleconv.c 2021-07-11 09:17:04.000000000 +0200 @@ -21,6 +21,8 @@ #include "syn123_int.h" #include "sample.h" #include "debug.h" +// Avoid conflict with pragmas in isnan() and friends. +#undef warning /* Conversions between native byte order encodings. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/src/libsyn123/syn123.h.in new/mpg123-1.28.2/src/libsyn123/syn123.h.in --- old/mpg123-1.28.0/src/libsyn123/syn123.h.in 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/src/libsyn123/syn123.h.in 2021-07-11 09:17:04.000000000 +0200 @@ -20,7 +20,9 @@ * This should be incremented at least each time a new symbol is added * to the header. */ +#ifndef SYN123_API_VERSION #define SYN123_API_VERSION @SYNAPI_VERSION@ +#endif #ifndef MPG123_EXPORT /** Defines needed for MS Visual Studio(tm) DLL builds. @@ -975,7 +977,13 @@ /* Lightweight large file hackery to enable worry-reduced use of off_t. Depending on the size of off_t in your client build, the corresponding library function needs to be chosen. */ -#if defined(_FILE_OFFSET_BITS) && !@BUILD_NO_LARGENAME@ +#ifndef MPG123_NO_CONFIGURE +#if !defined(MPG123_NO_LARGENAME) && @BUILD_NO_LARGENAME@ +#define MPG123_NO_LARGENAME +#endif +#endif + +#if defined(_FILE_OFFSET_BITS) && !defined(MPG123_NO_LARGENAME) # if _FILE_OFFSET_BITS+0 == 32 # define syn123_resample_total syn123_resample_total_32 # define syn123_resample_intotal syn123_resample_intotal_32 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mpg123-1.28.0/src/libsyn123/volume.c new/mpg123-1.28.2/src/libsyn123/volume.c --- old/mpg123-1.28.0/src/libsyn123/volume.c 2021-06-05 09:59:48.000000000 +0200 +++ new/mpg123-1.28.2/src/libsyn123/volume.c 2021-07-11 09:17:04.000000000 +0200 @@ -12,6 +12,8 @@ #define NO_SMAX #include "syn123_int.h" #include "debug.h" +// Avoid conflict with pragmas in isnan() and friends. +#undef warning static const double db_min = -SYN123_DB_LIMIT; static const double db_max = SYN123_DB_LIMIT;