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 4902

Summary: duration support for music_mad.c
Product: SDL_mixer Reporter: Ozkan Sezer <sezeroz>
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED WONTFIX QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2 CC: admin, uso.cosmo.ray
Version: unspecified   
Hardware: All   
OS: All   
Attachments: duration support for music_mad.c

Description Ozkan Sezer 2019-12-17 19:02:08 UTC
Created attachment 4110 [details]
duration support for music_mad.c

The attached patch, provided by Vitaly Novichkov, adds
duration support (i.e. bug #4715) to music_mad.c. It's
extracted from Vitaly's fork.  Please review.
Comment 1 Ozkan Sezer 2019-12-17 19:13:03 UTC
One bad thing about this patch, as far as I can see,
is that it scans the whole mp3 file. Using the Xing
frame, if present, would have been much better..
Comment 2 Vitaly Novichkov 2019-12-17 19:18:21 UTC
> Xing frame

Do you know kow to get it? One note that some bad MP3 files may result an incorrect length detection. The full scan of a file gives the accurate length value. It's even able to return the length for files are failing with mpg123. Btw, I have lots of these files are failing to return length with mpg123. So, try to get the Xing frame if possible, otherwise, do a full file scam to calculate the length.
Comment 3 Ozkan Sezer 2019-12-17 19:29:17 UTC
(In reply to Vitaly Novichkov from comment #2)
> > Xing frame
> 
> Do you know kow to get it? One note that some bad MP3 files may result an
> incorrect length detection. The full scan of a file gives the accurate
> length value. It's even able to return the length for files are failing with
> mpg123. Btw, I have lots of these files are failing to return length with
> mpg123. So, try to get the Xing frame if possible, otherwise, do a full file
> scam to calculate the length.

Never wrote code for it myself, but there are lots of documentation
on the web. The available code (the ones I know) are GPL or LGPL, so
I am not touching them.

Bad thing about full file scan is that it is slow. A 500k mp3 is OK
maybe, but a big file may cause an unwanted lag  at start.
Comment 4 Vitaly Novichkov 2019-12-17 19:34:24 UTC
Okay, once I get my home, I'll try to check out some.

About the lag: it's very dependent from a file size and the disk performance. In my experience, the lag while opening regular MP3 files is pretty short (less than 0.1 second), but when speaking about bigger files like more than 10 MB that obviously will be longer. Digging guts for me isn't a problem, I should give a shot to support a Xing frame for a faster length detection.
Comment 6 Ozkan Sezer 2019-12-19 16:03:53 UTC
Changing importance type to 'enhancement'. Mp3-mad isn't
even enabled by defalut due to license issues, therefore
low-priority.
Comment 7 Vitaly Novichkov 2019-12-19 21:07:26 UTC
Maybe it's reasonable to merge this thing now if it looks fine? It's now a blocker that prevents me to backport a big MusicInterface exchange from MixerX.
Comment 8 Ozkan Sezer 2019-12-19 21:51:53 UTC
(In reply to Vitaly Novichkov from comment #7)
> Maybe it's reasonable to merge this thing now if it looks fine? It's now a
> blocker that prevents me to backport a big MusicInterface exchange from
> MixerX.

Speaking for myself:  It does _not_ look fine to me. If it is
blocking you to prepare a patch-set, you should change things
on your end.
Comment 9 Ozkan Sezer 2020-10-25 21:08:57 UTC
We should not bother ourselves with this.  Closing as wont-fix.