Mark .exr as a valid image file.
[dcpomatic.git] / src / lib / butler.cc
index 2b6010aaa6df777498f90a7c969e667670eea623..a78a3b71b22db06998c8ac7073ef4093272c9065 100644 (file)
@@ -59,7 +59,6 @@ Butler::Butler (shared_ptr<Player> player, shared_ptr<Log> log, AudioMapping aud
 {
        _player_video_connection = _player->Video.connect (bind (&Butler::video, this, _1, _2));
        _player_audio_connection = _player->Audio.connect (bind (&Butler::audio, this, _1));
-       _player_changed_connection = _player->Changed.connect (bind (&Butler::player_changed, this));
        _thread = new boost::thread (bind (&Butler::thread, this));
 
        /* Create some threads to do work on the PlayerVideos we are creating; at present this is used to
@@ -102,12 +101,18 @@ Butler::should_run () const
                LOG_WARNING ("Butler audio buffers reached %1 frames", _audio.size());
        }
 
-       return (_video.size() < MINIMUM_VIDEO_READAHEAD || (!_disable_audio && _audio.size() < MINIMUM_AUDIO_READAHEAD))
-               && (_video.size() < MAXIMUM_VIDEO_READAHEAD)
-               && (_audio.size() < MAXIMUM_AUDIO_READAHEAD)
-               && !_stop_thread
-               && !_finished
-               && !_died;
+       if (_stop_thread || _finished || _died) {
+               /* Definitely do not run */
+               return false;
+       }
+
+       if (_video.size() < MINIMUM_VIDEO_READAHEAD || (!_disable_audio && _audio.size() < MINIMUM_AUDIO_READAHEAD)) {
+               /* Definitely do run: we need data */
+               return true;
+       }
+
+       /* Run if we aren't full of video or audio */
+       return (_video.size() < MAXIMUM_VIDEO_READAHEAD) && (_audio.size() < MAXIMUM_AUDIO_READAHEAD);
 }
 
 void
@@ -231,14 +236,6 @@ Butler::audio (shared_ptr<AudioBuffers> audio)
        _audio.put (remap (audio, _audio_channels, _audio_mapping));
 }
 
-void
-Butler::player_changed ()
-{
-       _video.clear ();
-       _audio.clear ();
-       _summon.notify_all ();
-}
-
 /** Try to get `frames' frames of audio and copy it into `out'.  Silence
  *  will be filled if no audio is available.
  *  @return true if there was a buffer underrun, otherwise false.