From: Carl Hetherington Date: Fri, 23 Apr 2021 23:16:51 +0000 (+0200) Subject: Add Piece::reference_dcp_audio(). X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=4a144b7f777146ff666057caf895ce4fe1c3c2bb;p=dcpomatic.git Add Piece::reference_dcp_audio(). --- diff --git a/src/lib/piece.cc b/src/lib/piece.cc index 0dad25178..0e5fd0259 100644 --- a/src/lib/piece.cc +++ b/src/lib/piece.cc @@ -21,6 +21,7 @@ #include "audio_content.h" #include "content.h" +#include "dcp_content.h" #include "dcpomatic_log.h" #include "decoder.h" #include "film.h" @@ -29,8 +30,9 @@ #include "video_content.h" -using std::shared_ptr; +using std::dynamic_pointer_cast; using std::make_shared; +using std::shared_ptr; using namespace dcpomatic; @@ -200,3 +202,10 @@ Piece::pass () done = decoder->pass(); } + +bool +Piece::reference_dcp_audio () const +{ + auto dcp = dynamic_pointer_cast(content); + return dcp && dcp->reference_audio(); +} diff --git a/src/lib/piece.h b/src/lib/piece.h index 7379a5c3f..5b80a7fff 100644 --- a/src/lib/piece.h +++ b/src/lib/piece.h @@ -65,6 +65,7 @@ public: int resampled_audio_frame_rate (std::shared_ptr film) const; double audio_gain () const; + bool reference_dcp_audio () const; std::shared_ptr decoder_for (std::shared_ptr content) const; diff --git a/src/lib/player.cc b/src/lib/player.cc index c9526411c..086cfbbbd 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -627,13 +627,12 @@ Player::pass () case CONTENT: { earliest_content->pass(); - auto dcp = dynamic_pointer_cast(earliest_content->content); - if (dcp && !_play_referenced && dcp->reference_audio()) { + if (!_play_referenced && earliest_content->reference_dcp_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; }