Move reference_audio.
authorCarl Hetherington <cth@carlh.net>
Tue, 23 Jun 2020 21:05:36 +0000 (23:05 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 1 Dec 2020 15:39:19 +0000 (16:39 +0100)
src/lib/piece.cc
src/lib/piece.h
src/lib/player.cc

index a34b39901fefe1dce17cbefd2466bd3870791fc8..ba5da7f785fe86473d86516344825c091b989f45 100644 (file)
@@ -167,3 +167,10 @@ Piece::pass () const
        _done = _decoder[0]->pass();
 }
 
+
+bool
+Piece::reference_audio () const
+{
+       shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(_content[0]);
+       return dcp && dcp->reference_audio();
+}
index f4f12b2b18984b68dc392845b45dc6072ad06960..cd0d3f8fc0df27d7f966924c55fedae2a99fd073 100644 (file)
@@ -39,6 +39,7 @@ public:
        void set_last_push_end (AudioStreamPtr stream, dcpomatic::DCPTime last_push_end);
        boost::optional<dcpomatic::DCPTime> position (boost::shared_ptr<const Film> film);
        bool has_text () const;
+       bool reference_audio () const;
 
        void pass ();
 
index ad5ba56bd93054b577dfcee9ca0d5bbdfe68f629..26bcd7df8c5daa376b80c5efafa3832e391932d9 100644 (file)
@@ -597,13 +597,12 @@ Player::pass ()
        {
                LOG_DEBUG_PLAYER ("Calling pass() on %1", earliest_content->content->path(0));
                earliest_content->pass ();
-               shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(earliest_content->content);
-               if (dcp && !_play_referenced && dcp->reference_audio()) {
+               if (!_play_referenced && earliest_content->reference_audio()) {
                        /* We are skipping some referenced DCP audio content, so we need to update _last_audio_time
                           to `hide' the fact that no audio was emitted during the referenced DCP (though
                           we need to behave as though it was).
                        */
-                       _last_audio_time = dcp->end (_film);
+                       _last_audio_time = earliest_content->end (_film);
                }
                break;
        }