libsdl-org / SDL_mixer

An audio mixer that supports various file formats for Simple Directmedia Layer.
zlib License
434 stars 146 forks source link

Support wav-files with MPEG encoding with mpg123 #377

Open maxmitti opened 2 years ago

maxmitti commented 2 years ago

(lib)mpg123 can play wav-files with MPEG encoded data. It would be useful if SDL_mixer could support those types as well if mpg123 is enabled. Here is such a file.

patch.patch.txt includes a hack which enables this feature for Mix_LoadWAV_RW to show that it is possible.

sezero commented 2 years ago

I guess we should detect WAVE_FORMAT_MPEGLAYER3 (0x55) audio format tag in music_wav.c, seek to the data chunk and somehow 'forward' the SDLRW to a mp3 decoder built into SDL_mixer.

maxmitti commented 2 years ago

Would it make sense to expose the audio format tag extraction from SDL for this? Maybe also something which seeks to the data chunk or returns the offset of the data chunk?

sezero commented 2 years ago

Possibly too late for 2.6.0. Mark for 2.8.0?