summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-24 01:16:51 +0200
committerCarl Hetherington <cth@carlh.net>2021-05-07 09:29:59 +0200
commit4a144b7f777146ff666057caf895ce4fe1c3c2bb (patch)
tree8147704ae2a9545a812e591a29d96b992cf36fa4
parent3b4794876db7b5351a09fa6366b87ae57af31463 (diff)
Add Piece::reference_dcp_audio().
-rw-r--r--src/lib/piece.cc11
-rw-r--r--src/lib/piece.h1
-rw-r--r--src/lib/player.cc5
3 files changed, 13 insertions, 4 deletions
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<DCPContent>(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<const Film> film) const;
double audio_gain () const;
+ bool reference_dcp_audio () const;
std::shared_ptr<Decoder> decoder_for (std::shared_ptr<Content> 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<DCPContent>(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;
}