mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 09:14:04 +02:00
Update extras.
This commit is contained in:
+28
-3
@@ -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.9 - 2020-04-05
|
||||
dr_flac - v0.12.10 - 2020-04-10
|
||||
|
||||
David Reid - mackron@gmail.com
|
||||
|
||||
@@ -5879,6 +5879,14 @@ static drflac_bool32 drflac__seek_to_pcm_frame__seek_table(drflac* pFlac, drflac
|
||||
iClosestSeekpoint = iSeekpoint;
|
||||
}
|
||||
|
||||
/* There's been cases where the seek table contains only zeros. We need to do some basic validation on the closest seekpoint. */
|
||||
if (pFlac->pSeekpoints[iClosestSeekpoint].pcmFrameCount == 0 || pFlac->pSeekpoints[iClosestSeekpoint].pcmFrameCount > pFlac->maxBlockSizeInPCMFrames) {
|
||||
return DRFLAC_FALSE;
|
||||
}
|
||||
if (pFlac->pSeekpoints[iClosestSeekpoint].firstPCMFrame > pFlac->totalPCMFrameCount && pFlac->totalPCMFrameCount > 0) {
|
||||
return DRFLAC_FALSE;
|
||||
}
|
||||
|
||||
#if !defined(DR_FLAC_NO_CRC)
|
||||
/* At this point we should know the closest seek point. We can use a binary search for this. We need to know the total sample count for this. */
|
||||
if (pFlac->totalPCMFrameCount > 0) {
|
||||
@@ -5888,9 +5896,23 @@ static drflac_bool32 drflac__seek_to_pcm_frame__seek_table(drflac* pFlac, drflac
|
||||
byteRangeHi = pFlac->firstFLACFramePosInBytes + (drflac_uint64)((drflac_int64)(pFlac->totalPCMFrameCount * pFlac->channels * pFlac->bitsPerSample)/8.0f);
|
||||
byteRangeLo = pFlac->firstFLACFramePosInBytes + pFlac->pSeekpoints[iClosestSeekpoint].flacFrameOffset;
|
||||
|
||||
/*
|
||||
If our closest seek point is not the last one, we only need to search between it and the next one. The section below calculates an appropriate starting
|
||||
value for byteRangeHi which will clamp it appropriately.
|
||||
|
||||
Note that the next seekpoint must have an offset greater than the closest seekpoint because otherwise our binary search algorithm will break down. There
|
||||
have been cases where a seektable consists of seek points where every byte offset is set to 0 which causes problems. If this happens we need to abort.
|
||||
*/
|
||||
if (iClosestSeekpoint < pFlac->seekpointCount-1) {
|
||||
if (pFlac->pSeekpoints[iClosestSeekpoint+1].firstPCMFrame != (((drflac_uint64)0xFFFFFFFF << 32) | 0xFFFFFFFF)) { /* Is it a placeholder seekpoint. */
|
||||
byteRangeHi = pFlac->firstFLACFramePosInBytes + pFlac->pSeekpoints[iClosestSeekpoint+1].flacFrameOffset-1; /* Must be zero based. */
|
||||
drflac_uint32 iNextSeekpoint = iClosestSeekpoint + 1;
|
||||
|
||||
/* Basic validation on the seekpoints to ensure they're usable. */
|
||||
if (pFlac->pSeekpoints[iClosestSeekpoint].flacFrameOffset >= pFlac->pSeekpoints[iNextSeekpoint].flacFrameOffset || pFlac->pSeekpoints[iNextSeekpoint].pcmFrameCount == 0) {
|
||||
return DRFLAC_FALSE; /* The next seekpoint doesn't look right. The seek table cannot be trusted from here. Abort. */
|
||||
}
|
||||
|
||||
if (pFlac->pSeekpoints[iNextSeekpoint].firstPCMFrame != (((drflac_uint64)0xFFFFFFFF << 32) | 0xFFFFFFFF)) { /* Make sure it's not a placeholder seekpoint. */
|
||||
byteRangeHi = pFlac->firstFLACFramePosInBytes + pFlac->pSeekpoints[iNextSeekpoint].flacFrameOffset - 1; /* byteRangeHi must be zero based. */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11692,6 +11714,9 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat
|
||||
/*
|
||||
REVISION HISTORY
|
||||
================
|
||||
v0.12.10 - 2020-04-10
|
||||
- Fix some bugs when trying to seek with an invalid seek table.
|
||||
|
||||
v0.12.9 - 2020-04-05
|
||||
- Fix warnings.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user