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 4876

Summary: [PATCH] Flac and ogg - Support User Play Count Selection When Looping
Product: SDL_mixer Reporter: Michael Day <mikeguy42>
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: admin, sezeroz
Version: 2.0.4   
Hardware: x86_64   
OS: Linux   
Attachments: Patch - music_flac.c and music.ogg.c - add support for play count when looping
Sample looping file
A short demo of patched result, recorded on the video

Description Michael Day 2019-11-24 03:09:04 UTC
Created attachment 4068 [details]
Patch - music_flac.c and music.ogg.c - add support for play count when looping

When looping using loop points specified by LOOP* metadata tags, the looping logic should be affected by the user-specified play count value. The patch here applies uniform looping logic to both music_ogg.c and music_flac.c. Also, when the play count is 1, we want to play the audio file straight through without any looping. (This is not currently how the looping logic behaves.)
Comment 1 Ozkan Sezer 2019-11-24 11:36:33 UTC
Vitaly:  This touches your patched code too, I think. So review/test.
Comment 2 Vitaly Novichkov 2019-11-26 10:25:28 UTC
Gonna to check out the thing...
Comment 3 Vitaly Novichkov 2019-11-26 10:42:23 UTC
I have tested this patch, and it fixes the bug! When the file is looping, and when is limited loops count set, the tail should be played after all loops were passed to finalize the song. So, now there are playing fine!
Comment 4 Vitaly Novichkov 2019-11-26 10:42:52 UTC
Created attachment 4069 [details]
Sample looping file

A short sample file to verify the looping
Comment 5 Vitaly Novichkov 2019-11-26 10:44:04 UTC
Created attachment 4070 [details]
A short demo of patched result, recorded on the video

Here you'll see the seek bar. The blue area is the loop range.
I did next tests:
- forever looping
- play single time
- loop twice
- loop trice
Comment 6 Ozkan Sezer 2019-11-26 11:38:33 UTC
Patch applied: http://hg.libsdl.org/SDL_mixer/rev/4f9f5e59419a
Thanks.