mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 01:04:02 +02:00
Add ma_decode_from_vfs().
This commit is contained in:
+13
-9
@@ -5571,6 +5571,7 @@ MA_API ma_result ma_decoder_seek_to_pcm_frame(ma_decoder* pDecoder, ma_uint64 fr
|
||||
Helper for opening and decoding a file into a heap allocated block of memory. Free the returned pointer with ma_free(). On input,
|
||||
pConfig should be set to what you want. On output it will be set to what you got.
|
||||
*/
|
||||
MA_API ma_result ma_decode_from_vfs(ma_vfs* pVFS, const char* pFilePath, ma_decoder_config* pConfig, ma_uint64* pFrameCountOut, void** ppPCMFramesOut);
|
||||
MA_API ma_result ma_decode_file(const char* pFilePath, ma_decoder_config* pConfig, ma_uint64* pFrameCountOut, void** ppPCMFramesOut);
|
||||
MA_API ma_result ma_decode_memory(const void* pData, size_t dataSize, ma_decoder_config* pConfig, ma_uint64* pFrameCountOut, void** ppPCMFramesOut);
|
||||
|
||||
@@ -43308,11 +43309,11 @@ static ma_result ma_decoder__full_decode_and_uninit(ma_decoder* pDecoder, ma_dec
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
MA_API ma_result ma_decode_file(const char* pFilePath, ma_decoder_config* pConfig, ma_uint64* pFrameCountOut, void** ppPCMFramesOut)
|
||||
MA_API ma_result ma_decode_from_vfs(ma_vfs* pVFS, const char* pFilePath, ma_decoder_config* pConfig, ma_uint64* pFrameCountOut, void** ppPCMFramesOut)
|
||||
{
|
||||
ma_result result;
|
||||
ma_decoder_config config;
|
||||
ma_decoder decoder;
|
||||
ma_result result;
|
||||
|
||||
if (pFrameCountOut != NULL) {
|
||||
*pFrameCountOut = 0;
|
||||
@@ -43321,18 +43322,21 @@ MA_API ma_result ma_decode_file(const char* pFilePath, ma_decoder_config* pConfi
|
||||
*ppPCMFramesOut = NULL;
|
||||
}
|
||||
|
||||
if (pFilePath == NULL) {
|
||||
return MA_INVALID_ARGS;
|
||||
}
|
||||
|
||||
config = ma_decoder_config_init_copy(pConfig);
|
||||
|
||||
result = ma_decoder_init_file(pFilePath, &config, &decoder);
|
||||
|
||||
result = ma_decoder_init_vfs(pVFS, pFilePath, &config, &decoder);
|
||||
if (result != MA_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return ma_decoder__full_decode_and_uninit(&decoder, pConfig, pFrameCountOut, ppPCMFramesOut);
|
||||
result = ma_decoder__full_decode_and_uninit(&decoder, pConfig, pFrameCountOut, ppPCMFramesOut);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
MA_API ma_result ma_decode_file(const char* pFilePath, ma_decoder_config* pConfig, ma_uint64* pFrameCountOut, void** ppPCMFramesOut)
|
||||
{
|
||||
return ma_decode_from_vfs(NULL, pFilePath, pConfig, pFrameCountOut, ppPCMFramesOut);
|
||||
}
|
||||
|
||||
MA_API ma_result ma_decode_memory(const void* pData, size_t dataSize, ma_decoder_config* pConfig, ma_uint64* pFrameCountOut, void** ppPCMFramesOut)
|
||||
|
||||
Reference in New Issue
Block a user