+
+void
+Butler::player_changed (int what)
+{
+ boost::mutex::scoped_lock lm (_mutex);
+ if (_died || _pending_seek_position) {
+ return;
+ }
+
+ DCPTime seek_to;
+ DCPTime next = _video.get().second;
+ if (_awaiting && _awaiting > next) {
+ /* We have recently done a player_changed seek and our buffers haven't been refilled yet,
+ so assume that we're seeking to the same place as last time.
+ */
+ seek_to = *_awaiting;
+ } else {
+ seek_to = next;
+ }
+
+ {
+ boost::mutex::scoped_lock lm (_video_audio_mutex);
+ _video.clear ();
+ _audio.clear ();
+ }
+
+ _finished = false;
+ _summon.notify_all ();
+
+ seek_unlocked (seek_to, true);
+ _awaiting = seek_to;
+}