X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplayer.h;h=20b83bfdb7c2468e702409fbc500286937553ec5;hb=f861018389acd9d277fe34d7621182b9b54f977f;hp=8a82ab2980b644e408d35b48f37f0921f2d5e749;hpb=9bdd8cc51942a13e360dde4efc04b3ca417c8b94;p=dcpomatic.git diff --git a/src/lib/player.h b/src/lib/player.h index 8a82ab298..20b83bfdb 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -17,8 +17,8 @@ */ -#ifndef DVDOMATIC_PLAYER_H -#define DVDOMATIC_PLAYER_H +#ifndef DCPOMATIC_PLAYER_H +#define DCPOMATIC_PLAYER_H #include #include @@ -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; - - bool _have_valid_decoders; - std::list > _video_decoders; - std::list >::iterator _video_decoder; - std::list > _sndfile_decoders; - boost::shared_ptr _sndfile_buffers; - - bool _video_sync; + /** Our decoders are ready to go; if this is false the decoders must be (re-)created before they are used */ + bool _have_valid_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; + boost::optional _audio_time; }; #endif