forked from WohlSoft/SDL-Mixer-X
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Synchronized some changes with the mainstream repository
- Loading branch information
Showing
5 changed files
with
107 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file. | ||
dr_flac - v0.12.39 - 2022-09-17 | ||
dr_flac - v0.12.41 - 2023-06-17 | ||
|
||
David Reid - [email protected] | ||
|
||
|
@@ -235,7 +235,7 @@ extern "C" { | |
|
||
#define DRFLAC_VERSION_MAJOR 0 | ||
#define DRFLAC_VERSION_MINOR 12 | ||
#define DRFLAC_VERSION_REVISION 39 | ||
#define DRFLAC_VERSION_REVISION 41 | ||
#define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION) | ||
|
||
#include <stddef.h> /* For size_t. */ | ||
|
@@ -273,6 +273,8 @@ typedef drflac_uint8 drflac_bool8; | |
typedef drflac_uint32 drflac_bool32; | ||
#define DRFLAC_TRUE 1 | ||
#define DRFLAC_FALSE 0 | ||
/* End Sized Types */ | ||
|
||
|
||
#if !defined(DRFLAC_API) | ||
#if defined(DRFLAC_DLL) | ||
|
@@ -303,6 +305,7 @@ typedef drflac_uint32 drflac_bool32; | |
#define DRFLAC_PRIVATE static | ||
#endif | ||
#endif | ||
/* End Decorations */ | ||
|
||
#if defined(_MSC_VER) && _MSC_VER >= 1700 /* Visual Studio 2012 */ | ||
#define DRFLAC_DEPRECATED __declspec(deprecated) | ||
|
@@ -321,6 +324,16 @@ typedef drflac_uint32 drflac_bool32; | |
DRFLAC_API void drflac_version(drflac_uint32* pMajor, drflac_uint32* pMinor, drflac_uint32* pRevision); | ||
DRFLAC_API const char* drflac_version_string(void); | ||
|
||
/* Allocation Callbacks */ | ||
typedef struct | ||
{ | ||
void* pUserData; | ||
void* (* onMalloc)(size_t sz, void* pUserData); | ||
void* (* onRealloc)(void* p, size_t sz, void* pUserData); | ||
void (* onFree)(void* p, void* pUserData); | ||
} drflac_allocation_callbacks; | ||
/* End Allocation Callbacks */ | ||
|
||
/* | ||
As data is read from the client it is placed into an internal buffer for fast access. This controls the size of that buffer. Larger values means more speed, | ||
but also more memory. In my testing there is diminishing returns after about 4KB, but you can fiddle with this to suit your own needs. Must be a multiple of 8. | ||
|
@@ -329,11 +342,22 @@ but also more memory. In my testing there is diminishing returns after about 4KB | |
#define DR_FLAC_BUFFER_SIZE 4096 | ||
#endif | ||
|
||
|
||
/* Check if we can enable 64-bit optimizations. */ | ||
#if defined(_WIN64) || defined(_LP64) || defined(__LP64__) | ||
#define DRFLAC_64BIT | ||
#endif | ||
|
||
#if defined(__x86_64__) || defined(_M_X64) | ||
#define DRFLAC_X64 | ||
#elif defined(__i386) || defined(_M_IX86) | ||
#define DRFLAC_X86 | ||
#elif defined(__arm__) || defined(_M_ARM) || defined(__arm64) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) | ||
#define DRFLAC_ARM | ||
#endif | ||
/* End Architecture Detection */ | ||
|
||
|
||
#ifdef DRFLAC_64BIT | ||
typedef drflac_uint64 drflac_cache_t; | ||
#else | ||
|
@@ -562,14 +586,6 @@ will be set to one of the DRFLAC_METADATA_BLOCK_TYPE_* tokens. | |
typedef void (* drflac_meta_proc)(void* pUserData, drflac_metadata* pMetadata); | ||
|
||
|
||
typedef struct | ||
{ | ||
void* pUserData; | ||
void* (* onMalloc)(size_t sz, void* pUserData); | ||
void* (* onRealloc)(void* p, size_t sz, void* pUserData); | ||
void (* onFree)(void* p, void* pUserData); | ||
} drflac_allocation_callbacks; | ||
|
||
/* Structure for internal use. Only used for decoders opened with drflac_open_memory. */ | ||
typedef struct | ||
{ | ||
|
@@ -1351,6 +1367,7 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat | |
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
/* Inline */ | ||
#ifdef _MSC_VER | ||
#define DRFLAC_INLINE __forceinline | ||
#elif defined(__GNUC__) | ||
|
@@ -1378,14 +1395,6 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat | |
#define DRFLAC_INLINE | ||
#endif | ||
|
||
/* CPU architecture. */ | ||
#if defined(__x86_64__) || defined(_M_X64) | ||
#define DRFLAC_X64 | ||
#elif defined(__i386) || defined(_M_IX86) | ||
#define DRFLAC_X86 | ||
#elif defined(__arm__) || defined(_M_ARM) || defined(__arm64) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) | ||
#define DRFLAC_ARM | ||
#endif | ||
|
||
/* | ||
Intrinsics Support | ||
|
@@ -1623,6 +1632,7 @@ static DRFLAC_INLINE drflac_bool32 drflac_has_sse41(void) | |
|
||
#define DRFLAC_MAX_SIMD_VECTOR_SIZE 64 /* 64 for AVX-512 in the future. */ | ||
|
||
/* Result Codes */ | ||
typedef drflac_int32 drflac_result; | ||
#define DRFLAC_SUCCESS 0 | ||
#define DRFLAC_ERROR -1 /* A generic error. */ | ||
|
@@ -1678,7 +1688,10 @@ typedef drflac_int32 drflac_result; | |
#define DRFLAC_CANCELLED -51 | ||
#define DRFLAC_MEMORY_ALREADY_MAPPED -52 | ||
#define DRFLAC_AT_END -53 | ||
#define DRFLAC_CRC_MISMATCH -128 | ||
|
||
#define DRFLAC_CRC_MISMATCH -100 | ||
/* End Result Codes */ | ||
|
||
|
||
#define DRFLAC_SUBFRAME_CONSTANT 0 | ||
#define DRFLAC_SUBFRAME_VERBATIM 1 | ||
|
@@ -8141,6 +8154,7 @@ static drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac | |
#include <wchar.h> /* For wcslen(), wcsrtombs() */ | ||
#endif | ||
|
||
|
||
/* drflac_result_from_errno() is only used for fopen() and wfopen() so putting it inside DR_WAV_NO_STDIO for now. If something else needs this later we can move it out. */ | ||
#include <errno.h> | ||
static drflac_result drflac_result_from_errno(int e) | ||
|
@@ -8544,6 +8558,8 @@ static drflac_result drflac_result_from_errno(int e) | |
default: return DRFLAC_ERROR; | ||
} | ||
} | ||
/* End Errno */ | ||
|
||
|
||
static drflac_result drflac_fopen(FILE** ppFile, const char* pFilePath, const char* pOpenMode) | ||
{ | ||
|
@@ -8702,6 +8718,7 @@ static drflac_result drflac_wfopen(FILE** ppFile, const wchar_t* pFilePath, cons | |
return DRFLAC_SUCCESS; | ||
} | ||
#endif | ||
/* End fopen */ | ||
|
||
static size_t drflac__on_read_stdio(void* pUserData, void* bufferOut, size_t bytesToRead) | ||
{ | ||
|
@@ -11664,6 +11681,7 @@ DRFLAC_API drflac_bool32 drflac_seek_to_pcm_frame(drflac* pFlac, drflac_uint64 p | |
|
||
|
||
|
||
|
||
/* High Level APIs */ | ||
|
||
#if defined(SIZE_MAX) | ||
|
@@ -11675,6 +11693,7 @@ DRFLAC_API drflac_bool32 drflac_seek_to_pcm_frame(drflac* pFlac, drflac_uint64 p | |
#define DRFLAC_SIZE_MAX 0xFFFFFFFF | ||
#endif | ||
#endif | ||
/* End SIZE_MAX */ | ||
|
||
|
||
/* Using a macro as the definition of the drflac__full_decode_and_close_*() API family. Sue me. */ | ||
|
@@ -12058,6 +12077,12 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat | |
/* | ||
REVISION HISTORY | ||
================ | ||
v0.12.41 - 2023-06-17 | ||
- Fix an incorrect date in revision history. No functional change. | ||
|
||
v0.12.40 - 2023-05-22 | ||
- Minor code restructure. No functional change. | ||
|
||
v0.12.39 - 2022-09-17 | ||
- Fix compilation with DJGPP. | ||
- Fix compilation error with Visual Studio 2019 and the ARM build. | ||
|
@@ -12488,7 +12513,7 @@ For more information, please refer to <http://unlicense.org/> | |
=============================================================================== | ||
ALTERNATIVE 2 - MIT No Attribution | ||
=============================================================================== | ||
Copyright 2020 David Reid | ||
Copyright 2023 David Reid | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.34 - 2022-09-17 | ||
dr_mp3 - v0.6.36 - 2023-06-17 | ||
David Reid - [email protected] | ||
|
@@ -95,7 +95,7 @@ extern "C" { | |
|
||
#define DRMP3_VERSION_MAJOR 0 | ||
#define DRMP3_VERSION_MINOR 6 | ||
#define DRMP3_VERSION_REVISION 34 | ||
#define DRMP3_VERSION_REVISION 36 | ||
#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. */ | ||
|
@@ -133,6 +133,8 @@ typedef drmp3_uint8 drmp3_bool8; | |
typedef drmp3_uint32 drmp3_bool32; | ||
#define DRMP3_TRUE 1 | ||
#define DRMP3_FALSE 0 | ||
/* End Sized Types */ | ||
|
||
|
||
#if !defined(DRMP3_API) | ||
#if defined(DRMP3_DLL) | ||
|
@@ -164,6 +166,8 @@ typedef drmp3_uint32 drmp3_bool32; | |
#endif | ||
#endif | ||
|
||
|
||
/* Result Codes */ | ||
typedef drmp3_int32 drmp3_result; | ||
#define DRMP3_SUCCESS 0 | ||
#define DRMP3_ERROR -1 /* A generic error. */ | ||
|
@@ -224,6 +228,7 @@ typedef drmp3_int32 drmp3_result; | |
#define DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME 1152 | ||
#define DRMP3_MAX_SAMPLES_PER_FRAME (DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME*2) | ||
|
||
/* Inline */ | ||
#ifdef _MSC_VER | ||
#define DRMP3_INLINE __forceinline | ||
#elif defined(__GNUC__) | ||
|
@@ -252,10 +257,22 @@ typedef drmp3_int32 drmp3_result; | |
#endif | ||
|
||
|
||
|
||
DRMP3_API void drmp3_version(drmp3_uint32* pMajor, drmp3_uint32* pMinor, drmp3_uint32* pRevision); | ||
DRMP3_API const char* drmp3_version_string(void); | ||
|
||
|
||
/* Allocation Callbacks */ | ||
typedef struct | ||
{ | ||
void* pUserData; | ||
void* (* onMalloc)(size_t sz, void* pUserData); | ||
void* (* onRealloc)(void* p, size_t sz, void* pUserData); | ||
void (* onFree)(void* p, void* pUserData); | ||
} drmp3_allocation_callbacks; | ||
/* End Allocation Callbacks */ | ||
|
||
|
||
/* | ||
Low Level Push API | ||
================== | ||
|
@@ -329,14 +346,6 @@ will be either drmp3_seek_origin_start or drmp3_seek_origin_current. | |
*/ | ||
typedef drmp3_bool32 (* drmp3_seek_proc)(void* pUserData, int offset, drmp3_seek_origin origin); | ||
|
||
typedef struct | ||
{ | ||
void* pUserData; | ||
void* (* onMalloc)(size_t sz, void* pUserData); | ||
void* (* onRealloc)(void* p, size_t sz, void* pUserData); | ||
void (* onFree)(void* p, void* pUserData); | ||
} drmp3_allocation_callbacks; | ||
|
||
typedef struct | ||
{ | ||
drmp3_uint32 channels; | ||
|
@@ -2415,6 +2424,7 @@ DRMP3_API void drmp3dec_f32_to_s16(const float *in, drmp3_int16 *out, size_t num | |
Main Public API | ||
************************************************************************************************************************************************************/ | ||
/* SIZE_MAX */ | ||
#if defined(SIZE_MAX) | ||
#define DRMP3_SIZE_MAX SIZE_MAX | ||
#else | ||
|
@@ -2425,6 +2435,7 @@ DRMP3_API void drmp3dec_f32_to_s16(const float *in, drmp3_int16 *out, size_t num | |
#endif | ||
#endif | ||
|
||
/* Options. */ | ||
/* Options. */ | ||
#ifndef DRMP3_SEEK_LEADING_MP3_FRAMES | ||
#define DRMP3_SEEK_LEADING_MP3_FRAMES 2 | ||
|
@@ -2931,6 +2942,7 @@ DRMP3_API drmp3_bool32 drmp3_init_memory(drmp3* pMP3, const void* pData, size_t | |
#include <stdio.h> | ||
#include <wchar.h> /* For wcslen(), wcsrtombs() */ | ||
|
||
/* drmp3_result_from_errno() is only used inside DR_MP3_NO_STDIO for now. Move this out if it's ever used elsewhere. */ | ||
/* drmp3_result_from_errno() is only used inside DR_MP3_NO_STDIO for now. Move this out if it's ever used elsewhere. */ | ||
#include <errno.h> | ||
static drmp3_result drmp3_result_from_errno(int e) | ||
|
@@ -3335,6 +3347,8 @@ static drmp3_result drmp3_result_from_errno(int e) | |
} | ||
} | ||
|
||
|
||
/* fopen */ | ||
static drmp3_result drmp3_fopen(FILE** ppFile, const char* pFilePath, const char* pOpenMode) | ||
{ | ||
#if defined(_MSC_VER) && _MSC_VER >= 1400 | ||
|
@@ -4476,6 +4490,12 @@ counts rather than sample counts. | |
/* | ||
REVISION HISTORY | ||
================ | ||
v0.6.36 - 2023-06-17 | ||
- Fix an incorrect date in revision history. No functional change. | ||
v0.6.35 - 2023-05-22 | ||
- Minor code restructure. No functional change. | ||
v0.6.34 - 2022-09-17 | ||
- Fix compilation with DJGPP. | ||
- Fix compilation when compiling with x86 with no SSE2. | ||
|
@@ -4777,7 +4797,7 @@ For more information, please refer to <http://unlicense.org/> | |
=============================================================================== | ||
ALTERNATIVE 2 - MIT No Attribution | ||
=============================================================================== | ||
Copyright 2020 David Reid | ||
Copyright 2023 David Reid | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.