X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplayer.h;h=20b83bfdb7c2468e702409fbc500286937553ec5;hb=f861018389acd9d277fe34d7621182b9b54f977f;hp=9a55b8599a4031dce55af54e202e060af32dda45;hpb=147cca5876dfbdf56e21289c3a36bec4b4850191;p=dcpomatic.git diff --git a/src/lib/player.h b/src/lib/player.h index 9a55b8599..20b83bfdb 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -29,13 +29,17 @@ #include "audio_sink.h" class VideoDecoder; -class SndfileDecoder; +class AudioDecoder; class Job; class Film; class Playlist; class AudioContent; -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 TimedVideoSource, public TimedAudioSource, public TimedVideoSink, public boost::enable_shared_from_this { public: Player (boost::shared_ptr, boost::shared_ptr); @@ -43,17 +47,18 @@ public: 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_back (); + void seek_forward (); double last_video_time () const; private: - void process_video (boost::shared_ptr i, bool same, boost::shared_ptr s); - void process_audio (boost::weak_ptr, boost::shared_ptr); + void process_video (boost::shared_ptr i, bool same, boost::shared_ptr s, double); + void process_audio (boost::weak_ptr, boost::shared_ptr, double); void setup_decoders (); void playlist_changed (); void content_changed (boost::weak_ptr, int); @@ -64,15 +69,24 @@ private: bool _video; bool _audio; bool _subtitles; - + + /** Our decoders are ready to go; if this is false the decoders must be (re-)created before they are used */ bool _have_valid_decoders; - std::list > _video_decoders; - std::list >::iterator _video_decoder; - std::list > _sndfile_decoders; + /** Video decoders in order of presentation */ + std::vector > _video_decoders; + /** Start positions of each video decoder in seconds*/ + std::vector _video_start; + /** Index of current video decoder */ + size_t _video_decoder; + /** Audio decoders in order of presentation (if they are from FFmpeg) */ + std::vector > _audio_decoders; + /** Start positions of each audio decoder (if they are from FFmpeg) in seconds */ + std::vector _audio_start; + /** Current audio decoder index if we are running them sequentially; otherwise undefined */ + size_t _sequential_audio_decoder; boost::shared_ptr _audio_buffers; - - bool _video_sync; + boost::optional _audio_time; }; #endif