mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
Update external libraries
This commit is contained in:
83
src/external/dr_mp3.h
vendored
83
src/external/dr_mp3.h
vendored
@ -1,6 +1,6 @@
|
||||
/*
|
||||
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
|
||||
dr_mp3 - v0.6.19 - 2020-11-13
|
||||
dr_mp3 - v0.6.27 - 2021-02-21
|
||||
|
||||
David Reid - mackron@gmail.com
|
||||
|
||||
@ -95,7 +95,7 @@ extern "C" {
|
||||
|
||||
#define DRMP3_VERSION_MAJOR 0
|
||||
#define DRMP3_VERSION_MINOR 6
|
||||
#define DRMP3_VERSION_REVISION 19
|
||||
#define DRMP3_VERSION_REVISION 27
|
||||
#define DRMP3_VERSION_STRING DRMP3_XSTRINGIFY(DRMP3_VERSION_MAJOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_MINOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_REVISION)
|
||||
|
||||
#include <stddef.h> /* For size_t. */
|
||||
@ -239,6 +239,8 @@ typedef drmp3_int32 drmp3_result;
|
||||
#else
|
||||
#define DRMP3_INLINE inline __attribute__((always_inline))
|
||||
#endif
|
||||
#elif defined(__WATCOMC__)
|
||||
#define DRMP3_INLINE __inline
|
||||
#else
|
||||
#define DRMP3_INLINE
|
||||
#endif
|
||||
@ -279,14 +281,6 @@ DRMP3_API void drmp3dec_f32_to_s16(const float *in, drmp3_int16 *out, size_t num
|
||||
Main API (Pull API)
|
||||
===================
|
||||
*/
|
||||
#ifndef DRMP3_DEFAULT_CHANNELS
|
||||
#define DRMP3_DEFAULT_CHANNELS 2
|
||||
#endif
|
||||
#ifndef DRMP3_DEFAULT_SAMPLE_RATE
|
||||
#define DRMP3_DEFAULT_SAMPLE_RATE 44100
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
drmp3_seek_origin_start,
|
||||
@ -596,7 +590,7 @@ DRMP3_API const char* drmp3_version_string(void)
|
||||
|
||||
#if !defined(DR_MP3_NO_SIMD)
|
||||
|
||||
#if !defined(DR_MP3_ONLY_SIMD) && (defined(_M_X64) || defined(_M_ARM64) || defined(__x86_64__) || defined(__aarch64__))
|
||||
#if !defined(DR_MP3_ONLY_SIMD) && (defined(_M_X64) || defined(__x86_64__) || defined(__aarch64__) || defined(_M_ARM64))
|
||||
/* x64 always have SSE2, arm64 always have neon, no need for generic code */
|
||||
#define DR_MP3_ONLY_SIMD
|
||||
#endif
|
||||
@ -672,7 +666,7 @@ end:
|
||||
return g_have_simd - 1;
|
||||
#endif
|
||||
}
|
||||
#elif defined(__ARM_NEON) || defined(__aarch64__)
|
||||
#elif defined(__ARM_NEON) || defined(__aarch64__) || defined(_M_ARM64)
|
||||
#include <arm_neon.h>
|
||||
#define DRMP3_HAVE_SSE 0
|
||||
#define DRMP3_HAVE_SIMD 1
|
||||
@ -705,7 +699,7 @@ static int drmp3_have_simd(void)
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__)
|
||||
#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__) && !defined(_M_ARM64)
|
||||
#define DRMP3_HAVE_ARMV6 1
|
||||
static __inline__ __attribute__((always_inline)) drmp3_int32 drmp3_clip_int16_arm(int32_t a)
|
||||
{
|
||||
@ -1868,7 +1862,7 @@ static void drmp3d_DCT_II(float *grbuf, int n)
|
||||
} else
|
||||
#endif
|
||||
#ifdef DR_MP3_ONLY_SIMD
|
||||
{}
|
||||
{} /* for HAVE_SIMD=1, MINIMP3_ONLY_SIMD=1 case we do not need non-intrinsic "else" branch */
|
||||
#else
|
||||
for (; k < n; k++)
|
||||
{
|
||||
@ -2101,7 +2095,7 @@ static void drmp3d_synth(float *xl, drmp3d_sample_t *dstl, int nch, float *lins)
|
||||
} else
|
||||
#endif
|
||||
#ifdef DR_MP3_ONLY_SIMD
|
||||
{}
|
||||
{} /* for HAVE_SIMD=1, MINIMP3_ONLY_SIMD=1 case we do not need non-intrinsic "else" branch */
|
||||
#else
|
||||
for (i = 14; i >= 0; i--)
|
||||
{
|
||||
@ -2829,7 +2823,7 @@ static drmp3_bool32 drmp3_init_internal(drmp3* pMP3, drmp3_read_proc onRead, drm
|
||||
|
||||
/* Decode the first frame to confirm that it is indeed a valid MP3 stream. */
|
||||
if (!drmp3_decode_next_frame(pMP3)) {
|
||||
drmp3_uninit(pMP3);
|
||||
drmp3__free_from_callbacks(pMP3->pData, &pMP3->allocationCallbacks); /* The call above may have allocated memory. Need to make sure it's freed before aborting. */
|
||||
return DRMP3_FALSE; /* Not a valid MP3 stream. */
|
||||
}
|
||||
|
||||
@ -3331,7 +3325,7 @@ static drmp3_result drmp3_result_from_errno(int e)
|
||||
|
||||
static drmp3_result drmp3_fopen(FILE** ppFile, const char* pFilePath, const char* pOpenMode)
|
||||
{
|
||||
#if _MSC_VER && _MSC_VER >= 1400
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
errno_t err;
|
||||
#endif
|
||||
|
||||
@ -3343,7 +3337,7 @@ static drmp3_result drmp3_fopen(FILE** ppFile, const char* pFilePath, const char
|
||||
return DRMP3_INVALID_ARGS;
|
||||
}
|
||||
|
||||
#if _MSC_VER && _MSC_VER >= 1400
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
err = fopen_s(ppFile, pFilePath, pOpenMode);
|
||||
if (err != 0) {
|
||||
return drmp3_result_from_errno(err);
|
||||
@ -3378,12 +3372,13 @@ _wfopen() isn't always available in all compilation environments.
|
||||
* MSVC seems to support it universally as far back as VC6 from what I can tell (haven't checked further back).
|
||||
* MinGW-64 (both 32- and 64-bit) seems to support it.
|
||||
* MinGW wraps it in !defined(__STRICT_ANSI__).
|
||||
* OpenWatcom wraps it in !defined(_NO_EXT_KEYS).
|
||||
|
||||
This can be reviewed as compatibility issues arise. The preference is to use _wfopen_s() and _wfopen() as opposed to the wcsrtombs()
|
||||
fallback, so if you notice your compiler not detecting this properly I'm happy to look at adding support.
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
#if defined(_MSC_VER) || defined(__MINGW64__) || !defined(__STRICT_ANSI__)
|
||||
#if defined(_MSC_VER) || defined(__MINGW64__) || (!defined(__STRICT_ANSI__) && !defined(_NO_EXT_KEYS))
|
||||
#define DRMP3_HAS_WFOPEN
|
||||
#endif
|
||||
#endif
|
||||
@ -3484,22 +3479,38 @@ static drmp3_bool32 drmp3__on_seek_stdio(void* pUserData, int offset, drmp3_seek
|
||||
|
||||
DRMP3_API drmp3_bool32 drmp3_init_file(drmp3* pMP3, const char* pFilePath, const drmp3_allocation_callbacks* pAllocationCallbacks)
|
||||
{
|
||||
drmp3_bool32 result;
|
||||
FILE* pFile;
|
||||
|
||||
if (drmp3_fopen(&pFile, pFilePath, "rb") != DRMP3_SUCCESS) {
|
||||
return DRMP3_FALSE;
|
||||
}
|
||||
|
||||
return drmp3_init(pMP3, drmp3__on_read_stdio, drmp3__on_seek_stdio, (void*)pFile, pAllocationCallbacks);
|
||||
result = drmp3_init(pMP3, drmp3__on_read_stdio, drmp3__on_seek_stdio, (void*)pFile, pAllocationCallbacks);
|
||||
if (result != DRMP3_TRUE) {
|
||||
fclose(pFile);
|
||||
return result;
|
||||
}
|
||||
|
||||
return DRMP3_TRUE;
|
||||
}
|
||||
|
||||
DRMP3_API drmp3_bool32 drmp3_init_file_w(drmp3* pMP3, const wchar_t* pFilePath, const drmp3_allocation_callbacks* pAllocationCallbacks)
|
||||
{
|
||||
drmp3_bool32 result;
|
||||
FILE* pFile;
|
||||
|
||||
if (drmp3_wfopen(&pFile, pFilePath, L"rb", pAllocationCallbacks) != DRMP3_SUCCESS) {
|
||||
return DRMP3_FALSE;
|
||||
}
|
||||
|
||||
return drmp3_init(pMP3, drmp3__on_read_stdio, drmp3__on_seek_stdio, (void*)pFile, pAllocationCallbacks);
|
||||
result = drmp3_init(pMP3, drmp3__on_read_stdio, drmp3__on_seek_stdio, (void*)pFile, pAllocationCallbacks);
|
||||
if (result != DRMP3_TRUE) {
|
||||
fclose(pFile);
|
||||
return result;
|
||||
}
|
||||
|
||||
return DRMP3_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -3511,7 +3522,11 @@ DRMP3_API void drmp3_uninit(drmp3* pMP3)
|
||||
|
||||
#ifndef DR_MP3_NO_STDIO
|
||||
if (pMP3->onRead == drmp3__on_read_stdio) {
|
||||
fclose((FILE*)pMP3->pUserData);
|
||||
FILE* pFile = (FILE*)pMP3->pUserData;
|
||||
if (pFile != NULL) {
|
||||
fclose(pFile);
|
||||
pMP3->pUserData = NULL; /* Make sure the file handle is cleared to NULL to we don't attempt to close it a second time. */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -4435,6 +4450,30 @@ counts rather than sample counts.
|
||||
/*
|
||||
REVISION HISTORY
|
||||
================
|
||||
v0.6.27 - 2021-02-21
|
||||
- Fix a warning due to referencing _MSC_VER when it is undefined.
|
||||
|
||||
v0.6.26 - 2021-01-31
|
||||
- Bring up to date with minimp3.
|
||||
|
||||
v0.6.25 - 2020-12-26
|
||||
- Remove DRMP3_DEFAULT_CHANNELS and DRMP3_DEFAULT_SAMPLE_RATE which are leftovers from some removed APIs.
|
||||
|
||||
v0.6.24 - 2020-12-07
|
||||
- Fix a typo in version date for 0.6.23.
|
||||
|
||||
v0.6.23 - 2020-12-03
|
||||
- Fix an error where a file can be closed twice when initialization of the decoder fails.
|
||||
|
||||
v0.6.22 - 2020-12-02
|
||||
- Fix an error where it's possible for a file handle to be left open when initialization of the decoder fails.
|
||||
|
||||
v0.6.21 - 2020-11-28
|
||||
- Bring up to date with minimp3.
|
||||
|
||||
v0.6.20 - 2020-11-21
|
||||
- Fix compilation with OpenWatcom.
|
||||
|
||||
v0.6.19 - 2020-11-13
|
||||
- Minor code clean up.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user