Emit no audio from DCPs if none is mapped
[dcpomatic.git] / src / lib / player.h
index 0add90e97c82aedc9d34c45eea2d1899a4296714..48f6f97ca2b6a542cb9d5b39afcde5a657527058 100644 (file)
 #include "content_audio.h"
 #include "content_text.h"
 #include "content_video.h"
+#include "dcp_text_track.h"
 #include "empty.h"
 #include "enum_indexed_vector.h"
-#include "film.h"
+#include "film_property.h"
 #include "image.h"
 #include "player_text.h"
 #include "position_image.h"
@@ -49,6 +50,7 @@ namespace dcp {
 class AtmosContent;
 class AudioBuffers;
 class Content;
+class Film;
 class PlayerVideo;
 class Playlist;
 class ReferencedReelAsset;
@@ -88,6 +90,8 @@ public:
 
        bool pass ();
        void seek (dcpomatic::DCPTime time, bool accurate);
+       Frame frames_done() const;
+       float progress() const;
 
        std::vector<std::shared_ptr<dcpomatic::Font>> get_subtitle_fonts ();
 
@@ -103,6 +107,7 @@ public:
        void set_fast ();
        void set_play_referenced ();
        void set_dcp_decode_reduction (boost::optional<int> reduction);
+       void set_disable_audio_processor();
 
        boost::optional<dcpomatic::DCPTime> content_time_to_dcp (std::shared_ptr<const Content> content, dcpomatic::ContentTime t) const;
        boost::optional<dcpomatic::ContentTime> dcp_to_content_time (std::shared_ptr<const Content> content, dcpomatic::DCPTime t) const;
@@ -142,7 +147,7 @@ private:
        void construct ();
        void connect();
        void setup_pieces ();
-       void film_change (ChangeType, Film::Property);
+       void film_change(ChangeType, FilmProperty);
        void playlist_change (ChangeType);
        void playlist_content_change (ChangeType, int, bool);
        Frame dcp_to_content_video (std::shared_ptr<const Piece> piece, dcpomatic::DCPTime t) const;
@@ -152,6 +157,7 @@ private:
        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;
+       std::pair<std::shared_ptr<Piece>, boost::optional<dcpomatic::DCPTime>> earliest_piece_and_time() const;
 
        void video (std::weak_ptr<Piece>, ContentVideo);
        void audio (std::weak_ptr<Piece>, AudioStreamPtr, ContentAudio);
@@ -183,7 +189,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::vector<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.
@@ -227,13 +233,12 @@ private:
        public:
                StreamState () {}
 
-               StreamState (std::shared_ptr<Piece> p, dcpomatic::DCPTime l)
+               explicit StreamState(std::shared_ptr<Piece> p)
                        : piece(p)
-                       , last_push_end(l)
                {}
 
                std::shared_ptr<Piece> piece;
-               dcpomatic::DCPTime last_push_end;
+               boost::optional<dcpomatic::DCPTime> last_push_end;
        };
        std::map<AudioStreamPtr, StreamState> _stream_states;
 
@@ -242,6 +247,7 @@ private:
 
        EnumIndexedVector<ActiveText, TextType> _active_texts;
        std::shared_ptr<AudioProcessor> _audio_processor;
+       bool _disable_audio_processor = false;
 
        boost::atomic<dcpomatic::DCPTime> _playback_length;