Rename ContentAudio -> PieceAudio and pass audio through Piece.
[dcpomatic.git] / src / lib / player.h
index fd3bbf205d286d01211aedfe76e82d2bfbe81d6d..faebeb6dbe4397df04ad86ead8333bb286f0c625 100644 (file)
 
 */
 
+
 #ifndef DCPOMATIC_PLAYER_H
 #define DCPOMATIC_PLAYER_H
 
-#include "atmos_metadata.h"
-#include "player_text.h"
+
 #include "active_text.h"
-#include "content_text.h"
-#include "film.h"
+#include "atmos_metadata.h"
+#include "audio_merger.h"
+#include "audio_stream.h"
 #include "content.h"
 #include "content_atmos.h"
-#include "position_image.h"
-#include "piece.h"
-#include "content_video.h"
-#include "content_audio.h"
-#include "audio_stream.h"
-#include "audio_merger.h"
+#include "content_text.h"
 #include "empty.h"
+#include "film.h"
+#include "piece.h"
+#include "piece_audio.h"
+#include "piece_video.h"
+#include "player_text.h"
+#include "position_image.h"
+#include "shuffler.h"
 #include <boost/atomic.hpp>
 #include <list>
 
+
 namespace dcp {
        class ReelAsset;
 }
@@ -46,12 +50,13 @@ namespace dcpomatic {
        class FontData;
 }
 
+
 class AtmosContent;
 class PlayerVideo;
 class Playlist;
 class AudioBuffers;
 class ReferencedReelAsset;
-class Shuffler;
+
 
 class PlayerProperty
 {
@@ -64,6 +69,7 @@ public:
        static int const PLAYBACK_LENGTH;
 };
 
+
 /** @class Player
  *  @brief A class which can play a Playlist.
  */
@@ -72,7 +78,6 @@ class Player : public std::enable_shared_from_this<Player>
 public:
        Player (std::shared_ptr<const Film>);
        Player (std::shared_ptr<const Film>, std::shared_ptr<const Playlist> playlist);
-       ~Player ();
 
        Player (Player const& Player) = delete;
        Player& operator= (Player const& Player) = delete;
@@ -131,17 +136,13 @@ private:
        void film_change (ChangeType, Film::Property);
        void playlist_change (ChangeType);
        void playlist_content_change (ChangeType, int, bool);
-       dcpomatic::DCPTime content_video_to_dcp (std::shared_ptr<const Piece> piece, Frame f) const;
-       dcpomatic::DCPTime resampled_audio_to_dcp (std::shared_ptr<const Piece> piece, Frame f) const;
-       dcpomatic::ContentTime dcp_to_content_time (std::shared_ptr<const Piece> piece, dcpomatic::DCPTime t) const;
-       dcpomatic::DCPTime content_time_to_dcp (std::shared_ptr<const Piece> piece, dcpomatic::ContentTime t) const;
        std::shared_ptr<PlayerVideo> black_player_video_frame (Eyes eyes) const;
 
-       void video (std::weak_ptr<Piece>, ContentVideo);
-       void audio (std::weak_ptr<Piece>, AudioStreamPtr, ContentAudio);
-       void bitmap_text_start (std::weak_ptr<Piece>, std::weak_ptr<const TextContent>, ContentBitmapText);
-       void plain_text_start (std::weak_ptr<Piece>, std::weak_ptr<const TextContent>, ContentStringText);
-       void subtitle_stop (std::weak_ptr<Piece>, std::weak_ptr<const TextContent>, dcpomatic::ContentTime);
+       void video (std::weak_ptr<Piece>, PieceVideo);
+       void audio (std::weak_ptr<Piece>, PieceAudio);
+       void bitmap_text_start (std::weak_ptr<Piece>, std::weak_ptr<const Content>, std::weak_ptr<const TextContent>, ContentBitmapText);
+       void plain_text_start (std::weak_ptr<Piece>, std::weak_ptr<const Content>, std::weak_ptr<const TextContent>, ContentStringText);
+       void subtitle_stop (std::weak_ptr<Piece>, std::weak_ptr<const Content>, std::weak_ptr<const TextContent>, dcpomatic::ContentTime);
        void atmos (std::weak_ptr<Piece>, ContentAtmos);
 
        dcpomatic::DCPTime one_video_frame () const;
@@ -167,7 +168,7 @@ private:
 
        /** > 0 if we are suspended (i.e. pass() and seek() do nothing) */
        boost::atomic<int> _suspended;
-       std::list<std::shared_ptr<Piece> > _pieces;
+       std::list<std::shared_ptr<Piece>> _pieces;
 
        /** Size of the image we are rendering to; this may be the DCP frame size, or
         *  the size of preview in a window.
@@ -200,8 +201,8 @@ private:
        LastVideoMap _last_video;
 
        AudioMerger _audio_merger;
-       Shuffler* _shuffler = nullptr;
-       std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime> > _delay;
+       std::unique_ptr<Shuffler> _shuffler;
+       std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime>> _delay;
 
        Empty _black;
        Empty _silent;