X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fbutler.h;h=a61011f4019fa1ddcc5e6e01f184a9e9011a3fb0;hb=c463929602252be95ca340b477b7f3b42ff6b0c0;hp=d801d6cf9b7f1d12ff1eaa2d9cac1b21d04ca62d;hpb=4f9cb03792e85cbb5b4d554ab8ec0a3275fa7524;p=dcpomatic.git diff --git a/src/lib/butler.h b/src/lib/butler.h index d801d6cf9..a61011f40 100644 --- a/src/lib/butler.h +++ b/src/lib/butler.h @@ -19,42 +19,67 @@ */ #include "video_ring_buffers.h" +#include "audio_ring_buffers.h" +#include "audio_mapping.h" +#include "exception_store.h" #include #include #include #include #include +#include -class Film; class Player; class PlayerVideo; +class Log; -class Butler : public boost::noncopyable +class Butler : public ExceptionStore, public boost::noncopyable { public: - Butler (boost::weak_ptr film, boost::shared_ptr player); + Butler (boost::shared_ptr player, boost::shared_ptr log, AudioMapping map, int audio_channels); ~Butler (); void seek (DCPTime position, bool accurate); std::pair, DCPTime> get_video (); + bool get_audio (float* out, Frame frames); + + void disable_audio (); + + std::pair memory_used () const; private: void thread (); void video (boost::shared_ptr video, DCPTime time); + void audio (boost::shared_ptr audio); + bool should_run () const; + void prepare (boost::weak_ptr video) const; - boost::weak_ptr _film; boost::shared_ptr _player; + boost::shared_ptr _log; boost::thread* _thread; VideoRingBuffers _video; + AudioRingBuffers _audio; + + boost::thread_group _prepare_pool; + boost::asio::io_service _prepare_service; + boost::shared_ptr _prepare_work; + /** mutex to protect _pending_seek_position, _pending_seek_acurate, _finished, _died, _stop_thread */ boost::mutex _mutex; boost::condition _summon; boost::condition _arrived; boost::optional _pending_seek_position; bool _pending_seek_accurate; - bool _finished; + bool _died; + bool _stop_thread; + + AudioMapping _audio_mapping; + int _audio_channels; + + bool _disable_audio; boost::signals2::scoped_connection _player_video_connection; + boost::signals2::scoped_connection _player_audio_connection; };