X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplayer.h;h=e4fb832209025117a3f5c02414a3d429bf62bc5a;hb=01791aac0b11e9f296cd31a7803e287203bd8355;hp=9a55b8599a4031dce55af54e202e060af32dda45;hpb=a84e33159d708362b10ff61af186a59cc9f5be6b;p=dcpomatic.git diff --git a/src/lib/player.h b/src/lib/player.h index 9a55b8599..e4fb83220 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -27,52 +27,64 @@ #include "audio_source.h" #include "video_sink.h" #include "audio_sink.h" +#include "playlist.h" +#include "audio_buffers.h" -class VideoDecoder; -class SndfileDecoder; class Job; class Film; class Playlist; class AudioContent; +class Piece; -class Player : public VideoSource, public AudioSource, public VideoSink, public boost::enable_shared_from_this +/** @class Player + * @brief A class which can `play' a Playlist; emitting its audio and video. + */ + +class Player : public VideoSource, public AudioSource, public boost::enable_shared_from_this { public: Player (boost::shared_ptr, boost::shared_ptr); void disable_video (); void disable_audio (); - void disable_subtitles (); - void disable_video_sync (); bool pass (); - void set_progress (boost::shared_ptr); - bool seek (double); + void seek (Time); + void seek_back (); + void seek_forward (); - double last_video_time () const; + /** @return position that we are at; ie the time of the next thing we will emit on pass() */ + Time position () const { + return _position; + } + + void set_video_container_size (libdcp::Size); private: - void process_video (boost::shared_ptr i, bool same, boost::shared_ptr s); - void process_audio (boost::weak_ptr, boost::shared_ptr); - void setup_decoders (); + + void process_video (boost::weak_ptr, boost::shared_ptr, bool, Time); + void process_audio (boost::weak_ptr, boost::shared_ptr, Time); + void setup_pieces (); void playlist_changed (); void content_changed (boost::weak_ptr, int); + void do_seek (Time, bool); + void add_black_piece (Time, Time); + void add_silent_piece (Time, Time); + void flush (); boost::shared_ptr _film; boost::shared_ptr _playlist; bool _video; bool _audio; - bool _subtitles; - - bool _have_valid_decoders; - std::list > _video_decoders; - std::list >::iterator _video_decoder; - std::list > _sndfile_decoders; - - boost::shared_ptr _audio_buffers; - bool _video_sync; + /** Our pieces are ready to go; if this is false the pieces must be (re-)created before they are used */ + bool _have_valid_pieces; + std::list > _pieces; + Time _position; + AudioBuffers _audio_buffers; + Time _next_audio; + boost::optional _video_container_size; }; #endif