mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 01:04:02 +02:00
Update dr_wav and dr_mp3.
This commit is contained in:
+8
-2
@@ -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.18 - 2020-11-01
|
||||
dr_mp3 - v0.6.19 - 2020-11-13
|
||||
|
||||
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 18
|
||||
#define DRMP3_VERSION_REVISION 19
|
||||
#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. */
|
||||
@@ -2691,6 +2691,9 @@ static drmp3_uint32 drmp3_decode_next_frame_ex__callbacks(drmp3* pMP3, drmp3d_sa
|
||||
return 0; /* File too big. */
|
||||
}
|
||||
|
||||
DRMP3_ASSERT(pMP3->pData != NULL);
|
||||
DRMP3_ASSERT(pMP3->dataCapacity > 0);
|
||||
|
||||
pcmFramesRead = drmp3dec_decode_frame(&pMP3->decoder, pMP3->pData + pMP3->dataConsumed, (int)pMP3->dataSize, pPCMFrames, &info); /* <-- Safe size_t -> int conversion thanks to the check above. */
|
||||
|
||||
/* Consume the data. */
|
||||
@@ -4432,6 +4435,9 @@ counts rather than sample counts.
|
||||
/*
|
||||
REVISION HISTORY
|
||||
================
|
||||
v0.6.19 - 2020-11-13
|
||||
- Minor code clean up.
|
||||
|
||||
v0.6.18 - 2020-11-01
|
||||
- Improve compiler support for older versions of GCC.
|
||||
|
||||
|
||||
+24
-4
@@ -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.
|
||||
dr_wav - v0.12.13 - 2020-11-01
|
||||
dr_wav - v0.12.14 - 2020-11-13
|
||||
|
||||
David Reid - mackron@gmail.com
|
||||
|
||||
@@ -144,7 +144,7 @@ extern "C" {
|
||||
|
||||
#define DRWAV_VERSION_MAJOR 0
|
||||
#define DRWAV_VERSION_MINOR 12
|
||||
#define DRWAV_VERSION_REVISION 13
|
||||
#define DRWAV_VERSION_REVISION 14
|
||||
#define DRWAV_VERSION_STRING DRWAV_XSTRINGIFY(DRWAV_VERSION_MAJOR) "." DRWAV_XSTRINGIFY(DRWAV_VERSION_MINOR) "." DRWAV_XSTRINGIFY(DRWAV_VERSION_REVISION)
|
||||
|
||||
#include <stddef.h> /* For size_t. */
|
||||
@@ -2478,6 +2478,13 @@ static drwav_bool32 drwav_init_write__internal(drwav* pWav, const drwav_data_for
|
||||
runningPos += drwav__write_u32ne_to_le(pWav, 0xFFFFFFFF); /* Always set to 0xFFFFFFFF for RF64. The true size of the data chunk is specified in the ds64 chunk. */
|
||||
}
|
||||
|
||||
/*
|
||||
The runningPos variable is incremented in the section above but is left unused which is causing some static analysis tools to detect it
|
||||
as a dead store. I'm leaving this as-is for safety just in case I want to expand this function later to include other tags and want to
|
||||
keep track of the running position for whatever reason. The line below should silence the static analysis tools.
|
||||
*/
|
||||
(void)runningPos;
|
||||
|
||||
/* Set some properties for the client's convenience. */
|
||||
pWav->container = pFormat->container;
|
||||
pWav->channels = (drwav_uint16)pFormat->channels;
|
||||
@@ -3575,6 +3582,7 @@ DRWAV_API size_t drwav_read_raw(drwav* pWav, size_t bytesToRead, void* pBufferOu
|
||||
DRWAV_API drwav_uint64 drwav_read_pcm_frames_le(drwav* pWav, drwav_uint64 framesToRead, void* pBufferOut)
|
||||
{
|
||||
drwav_uint32 bytesPerFrame;
|
||||
drwav_uint64 bytesToRead; /* Intentionally uint64 instead of size_t so we can do a check that we're not reading too much on 32-bit builds. */
|
||||
|
||||
if (pWav == NULL || framesToRead == 0) {
|
||||
return 0;
|
||||
@@ -3591,11 +3599,20 @@ DRWAV_API drwav_uint64 drwav_read_pcm_frames_le(drwav* pWav, drwav_uint64 frames
|
||||
}
|
||||
|
||||
/* Don't try to read more samples than can potentially fit in the output buffer. */
|
||||
if (framesToRead * bytesPerFrame > DRWAV_SIZE_MAX) {
|
||||
bytesToRead = framesToRead * bytesPerFrame;
|
||||
if (bytesToRead > DRWAV_SIZE_MAX) {
|
||||
framesToRead = DRWAV_SIZE_MAX / bytesPerFrame;
|
||||
}
|
||||
|
||||
return drwav_read_raw(pWav, (size_t)(framesToRead * bytesPerFrame), pBufferOut) / bytesPerFrame;
|
||||
/*
|
||||
Doing an explicit check here just to make it clear that we don't want to be attempt to read anything if there's no bytes to read. There
|
||||
*could* be a time where it evaluates to 0 due to overflowing.
|
||||
*/
|
||||
if (bytesToRead == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return drwav_read_raw(pWav, (size_t)bytesToRead, pBufferOut) / bytesPerFrame;
|
||||
}
|
||||
|
||||
DRWAV_API drwav_uint64 drwav_read_pcm_frames_be(drwav* pWav, drwav_uint64 framesToRead, void* pBufferOut)
|
||||
@@ -6033,6 +6050,9 @@ two different ways to initialize a drwav object.
|
||||
/*
|
||||
REVISION HISTORY
|
||||
================
|
||||
v0.12.14 - 2020-11-13
|
||||
- Minor code clean up.
|
||||
|
||||
v0.12.13 - 2020-11-01
|
||||
- Improve compiler support for older versions of GCC.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user