We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3706 - [PATCH] mpg123 support
Summary: [PATCH] mpg123 support
Status: RESOLVED FIXED
Alias: None
Product: SDL_mixer
Classification: Unclassified
Component: misc (show other bugs)
Version: 2.0.1
Hardware: x86_64 Linux
: P2 enhancement
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-20 22:24 UTC by Franc[e]sco
Modified: 2017-10-13 05:28 UTC (History)
0 users

See Also:


Attachments
mpg123 support patch (27.35 KB, patch)
2017-07-20 22:24 UTC, Franc[e]sco
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Franc[e]sco 2017-07-20 22:24:12 UTC
Created attachment 2805 [details]
mpg123 support patch

hello, I was playing with SDL2_mixer and I've noticed that smpeg2 has major issues loading specific malformed/exotic mp3 files such as mp3 files with japanese metadata, which made it hang upon loading the file.

after googling around, I found a github issue about SDL_mixer's mp3 support and they ended up plugging libmpg123 using the music player hook.

libmad seems to do okay for me, but the aforementioned issue reports "noises or crashes due to buffer issues" and both libmad and smpeg2 appear to be unmaintained for many years, so I thought I'd add a libmpg123 mp3 module.

thanks to mpg123's flexible interface I was able to achieve this quickly and with little code, and it even supports seeking. this is a lot cleaner than using the MusicPlayer hook and more flexible.

you can find some advantages of mpg123 on the aforementioned github issue (https://github.com/EasyRPG/Player/issues/818), but basically it handles broken or exotic files much better than mad and smpeg (especially smpeg), and it's a bit more maintained from what I can see.

I have attached the patch, first time working with mercurial and sending patches through mail so there might be mistakes.
Comment 1 Franc[e]sco 2017-07-23 12:21:06 UTC
update: I've found a couple mp3's that play incorrectly even on libmad (stuttering really hard) but play perfectly with my mpg123 patch
Comment 2 Sam Lantinga 2017-10-13 05:28:59 UTC
Added, thanks!
https://hg.libsdl.org/SDL_mixer/rev/420f3b37dc95