emscripten
emscripten copied to clipboard
help wanted adding pthread support to sdl2_mixer
Hi,
I wanted to add pthread support to the sdl2_mixer port just like sdl2_ttf and sdl2_image have it. I am relatively new to python and emscripten so I got a question.
how is this variants being used, is there some documentation somewhere ?
in sdl2_mixer for example are two variants:
variants = {
'sdl2_mixer_mp3': {'SDL2_MIXER_FORMATS': ["mp3"]},
'sdl2_mixer_none': {'SDL2_MIXER_FORMATS': []},
}
where is the decision being made that sdl2_mixer_mp3 is being used ?
in the __init__.py I can see that there is the port_variants variable where the variants gets collected into.
And in the embuilder.py, the function get_port_variant is using it.
But I still don't understand it fully... what is calling "get_port_variant" ? would a name like "sdl2_image-png-mt" or equivalent then sdl2_mixer_mp3-mt then being build somewhere ?
So, I just went ahead and created a PR (https://github.com/emscripten-core/emscripten/pull/23094). Although the questions are still open, the changes work for me, so It might not be totally wrong :-)
What is the motivation here? Does SDL2_mixer actually use threads?
To be honest, I don't know. I can not really see much thread related stuff in the SDL2_mixer repo. Without the changes I get a log of errors like:
AssertionError: attempt to lock the cache while a parent process is holding the lock (sysroot/lib/wasm32-emscripten/libSDL2.a)
So It might be a dependency problem ? Maybe because mixer depends on another SDL2 version then the others now ? Not sure
Ah yes, if it solves the dependency issue then this looks like the only/right fix
Please mentions the issue it fixed in the PR description.
Please mentions the issue it fixed in the PR description.
will sdl2_mixer format variants support "opus"?i think the opus format is friendly for web.i have build the sdl_mixer support opus for other platform,but when i build with -s SDL2_MIXER_FORMATS='["mp3","ogg","opus"]'
i found it's not useful。
when i search the documents,
Formats to support in SDL2_mixer. Valid values: ogg, mp3, mod, mid
so will sdl2_mixer format variants support "opus"? thanks!
If you would like to support opus that would mean adding an opus port and then adding opus to the list of available formats in ports/sdl2_mixer.py. If you are doing to be using opus support maybe you could send a PR to add that?