public override void SetNextTrackUri (SafeUri uri, bool maybeVideo)
{
next_track_pending = false;
if (next_track_set.WaitOne (0, false)) {
// We're not waiting for the next track to be set.
// This means that we've missed the window for gapless.
// Save this URI to be played when we receive EOS.
pending_uri = uri;
pending_maybe_video = maybeVideo;
return;
}
// If there isn't a next track for us, release the block on the about-to-finish callback.
if (uri == null) {
next_track_set.Set ();
return;
}
IntPtr uri_ptr = GLib.Marshaller.StringToPtrGStrdup (uri.AbsoluteUri);
try {
bp_set_next_track (handle, uri_ptr, maybeVideo);
} finally {
GLib.Marshaller.Free (uri_ptr);
next_track_set.Set ();
}
}