Fix pull timing; fix units of ReelWriter::total_written_audio_frames.
[dcpomatic.git] / src / lib / player.h
index ba7845b541d935e905663eca9a91abdad9dafe17..69149d0393aefe2b8863eca73f0661fe8d34f37f 100644 (file)
@@ -44,6 +44,7 @@ class Playlist;
 class Font;
 class AudioBuffers;
 class ReferencedReelAsset;
+class Resampler;
 
 /** @class Player
  *  @brief A class which can `play' a Playlist.
@@ -105,6 +106,7 @@ private:
        void audio (boost::weak_ptr<Piece>, AudioStreamPtr, ContentAudio);
        void image_subtitle (boost::weak_ptr<Piece>, ContentImageSubtitle);
        void text_subtitle (boost::weak_ptr<Piece>, ContentTextSubtitle);
+       boost::shared_ptr<Resampler> resampler (boost::shared_ptr<const AudioContent> content, AudioStreamPtr stream, bool create);
 
        boost::shared_ptr<const Film> _film;
        boost::shared_ptr<const Playlist> _playlist;
@@ -138,9 +140,25 @@ private:
        AudioMerger _audio_merger;
        DCPTime _last_audio_time;
 
+       class StreamState {
+       public:
+               StreamState () {}
+
+               StreamState (boost::shared_ptr<Piece> p, DCPTime l)
+                       : piece(p)
+                       , last_push_end(l)
+               {}
+
+               boost::shared_ptr<Piece> piece;
+               DCPTime last_push_end;
+       };
+       std::map<AudioStreamPtr, StreamState> _stream_states;
+
        std::list<std::pair<PlayerSubtitles, DCPTimePeriod> > _subtitles;
 
        boost::shared_ptr<AudioProcessor> _audio_processor;
+       typedef std::map<std::pair<boost::shared_ptr<const AudioContent>, AudioStreamPtr>, boost::shared_ptr<Resampler> > ResamplerMap;
+       ResamplerMap _resamplers;
 
        boost::signals2::scoped_connection _film_changed_connection;
        boost::signals2::scoped_connection _playlist_changed_connection;