commit
8baf780aa5
|
|
@ -28,4 +28,6 @@ elseif(APPLE)
|
||||||
endif()
|
endif()
|
||||||
elseif(OHOS)
|
elseif(OHOS)
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/ohos/CMakeLists.txt)
|
include(${CMAKE_CURRENT_LIST_DIR}/ohos/CMakeLists.txt)
|
||||||
|
elseif(EMSCRIPTEN)
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/emscripten/CMakeLists.txt)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ endif()
|
||||||
|
|
||||||
############################# glslang #############################
|
############################# glslang #############################
|
||||||
|
|
||||||
set(glslang_libs_name glslang glslang-default-resource-limits SPIRV MachineIndependent OGLCompiler OSDependent SPIRV-Tools-opt SPIRV-Tools GenericCodeGen)
|
set(glslang_libs_name glslang glslang-default-resource-limits MachineIndependent OGLCompiler OSDependent SPIRV SPIRV-Tools-opt SPIRV-Tools GenericCodeGen)
|
||||||
foreach(lib IN LISTS glslang_libs_name)
|
foreach(lib IN LISTS glslang_libs_name)
|
||||||
add_library(${lib} STATIC IMPORTED GLOBAL)
|
add_library(${lib} STATIC IMPORTED GLOBAL)
|
||||||
set_target_properties(${lib} PROPERTIES
|
set_target_properties(${lib} PROPERTIES
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,9 @@ elseif(MACOSX)
|
||||||
elseif(OHOS)
|
elseif(OHOS)
|
||||||
set(platform_name ohos)
|
set(platform_name ohos)
|
||||||
set(platform_spec_path ohos/${OHOS_ARCH})
|
set(platform_spec_path ohos/${OHOS_ARCH})
|
||||||
|
elseif(EMSCRIPTEN)
|
||||||
|
set(platform_name emscripten)
|
||||||
|
set(platform_spec_path emscripten)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(platform_spec_path "${CMAKE_CURRENT_LIST_DIR}/../${platform_spec_path}")
|
set(platform_spec_path "${CMAKE_CURRENT_LIST_DIR}/../${platform_spec_path}")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
|
||||||
|
add_library(z STATIC IMPORTED GLOBAL)
|
||||||
|
set_target_properties(z PROPERTIES
|
||||||
|
IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/libs/libz.a
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/include/zlib
|
||||||
|
)
|
||||||
|
|
||||||
|
############################# SPIRV-Cross #############################
|
||||||
|
# add_library(spirv-cross-core STATIC IMPORTED GLOBAL)
|
||||||
|
# set_target_properties(spirv-cross-core PROPERTIES
|
||||||
|
# IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/libs/libspirv-cross-core.a
|
||||||
|
# INTERFACE_INCLUDE_DIRECTORIES "${SPIRV_INCLUDE_DIRS}"
|
||||||
|
# )
|
||||||
|
# add_library(spirv-cross-msl STATIC IMPORTED GLOBAL)
|
||||||
|
# set_target_properties(spirv-cross-msl PROPERTIES
|
||||||
|
# IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/libs/libspirv-cross-msl.a
|
||||||
|
# )
|
||||||
|
# add_library(spirv-cross-glsl STATIC IMPORTED GLOBAL)
|
||||||
|
# set_target_properties(spirv-cross-glsl PROPERTIES
|
||||||
|
# IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/libs/libspirv-cross-glsl.a
|
||||||
|
# )
|
||||||
|
# set(spirv-cross_libs_name spirv-cross-core spirv-cross-glsl spirv-cross-msl)
|
||||||
|
|
||||||
|
############################# TBB #############################
|
||||||
|
|
||||||
|
# add_library(tbb STATIC IMPORTED GLOBAL)
|
||||||
|
# set_target_properties(tbb PROPERTIES
|
||||||
|
# IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/libs/libtbb_static.a
|
||||||
|
# )
|
||||||
|
# add_library(tbbmalloc STATIC IMPORTED GLOBAL)
|
||||||
|
# set_target_properties(tbbmalloc PROPERTIES
|
||||||
|
# IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/libs/libtbbmalloc_static.a
|
||||||
|
# )
|
||||||
|
# add_library(tbbmalloc_proxy STATIC IMPORTED GLOBAL)
|
||||||
|
# set_target_properties(tbbmalloc_proxy PROPERTIES
|
||||||
|
# IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/libs/libtbbmalloc_proxy_static.a
|
||||||
|
# )
|
||||||
|
# set(tbb_libs_name tbb tbbmalloc tbbmalloc_proxy)
|
||||||
|
|
||||||
|
#if(USE_PHYSICS_PHYSX)
|
||||||
|
# set(PhysXSDK PhysX PhysXCommon PhysXFoundation PhysXExtensions PhysXCooking PhysXCharacterKinematic PhysXVehicle PhysXPvdSDK)
|
||||||
|
# foreach(PX IN LISTS PhysXSDK)
|
||||||
|
# add_library(${PX} STATIC IMPORTED GLOBAL)
|
||||||
|
# set_target_properties(${PX} PROPERTIES
|
||||||
|
# IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/libs/PhysX/lib${PX}_static_64.a
|
||||||
|
# )
|
||||||
|
# endforeach()
|
||||||
|
#else()
|
||||||
|
# set(PhysXSDK)
|
||||||
|
#endif()
|
||||||
|
|
||||||
|
list(APPEND CC_EXTERNAL_LIBS
|
||||||
|
#freetype
|
||||||
|
#jpeg
|
||||||
|
#png
|
||||||
|
#webp
|
||||||
|
#curl
|
||||||
|
#crypto
|
||||||
|
#ssl
|
||||||
|
#${tbb_libs_name}
|
||||||
|
#${PhysXSDK}
|
||||||
|
)
|
||||||
|
|
||||||
|
set(ZLIB z)
|
||||||
|
if(NOT USE_MODULES)
|
||||||
|
list(APPEND CC_EXTERNAL_LIBS ${ZLIB})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
list(APPEND CC_EXTERNAL_INCLUDES
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/include
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,534 @@
|
||||||
|
/* zconf.h -- configuration of the zlib compression library
|
||||||
|
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
|
||||||
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* @(#) $Id$ */
|
||||||
|
|
||||||
|
#ifndef ZCONF_H
|
||||||
|
#define ZCONF_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If you *really* need a unique prefix for all types and library functions,
|
||||||
|
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||||
|
* Even better than compiling with -DZ_PREFIX would be to use configure to set
|
||||||
|
* this permanently in zconf.h using "./configure --zprefix".
|
||||||
|
*/
|
||||||
|
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
|
||||||
|
# define Z_PREFIX_SET
|
||||||
|
|
||||||
|
/* all linked symbols and init macros */
|
||||||
|
# define _dist_code z__dist_code
|
||||||
|
# define _length_code z__length_code
|
||||||
|
# define _tr_align z__tr_align
|
||||||
|
# define _tr_flush_bits z__tr_flush_bits
|
||||||
|
# define _tr_flush_block z__tr_flush_block
|
||||||
|
# define _tr_init z__tr_init
|
||||||
|
# define _tr_stored_block z__tr_stored_block
|
||||||
|
# define _tr_tally z__tr_tally
|
||||||
|
# define adler32 z_adler32
|
||||||
|
# define adler32_combine z_adler32_combine
|
||||||
|
# define adler32_combine64 z_adler32_combine64
|
||||||
|
# define adler32_z z_adler32_z
|
||||||
|
# ifndef Z_SOLO
|
||||||
|
# define compress z_compress
|
||||||
|
# define compress2 z_compress2
|
||||||
|
# define compressBound z_compressBound
|
||||||
|
# endif
|
||||||
|
# define crc32 z_crc32
|
||||||
|
# define crc32_combine z_crc32_combine
|
||||||
|
# define crc32_combine64 z_crc32_combine64
|
||||||
|
# define crc32_z z_crc32_z
|
||||||
|
# define deflate z_deflate
|
||||||
|
# define deflateBound z_deflateBound
|
||||||
|
# define deflateCopy z_deflateCopy
|
||||||
|
# define deflateEnd z_deflateEnd
|
||||||
|
# define deflateGetDictionary z_deflateGetDictionary
|
||||||
|
# define deflateInit z_deflateInit
|
||||||
|
# define deflateInit2 z_deflateInit2
|
||||||
|
# define deflateInit2_ z_deflateInit2_
|
||||||
|
# define deflateInit_ z_deflateInit_
|
||||||
|
# define deflateParams z_deflateParams
|
||||||
|
# define deflatePending z_deflatePending
|
||||||
|
# define deflatePrime z_deflatePrime
|
||||||
|
# define deflateReset z_deflateReset
|
||||||
|
# define deflateResetKeep z_deflateResetKeep
|
||||||
|
# define deflateSetDictionary z_deflateSetDictionary
|
||||||
|
# define deflateSetHeader z_deflateSetHeader
|
||||||
|
# define deflateTune z_deflateTune
|
||||||
|
# define deflate_copyright z_deflate_copyright
|
||||||
|
# define get_crc_table z_get_crc_table
|
||||||
|
# ifndef Z_SOLO
|
||||||
|
# define gz_error z_gz_error
|
||||||
|
# define gz_intmax z_gz_intmax
|
||||||
|
# define gz_strwinerror z_gz_strwinerror
|
||||||
|
# define gzbuffer z_gzbuffer
|
||||||
|
# define gzclearerr z_gzclearerr
|
||||||
|
# define gzclose z_gzclose
|
||||||
|
# define gzclose_r z_gzclose_r
|
||||||
|
# define gzclose_w z_gzclose_w
|
||||||
|
# define gzdirect z_gzdirect
|
||||||
|
# define gzdopen z_gzdopen
|
||||||
|
# define gzeof z_gzeof
|
||||||
|
# define gzerror z_gzerror
|
||||||
|
# define gzflush z_gzflush
|
||||||
|
# define gzfread z_gzfread
|
||||||
|
# define gzfwrite z_gzfwrite
|
||||||
|
# define gzgetc z_gzgetc
|
||||||
|
# define gzgetc_ z_gzgetc_
|
||||||
|
# define gzgets z_gzgets
|
||||||
|
# define gzoffset z_gzoffset
|
||||||
|
# define gzoffset64 z_gzoffset64
|
||||||
|
# define gzopen z_gzopen
|
||||||
|
# define gzopen64 z_gzopen64
|
||||||
|
# ifdef _WIN32
|
||||||
|
# define gzopen_w z_gzopen_w
|
||||||
|
# endif
|
||||||
|
# define gzprintf z_gzprintf
|
||||||
|
# define gzputc z_gzputc
|
||||||
|
# define gzputs z_gzputs
|
||||||
|
# define gzread z_gzread
|
||||||
|
# define gzrewind z_gzrewind
|
||||||
|
# define gzseek z_gzseek
|
||||||
|
# define gzseek64 z_gzseek64
|
||||||
|
# define gzsetparams z_gzsetparams
|
||||||
|
# define gztell z_gztell
|
||||||
|
# define gztell64 z_gztell64
|
||||||
|
# define gzungetc z_gzungetc
|
||||||
|
# define gzvprintf z_gzvprintf
|
||||||
|
# define gzwrite z_gzwrite
|
||||||
|
# endif
|
||||||
|
# define inflate z_inflate
|
||||||
|
# define inflateBack z_inflateBack
|
||||||
|
# define inflateBackEnd z_inflateBackEnd
|
||||||
|
# define inflateBackInit z_inflateBackInit
|
||||||
|
# define inflateBackInit_ z_inflateBackInit_
|
||||||
|
# define inflateCodesUsed z_inflateCodesUsed
|
||||||
|
# define inflateCopy z_inflateCopy
|
||||||
|
# define inflateEnd z_inflateEnd
|
||||||
|
# define inflateGetDictionary z_inflateGetDictionary
|
||||||
|
# define inflateGetHeader z_inflateGetHeader
|
||||||
|
# define inflateInit z_inflateInit
|
||||||
|
# define inflateInit2 z_inflateInit2
|
||||||
|
# define inflateInit2_ z_inflateInit2_
|
||||||
|
# define inflateInit_ z_inflateInit_
|
||||||
|
# define inflateMark z_inflateMark
|
||||||
|
# define inflatePrime z_inflatePrime
|
||||||
|
# define inflateReset z_inflateReset
|
||||||
|
# define inflateReset2 z_inflateReset2
|
||||||
|
# define inflateResetKeep z_inflateResetKeep
|
||||||
|
# define inflateSetDictionary z_inflateSetDictionary
|
||||||
|
# define inflateSync z_inflateSync
|
||||||
|
# define inflateSyncPoint z_inflateSyncPoint
|
||||||
|
# define inflateUndermine z_inflateUndermine
|
||||||
|
# define inflateValidate z_inflateValidate
|
||||||
|
# define inflate_copyright z_inflate_copyright
|
||||||
|
# define inflate_fast z_inflate_fast
|
||||||
|
# define inflate_table z_inflate_table
|
||||||
|
# ifndef Z_SOLO
|
||||||
|
# define uncompress z_uncompress
|
||||||
|
# define uncompress2 z_uncompress2
|
||||||
|
# endif
|
||||||
|
# define zError z_zError
|
||||||
|
# ifndef Z_SOLO
|
||||||
|
# define zcalloc z_zcalloc
|
||||||
|
# define zcfree z_zcfree
|
||||||
|
# endif
|
||||||
|
# define zlibCompileFlags z_zlibCompileFlags
|
||||||
|
# define zlibVersion z_zlibVersion
|
||||||
|
|
||||||
|
/* all zlib typedefs in zlib.h and zconf.h */
|
||||||
|
# define Byte z_Byte
|
||||||
|
# define Bytef z_Bytef
|
||||||
|
# define alloc_func z_alloc_func
|
||||||
|
# define charf z_charf
|
||||||
|
# define free_func z_free_func
|
||||||
|
# ifndef Z_SOLO
|
||||||
|
# define gzFile z_gzFile
|
||||||
|
# endif
|
||||||
|
# define gz_header z_gz_header
|
||||||
|
# define gz_headerp z_gz_headerp
|
||||||
|
# define in_func z_in_func
|
||||||
|
# define intf z_intf
|
||||||
|
# define out_func z_out_func
|
||||||
|
# define uInt z_uInt
|
||||||
|
# define uIntf z_uIntf
|
||||||
|
# define uLong z_uLong
|
||||||
|
# define uLongf z_uLongf
|
||||||
|
# define voidp z_voidp
|
||||||
|
# define voidpc z_voidpc
|
||||||
|
# define voidpf z_voidpf
|
||||||
|
|
||||||
|
/* all zlib structs in zlib.h and zconf.h */
|
||||||
|
# define gz_header_s z_gz_header_s
|
||||||
|
# define internal_state z_internal_state
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__MSDOS__) && !defined(MSDOS)
|
||||||
|
# define MSDOS
|
||||||
|
#endif
|
||||||
|
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
|
||||||
|
# define OS2
|
||||||
|
#endif
|
||||||
|
#if defined(_WINDOWS) && !defined(WINDOWS)
|
||||||
|
# define WINDOWS
|
||||||
|
#endif
|
||||||
|
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
|
||||||
|
# ifndef WIN32
|
||||||
|
# define WIN32
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
||||||
|
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
||||||
|
# ifndef SYS16BIT
|
||||||
|
# define SYS16BIT
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
||||||
|
* than 64k bytes at a time (needed on systems with 16-bit int).
|
||||||
|
*/
|
||||||
|
#ifdef SYS16BIT
|
||||||
|
# define MAXSEG_64K
|
||||||
|
#endif
|
||||||
|
#ifdef MSDOS
|
||||||
|
# define UNALIGNED_OK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __STDC_VERSION__
|
||||||
|
# ifndef STDC
|
||||||
|
# define STDC
|
||||||
|
# endif
|
||||||
|
# if __STDC_VERSION__ >= 199901L
|
||||||
|
# ifndef STDC99
|
||||||
|
# define STDC99
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
|
||||||
|
# define STDC
|
||||||
|
#endif
|
||||||
|
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
|
||||||
|
# define STDC
|
||||||
|
#endif
|
||||||
|
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
|
||||||
|
# define STDC
|
||||||
|
#endif
|
||||||
|
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
|
||||||
|
# define STDC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
|
||||||
|
# define STDC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef STDC
|
||||||
|
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
|
||||||
|
# define const /* note: need a more gentle solution here */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ZLIB_CONST) && !defined(z_const)
|
||||||
|
# define z_const const
|
||||||
|
#else
|
||||||
|
# define z_const
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Z_SOLO
|
||||||
|
typedef unsigned long z_size_t;
|
||||||
|
#else
|
||||||
|
# define z_longlong long long
|
||||||
|
# if defined(NO_SIZE_T)
|
||||||
|
typedef unsigned NO_SIZE_T z_size_t;
|
||||||
|
# elif defined(STDC)
|
||||||
|
# include <stddef.h>
|
||||||
|
typedef size_t z_size_t;
|
||||||
|
# else
|
||||||
|
typedef unsigned long z_size_t;
|
||||||
|
# endif
|
||||||
|
# undef z_longlong
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Maximum value for memLevel in deflateInit2 */
|
||||||
|
#ifndef MAX_MEM_LEVEL
|
||||||
|
# ifdef MAXSEG_64K
|
||||||
|
# define MAX_MEM_LEVEL 8
|
||||||
|
# else
|
||||||
|
# define MAX_MEM_LEVEL 9
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
|
||||||
|
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
|
||||||
|
* created by gzip. (Files created by minigzip can still be extracted by
|
||||||
|
* gzip.)
|
||||||
|
*/
|
||||||
|
#ifndef MAX_WBITS
|
||||||
|
# define MAX_WBITS 15 /* 32K LZ77 window */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The memory requirements for deflate are (in bytes):
|
||||||
|
(1 << (windowBits+2)) + (1 << (memLevel+9))
|
||||||
|
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
|
||||||
|
plus a few kilobytes for small objects. For example, if you want to reduce
|
||||||
|
the default memory requirements from 256K to 128K, compile with
|
||||||
|
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
|
||||||
|
Of course this will generally degrade compression (there's no free lunch).
|
||||||
|
|
||||||
|
The memory requirements for inflate are (in bytes) 1 << windowBits
|
||||||
|
that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
|
||||||
|
for small objects.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Type declarations */
|
||||||
|
|
||||||
|
#ifndef OF /* function prototypes */
|
||||||
|
# ifdef STDC
|
||||||
|
# define OF(args) args
|
||||||
|
# else
|
||||||
|
# define OF(args) ()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Z_ARG /* function prototypes for stdarg */
|
||||||
|
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||||
|
# define Z_ARG(args) args
|
||||||
|
# else
|
||||||
|
# define Z_ARG(args) ()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||||
|
* model programming (small or medium model with some far allocations).
|
||||||
|
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||||
|
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
|
||||||
|
* just define FAR to be empty.
|
||||||
|
*/
|
||||||
|
#ifdef SYS16BIT
|
||||||
|
# if defined(M_I86SM) || defined(M_I86MM)
|
||||||
|
/* MSC small or medium model */
|
||||||
|
# define SMALL_MEDIUM
|
||||||
|
# ifdef _MSC_VER
|
||||||
|
# define FAR _far
|
||||||
|
# else
|
||||||
|
# define FAR far
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# if (defined(__SMALL__) || defined(__MEDIUM__))
|
||||||
|
/* Turbo C small or medium model */
|
||||||
|
# define SMALL_MEDIUM
|
||||||
|
# ifdef __BORLANDC__
|
||||||
|
# define FAR _far
|
||||||
|
# else
|
||||||
|
# define FAR far
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(WINDOWS) || defined(WIN32)
|
||||||
|
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||||
|
* This is not mandatory, but it offers a little performance increase.
|
||||||
|
*/
|
||||||
|
# ifdef ZLIB_DLL
|
||||||
|
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
||||||
|
# ifdef ZLIB_INTERNAL
|
||||||
|
# define ZEXTERN extern __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define ZEXTERN extern __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# endif /* ZLIB_DLL */
|
||||||
|
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||||
|
* define ZLIB_WINAPI.
|
||||||
|
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||||
|
*/
|
||||||
|
# ifdef ZLIB_WINAPI
|
||||||
|
# ifdef FAR
|
||||||
|
# undef FAR
|
||||||
|
# endif
|
||||||
|
# include <windows.h>
|
||||||
|
/* No need for _export, use ZLIB.DEF instead. */
|
||||||
|
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||||
|
# define ZEXPORT WINAPI
|
||||||
|
# ifdef WIN32
|
||||||
|
# define ZEXPORTVA WINAPIV
|
||||||
|
# else
|
||||||
|
# define ZEXPORTVA FAR CDECL
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (__BEOS__)
|
||||||
|
# ifdef ZLIB_DLL
|
||||||
|
# ifdef ZLIB_INTERNAL
|
||||||
|
# define ZEXPORT __declspec(dllexport)
|
||||||
|
# define ZEXPORTVA __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define ZEXPORT __declspec(dllimport)
|
||||||
|
# define ZEXPORTVA __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ZEXTERN
|
||||||
|
# define ZEXTERN extern
|
||||||
|
#endif
|
||||||
|
#ifndef ZEXPORT
|
||||||
|
# define ZEXPORT
|
||||||
|
#endif
|
||||||
|
#ifndef ZEXPORTVA
|
||||||
|
# define ZEXPORTVA
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FAR
|
||||||
|
# define FAR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__MACTYPES__)
|
||||||
|
typedef unsigned char Byte; /* 8 bits */
|
||||||
|
#endif
|
||||||
|
typedef unsigned int uInt; /* 16 bits or more */
|
||||||
|
typedef unsigned long uLong; /* 32 bits or more */
|
||||||
|
|
||||||
|
#ifdef SMALL_MEDIUM
|
||||||
|
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
|
||||||
|
# define Bytef Byte FAR
|
||||||
|
#else
|
||||||
|
typedef Byte FAR Bytef;
|
||||||
|
#endif
|
||||||
|
typedef char FAR charf;
|
||||||
|
typedef int FAR intf;
|
||||||
|
typedef uInt FAR uIntf;
|
||||||
|
typedef uLong FAR uLongf;
|
||||||
|
|
||||||
|
#ifdef STDC
|
||||||
|
typedef void const *voidpc;
|
||||||
|
typedef void FAR *voidpf;
|
||||||
|
typedef void *voidp;
|
||||||
|
#else
|
||||||
|
typedef Byte const *voidpc;
|
||||||
|
typedef Byte FAR *voidpf;
|
||||||
|
typedef Byte *voidp;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
|
||||||
|
# include <limits.h>
|
||||||
|
# if (UINT_MAX == 0xffffffffUL)
|
||||||
|
# define Z_U4 unsigned
|
||||||
|
# elif (ULONG_MAX == 0xffffffffUL)
|
||||||
|
# define Z_U4 unsigned long
|
||||||
|
# elif (USHRT_MAX == 0xffffffffUL)
|
||||||
|
# define Z_U4 unsigned short
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Z_U4
|
||||||
|
typedef Z_U4 z_crc_t;
|
||||||
|
#else
|
||||||
|
typedef unsigned long z_crc_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 1 /* was set to #if 1 by ./configure */
|
||||||
|
# define Z_HAVE_UNISTD_H
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 1 /* was set to #if 1 by ./configure */
|
||||||
|
# define Z_HAVE_STDARG_H
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STDC
|
||||||
|
# ifndef Z_SOLO
|
||||||
|
# include <sys/types.h> /* for off_t */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||||
|
# ifndef Z_SOLO
|
||||||
|
# include <stdarg.h> /* for va_list */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# ifndef Z_SOLO
|
||||||
|
# include <stddef.h> /* for wchar_t */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
|
||||||
|
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
|
||||||
|
* though the former does not conform to the LFS document), but considering
|
||||||
|
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
|
||||||
|
* equivalently requesting no 64-bit operations
|
||||||
|
*/
|
||||||
|
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
|
||||||
|
# undef _LARGEFILE64_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
|
||||||
|
# define Z_HAVE_UNISTD_H
|
||||||
|
#endif
|
||||||
|
#ifndef Z_SOLO
|
||||||
|
# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
|
||||||
|
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
|
||||||
|
# ifdef VMS
|
||||||
|
# include <unixio.h> /* for off_t */
|
||||||
|
# endif
|
||||||
|
# ifndef z_off_t
|
||||||
|
# define z_off_t off_t
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
|
||||||
|
# define Z_LFS64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
|
||||||
|
# define Z_LARGE64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
|
||||||
|
# define Z_WANT64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(SEEK_SET) && !defined(Z_SOLO)
|
||||||
|
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||||
|
# define SEEK_CUR 1 /* Seek from current position. */
|
||||||
|
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef z_off_t
|
||||||
|
# define z_off_t long
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_WIN32) && defined(Z_LARGE64)
|
||||||
|
# define z_off64_t off64_t
|
||||||
|
#else
|
||||||
|
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
|
||||||
|
# define z_off64_t __int64
|
||||||
|
# else
|
||||||
|
# define z_off64_t z_off_t
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* MVS linker does not support external names larger than 8 bytes */
|
||||||
|
#if defined(__MVS__)
|
||||||
|
#pragma map(deflateInit_,"DEIN")
|
||||||
|
#pragma map(deflateInit2_,"DEIN2")
|
||||||
|
#pragma map(deflateEnd,"DEEND")
|
||||||
|
#pragma map(deflateBound,"DEBND")
|
||||||
|
#pragma map(inflateInit_,"ININ")
|
||||||
|
#pragma map(inflateInit2_,"ININ2")
|
||||||
|
#pragma map(inflateEnd,"INEND")
|
||||||
|
#pragma map(inflateSync,"INSY")
|
||||||
|
#pragma map(inflateSetDictionary,"INSEDI")
|
||||||
|
#pragma map(compressBound,"CMBND")
|
||||||
|
#pragma map(inflate_table,"INTABL")
|
||||||
|
#pragma map(inflate_fast,"INFA")
|
||||||
|
#pragma map(inflate_copyright,"INCOPY")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* ZCONF_H */
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -200,7 +200,7 @@ endif()
|
||||||
|
|
||||||
############################# glslang #############################
|
############################# glslang #############################
|
||||||
|
|
||||||
set(glslang_libs_name glslang glslang-default-resource-limits SPIRV MachineIndependent OGLCompiler OSDependent SPIRV-Tools-opt SPIRV-Tools GenericCodeGen)
|
set(glslang_libs_name glslang glslang-default-resource-limits MachineIndependent OGLCompiler OSDependent SPIRV SPIRV-Tools-opt SPIRV-Tools GenericCodeGen)
|
||||||
foreach(gl IN LISTS glslang_libs_name)
|
foreach(gl IN LISTS glslang_libs_name)
|
||||||
add_library(${gl} STATIC IMPORTED GLOBAL)
|
add_library(${gl} STATIC IMPORTED GLOBAL)
|
||||||
set_target_properties(${gl} PROPERTIES
|
set_target_properties(${gl} PROPERTIES
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ set_target_properties(jpeg PROPERTIES
|
||||||
add_library(mpg123 SHARED IMPORTED GLOBAL)
|
add_library(mpg123 SHARED IMPORTED GLOBAL)
|
||||||
|
|
||||||
set_target_properties(mpg123 PROPERTIES
|
set_target_properties(mpg123 PROPERTIES
|
||||||
IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/libs/libmpg123.dll
|
IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/libs/libmpg123-0.dll
|
||||||
IMPORTED_IMPLIB ${CMAKE_CURRENT_LIST_DIR}/libs/libmpg123.lib
|
IMPORTED_IMPLIB ${CMAKE_CURRENT_LIST_DIR}/libs/libmpg123-0.lib
|
||||||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/include/mpg123
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/include/mpg123
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -200,7 +200,7 @@ endif()
|
||||||
|
|
||||||
############################# glslang #############################
|
############################# glslang #############################
|
||||||
|
|
||||||
set(glslang_libs_name glslang glslang-default-resource-limits SPIRV MachineIndependent OGLCompiler OSDependent SPIRV-Tools-opt SPIRV-Tools GenericCodeGen)
|
set(glslang_libs_name glslang glslang-default-resource-limits MachineIndependent OGLCompiler OSDependent SPIRV SPIRV-Tools-opt SPIRV-Tools GenericCodeGen)
|
||||||
foreach(gl IN LISTS glslang_libs_name)
|
foreach(gl IN LISTS glslang_libs_name)
|
||||||
add_library(${gl} STATIC IMPORTED GLOBAL)
|
add_library(${gl} STATIC IMPORTED GLOBAL)
|
||||||
set_target_properties(${gl} PROPERTIES
|
set_target_properties(${gl} PROPERTIES
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ struct mpg123_fmt
|
||||||
int encoding;
|
int encoding;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* @} */
|
/** @} */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,734 @@
|
||||||
|
/*
|
||||||
|
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. */
|
||||||
|
|
||||||
|
/* 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>
|
||||||
|
|
||||||
|
/** A macro to check at compile time which set of API functions to expect.
|
||||||
|
* This should be incremented at least each time a new symbol is added
|
||||||
|
* to the header.
|
||||||
|
*/
|
||||||
|
#ifndef OUT123_API_VERSION
|
||||||
|
#define OUT123_API_VERSION 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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;
|
||||||
|
|
||||||
|
/** 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
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue