mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 09:14:04 +02:00
Update dr_wav, dr_flac and dr_mp3.
This commit is contained in:
+7
-3
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
|
FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
|
||||||
dr_flac - v0.12.3 - 2019-12-02
|
dr_flac - v0.12.4 - 2020-01-29
|
||||||
|
|
||||||
David Reid - mackron@gmail.com
|
David Reid - mackron@gmail.com
|
||||||
*/
|
*/
|
||||||
@@ -4679,6 +4679,7 @@ static drflac_bool32 drflac__read_next_flac_frame_header(drflac_bs* bs, drflac_u
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DRFLAC_ASSERT(blockSize > 0);
|
||||||
if (blockSize == 1) {
|
if (blockSize == 1) {
|
||||||
header->blockSizeInPCMFrames = 192;
|
header->blockSizeInPCMFrames = 192;
|
||||||
} else if (blockSize >= 2 && blockSize <= 5) {
|
} else if (blockSize >= 2 && blockSize <= 5) {
|
||||||
@@ -10320,7 +10321,7 @@ drflac_bool32 drflac_seek_to_pcm_frame(drflac* pFlac, drflac_uint64 pcmFrameInde
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* First try seeking via the seek table. If this fails, fall back to a brute force seek which is much slower. */
|
/* First try seeking via the seek table. If this fails, fall back to a brute force seek which is much slower. */
|
||||||
if (!wasSuccessful && !pFlac->_noSeekTableSeek) {
|
if (/*!wasSuccessful && */!pFlac->_noSeekTableSeek) {
|
||||||
wasSuccessful = drflac__seek_to_pcm_frame__seek_table(pFlac, pcmFrameIndex);
|
wasSuccessful = drflac__seek_to_pcm_frame__seek_table(pFlac, pcmFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10737,6 +10738,9 @@ drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterator* pIter,
|
|||||||
/*
|
/*
|
||||||
REVISION HISTORY
|
REVISION HISTORY
|
||||||
================
|
================
|
||||||
|
v0.12.4 - 2020-01-29
|
||||||
|
- Silence some static analysis warnings.
|
||||||
|
|
||||||
v0.12.3 - 2019-12-02
|
v0.12.3 - 2019-12-02
|
||||||
- Fix some warnings when compiling with GCC and the -Og flag.
|
- Fix some warnings when compiling with GCC and the -Og flag.
|
||||||
- Fix a crash in out-of-memory situations.
|
- Fix a crash in out-of-memory situations.
|
||||||
@@ -11041,7 +11045,7 @@ For more information, please refer to <http://unlicense.org/>
|
|||||||
===============================================================================
|
===============================================================================
|
||||||
ALTERNATIVE 2 - MIT No Attribution
|
ALTERNATIVE 2 - MIT No Attribution
|
||||||
===============================================================================
|
===============================================================================
|
||||||
Copyright 2018 David Reid
|
Copyright 2020 David Reid
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
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 software and associated documentation files (the "Software"), to deal in
|
||||||
|
|||||||
+8
-4
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
|
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
|
||||||
dr_mp3 - v0.5.4 - 2019-12-02
|
dr_mp3 - v0.5.5 - 2020-01-29
|
||||||
|
|
||||||
David Reid - mackron@gmail.com
|
David Reid - mackron@gmail.com
|
||||||
|
|
||||||
@@ -823,7 +823,7 @@ static void drmp3_L12_read_scalefactors(drmp3_bs *bs, drmp3_uint8 *pba, drmp3_ui
|
|||||||
if (mask & m)
|
if (mask & m)
|
||||||
{
|
{
|
||||||
int b = drmp3_bs_get_bits(bs, 6);
|
int b = drmp3_bs_get_bits(bs, 6);
|
||||||
s = g_deq_L12[ba*3 - 6 + b % 3]*(1 << 21 >> b/3);
|
s = g_deq_L12[ba*3 - 6 + b % 3]*(int)(1 << 21 >> b/3);
|
||||||
}
|
}
|
||||||
*scf++ = s;
|
*scf++ = s;
|
||||||
}
|
}
|
||||||
@@ -3872,7 +3872,7 @@ drmp3_int16* drmp3__full_read_and_close_s16(drmp3* pMP3, drmp3_config* pConfig,
|
|||||||
drmp3_uint64 newFramesCap;
|
drmp3_uint64 newFramesCap;
|
||||||
drmp3_int16* pNewFrames;
|
drmp3_int16* pNewFrames;
|
||||||
|
|
||||||
newFramesCap = framesCapacity * 2;
|
newFramesCap = framesCapacity * 2;
|
||||||
if (newFramesCap < totalFramesRead + framesJustRead) {
|
if (newFramesCap < totalFramesRead + framesJustRead) {
|
||||||
newFramesCap = totalFramesRead + framesJustRead;
|
newFramesCap = totalFramesRead + framesJustRead;
|
||||||
}
|
}
|
||||||
@@ -3890,6 +3890,7 @@ drmp3_int16* drmp3__full_read_and_close_s16(drmp3* pMP3, drmp3_config* pConfig,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pFrames = pNewFrames;
|
pFrames = pNewFrames;
|
||||||
|
framesCapacity = newFramesCap;
|
||||||
}
|
}
|
||||||
|
|
||||||
DRMP3_COPY_MEMORY(pFrames + totalFramesRead*pMP3->channels, temp, (size_t)(framesJustRead*pMP3->channels*sizeof(drmp3_int16)));
|
DRMP3_COPY_MEMORY(pFrames + totalFramesRead*pMP3->channels, temp, (size_t)(framesJustRead*pMP3->channels*sizeof(drmp3_int16)));
|
||||||
@@ -4009,6 +4010,9 @@ DIFFERENCES BETWEEN minimp3 AND dr_mp3
|
|||||||
/*
|
/*
|
||||||
REVISION HISTORY
|
REVISION HISTORY
|
||||||
================
|
================
|
||||||
|
v0.5.5 - 2020-01-29
|
||||||
|
- Fix a memory allocation bug in high level s16 decoding APIs.
|
||||||
|
|
||||||
v0.5.4 - 2019-12-02
|
v0.5.4 - 2019-12-02
|
||||||
- Fix a possible null pointer dereference when using custom memory allocators for realloc().
|
- Fix a possible null pointer dereference when using custom memory allocators for realloc().
|
||||||
|
|
||||||
@@ -4182,7 +4186,7 @@ For more information, please refer to <http://unlicense.org/>
|
|||||||
===============================================================================
|
===============================================================================
|
||||||
ALTERNATIVE 2 - MIT No Attribution
|
ALTERNATIVE 2 - MIT No Attribution
|
||||||
===============================================================================
|
===============================================================================
|
||||||
Copyright 2018 David Reid
|
Copyright 2020 David Reid
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
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 software and associated documentation files (the "Software"), to deal in
|
||||||
|
|||||||
+19
-12
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
WAV audio loader and writer. Choice of public domain or MIT-0. See license statements at the end of this file.
|
WAV audio loader and writer. Choice of public domain or MIT-0. See license statements at the end of this file.
|
||||||
dr_wav - v0.11.3 - 2020-01-12
|
dr_wav - v0.11.4 - 2020-01-29
|
||||||
|
|
||||||
David Reid - mackron@gmail.com
|
David Reid - mackron@gmail.com
|
||||||
*/
|
*/
|
||||||
@@ -1100,14 +1100,14 @@ static const drwav_uint8 drwavGUID_W64_SMPL[16] = {0x73,0x6D,0x70,0x6C, 0xF3,0xA
|
|||||||
|
|
||||||
static DRWAV_INLINE drwav_bool32 drwav__guid_equal(const drwav_uint8 a[16], const drwav_uint8 b[16])
|
static DRWAV_INLINE drwav_bool32 drwav__guid_equal(const drwav_uint8 a[16], const drwav_uint8 b[16])
|
||||||
{
|
{
|
||||||
const drwav_uint32* a32 = (const drwav_uint32*)a;
|
int i;
|
||||||
const drwav_uint32* b32 = (const drwav_uint32*)b;
|
for (i = 0; i < 16; i += 1) {
|
||||||
|
if (a[i] != b[i]) {
|
||||||
|
return DRWAV_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return DRWAV_TRUE;
|
||||||
a32[0] == b32[0] &&
|
|
||||||
a32[1] == b32[1] &&
|
|
||||||
a32[2] == b32[2] &&
|
|
||||||
a32[3] == b32[3];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DRWAV_INLINE drwav_bool32 drwav__fourcc_equal(const unsigned char* a, const char* b)
|
static DRWAV_INLINE drwav_bool32 drwav__fourcc_equal(const unsigned char* a, const char* b)
|
||||||
@@ -3579,7 +3579,8 @@ static void drwav__pcm_to_s16(drwav_int16* pOut, const unsigned char* pIn, size_
|
|||||||
unsigned int shift = (8 - bytesPerSample) * 8;
|
unsigned int shift = (8 - bytesPerSample) * 8;
|
||||||
|
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
for (j = 0; j < bytesPerSample && j < 8; j += 1) {
|
for (j = 0; j < bytesPerSample; j += 1) {
|
||||||
|
DRWAV_ASSERT(j < 8);
|
||||||
sample |= (drwav_uint64)(pIn[j]) << shift;
|
sample |= (drwav_uint64)(pIn[j]) << shift;
|
||||||
shift += 8;
|
shift += 8;
|
||||||
}
|
}
|
||||||
@@ -3901,7 +3902,8 @@ static void drwav__pcm_to_f32(float* pOut, const unsigned char* pIn, size_t samp
|
|||||||
unsigned int shift = (8 - bytesPerSample) * 8;
|
unsigned int shift = (8 - bytesPerSample) * 8;
|
||||||
|
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
for (j = 0; j < bytesPerSample && j < 8; j += 1) {
|
for (j = 0; j < bytesPerSample; j += 1) {
|
||||||
|
DRWAV_ASSERT(j < 8);
|
||||||
sample |= (drwav_uint64)(pIn[j]) << shift;
|
sample |= (drwav_uint64)(pIn[j]) << shift;
|
||||||
shift += 8;
|
shift += 8;
|
||||||
}
|
}
|
||||||
@@ -4051,7 +4053,7 @@ drwav_uint64 drwav_read_pcm_frames_f32__alaw(drwav* pWav, drwav_uint64 framesToR
|
|||||||
|
|
||||||
totalFramesRead = 0;
|
totalFramesRead = 0;
|
||||||
|
|
||||||
while (bytesPerFrame > 0) {
|
while (framesToRead > 0) {
|
||||||
drwav_uint64 framesRead = drwav_read_pcm_frames(pWav, drwav_min(framesToRead, sizeof(sampleData)/bytesPerFrame), sampleData);
|
drwav_uint64 framesRead = drwav_read_pcm_frames(pWav, drwav_min(framesToRead, sizeof(sampleData)/bytesPerFrame), sampleData);
|
||||||
if (framesRead == 0) {
|
if (framesRead == 0) {
|
||||||
break;
|
break;
|
||||||
@@ -4303,7 +4305,8 @@ static void drwav__pcm_to_s32(drwav_int32* pOut, const unsigned char* pIn, size_
|
|||||||
unsigned int shift = (8 - bytesPerSample) * 8;
|
unsigned int shift = (8 - bytesPerSample) * 8;
|
||||||
|
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
for (j = 0; j < bytesPerSample && j < 8; j += 1) {
|
for (j = 0; j < bytesPerSample; j += 1) {
|
||||||
|
DRWAV_ASSERT(j < 8);
|
||||||
sample |= (drwav_uint64)(pIn[j]) << shift;
|
sample |= (drwav_uint64)(pIn[j]) << shift;
|
||||||
shift += 8;
|
shift += 8;
|
||||||
}
|
}
|
||||||
@@ -5052,6 +5055,10 @@ void drwav_free(void* p, const drwav_allocation_callbacks* pAllocationCallbacks)
|
|||||||
/*
|
/*
|
||||||
REVISION HISTORY
|
REVISION HISTORY
|
||||||
================
|
================
|
||||||
|
v0.11.4 - 2020-01-29
|
||||||
|
- Fix some static analysis warnings.
|
||||||
|
- Fix a bug when reading f32 samples from an A-law encoded stream.
|
||||||
|
|
||||||
v0.11.3 - 2020-01-12
|
v0.11.3 - 2020-01-12
|
||||||
- Minor changes to some f32 format conversion routines.
|
- Minor changes to some f32 format conversion routines.
|
||||||
- Minor bug fix for ADPCM conversion when end of file is reached.
|
- Minor bug fix for ADPCM conversion when end of file is reached.
|
||||||
|
|||||||
Reference in New Issue
Block a user