{
_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
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
_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.