private void OnEos (IntPtr player)
{
StopIterating ();
Close (false);
OnEventChanged (PlayerEvent.EndOfStream);
if (!next_track_pending &&
(!GaplessEnabled || (CurrentTrack != null && CurrentTrack.HasAttribute (TrackMediaAttributes.VideoStream)))) {
// We don't request next track in OnEoS if gapless playback is enabled and current track has no video stream contained.
// The request next track is already called in OnAboutToFinish().
OnEventChanged (PlayerEvent.RequestNextTrack);
} else if (pending_uri != null) {
Log.Warning ("[Gapless] EOS signalled while waiting for next track. This means that Banshee " +
"was too slow at calculating what track to play next. " +
"If this happens frequently, please file a bug");
OnStateChanged (PlayerState.Loading);
OpenUri (pending_uri, pending_maybe_video);
Play ();
pending_uri = null;
} else if (!GaplessEnabled || (CurrentTrack != null && CurrentTrack.HasAttribute (TrackMediaAttributes.VideoStream))) {
// This should be unreachable - the RequestNextTrack event is delegated to the main thread
// and so blocks the bus callback from delivering the EOS message.
//
// Playback should continue as normal from here, when the RequestNextTrack message gets handled.
Log.Warning ("[Gapless] EndOfStream message received before the next track has been set. " +
"If this happens frequently, please file a bug");
} else {
Log.Debug ("[Gapless] Reach the last music under repeat off mode");
}
}