[Bug 647364] VGM files loop indefinately
bugzilla at gnome.org
Sat Apr 16 12:40:30 PDT 2011
GStreamer | gst-plugins-bad | 0.10.21
--- Comment #9 from mihai.draghicioiu at gmail.com 2011-04-16 19:40:27 UTC ---
Alright, after a bit of research and effort, I found a solution that should
work fine. Apparently, the play_length member of the gme_info_t struct contains
the value we need for song length. Here's an excerpt from gme.h:
/* times in milliseconds; -1 if unknown */
int length; /* total length, if file specifies it */
int intro_length; /* length of song up to looping section */
int loop_length; /* length of looping section */
/* Length if available, otherwise intro_length+loop_length*2 if available,
otherwise a default of 150000 (2.5 minutes). */
So theoretically, it is correct to stop the song at play_length msecs. However,
in gstgme.c, the condition for eos was if (gme_track_ended (gme->player)). This
turns out to be either poorly implemented or just misunderstood in the gme
library. For looping songs, it only returns true when fading is enabled. To
enable fading, one has to call gme_set_fade(gme->player, fade_time), where
fade_time is the time from when to start the fade. The fade duration is 8000
ms, kind of hardcoded in the C api (the C++ gme api allows you to set the fade
duration too). But the fading turned out to be unreliable as well. So my final
solution was to add 8 seconds length to songs which have loop_length > 0 (they
are looping songs), and instead of gme_track_ended() use gme_tell() and compare
to total_duration. I also enabled fading, but this time it is not used for
determining track end, it is simply there to have some fading out towards the
end of the song. I need to mention that it doesn't always work, but at least
the songs progress.
I suspect all this is due to a few bugs in libgme. But that's alright, I seem
to have worked around it.
So I am attaching the new patch, hopefully this is what you meant by git
format-patch format. If not, can you please instruct me how to create a proper
patch? I have no idea how to do this without cloning the git repo.
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs