Fix confusion about what dcp_to_content_audio should be doing.
[dcpomatic.git] / src / lib / player.h
index 6edfa49b7d20ada1a4acb15d1c1171ea39a3560b..3cfca47368a7f122d1d630ea4bf27762895285a5 100644 (file)
@@ -78,12 +78,12 @@ public:
 };
 
 /** @class Player
- *  @brief A class which can `play' a Film.
+ *  @brief A class which can `play' a Playlist.
  */
 class Player : public boost::enable_shared_from_this<Player>, public boost::noncopyable
 {
 public:
-       Player (boost::shared_ptr<const Film>);
+       Player (boost::shared_ptr<const Film>, boost::shared_ptr<const Playlist> playlist);
 
        std::list<boost::shared_ptr<PlayerVideo> > get_video (DCPTime time, bool accurate);
        boost::shared_ptr<AudioBuffers> get_audio (DCPTime time, DCPTime length, bool accurate);
@@ -109,16 +109,20 @@ private:
        friend class PlayerWrapper;
        friend class Piece;
        friend struct player_overlaps_test;
+       friend struct player_time_calculation_test1;
+       friend struct player_time_calculation_test2;
+       friend struct player_time_calculation_test3;
 
        void setup_pieces ();
-       void content_changed (boost::weak_ptr<Content>, int, bool);
        void flush ();
        void film_changed (Film::Property);
+       void playlist_changed ();
+       void playlist_content_changed (boost::weak_ptr<Content>, int, bool);
        std::list<PositionImage> transform_image_subtitles (std::list<ImageSubtitle>) const;
        void update_subtitle_from_text ();
        Frame dcp_to_content_video (boost::shared_ptr<const Piece> piece, DCPTime t) const;
        DCPTime content_video_to_dcp (boost::shared_ptr<const Piece> piece, Frame f) const;
-       Frame dcp_to_content_audio (boost::shared_ptr<const Piece> piece, DCPTime t) const;
+       Frame dcp_to_resampled_audio (boost::shared_ptr<const Piece> piece, DCPTime t) const;
        ContentTime dcp_to_content_subtitle (boost::shared_ptr<const Piece> piece, DCPTime t) const;
        boost::shared_ptr<PlayerVideo> black_player_video_frame (DCPTime) const;
 
@@ -146,6 +150,7 @@ private:
        }
 
        boost::shared_ptr<const Film> _film;
+       boost::shared_ptr<const Playlist> _playlist;
 
        /** Our pieces are ready to go; if this is false the pieces must be (re-)created before they are used */
        bool _have_valid_pieces;
@@ -166,8 +171,9 @@ private:
 
        PlayerStatistics _statistics;
 
-       boost::signals2::scoped_connection _film_content_changed_connection;
        boost::signals2::scoped_connection _film_changed_connection;
+       boost::signals2::scoped_connection _playlist_changed_connection;
+       boost::signals2::scoped_connection _playlist_content_changed_connection;
 };
 
 #endif