Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
655c0876
Commit
655c0876
authored
Jul 11, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid some superfluous decoder backend initialization.
parent
dcec55f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
miniaudio.h
miniaudio.h
+48
-0
No files found.
miniaudio.h
View file @
655c0876
...
...
@@ -50291,6 +50291,14 @@ static ma_result ma_decoder_init__internal(ma_decoder_read_proc onRead, ma_decod
}
}
/*
If we get to this point and we still haven't found a decoder, and the caller has requested a
specific encoding format, there's no hope for it. Abort.
*/
if (pConfig->encodingFormat != ma_encoding_format_unknown) {
return MA_NO_BACKEND;
}
#ifdef MA_HAS_WAV
if (result != MA_SUCCESS) {
result = ma_decoder_init_wav__internal(pConfig, pDecoder);
...
...
@@ -50808,6 +50816,26 @@ MA_API ma_result ma_decoder_init_vfs(ma_vfs* pVFS, const char* pFilePath, const
if (result != MA_SUCCESS) {
/* Getting here means we weren't able to initialize a decoder of a specific encoding format. */
/*
We use trial and error to open a decoder. We prioritize custom decoders so that if they
implement the same encoding format they take priority over the built-in decoders.
*/
if (result != MA_SUCCESS) {
result = ma_decoder_init_custom__internal(pConfig, pDecoder);
if (result != MA_SUCCESS) {
ma_decoder__on_seek_vfs(pDecoder, 0, ma_seek_origin_start);
}
}
/*
If we get to this point and we still haven't found a decoder, and the caller has requested a
specific encoding format, there's no hope for it. Abort.
*/
if (pConfig->encodingFormat != ma_encoding_format_unknown) {
return MA_NO_BACKEND;
}
#ifdef MA_HAS_WAV
if (result != MA_SUCCESS && ma_path_extension_equal(pFilePath, "wav")) {
result = ma_decoder_init_wav__internal(&config, pDecoder);
...
...
@@ -50994,6 +51022,26 @@ MA_API ma_result ma_decoder_init_vfs_w(ma_vfs* pVFS, const wchar_t* pFilePath, c
if (result != MA_SUCCESS) {
/* Getting here means we weren't able to initialize a decoder of a specific encoding format. */
/*
We use trial and error to open a decoder. We prioritize custom decoders so that if they
implement the same encoding format they take priority over the built-in decoders.
*/
if (result != MA_SUCCESS) {
result = ma_decoder_init_custom__internal(pConfig, pDecoder);
if (result != MA_SUCCESS) {
ma_decoder__on_seek_vfs(pDecoder, 0, ma_seek_origin_start);
}
}
/*
If we get to this point and we still haven't found a decoder, and the caller has requested a
specific encoding format, there's no hope for it. Abort.
*/
if (pConfig->encodingFormat != ma_encoding_format_unknown) {
return MA_NO_BACKEND;
}
#ifdef MA_HAS_WAV
if (result != MA_SUCCESS && ma_path_extension_equal_w(pFilePath, L"wav")) {
result = ma_decoder_init_wav__internal(&config, pDecoder);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment