mpg123-1.32.4

This commit is contained in:
Ozkan Sezer
2024-01-10 20:40:40 +03:00
parent 530d2f6056
commit a06847ca33
142 changed files with 1370 additions and 1487 deletions

View File

@@ -7,10 +7,8 @@
# For dynamic modules.
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
include src/libout123/modules/Makemodule.am
endif
endif
if NEED_MAINLIB
if BUILD_LIBOUT123
@@ -20,7 +18,7 @@ if !HAVE_MODULES
include src/libout123/modules/Makemodule.am
endif
include_HEADERS += src/libout123/out123.h
include_HEADERS += src/include/out123.h
noinst_LTLIBRARIES += src/libout123/libmodule.la
@@ -30,7 +28,6 @@ endif
endif
src_libout123_libout123_la_SOURCES = \
src/libout123/out123.h \
src/libout123/libout123.c \
src/libout123/stringlists.h \
src/libout123/stringlists.c \

View File

@@ -1,7 +1,7 @@
/*
buffer.c: output buffer
copyright 1997-2015 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 1997-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Oliver Fromme
@@ -45,7 +45,7 @@
#endif
#endif
#include "debug.h"
#include "../common/debug.h"
#define BUF_CMD_OPEN XF_CMD_CUSTOM1
#define BUF_CMD_CLOSE XF_CMD_CUSTOM2
@@ -667,8 +667,8 @@ int buffer_loop(out123_handle *ao)
if(mystate == play_live)
{
size_t bytes = INT123_xfermem_get_usedspace(xf);
debug4( "Play or preload? Got %"SIZE_P" B / %"SIZE_P" B (%i,%i)."
, (size_p)bytes, (size_p)preload_size(ao), preloading, draining );
debug4( "Play or preload? Got %zu B / %zu B (%i,%i)."
, bytes, preload_size(ao), preloading, draining );
if(preloading)
preloading = (bytes < preload_size(ao));
if(!preloading)
@@ -860,8 +860,7 @@ int buffer_loop(out123_handle *ao)
int success;
blocksize = sizeof(*fmtlist)*fmtcount;
debug2("responding with %i formats (block: %"SIZE_P")"
, fmtcount, (size_p)blocksize);
debug2("responding with %i formats (block: %zu)", fmtcount, blocksize);
INT123_xfermem_putcmd(my_fd, XF_CMD_OK);
success =
GOOD_WRITEVAL(my_fd, fmtcount)
@@ -977,8 +976,7 @@ int buffer_loop(out123_handle *ao)
mystate = ao->state;
draining = FALSE;
}
debug2( "buffer drained %"SIZE_P" / %"SIZE_P
, oldfill-bytes, limit );
debug2("buffer drained %zu / %zu", oldfill-bytes, limit);
}
else
debug("drain without playback ... not good");

View File

@@ -17,7 +17,7 @@
#define _MPG123_BUFFER_H_
#include "out123_int.h"
#include "compat.h"
#include "../compat/compat.h"
int INT123_buffer_init(out123_handle *ao, size_t bytes);
void INT123_buffer_exit(out123_handle *ao);

View File

@@ -19,7 +19,7 @@
#include "out123_int.h"
#include "hextxt.h"
#include "debug.h"
#include "../common/debug.h"
int hex_formats(out123_handle *ao)
{

View File

@@ -7,7 +7,7 @@
*/
#include "out123_int.h"
#include "debug.h"
#include "../common/debug.h"
/* A single module is staticly compiled in for each type */
extern mpg123_module_t mpg123_output_module_info;

View File

@@ -32,7 +32,7 @@
#endif
#endif
#include "version.h"
#include "../version.h"
#include "wav.h"
#include "hextxt.h"
#ifndef NOXFERMEM
@@ -44,7 +44,7 @@ static int have_buffer(out123_handle *ao)
#endif
#include "stringlists.h"
#include "debug.h"
#include "../common/debug.h"
const char * attribute_align_arg out123_distversion(unsigned int *major, unsigned int *minor, unsigned int *patch)
{
@@ -234,7 +234,7 @@ static int out123_seterr(out123_handle *ao, enum out123_error errcode)
int attribute_align_arg
out123_set_buffer(out123_handle *ao, size_t buffer_bytes)
{
debug2("out123_set_buffer(%p, %"SIZE_P")", (void*)ao, (size_p)buffer_bytes);
debug2("out123_set_buffer(%p, %zu)", (void*)ao, buffer_bytes);
if(!ao)
return OUT123_ERR;
ao->errcode = 0;
@@ -679,8 +679,8 @@ out123_play(out123_handle *ao, void *bytes, size_t count)
size_t sum = 0;
int written;
debug5( "[%ld]out123_play(%p, %p, %"SIZE_P") (%i)", (long)getpid()
, (void*)ao, bytes, (size_p)count, ao ? (int)ao->state : -1 );
debug5( "[%ld]out123_play(%p, %p, %zu) (%i)", (long)getpid()
, (void*)ao, bytes, count, ao ? (int)ao->state : -1 );
if(!ao)
return 0;
ao->errcode = 0;
@@ -748,8 +748,8 @@ out123_play(out123_handle *ao, void *bytes, size_t count)
}
} while(count && ao->flags & OUT123_KEEP_PLAYING);
}
debug3( "out123_play(%p, %p, ...) = %"SIZE_P
, (void*)ao, bytes, (size_p)sum );
debug3( "out123_play(%p, %p, ...) = %zu"
, (void*)ao, bytes, sum );
return sum;
}
@@ -800,7 +800,7 @@ void attribute_align_arg out123_drain(out123_handle *ao)
void attribute_align_arg out123_ndrain(out123_handle *ao, size_t bytes)
{
debug3("[%ld]out123_ndrain(%p, %"SIZE_P")", (long)getpid(), (void*)ao, (size_p)bytes);
debug3("[%ld]out123_ndrain(%p, %zu)", (long)getpid(), (void*)ao, bytes);
if(!ao)
return;
ao->errcode = 0;
@@ -1507,7 +1507,7 @@ size_t attribute_align_arg out123_buffered(out123_handle *ao)
if(have_buffer(ao))
{
size_t fill = INT123_buffer_fill(ao);
debug2("out123_buffered(%p) = %"SIZE_P, (void*)ao, (size_p)fill);
debug2("out123_buffered(%p) = %zu", (void*)ao, fill);
return fill;
}
else

View File

@@ -11,11 +11,11 @@
#define _BSD_SOURCE
#include "config.h"
#include "stringlists.h"
#include "compat.h"
#include "../compat/compat.h"
#include <errno.h>
#include "module.h"
#include "debug.h"
#include "../common/debug.h"
#ifndef USE_MODULES
#error This is a build without modules. Why am I here?

View File

@@ -33,10 +33,12 @@ MODULE_CFLAGS= -shared
#pulse sdl sndio sun win32 win32_wasapi aix alib arts hp os2 \
#sgi mint openal \
#| tr ' ' '\n' |
#perl -ne 'chomp; $big = uc($_); print <<EOT;
#perl -ne 'chomp; $big = uc($_);
# @guard= $big ne "DUMMY" ? ("if BUILD_LIBOUT123_MODULES\n", "endif\n") : ("","");
# print <<EOT;
#
#if HAVE_MODULES
#if HAVE_$big
#$guard[0]if HAVE_$big
#pkglib_LTLIBRARIES += \src/libout123/modules/output_$_.la
#src_libout123_modules_output_${_}_la_SOURCES = \\
# src/libout123/modules/$_.c
@@ -49,7 +51,7 @@ MODULE_CFLAGS= -shared
# \$(AM_CPPFLAGS) \\
# \$(libout123_mod_cppflags)
#endif
#else
#$guard[1]else
#if BUILD_$big
#src_libout123_modules_libdefaultmodule_la_SOURCES = \\
# src/libout123/modules/$_.c
@@ -93,6 +95,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_TINYALSA
pkglib_LTLIBRARIES += src/libout123/modules/output_tinyalsa.la
src_libout123_modules_output_tinyalsa_la_SOURCES = \
@@ -106,6 +109,7 @@ src_libout123_modules_outout_tinyalsa_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_TINYALSA
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -120,6 +124,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_ALSA
pkglib_LTLIBRARIES += src/libout123/modules/output_alsa.la
src_libout123_modules_output_alsa_la_SOURCES = \
@@ -133,6 +138,7 @@ src_libout123_modules_outout_alsa_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_ALSA
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -147,6 +153,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_QSA
pkglib_LTLIBRARIES += src/libout123/modules/output_qsa.la
src_libout123_modules_output_qsa_la_SOURCES = \
@@ -160,6 +167,7 @@ src_libout123_modules_outout_qsa_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_QSA
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -174,6 +182,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_COREAUDIO
pkglib_LTLIBRARIES += src/libout123/modules/output_coreaudio.la
src_libout123_modules_output_coreaudio_la_SOURCES = \
@@ -187,6 +196,7 @@ src_libout123_modules_outout_coreaudio_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_COREAUDIO
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -201,6 +211,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_ESD
pkglib_LTLIBRARIES += src/libout123/modules/output_esd.la
src_libout123_modules_output_esd_la_SOURCES = \
@@ -214,6 +225,7 @@ src_libout123_modules_outout_esd_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_ESD
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -228,6 +240,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_JACK
pkglib_LTLIBRARIES += src/libout123/modules/output_jack.la
src_libout123_modules_output_jack_la_SOURCES = \
@@ -241,6 +254,7 @@ src_libout123_modules_outout_jack_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_JACK
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -255,6 +269,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_NAS
pkglib_LTLIBRARIES += src/libout123/modules/output_nas.la
src_libout123_modules_output_nas_la_SOURCES = \
@@ -268,6 +283,7 @@ src_libout123_modules_outout_nas_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_NAS
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -282,6 +298,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_OSS
pkglib_LTLIBRARIES += src/libout123/modules/output_oss.la
src_libout123_modules_output_oss_la_SOURCES = \
@@ -295,6 +312,7 @@ src_libout123_modules_outout_oss_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_OSS
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -309,6 +327,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_PORTAUDIO
pkglib_LTLIBRARIES += src/libout123/modules/output_portaudio.la
src_libout123_modules_output_portaudio_la_SOURCES = \
@@ -322,6 +341,7 @@ src_libout123_modules_outout_portaudio_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_PORTAUDIO
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -336,6 +356,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_PULSE
pkglib_LTLIBRARIES += src/libout123/modules/output_pulse.la
src_libout123_modules_output_pulse_la_SOURCES = \
@@ -349,6 +370,7 @@ src_libout123_modules_outout_pulse_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_PULSE
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -363,6 +385,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_SDL
pkglib_LTLIBRARIES += src/libout123/modules/output_sdl.la
src_libout123_modules_output_sdl_la_SOURCES = \
@@ -376,6 +399,7 @@ src_libout123_modules_outout_sdl_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_SDL
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -390,6 +414,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_SNDIO
pkglib_LTLIBRARIES += src/libout123/modules/output_sndio.la
src_libout123_modules_output_sndio_la_SOURCES = \
@@ -403,6 +428,7 @@ src_libout123_modules_outout_sndio_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_SNDIO
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -417,6 +443,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_SUN
pkglib_LTLIBRARIES += src/libout123/modules/output_sun.la
src_libout123_modules_output_sun_la_SOURCES = \
@@ -430,6 +457,7 @@ src_libout123_modules_outout_sun_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_SUN
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -444,6 +472,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_WIN32
pkglib_LTLIBRARIES += src/libout123/modules/output_win32.la
src_libout123_modules_output_win32_la_SOURCES = \
@@ -457,6 +486,7 @@ src_libout123_modules_outout_win32_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_WIN32
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -471,6 +501,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_WIN32_WASAPI
pkglib_LTLIBRARIES += src/libout123/modules/output_win32_wasapi.la
src_libout123_modules_output_win32_wasapi_la_SOURCES = \
@@ -484,6 +515,7 @@ src_libout123_modules_outout_win32_wasapi_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_WIN32_WASAPI
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -498,6 +530,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_AIX
pkglib_LTLIBRARIES += src/libout123/modules/output_aix.la
src_libout123_modules_output_aix_la_SOURCES = \
@@ -511,6 +544,7 @@ src_libout123_modules_outout_aix_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_AIX
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -525,6 +559,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_ALIB
pkglib_LTLIBRARIES += src/libout123/modules/output_alib.la
src_libout123_modules_output_alib_la_SOURCES = \
@@ -538,6 +573,7 @@ src_libout123_modules_outout_alib_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_ALIB
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -552,6 +588,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_ARTS
pkglib_LTLIBRARIES += src/libout123/modules/output_arts.la
src_libout123_modules_output_arts_la_SOURCES = \
@@ -565,6 +602,7 @@ src_libout123_modules_outout_arts_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_ARTS
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -579,6 +617,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_HP
pkglib_LTLIBRARIES += src/libout123/modules/output_hp.la
src_libout123_modules_output_hp_la_SOURCES = \
@@ -592,6 +631,7 @@ src_libout123_modules_outout_hp_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_HP
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -606,6 +646,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_OS2
pkglib_LTLIBRARIES += src/libout123/modules/output_os2.la
src_libout123_modules_output_os2_la_SOURCES = \
@@ -619,6 +660,7 @@ src_libout123_modules_outout_os2_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_OS2
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -633,6 +675,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_SGI
pkglib_LTLIBRARIES += src/libout123/modules/output_sgi.la
src_libout123_modules_output_sgi_la_SOURCES = \
@@ -646,6 +689,7 @@ src_libout123_modules_outout_sgi_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_SGI
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -660,6 +704,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_MINT
pkglib_LTLIBRARIES += src/libout123/modules/output_mint.la
src_libout123_modules_output_mint_la_SOURCES = \
@@ -673,6 +718,7 @@ src_libout123_modules_outout_mint_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_MINT
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -687,6 +733,7 @@ endif
endif
if HAVE_MODULES
if BUILD_LIBOUT123_MODULES
if HAVE_OPENAL
pkglib_LTLIBRARIES += src/libout123/modules/output_openal.la
src_libout123_modules_output_openal_la_SOURCES = \
@@ -700,6 +747,7 @@ src_libout123_modules_outout_openal_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(libout123_mod_cppflags)
endif
endif
else
if BUILD_OPENAL
src_libout123_modules_libdefaultmodule_la_SOURCES = \
@@ -713,6 +761,7 @@ src_libout123_modules_libdefaultmodule_la_CPPFLAGS = \
endif
endif
if BUILD_LIBOUT123_OR_MODULES
if HAVE_MODULES
# Get rid of .la files, at least _after_ install.
install-exec-hook:
@@ -721,3 +770,4 @@ install-exec-hook:
uninstall-hook:
for m in @output_modules_la@; do eval $$(grep dlname= src/libout123/modules/$$m) && rm -f $(DESTDIR)$(pkglibdir)/$$dlname; done
endif
endif

View File

@@ -8,7 +8,7 @@
untested since quite some years now ...
*/
#include "out123_int.h"
#include "../out123_int.h"
#include <stdio.h>
#include <unistd.h>
@@ -23,7 +23,7 @@
#include <sys/stat.h>
#include <sys/param.h>
#include "debug.h"
#include "../../common/debug.h"
/* use AUDIO_BSIZE to set the msec for audio buffering in Ultimedia library
*/

View File

@@ -30,7 +30,7 @@
/**************************************************************************/
#include "out123_int.h"
#include "../out123_int.h"
#include <fcntl.h>
@@ -44,7 +44,7 @@
#include <Alib.h> /* /opt/audio/include */
#include <CUlib.h> /* /opt/audio/include */
#include "debug.h"
#include "../../common/debug.h"
/**************************************************************************/

View File

@@ -17,7 +17,7 @@
/* Things are still missing if _DEFAULT_SOURCE is not defined (for recent
glibc, I presume. */
#define _DEFAULT_SOURCE
#include "out123_int.h"
#include "../out123_int.h"
#include <errno.h>
/* make ALSA 0.9.x compatible to the 1.0.x API */
@@ -27,7 +27,7 @@
#include <alloca.h> /* GCC complains about missing declaration of alloca. */
#include <alsa/asoundlib.h>
#include "debug.h"
#include "../../common/debug.h"
/* Total buffer size in seconds, 0.2 is more true to what ALSA maximally uses
here (8192 samples). The earlier default of 0.5 was never true. */

View File

@@ -8,9 +8,9 @@
*/
#include "out123_int.h"
#include "../out123_int.h"
#include <artsc.h>
#include "debug.h"
#include "../../common/debug.h"
typedef struct
{

View File

@@ -9,7 +9,7 @@
*/
#include "out123_int.h"
#include "../out123_int.h"
/* has been around since at least 10.4 */
#include <AvailabilityMacros.h>
@@ -44,9 +44,9 @@
/* Including the sfifo code locally, to avoid module linkage issues. */
#define SFIFO_STATIC
#include "sfifo.c"
#include "../sfifo.c"
#include "debug.h"
#include "../../common/debug.h"
/* Duration of the ring buffer in seconds.
Is that all that there is to tunable latency?

View File

@@ -5,8 +5,8 @@
see COPYING and AUTHORS files in distribution or http://mpg123.org
*/
#include "out123_int.h"
#include "debug.h"
#include "../out123_int.h"
#include "../../common/debug.h"
static int open_dummy(out123_handle *ao)
{

View File

@@ -8,7 +8,7 @@
/* First the common header, including config.h
...this is important for stuff like _FILE_OFFSET_BITS */
#include "out123_int.h"
#include "../out123_int.h"
#include <esd.h>
#include <errno.h>
@@ -22,7 +22,7 @@
#include <sys/ioctl.h>
#include <sys/audioio.h>
#endif
#include "debug.h"
#include "../../common/debug.h"
static unsigned esd_rate = 0, esd_format = 0, esd_channels = 0;
@@ -162,7 +162,7 @@ mpg123_module_t mpg123_output_module_info = {
/* api_version */ MPG123_MODULE_API_VERSION,
/* name */ "esd",
/* description */ "Output audio using ESounD (The Enlightened Sound Daemon).",
/* revision */ "$Rev: 3915 $",
/* revision */ "$Rev: 5386 $",
/* handle */ NULL,
/* init_output */ init_esound,

View File

@@ -6,10 +6,10 @@
initially written by Michael Hipp
*/
#include "out123_int.h"
#include "../out123_int.h"
#include <fcntl.h>
#include <sys/audio.h>
#include "debug.h"
#include "../../common/debug.h"
static int set_rate(out123_handle *ao)

View File

@@ -1,7 +1,7 @@
/*
jack: audio output via JACK Audio Connection Kit
copyright 2006-2016 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2006-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Nicholas J. Humfrey
@@ -14,7 +14,7 @@
There's always a deadlock. --ThOr
*/
#include "out123_int.h"
#include "../out123_int.h"
#include <math.h>
@@ -26,7 +26,7 @@
#include <semaphore.h>
#include <sys/errno.h>
#include "debug.h"
#include "../../common/debug.h"
typedef struct {
int alive;
@@ -147,8 +147,7 @@ static int process_callback( jack_nframes_t nframes, void *arg )
got_piece = jack_ringbuffer_read( handle->rb
, handle->procbuf, (avail_piece > piece ? piece : avail_piece)
* handle->framesize ) / handle->framesize;
debug2( "fetched %"SIZE_P" frames from ringbuffer (wanted %"SIZE_P")"
, (size_p)got_piece, (size_p)piece );
debug2("fetched %zu frames from ringbuffer (wanted %zu)", got_piece, piece);
/* If this is the last piece, fill up, not time to wait. */
if(to_read > piece)
piece = got_piece; /* We got further loop cycle(s) to get the rest. */
@@ -326,7 +325,7 @@ static int connect_jack_ports(out123_handle *ao
for(c=0;c<wish_channels;++c)
{
while(devcopy[i] != 0 && devcopy[i] != ',') ++i;
debug2("devcopy[%"SIZE_P"]=%i", i, devcopy[i]);
debug2("devcopy[%zu]=%i", i, devcopy[i]);
if(devcopy[i] == ',')
{
/* Terminate previous port name, assign next one. */
@@ -362,9 +361,9 @@ static void drain_jack(out123_handle *ao)
while( handle && handle->alive && handle->rb
&& jack_ringbuffer_write_space(handle->rb)+1 < handle->rb_size )
{
debug2( "JACK close wait %"SIZE_P" < %"SIZE_P"\n"
, (size_p)jack_ringbuffer_write_space(handle->rb)
, (size_p)handle->rb_size );
debug2( "JACK close wait %zu < %zu\n"
, jack_ringbuffer_write_space(handle->rb)
, handle->rb_size );
sem_wait(&handle->sem);
}
}
@@ -486,7 +485,7 @@ static int open_jack(out123_handle *ao)
handle->procbuf_frames = jack_get_buffer_size(handle->client);
if(handle->rb_size < 2*handle->procbuf_frames)
handle->rb_size = 2*handle->procbuf_frames;
debug1("JACK ringbuffer for %"SIZE_P" PCM frames", (size_p)handle->rb_size);
debug1("JACK ringbuffer for %zu PCM frames", handle->rb_size);
/* Convert to bytes. */
handle->rb_size *= handle->framesize;
handle->rb = jack_ringbuffer_create(handle->rb_size);
@@ -553,7 +552,7 @@ static int write_jack(out123_handle *ao, unsigned char *buf, int len)
debug("writing to ringbuffer");
/* No help: piece1 = jack_ringbuffer_write_space(handle->rb); */
piece = jack_ringbuffer_write(handle->rb, (char*)buf, bytes_left);
debug1("wrote %"SIZE_P" B", (size_p)piece);
debug1("wrote %zu B", piece);
buf += piece;
bytes_left -= piece;
/* Allow nothing being written some times, but not too often.

View File

@@ -6,13 +6,13 @@
initially written by Petr Stehlik
*/
#include "out123_int.h"
#include "../out123_int.h"
/* derived from LINUX, VOXWARE and SUN for MiNT Audio Device by Petr Stehlik */
#include <fcntl.h>
#include <ioctl.h>
#include <audios.h>
#include "debug.h"
#include "../../common/debug.h"
/* Globals */
/* extern int outburst; */

View File

@@ -6,11 +6,11 @@
initially written by Martin Denn
*/
#include "out123_int.h"
#include "../out123_int.h"
#include <fcntl.h>
#include <audio/audiolib.h>
#include <audio/soundlib.h>
#include "debug.h"
#include "../../common/debug.h"
typedef struct
{

View File

@@ -10,7 +10,7 @@
#define _DEFAULT_SOURCE
#define _BSD_SOURCE
#include "out123_int.h"
#include "../out123_int.h"
#ifdef OPENAL_SUBDIR_OPENAL
#include <OpenAL/al.h>
@@ -25,7 +25,7 @@
#include <errno.h>
#include <unistd.h>
#include "debug.h"
#include "../../common/debug.h"
#define NUM_BUFFERS 16

View File

@@ -6,7 +6,7 @@
initially written by Samuel Audet
*/
#include "out123_int.h"
#include "../out123_int.h"
#undef VERSION /* The VERSION macro conflicts with the OS/2 multimedia headers */
@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <ctype.h>
#include "debug.h"
#include "../../common/debug.h"
// Only one instance at a time! This all needs to go into userptr!
static BOOL opened = FALSE;

View File

@@ -6,7 +6,7 @@
initially written by Michael Hipp
*/
#include "out123_int.h"
#include "../out123_int.h"
#include <sys/ioctl.h>
#include <fcntl.h>
@@ -39,7 +39,7 @@
# endif
#endif
#include "debug.h"
#include "../../common/debug.h"
struct oss_stuff
{
@@ -312,7 +312,7 @@ mpg123_module_t mpg123_output_module_info = {
/* api_version */ MPG123_MODULE_API_VERSION,
/* name */ "oss",
/* description */ "Output audio using OSS",
/* revision */ "$Rev: 4021 $",
/* revision */ "$Rev: 5386 $",
/* handle */ NULL,
/* init_output */ init_oss,

View File

@@ -9,7 +9,7 @@
/* Need usleep(). */
#define _DEFAULT_SOURCE
#define _BSD_SOURCE
#include "out123_int.h"
#include "../out123_int.h"
#include <math.h>
#include <portaudio.h>
@@ -19,9 +19,9 @@
/* Including the sfifo code locally, to avoid module linkage issues. */
#define SFIFO_STATIC
#include "sfifo.c"
#include "../sfifo.c"
#include "debug.h"
#include "../../common/debug.h"
#define SAMPLE_SIZE (2)
#define FRAMES_PER_BUFFER (256)

View File

@@ -6,7 +6,7 @@
initially written by Nicholas J. Humfrey
*/
#include "out123_int.h"
#include "../out123_int.h"
#include <stdlib.h>
#include <stdio.h>
@@ -19,7 +19,7 @@
#include <pulse/error.h>
#include <pulse/pulseaudio.h>
#include "debug.h"
#include "../../common/debug.h"
// Since we learned the async API for enumeration, let's abuse it for
// a simple check if a pulse server is active before accidentally

View File

@@ -7,13 +7,13 @@
written by Mike Gorchak <mike.gorchak.qnx@gmail.com>
*/
#include "out123_int.h"
#include "../out123_int.h"
#include <errno.h>
#include <stdint.h>
#include <sys/asoundlib.h>
#include "debug.h"
#include "../../common/debug.h"
typedef struct _qsa_mp_map
{

View File

@@ -10,7 +10,7 @@
#define _XOPEN_SOURCE 500
#define _DEFAULT_SOURCE
#include "out123_int.h"
#include "../out123_int.h"
#include <math.h>
#include <SDL.h>
@@ -21,9 +21,9 @@
/* Including the sfifo code locally, to avoid module linkage issues. */
#define SFIFO_STATIC
#include "sfifo.c"
#include "../sfifo.c"
#include "debug.h"
#include "../../common/debug.h"
#define SAMPLE_SIZE (2)

View File

@@ -6,11 +6,11 @@
initially written (as it seems) by Thomas Woerner
*/
#include "out123_int.h"
#include "../out123_int.h"
#include <fcntl.h>
#include <dmedia/audio.h>
#include "errno.h"
#include "debug.h"
#include <errno.h>
#include "../../common/debug.h"
static int set_rate(out123_handle *ao, ALconfig config)
{

View File

@@ -17,11 +17,11 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "out123_int.h"
#include "../out123_int.h"
#include <sndio.h>
#include "debug.h"
#include "../../common/debug.h"
static int sndio_to_mpg123_enc(int sign, int bits)
{

View File

@@ -6,7 +6,7 @@
initially written by Michael Hipp
*/
#include "out123_int.h"
#include "../out123_int.h"
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
@@ -29,7 +29,7 @@
#endif
#include <fcntl.h>
#include "debug.h"
#include "../../common/debug.h"
static void set_format_helper(out123_handle *ao, audio_info_t *ainfo)
{
@@ -274,7 +274,7 @@ mpg123_module_t mpg123_output_module_info = {
/* api_version */ MPG123_MODULE_API_VERSION,
/* name */ "sun",
/* description */ "Audio output for Sun Audio.",
/* revision */ "$Rev: 4625 $",
/* revision */ "$Rev: 5386 $",
/* handle */ NULL,
/* init_output */ init_sun,

View File

@@ -7,12 +7,12 @@
initially written by Jarno Lehtinen <lehtinen@sci.fi>
*/
#include "out123_int.h"
#include "../out123_int.h"
#include <errno.h>
#include <tinyalsa/asoundlib.h>
#include "debug.h"
#include "../../common/debug.h"
typedef struct

View File

@@ -9,9 +9,9 @@
Closing buffer playback fixed by David Wohlferd <limegreensocks (*) yahoo dod com>
*/
#include "out123_int.h"
#include "../out123_int.h"
#include <windows.h>
#include "debug.h"
#include "../../common/debug.h"
/*
Buffer size and number of buffers in the playback ring

View File

@@ -14,14 +14,14 @@
# define _WIN32_WINNT 0x0601
#endif
#define COBJMACROS 1
#include "out123_int.h"
#include "../out123_int.h"
#include <inttypes.h>
#include <initguid.h>
#include <audioclient.h>
#include <mmdeviceapi.h>
#include <avrt.h>
#include <functiondiscoverykeys_devpkey.h>
#include "debug.h"
#include "../../common/debug.h"
#ifdef _MSC_VER

View File

@@ -1,751 +0,0 @@
/*
out123: audio output interface
copyright 1995-2016 by the mpg123 project,
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written as audio.h by Michael Hipp, reworked into out123 API
by Thomas Orgis
*/
#ifndef _OUT123_H_
#define _OUT123_H_
/** \file out123.h The header file for the libout123 audio output facility. */
/** A macro to check at compile time which set of API functions to expect.
* This must be incremented at least each time a new symbol is added
* to the header.
*/
#define OUT123_API_VERSION 5
/** library patch level at client build time */
#define OUT123_PATCHLEVEL 0
/* We only need size_t definition. */
#include <stddef.h>
/* Common audio encoding specification, including a macro for getting
* size of encoded samples in bytes. Said macro is still hardcoded
* into out123_encsize(). Relying on this one may help an old program
* know sizes of encodings added to fmt123.h later on.
* If you don't care, just use the macro.
*/
#include "fmt123.h"
#ifndef MPG123_EXPORT
/** Defines needed for MS Visual Studio(tm) DLL builds.
* Every public function must be prefixed with MPG123_EXPORT. When building
* 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
* with the DLL. When consuming the DLL ensure to define LINK_MPG123_DLL which
* imports the functions from the DLL.
*/
#ifdef BUILD_MPG123_DLL
/* The dll exports. */
#define MPG123_EXPORT __declspec(dllexport)
#else
#ifdef LINK_MPG123_DLL
/* The exe imports. */
#define MPG123_EXPORT __declspec(dllimport)
#else
/* Nothing on normal/UNIX builds */
#define MPG123_EXPORT
#endif
#endif
#endif
/* Earlier versions of libout123 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
* to have them in API calls. Thus, the default is to remap calls and
* structs to variants that use plain ints. Define MPG123_ENUM_API to
* prevent that remapping.
*
* You might want to define this to increase the chance of your binary
* working with an older version of the library. But if that is your goal,
* you should better build with an older version to begin with.
*/
#ifndef MPG123_ENUM_API
#define out123_param out123_param2
#define out123_getparam out123_getparam2
#endif
#ifdef __cplusplus
extern "C" {
#endif
/** \defgroup out123_api out123 library API
* This is out123, a library focused on continuous playback of audio streams
* via various platform-specific output methods. It glosses over details of
* the native APIs to give an interface close to simply writing data to a
* file. There might be the option to tune details like buffer (period) sizes
* and the number of them on the device side in future, but the focus of the
* library is to ease the use case of just getting that raw audio data out
* there, without interruptions.
*
* The basic idea is to create a handle with out123_new() and open a certain
* output device (using a certain driver module, possibly build-time defaults)
* with out123_open(). Now, you can query the output device for supported
* encodings for given rate and channel count with out123_get_encodings() and
* decide what to use for actually starting playback with out123_start().
*
* Then, you just need to provide (interleaved pcm) data for playback with
* out123_play(), which will block when the device's buffers are full. You get
* your timing from that (instead of callbacks). If your program does the
* production of the audio data just a little bit faster than the playback,
* causing out123_play() to block ever so briefly, you're fine.
*
* You stop playback with out123_stop(), or just close the device and driver
* via out123_close(), or even just decide to drop it all and do out123_del()
* right away when you're done.
*
* There are other functions for specific needs, but the basic idea should be
* covered by the above.
*
* Note that the driver modules that bind to the operating system API for
* output might impose restrictions on what you can safely do regarding your
* out123_handle and multiple threads or processes. You should be on the safe
* side ensuring that you confine usage of a handle to a single thread instead
* of passing it around.
@{
*/
/** Opaque structure for the libout123 handle. */
struct out123_struct;
/** Typedef shortcut as preferrend name for the handle type. */
typedef struct out123_struct out123_handle;
/** Get version of the mpg123 distribution this library build came with.
* (optional means non-NULL)
* \param major optional address to store major version number
* \param minor optional address to store minor version number
* \param patch optional address to store patchlevel version number
* \return full version string (like "1.2.3-beta4 (experimental)")
*/
MPG123_EXPORT
const char *out123_distversion(unsigned int *major, unsigned int *minor, unsigned int *patch);
/** Get API version of library build.
* \param patch optional address to store patchlevel
* \return API version of library
*/
MPG123_EXPORT
unsigned int out123_libversion(unsigned int *patch);
/** Enumeration of codes for the parameters that it is possible to set/get. */
enum out123_parms
{
OUT123_FLAGS = 1 /**< integer, various flags, see enum #out123_flags */
, OUT123_PRELOAD /**< float, fraction of buffer to fill before playback */
, OUT123_GAIN /**< integer, output device gain (module-specific) */
, OUT123_VERBOSE /**< integer, verbosity to stderr, >= 0 */
, OUT123_DEVICEBUFFER /**<
* float, length of device buffer in seconds;
* This might be ignored, might have only a loose relation to actual
* buffer sizes and latency, depending on output driver. Try to tune
* this before opening a device if you want to influcence latency or reduce
* dropouts. Value <= 0 uses some default, usually favouring stable playback
* over low latency. Values above 0.5 are probably too much.
*/
, OUT123_PROPFLAGS /**< integer, query driver/device property flags (r/o) */
, OUT123_NAME /**< string, name of this instance (NULL restores default);
* The value returned by out123_getparam() might be different if the audio
* backend changed it (to be unique among clients, p.ex.).
* TODO: The name provided here is used as prefix in diagnostic messages. */
, OUT123_BINDIR /**< string, path to a program binary directory to use
* as starting point in the search for the output module directory
* (e.g. ../lib/mpg123 or ./plugins). The environment variable MPG123_MODDIR
* is always tried first and the in-built installation path last.
*/
, OUT123_ADD_FLAGS /**< enable given flags */
, OUT123_REMOVE_FLAGS /**< disable diven flags */
};
/** Flags to tune out123 behaviour */
enum out123_flags
{
OUT123_HEADPHONES = 0x01 /**< output to headphones (if supported) */
, OUT123_INTERNAL_SPEAKER = 0x02 /**< output to speaker (if supported) */
, OUT123_LINE_OUT = 0x04 /**< output to line out (if supported) */
, OUT123_QUIET = 0x08 /**< no printouts to standard error */
, OUT123_KEEP_PLAYING = 0x10 /**<
* When this is set (default), playback continues in a loop when the device
* does not consume all given data at once. This happens when encountering
* signals (like SIGSTOP, SIGCONT) that cause interruption of the underlying
* functions.
* Note that this flag is meaningless when the optional buffer is employed,
* There, your program will always block until the buffer completely took
* over the data given to it via out123_play(), unless a communication error
* arises.
*/
, OUT123_MUTE = 0x20 /**< software mute (play silent audio) */
};
/** Read-only output driver/device property flags (OUT123_PROPFLAGS). */
enum out123_propflags
{
OUT123_PROP_LIVE = 0x01 /**< This is a live output, meaning that
* special care might be needed for pauses in playback (p.ex. stream
* of silence instead of interruption), as opposed to files on disk.
*/
, OUT123_PROP_PERSISTENT = 0x02 /**< This (live) output does not need
* special care for pauses (continues with silence itself),
* out123_pause() does nothing to the device.
*/
};
/** Create a new output handle.
* This only allocates and initializes memory, so the only possible
* error condition is running out of memory.
* \return pointer to new handle or NULL on error
*/
MPG123_EXPORT
out123_handle *out123_new(void);
/** Delete output handle.
* This implies out123_close().
*/
MPG123_EXPORT
void out123_del(out123_handle *ao);
/** Free plain memory allocated within libout123.
* This is for library users that are not sure to use the same underlying
* memory allocator as libout123. It is just a wrapper over free() in
* the underlying C library.
*/
MPG123_EXPORT void out123_free(void *ptr);
/** Error code enumeration
* API calls return a useful (positve) value or zero (OUT123_OK) on simple
* success. A negative value (-1 == OUT123_ERR) usually indicates that some
* error occured. Which one, that can be queried using out123_errcode()
* and friends.
*/
enum out123_error
{
OUT123_ERR = -1 /**< generic alias for verbosity, always == -1 */
, OUT123_OK = 0 /**< just a name for zero, not going to change */
, OUT123_DOOM /**< dazzled, out of memory */
, OUT123_BAD_DRIVER_NAME /**< bad driver name given */
, OUT123_BAD_DRIVER /**< unspecified issue loading a driver */
, OUT123_NO_DRIVER /**< no driver loaded */
, OUT123_NOT_LIVE /**< no active audio device */
, OUT123_DEV_PLAY /**< some device playback error */
, OUT123_DEV_OPEN /**< error opening device */
, OUT123_BUFFER_ERROR /**<
* Some (really unexpected) error in buffer infrastructure.
*/
, OUT123_MODULE_ERROR /**< basic failure in module loading */
, OUT123_ARG_ERROR /**< some bad function arguments supplied */
, OUT123_BAD_PARAM /**< unknown parameter code */
, OUT123_SET_RO_PARAM /**< attempt to set read-only parameter */
, OUT123_BAD_HANDLE /**< bad handle pointer (NULL, usually) */
, OUT123_NOT_SUPPORTED /**< some requested operation is not supported (right now) */
, OUT123_DEV_ENUMERATE /**< device enumeration itself failed */
, OUT123_ERRCOUNT /**< placeholder for shaping arrays */
};
/** Get string representation of last encountered error in the
* context of given handle.
* \param ao handle
* \return error string
*/
MPG123_EXPORT
const char* out123_strerror(out123_handle *ao);
/** Get the plain errcode intead of a string.
* Note that this used to return OUT123_ERR instead of
* OUT123_BAD_HANDLE in case of ao==NULL before mpg123-1.23.5 .
* \param ao handle
* \return error code recorded in handle or OUT123_BAD_HANDLE
*/
MPG123_EXPORT
int out123_errcode(out123_handle *ao);
/** Return the error string for a given error code.
* \param errcode the integer error code
* \return error string
*/
MPG123_EXPORT
const char* out123_plain_strerror(int errcode);
/** Set a desired output buffer size.
* This starts a separate process that handles the audio output, decoupling
* the latter from the main process with a memory buffer and saving you the
* burden to ensure sparing CPU cycles for actual playback.
* This is for applicatons that prefer continuous playback over small latency.
* In other words: The kind of applications that out123 is designed for.
* This routine always kills off any currently active audio output module /
* device, even if you just disable the buffer when there is no buffer.
*
* Keep this in mind for memory-constrainted systems: Activating the
* buffer causes a fork of the calling process, doubling the virtual memory
* use. Depending on your operating system kernel's behaviour regarding
* memory overcommit, it might be wise to call out123_set_buffer() very
* early in your program before allocating lots of memory.
*
* There _might_ be a change to threads in future, but for now this is
* classic fork with shared memory, working without any threading library.
* If your platform or build does not support that, you will always get an
* error on trying to set up a non-zero buffer (but the API call will be
* present).
*
* Also, if you do intend to use this from a multithreaded program, think
* twice and make sure that your setup is happy with forking full-blown
* processes off threaded programs. Probably you are better off spawning a
* buffer thread yourself.
*
* \param ao handle
* \param buffer_bytes size (bytes) of a memory buffer for decoded audio,
* a value of zero disables the buffer.
* \return 0 on success, OUT123_ERR on error
*/
MPG123_EXPORT
int out123_set_buffer(out123_handle *ao, size_t buffer_bytes);
#ifdef MPG123_ENUM_API
/** Set a parameter on a out123_handle.
*
* Note that this name is mapped to out123_param2() instead unless
* MPG123_ENUM_API is defined.
*
* The parameters usually only change what happens on next out123_open, not
* incfluencing running operation. There are macros To ease the API a bit:
* You can call out123_param_int(ao, code, value) for integer (long) values,
* same with out123_param_float() and out123_param_string().
*
* \param ao handle
* \param code parameter code
* \param value input value for integer parameters
* \param fvalue input value for floating point parameters
* \param svalue input value for string parameters (contens are copied)
* \return 0 on success, OUT123_ERR on error.
*/
MPG123_EXPORT
int out123_param( out123_handle *ao, enum out123_parms code
, long value, double fvalue, const char *svalue );
#endif
/** Set a parameter on a out123_handle. No enum.
*
* This is actually called instead of out123_param()
* unless MPG123_ENUM_API is defined.
*
* The parameters usually only change what happens on next out123_open, not
* incfluencing running operation. There are macros To ease the API a bit:
* You can call out123_param_int(ao, code, value) for integer (long) values,
* same with out123_param_float() and out123_param_string().
*
* \param ao handle
* \param code parameter code (from enum #out123_parms)
* \param value input value for integer parameters
* \param fvalue input value for floating point parameters
* \param svalue input value for string parameters (contens are copied)
* \return 0 on success, OUT123_ERR on error.
*/
MPG123_EXPORT
int out123_param2( out123_handle *ao, int code
, long value, double fvalue, const char *svalue );
/** Shortcut for out123_param() to set an integer parameter. */
#define out123_param_int(ao, code, value) \
out123_param((ao), (code), (value), 0., NULL)
/** Shortcut for out123_param() to set a float parameter. */
#define out123_param_float(ao, code, value) \
out123_param((ao), (code), 0, (value), NULL)
/** Shortcut for out123_param() to set an string parameter. */
#define out123_param_string(ao, code, value) \
out123_param((ao), (code), 0, 0., (value))
#ifdef MPG123_ENUM_API
/** Get a parameter from an out123_handle.
*
* Note that this name is mapped to out123_param2() instead unless
* MPG123_ENUM_API is defined.
*
* \param ao handle
* \param code parameter code
* \param ret_value output address for integer parameters
* \param ret_fvalue output address for floating point parameters
* \param ret_svalue output address for string parameters (pointer to
* internal memory, so no messing around, please)
* \return 0 on success, OUT123_ERR on error (bad parameter name or bad handle).
*/
MPG123_EXPORT
int out123_getparam( out123_handle *ao, enum out123_parms code
, long *ret_value, double *ret_fvalue, char* *ret_svalue );
#endif
/** Get a parameter from an out123_handle. No enum.
*
* This is actually called instead of out123_getparam()
* unless MPG123_ENUM_API is defined.
*
* \param ao handle
* \param code parameter code (from enum #out123_parms)
* \param ret_value output address for integer parameters
* \param ret_fvalue output address for floating point parameters
* \param ret_svalue output address for string parameters (pointer to
* internal memory, so no messing around, please)
* \return 0 on success, OUT123_ERR on error (bad parameter name or bad handle).
*/
MPG123_EXPORT
int out123_getparam2( out123_handle *ao, int code
, long *ret_value, double *ret_fvalue, char* *ret_svalue );
/** Shortcut for out123_getparam() to get an integer parameter. */
#define out123_getparam_int(ao, code, value) \
out123_getparam((ao), (code), (value), NULL, NULL)
/** Shortcut for out123_getparam() to get a float parameter. */
#define out123_getparam_float(ao, code, value) \
out123_getparam((ao), (code), NULL, (value), NULL)
/** Shortcut for out123_getparam() to get a string parameter. */
#define out123_getparam_string(ao, code, value) \
out123_getparam((ao), (code), NULL, NULL, (value))
/** Copy parameters from another out123_handle.
* \param ao handle
* \param from_ao the handle to copy parameters from
* \return 0 in success, -1 on error
*/
MPG123_EXPORT
int out123_param_from(out123_handle *ao, out123_handle* from_ao);
/** Get list of driver modules reachable in system in C argv-style format.
*
* The client is responsible for freeing the memory of both the individual
* strings and the lists themselves. There is out123_stringlists_free()
* to assist.
*
* A module that is not loadable because of missing libraries is simply
* skipped. You will get stderr messages about that unless OUT123_QUIET was
* was set, though. Failure to open the module directory is a serious error,
* resulting in negative return value.
*
* \param ao handle
* \param names address for storing list of names
* \param descr address for storing list of descriptions
* \return number of drivers found, -1 on error
*/
MPG123_EXPORT
int out123_drivers(out123_handle *ao, char ***names, char ***descr);
/** Get a list of available output devices for a given driver.
*
* If the driver supports enumeration, you can get a listing of possible
* output devices. If this list is exhaustive, depends on the driver.
* Note that this implies out123_close(). When you have a device already
* open, you don't need to look for one anymore. If you really do, just
* create another handle.
*
* Your provided pointers are only used for non-negative return values.
* In this case, you are responsible for freeing the associated memory of
* the strings and the lists themselves. The format of the lists is an
* array of char pointers, with the returned count just like the usual
* C argv and argc. There is out123_stringlists_free() to assist.
*
* Note: Calling this on a handle with a configured buffer process will
* yield #OUT123_NOT_SUPPORTED.
*
* \param ao handle
* \param driver driver name or comma-separated list of names
* to try, just like for out123_open(), possibly NULL for some default
* \param names address for storing list of names
* \param descr address for storing list of descriptions
* \param active_driver address for storing a copy of the actually active
* driver name (in case you gave a list or NULL as driver), can be NULL
* if not interesting
* \return count of devices or #OUT123_ERR if some error was encountered,
* possibly just #OUT123_NOT_SUPPORTED if the driver lacks enumeration support
*/
MPG123_EXPORT
int out123_devices( out123_handle *ao, const char *driver
, char ***names, char ***descr, char **active_driver );
/** Helper to free string list memory.
*
* This aids in freeing the memory allocated by out123_devices() and
* out123_drivers().
*
* Any of the given lists can be NULL and nothing will happen to it.
*
* \param name first string list
* \param descr second string list
* \param count count of strings
*/
MPG123_EXPORT
void out123_stringlists_free(char **name, char **descr, int count);
/** Open an output device with a certain driver
* Note: Opening means that the driver code is loaded and the desired
* device name recorded, possibly tested for availability or tentatively
* opened. After out123_open(), you can ask for supported encodings
* and then really open the device for playback with out123_start().
* \param ao handle
* \param driver (comma-separated list of) output driver name(s to try),
* NULL for default
* \param device device name to open, NULL for default
* (stdout for file-based drivers)
* \return 0 on success, -1 on error.
*/
MPG123_EXPORT
int out123_open(out123_handle *ao, const char* driver, const char* device);
/** Give info about currently loaded driver and device
* Any of the return addresses can be NULL if you are not interested in
* everything. You get pointers to internal storage. They are valid
* as long as the driver/device combination is opened.
* The device may be NULL indicating some unnamed default.
* TODO: Make the driver modules return names for such defaults.
* \param ao handle
* \param driver return address for driver name
* \param device return address for device name
* \return 0 on success, -1 on error (i.e. no driver loaded)
*/
MPG123_EXPORT
int out123_driver_info(out123_handle *ao, char **driver, char **device);
/** Close the current output device and driver.
* This implies out123_drain() to ensure no data is lost.
* With a buffer, that might cause considerable delay during
* which your main application is blocked waiting.
* Call out123_drop() beforehand if you want to end things
* quickly.
* \param ao handle
*/
MPG123_EXPORT
void out123_close(out123_handle *ao);
/** Get supported audio encodings for given rate and channel count,
* for the currently openend audio device.
* Usually, a wider range of rates is supported, but the number
* of sample encodings is limited, as is the number of channels.
* So you can call this with some standard rate and hope that the
* returned encodings work also for others, with the tested channel
* count.
* The return value of -1 on some encountered error conveniently also
* does not match any defined format (only 15 bits used for encodings,
* so this would even work with 16 bit integers).
* This implies out123_stop() to enter query mode.
* \param ao handle
* \param rate sampling rate
* \param channels number of channels
* \return supported encodings combined with bitwise or, to be checked
* against your favourite bitmask, -1 on error
*/
MPG123_EXPORT
int out123_encodings(out123_handle *ao, long rate, int channels);
/** Return the size (in bytes) of one mono sample of the named encoding.
* \param encoding The encoding value to analyze.
* \return positive size of encoding in bytes, 0 on invalid encoding. */
MPG123_EXPORT int out123_encsize(int encoding);
/** Get list of supported formats for currently opened audio device.
* Given a list of sampling rates and minimal/maximal channel count,
* this quickly checks what formats are supported with these
* constraints. The first entry is always reserved for a default
* format for the output device. If there is no such default,
* all values of the format are -1.
* For each requested combination of rate and channels, a format entry is
* created, possible with encoding value 0 to indicate that this combination
* has been tested and rejected. So, when there is no basic error, the
* number of returned format entries should be
* (ratecount*(maxchannels-minchannels+1)+1)
* . But instead of forcing you to guess, this will be allocated by
* successful run.
* For the first entry, the encoding member is supposed to be a definite
* encoding, for the others it is a bitwise combination of all possible
* encodings.
* This function is more efficient than many calls to out123_encodings().
* \param ao handle
* \param rates pointer to an array of sampling rates, may be NULL for none
* \param ratecount number of provided sampling rates
* \param minchannels minimal channel count
* \param maxchannels maximal channel count
* \param fmtlist return address for array of supported formats
* the encoding field of each entry is a combination of all
* supported encodings at this rate and channel count;
* Memory shall be freed by user.
* \return number of returned format enries, -1 on error
*/
MPG123_EXPORT
int out123_formats( out123_handle *ao, const long *rates, int ratecount
, int minchannels, int maxchannels
, struct mpg123_fmt **fmtlist );
/** Get list of encodings known to the library.
* You are responsible for freeing the allocated array.
* \param enclist return address for allocated array of encoding codes
* \return number of encodings, -1 on error
*/
MPG123_EXPORT
int out123_enc_list(int **enclist);
/** Find encoding code by name.
* \param name short or long name to find encoding code for
* \return encoding if found (enum #mpg123_enc_enum), else 0
*/
MPG123_EXPORT
int out123_enc_byname(const char *name);
/** Get name of encoding.
* \param encoding code (enum #mpg123_enc_enum)
* \return short name for valid encodings, NULL otherwise
*/
MPG123_EXPORT
const char* out123_enc_name(int encoding);
/** Get long name of encoding.
* \param encoding code (enum #mpg123_enc_enum)
* \return long name for valid encodings, NULL otherwise
*/
MPG123_EXPORT
const char* out123_enc_longname(int encoding);
/** Start playback with a certain output format
* It might be a good idea to have audio data handy to feed after this
* returns with success.
* Rationale for not taking a pointer to struct mpg123_fmt: This would
* always force you to deal with that type and needlessly enlarge the
* shortest possible program.
* \param ao handle
* \param encoding sample encoding (values matching libmpg123 API)
* \param channels number of channels (1 or 2, usually)
* \param rate sampling rate
* \return 0 on success, negative on error (bad format, usually)
*/
MPG123_EXPORT
int out123_start( out123_handle *ao
, long rate, int channels, int encoding );
/** Pause playback
* Interrupt playback, holding any data in the optional buffer.
*
* This closes the audio device if it is a live sink, ready to be re-opened
* by out123_continue() or out123_play() with the existing parameters.
* \param ao handle
*/
MPG123_EXPORT
void out123_pause(out123_handle *ao);
/** Continue playback
* The counterpart to out123_pause(). Announce to the driver that playback
* shall continue.
*
* Playback might not resume immediately if the optional buffer is configured
* to wait for a minimum fill and close to being empty. You can force playback
* of the last scrap with out123_drain(), or just by feeding more data with
* out123_play(), which will trigger out123_continue() for you, too.
* \param ao handle
*/
MPG123_EXPORT
void out123_continue(out123_handle *ao);
/** Stop playback.
* This waits for pending audio data to drain to the speakers.
* You might want to call out123_drop() before stopping if you want
* to end things right away.
* \param ao handle
*/
MPG123_EXPORT
void out123_stop(out123_handle *ao);
/** Hand over data for playback and wait in case audio device is busy.
* This survives non-fatal signals like SIGSTOP/SIGCONT and keeps on
* playing until the buffer is done with if the flag
* OUT123_KEEP_PLAYING ist set (default). So, per default, if
* you provided a byte count divisible by the PCM frame size, it is an
* error when less bytes than given are played.
* To be sure if an error occured, check out123_errcode().
* Also note that it is no accident that the buffer parameter is not marked
* as constant. Some output drivers might need to do things like swap
* byte order. This is done in-place instead of wasting memory on yet
* another copy. Software muting also overwrites the data.
* \param ao handle
* \param buffer pointer to raw audio data to be played
* \param bytes number of bytes to read from the buffer
* \return number of bytes played (might be less than given, even zero)
*/
MPG123_EXPORT
size_t out123_play( out123_handle *ao
, void *buffer, size_t bytes );
/** Drop any buffered data, making next provided data play right away.
* This does not imply an actual pause in playback.
* You are expected to play something, unless you called out123_pause().
* Feel free to call out123_stop() afterwards instead for a quicker
* exit than the implied out123_drain().
* For live sinks, this may include dropping data from their buffers.
* For others (files), this only concerns data in the optional buffer.
* \param ao handle
*/
MPG123_EXPORT
void out123_drop(out123_handle *ao);
/** Drain the output, waiting until all data went to the hardware.
* This does imply out123_continue() before and out123_pause()
* after draining.
* This might involve only the optional buffer process, or the
* buffers on the audio driver side, too.
* \param ao handle
*/
MPG123_EXPORT
void out123_drain(out123_handle *ao);
/** Drain the output, but only partially up to the given number of
* bytes. This gives you the opportunity to do something while
* the optional buffer is writing remaining data instead of having
* one atomic API call for it all.
*
* It is wholly expected that the return value of out123_buffered()
* before and after calling this has a bigger difference than the
* provided limit, as the buffer is writing all the time in the
* background.
*
* This is just a plain out123_drain() if the optional buffer is not
* in use. Also triggers out123_continue(), but only out123_pause()
* if there is no buffered data anymore.
* \param ao handle
* \param bytes limit of buffered bytes to drain
* \return number of bytes drained from buffer
*/
MPG123_EXPORT
void out123_ndrain(out123_handle *ao, size_t bytes);
/** Get an indication of how many bytes reside in the optional buffer.
* This might get extended to tell the number of bytes queued up in the
* audio backend, too.
* \param ao handle
* \return number of bytes in out123 library buffer
*/
MPG123_EXPORT
size_t out123_buffered(out123_handle *ao);
/** Extract currently used audio format from handle.
* matching mpg123_getformat().
* Given return addresses may be NULL to indicate no interest.
* \param ao handle
* \param rate address for sample rate
* \param channels address for channel count
* \param encoding address for encoding
* \param framesize size of a full PCM frame (for convenience)
* \return 0 on success, -1 on error
*/
MPG123_EXPORT
int out123_getformat( out123_handle *ao
, long *rate, int *channels, int *encoding, int *framesize );
/** @} */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -12,8 +12,8 @@
#define MPG123_ENUM_API
#include "config.h"
#include "abi_align.h"
#include "compat.h"
#include "../common/abi_align.h"
#include "../compat/compat.h"
#include "out123.h"
#include "module.h"

View File

@@ -19,7 +19,7 @@ TODO:
#include <stdlib.h>
#include "sfifo.h"
#include "debug.h"
#include "../common/debug.h"
/*
* Alloc buffer, init FIFO etc...

View File

@@ -10,7 +10,7 @@
functions just for returning driver module lists.
*/
#include "compat.h"
#include "../compat/compat.h"
#include "out123.h"
static char* always_strdup(const char *in)

View File

@@ -28,7 +28,7 @@
#include "wav.h"
#include <errno.h>
#include "debug.h"
#include "../common/debug.h"
/* Create the two WAV headers. */

View File

@@ -10,7 +10,7 @@
*/
#include "config.h"
#include "compat.h"
#include "../compat/compat.h"
#include "xfermem.h"
#include <string.h>
#include <errno.h>
@@ -24,7 +24,7 @@
#include <sys/shm.h>
#endif
#include "debug.h"
#include "../common/debug.h"
#if defined (HAVE_MMAP) && defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
#define MAP_ANON MAP_ANONYMOUS

View File

@@ -20,7 +20,7 @@
#ifndef _XFERMEM_H_
#define _XFERMEM_H_
#include "compat.h"
#include "../compat/compat.h"
typedef struct {
size_t freeindex; /* [W] next free index */