mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 01:04:02 +02:00
Merge branch 'dev' into dev-0.12
This commit is contained in:
+55
-30
@@ -61146,33 +61146,8 @@ static ma_result ma_wav_init_internal(const ma_decoding_backend_config* pConfig,
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
MA_API ma_result ma_wav_init(ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_proc onTell, void* pReadSeekTellUserData, const ma_decoding_backend_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_wav* pWav)
|
||||
static ma_result ma_wav_post_init(ma_wav* pWav)
|
||||
{
|
||||
ma_result result;
|
||||
|
||||
result = ma_wav_init_internal(pConfig, pWav);
|
||||
if (result != MA_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (onRead == NULL || onSeek == NULL) {
|
||||
return MA_INVALID_ARGS; /* onRead and onSeek are mandatory. */
|
||||
}
|
||||
|
||||
pWav->onRead = onRead;
|
||||
pWav->onSeek = onSeek;
|
||||
pWav->onTell = onTell;
|
||||
pWav->pReadSeekTellUserData = pReadSeekTellUserData;
|
||||
|
||||
#if !defined(MA_NO_WAV)
|
||||
{
|
||||
ma_bool32 wavResult;
|
||||
|
||||
wavResult = ma_dr_wav_init(&pWav->dr, ma_wav_dr_callback__read, ma_wav_dr_callback__seek, pWav, pAllocationCallbacks);
|
||||
if (wavResult != MA_TRUE) {
|
||||
return MA_INVALID_FILE;
|
||||
}
|
||||
|
||||
/*
|
||||
If an explicit format was not specified, try picking the closest match based on the internal
|
||||
format. The format needs to be supported by miniaudio.
|
||||
@@ -61211,6 +61186,38 @@ MA_API ma_result ma_wav_init(ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_p
|
||||
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
MA_API ma_result ma_wav_init(ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_proc onTell, void* pReadSeekTellUserData, const ma_decoding_backend_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_wav* pWav)
|
||||
{
|
||||
ma_result result;
|
||||
|
||||
result = ma_wav_init_internal(pConfig, pWav);
|
||||
if (result != MA_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (onRead == NULL || onSeek == NULL) {
|
||||
return MA_INVALID_ARGS; /* onRead and onSeek are mandatory. */
|
||||
}
|
||||
|
||||
pWav->onRead = onRead;
|
||||
pWav->onSeek = onSeek;
|
||||
pWav->onTell = onTell;
|
||||
pWav->pReadSeekTellUserData = pReadSeekTellUserData;
|
||||
|
||||
#if !defined(MA_NO_WAV)
|
||||
{
|
||||
ma_bool32 wavResult;
|
||||
|
||||
wavResult = ma_dr_wav_init(&pWav->dr, ma_wav_dr_callback__read, ma_wav_dr_callback__seek, pWav, pAllocationCallbacks);
|
||||
if (wavResult != MA_TRUE) {
|
||||
return MA_INVALID_FILE;
|
||||
}
|
||||
|
||||
ma_wav_post_init(pWav);
|
||||
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
#else
|
||||
{
|
||||
/* wav is disabled. */
|
||||
@@ -61238,6 +61245,8 @@ MA_API ma_result ma_wav_init_file(const char* pFilePath, const ma_decoding_backe
|
||||
return MA_INVALID_FILE;
|
||||
}
|
||||
|
||||
ma_wav_post_init(pWav);
|
||||
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
#else
|
||||
@@ -61268,6 +61277,8 @@ MA_API ma_result ma_wav_init_file_w(const wchar_t* pFilePath, const ma_decoding_
|
||||
return MA_INVALID_FILE;
|
||||
}
|
||||
|
||||
ma_wav_post_init(pWav);
|
||||
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
#else
|
||||
@@ -61298,6 +61309,8 @@ MA_API ma_result ma_wav_init_memory(const void* pData, size_t dataSize, const ma
|
||||
return MA_INVALID_FILE;
|
||||
}
|
||||
|
||||
ma_wav_post_init(pWav);
|
||||
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
#else
|
||||
@@ -62476,6 +62489,18 @@ static ma_result ma_mp3_generate_seek_table(ma_mp3* pMP3, const ma_decoding_back
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
static ma_result ma_mp3_post_init(ma_mp3* pMP3, const ma_decoding_backend_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks)
|
||||
{
|
||||
ma_result result;
|
||||
|
||||
result = ma_mp3_generate_seek_table(pMP3, pConfig, pAllocationCallbacks);
|
||||
if (result != MA_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
MA_API ma_result ma_mp3_init(ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_proc onTell, void* pReadSeekTellUserData, const ma_decoding_backend_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_mp3* pMP3)
|
||||
{
|
||||
ma_result result;
|
||||
@@ -62503,7 +62528,7 @@ MA_API ma_result ma_mp3_init(ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_p
|
||||
return MA_INVALID_FILE;
|
||||
}
|
||||
|
||||
ma_mp3_generate_seek_table(pMP3, pConfig, pAllocationCallbacks);
|
||||
ma_mp3_post_init(pMP3, pConfig, pAllocationCallbacks);
|
||||
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
@@ -62534,7 +62559,7 @@ MA_API ma_result ma_mp3_init_file(const char* pFilePath, const ma_decoding_backe
|
||||
return MA_INVALID_FILE;
|
||||
}
|
||||
|
||||
ma_mp3_generate_seek_table(pMP3, pConfig, pAllocationCallbacks);
|
||||
ma_mp3_post_init(pMP3, pConfig, pAllocationCallbacks);
|
||||
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
@@ -62566,7 +62591,7 @@ MA_API ma_result ma_mp3_init_file_w(const wchar_t* pFilePath, const ma_decoding_
|
||||
return MA_INVALID_FILE;
|
||||
}
|
||||
|
||||
ma_mp3_generate_seek_table(pMP3, pConfig, pAllocationCallbacks);
|
||||
ma_mp3_post_init(pMP3, pConfig, pAllocationCallbacks);
|
||||
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
@@ -62598,7 +62623,7 @@ MA_API ma_result ma_mp3_init_memory(const void* pData, size_t dataSize, const ma
|
||||
return MA_INVALID_FILE;
|
||||
}
|
||||
|
||||
ma_mp3_generate_seek_table(pMP3, pConfig, pAllocationCallbacks);
|
||||
ma_mp3_post_init(pMP3, pConfig, pAllocationCallbacks);
|
||||
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user