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 4907

Summary: mp3_skiptags update and mpg123 duration fix
Product: SDL_mixer Reporter: Ozkan Sezer <sezeroz>
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: admin
Version: unspecified   
Hardware: x86   
OS: Linux   
Attachments: mp3utils1.patch - let mpg123 keep id3v2
mp3utils2.patch - mp3_skiptags() update

Description Ozkan Sezer 2019-12-19 23:49:47 UTC
Two patches:

1. As it is now, mpg123 backend reports -1 duration for multiple mp3s
for me.  The failure is because we skipping the tags unconditionally
since changeset 1072:503ad6c93c50.  If libmpg123 sees the ID3v2 tags,
it does properly report duration for those files.  So the first patch
lets music_mp3123 to keep the ID3v2 tags.

2. Changes to mp3_skiptags() so that it consumes all the tags at file
end:  We do not know the order of ape, or lyrics3, or musicmatch tags,
so we loop until we consume them all, scanning for each tag type once.
(I don't yet care about freaky broken mp3 files with double tags.) It
also removes inline directive from a few detection procedures there.

OK to apply?
Comment 1 Ozkan Sezer 2019-12-19 23:50:29 UTC
Created attachment 4120 [details]
mp3utils1.patch - let mpg123 keep id3v2
Comment 2 Ozkan Sezer 2019-12-19 23:50:55 UTC
Created attachment 4121 [details]
mp3utils2.patch - mp3_skiptags() update
Comment 3 Vitaly Novichkov 2019-12-19 23:53:10 UTC
Note that there are several MP3 files with an invalid length in ID3v2 tag which makes mpg123 return an incorrect duration.
Comment 4 Ozkan Sezer 2019-12-19 23:58:50 UTC
(In reply to Vitaly Novichkov from comment #3)
> Note that there are several MP3 files with an invalid length
> in ID3v2 tag which makes mpg123 return an incorrect duration.

That is a problem of libmpg123 we cannot, and should not try to,
solve by ourselves.
Comment 5 Ozkan Sezer 2019-12-20 08:53:50 UTC
Patches applied:
https://hg.libsdl.org/SDL_mixer/rev/ba8b8227a7bd
https://hg.libsdl.org/SDL_mixer/rev/2e69576079bd
https://hg.libsdl.org/SDL_mixer/rev/91dc8a87aaee
https://hg.libsdl.org/SDL_mixer/rev/4e1c2282e6f1

If any issues are revealed, or if improvements
can be made to them, please drop a note here.