Re: [Rhythmbox-devel] Gapless/crossfade playback in svn trunk



On Wed, Mar 28, 2007 at 10:41:17AM +1200, Steve Baker wrote:
> On 28/03/07, Jonathan Matthew <jonathan kaolin wh9
> > I just committed the gapless/crossfading player backend I've been
> > working on for a while.
> 
> Just as a matter of interest, can you give an overview of how the
> crossfade GStreamer pipeline works?

It creates a bin for each stream (src ! decodebin ! audioconvert !
audioresample ! volume, basically) and links these to an adder element
while they're supposed to be playing.  The volume element for each
stream is used to perform fades (using GstControllers) and also for
replaygain.

To pause or seek in a stream, the stream's src pad is
blocked, then the stream is unlinked from the adder; to unpause, or when
the seek is complete, the stream is linked back to the adder and
unblocked.

Gapless track changes are done by prerolling the next stream
a couple of seconds ahead of time, then waiting until an end of stream
event on the playing stream before actually starting it.  This works
nicely for ogg vorbis and (apparently) flac files, but not for mp3s.

Crossfading is pretty simple - just create a new stream bin, link it in,
tell its volume control to go from 0.0 to 1.0 over n seconds, then find
the playing stream and tell its volume control to go from 1.0 to 0.0
over n seconds.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]