6 Commits

Author SHA1 Message Date
David Reid 12bacf1186 Revert "Enforce a read callback to be specified for decoders."
This reverts commit 52d09d3688.
2026-03-13 11:22:40 +10:00
David Reid 117366df9a Fix an incorrect check for the decoding seek callback. 2026-03-12 06:24:04 +10:00
David Reid 0041150de0 Update change history. 2026-03-12 06:16:57 +10:00
David Reid 52d09d3688 Enforce a read callback to be specified for decoders. 2026-03-12 06:15:27 +10:00
David Reid 6922366bb1 Don't crash when a decoding seek callback is unavailable. 2026-03-12 06:14:00 +10:00
David Reid 4c082afe71 Clarify usage of the decoder read callback. 2026-03-12 06:08:27 +10:00
2 changed files with 24 additions and 3 deletions
+5
View File
@@ -1,3 +1,8 @@
v0.11.26 - TBD
=====================
* Fixed a crash when passing in null for the read or seek callbacks for a decoder.
v0.11.25 - 2026-03-04
=====================
* Bug fixes to the WAV decoder.
+19 -3
View File
@@ -1,6 +1,6 @@
/*
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file.
miniaudio - v0.11.25 - 2026-03-04
miniaudio - v0.11.26 - TBD
David Reid - mackron@gmail.com
@@ -3747,7 +3747,7 @@ extern "C" {
#define MA_VERSION_MAJOR 0
#define MA_VERSION_MINOR 11
#define MA_VERSION_REVISION 25
#define MA_VERSION_REVISION 26
#define MA_VERSION_STRING MA_XSTRINGIFY(MA_VERSION_MAJOR) "." MA_XSTRINGIFY(MA_VERSION_MINOR) "." MA_XSTRINGIFY(MA_VERSION_REVISION)
#if defined(_MSC_VER) && !defined(__clang__)
@@ -9974,7 +9974,19 @@ typedef struct
} ma_decoding_backend_vtable;
typedef ma_result (* ma_decoder_read_proc)(ma_decoder* pDecoder, void* pBufferOut, size_t bytesToRead, size_t* pBytesRead); /* Returns the number of bytes read. */
/*
The read callback should return MA_SUCCESS if more than zero bytes were successfully read. If zero
bytes can be read because it reached the end of the file, return MA_AT_END. If any other error
occurs just return any other error code (it's fine to just generically return MA_ERROR).
Return the actual number of bytes read in `pBytesRead`. Important note: if the number of bytes
actually read is less than the number of bytes requested (bytesToRead), miniaudio will treat it as
if the end of the file has been reached and it will stop decoding. This becomes relevant for things
like streaming data sources, such as internet streams. If you haven't yet received `bytesToRead`
from the network, you need to have your callback wait for it and then only return when the full
number of bytes can be output, or when you've reached the genuine end of the stream.
*/
typedef ma_result (* ma_decoder_read_proc)(ma_decoder* pDecoder, void* pBufferOut, size_t bytesToRead, size_t* pBytesRead);
typedef ma_result (* ma_decoder_seek_proc)(ma_decoder* pDecoder, ma_int64 byteOffset, ma_seek_origin origin);
typedef ma_result (* ma_decoder_tell_proc)(ma_decoder* pDecoder, ma_int64* pCursor);
@@ -62853,6 +62865,10 @@ static ma_result ma_decoder_seek_bytes(ma_decoder* pDecoder, ma_int64 byteOffset
{
MA_ASSERT(pDecoder != NULL);
if (pDecoder->onSeek == NULL) {
return MA_NOT_IMPLEMENTED;
}
return pDecoder->onSeek(pDecoder, byteOffset, origin);
}