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
8567a4bc
Commit
8567a4bc
authored
Jun 30, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hook up custom decoders to the resource manager.
parent
45592535
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
research/miniaudio_engine.h
research/miniaudio_engine.h
+28
-1
No files found.
research/miniaudio_engine.h
View file @
8567a4bc
...
...
@@ -1466,6 +1466,9 @@ typedef struct
ma_uint32
jobThreadCount
;
/* Set to 0 if you want to self-manage your job threads. Defaults to 1. */
ma_uint32
flags
;
ma_vfs
*
pVFS
;
/* Can be NULL in which case defaults will be used. */
ma_decoding_backend_vtable
**
ppCustomDecodingBackendVTables
;
ma_uint32
customDecodingBackendVTableCount
;
void
*
pCustomDecodingBackendUserData
;
}
ma_resource_manager_config
;
MA_API
ma_resource_manager_config
ma_resource_manager_config_init
(
void
);
...
...
@@ -6905,11 +6908,30 @@ MA_API ma_result ma_resource_manager_init(const ma_resource_manager_config* pCon
}
/* Custom decoding backends. */
if
(
pConfig
->
ppCustomDecodingBackendVTables
!=
NULL
&&
pConfig
->
customDecodingBackendVTableCount
>
0
)
{
size_t
sizeInBytes
=
sizeof
(
*
pResourceManager
->
config
.
ppCustomDecodingBackendVTables
)
*
pConfig
->
customDecodingBackendVTableCount
;
pResourceManager
->
config
.
ppCustomDecodingBackendVTables
=
(
ma_decoding_backend_vtable
**
)
ma_malloc
(
sizeInBytes
,
&
pResourceManager
->
config
.
allocationCallbacks
);
if
(
pResourceManager
->
config
.
ppCustomDecodingBackendVTables
==
NULL
)
{
ma_job_queue_uninit
(
&
pResourceManager
->
jobQueue
);
return
MA_OUT_OF_MEMORY
;
}
MA_COPY_MEMORY
(
pResourceManager
->
config
.
ppCustomDecodingBackendVTables
,
pConfig
->
ppCustomDecodingBackendVTables
,
sizeInBytes
);
pResourceManager
->
config
.
customDecodingBackendVTableCount
=
pConfig
->
customDecodingBackendVTableCount
;
pResourceManager
->
config
.
pCustomDecodingBackendUserData
=
pConfig
->
pCustomDecodingBackendUserData
;
}
/* Here is where we initialize our threading stuff. We don't do this if we don't support threading. */
if
(
ma_resource_manager_is_threading_enabled
(
pResourceManager
))
{
/* Data buffer lock. */
result
=
ma_mutex_init
(
&
pResourceManager
->
dataBufferBSTLock
);
if
(
result
!=
MA_SUCCESS
)
{
ma_job_queue_uninit
(
&
pResourceManager
->
jobQueue
);
return
result
;
}
...
...
@@ -6973,6 +6995,8 @@ MA_API void ma_resource_manager_uninit(ma_resource_manager* pResourceManager)
if
(
ma_resource_manager_is_threading_enabled
(
pResourceManager
))
{
ma_mutex_uninit
(
&
pResourceManager
->
dataBufferBSTLock
);
}
ma_free
(
pResourceManager
->
config
.
ppCustomDecodingBackendVTables
,
&
pResourceManager
->
config
.
allocationCallbacks
);
}
...
...
@@ -6985,7 +7009,10 @@ static ma_result ma_resource_manager__init_decoder(ma_resource_manager* pResourc
MA_ASSERT
(
pDecoder
!=
NULL
);
config
=
ma_decoder_config_init
(
pResourceManager
->
config
.
decodedFormat
,
pResourceManager
->
config
.
decodedChannels
,
pResourceManager
->
config
.
decodedSampleRate
);
config
.
allocationCallbacks
=
pResourceManager
->
config
.
allocationCallbacks
;
config
.
allocationCallbacks
=
pResourceManager
->
config
.
allocationCallbacks
;
config
.
ppCustomBackendVTables
=
pResourceManager
->
config
.
ppCustomDecodingBackendVTables
;
config
.
customBackendVTableCount
=
pResourceManager
->
config
.
customDecodingBackendVTableCount
;
config
.
pCustomBackendUserData
=
pResourceManager
->
config
.
pCustomDecodingBackendUserData
;
if
(
pFilePath
!=
NULL
)
{
return
ma_decoder_init_vfs
(
pResourceManager
->
config
.
pVFS
,
pFilePath
,
&
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