diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-04-23 22:42:19 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-05-07 09:29:58 +0200 |
| commit | d0054530546a5347e2058f2a98b18a0efc9247f3 (patch) | |
| tree | a5d07a5e961d47e52a9c4bc33ba975ea8ec9aca0 | |
| parent | aef193a1fff119ed2420885ce6933444294aea4c (diff) | |
Add Piece::use_video().
| -rw-r--r-- | src/lib/piece.cc | 9 | ||||
| -rw-r--r-- | src/lib/piece.h | 2 | ||||
| -rw-r--r-- | src/lib/player.cc | 20 |
3 files changed, 20 insertions, 11 deletions
diff --git a/src/lib/piece.cc b/src/lib/piece.cc index 3656cfe1a..877ba6e8b 100644 --- a/src/lib/piece.cc +++ b/src/lib/piece.cc @@ -23,6 +23,7 @@ #include "content.h" #include "film.h" #include "piece.h" +#include "video_content.h" using std::shared_ptr; @@ -103,3 +104,11 @@ Piece::content_time_to_dcp (ContentTime t) const { return max (DCPTime(), DCPTime(t - content->trim_start(), frc) + content->position()); } + + +bool +Piece::use_video () const +{ + return content->video && content->video->use(); +} + diff --git a/src/lib/piece.h b/src/lib/piece.h index 7d04b8c21..b9a43500c 100644 --- a/src/lib/piece.h +++ b/src/lib/piece.h @@ -47,6 +47,8 @@ public: dcpomatic::ContentTime dcp_to_content_time (dcpomatic::DCPTime t, std::shared_ptr<const Film> film) const; dcpomatic::DCPTime content_time_to_dcp (dcpomatic::ContentTime t) const; + bool use_video () const; + std::shared_ptr<Content> content; std::shared_ptr<Decoder> decoder; boost::optional<dcpomatic::DCPTimePeriod> ignore_video; diff --git a/src/lib/player.cc b/src/lib/player.cc index 1f7d1ac1d..646f7d582 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -258,16 +258,14 @@ Player::setup_pieces_unlocked () } for (auto i = _pieces.begin(); i != _pieces.end(); ++i) { - if (auto video = (*i)->content->video) { - if (video->use() && video->frame_type() != VideoFrameType::THREE_D_LEFT && video->frame_type() != VideoFrameType::THREE_D_RIGHT) { - /* Look for content later in the content list with in-use video that overlaps this */ - auto period = DCPTimePeriod((*i)->content->position(), (*i)->content->end(_film)); - auto j = i; - ++j; - for (; j != _pieces.end(); ++j) { - if ((*j)->content->video && (*j)->content->video->use()) { - (*i)->ignore_video = DCPTimePeriod((*j)->content->position(), (*j)->content->end(_film)).overlap(period); - } + if ((*i)->use_video() && (*i)->content->video->frame_type() != VideoFrameType::THREE_D_LEFT && (*i)->content->video->frame_type() != VideoFrameType::THREE_D_RIGHT) { + /* Look for content later in the content list with in-use video that overlaps this */ + auto period = DCPTimePeriod((*i)->content->position(), (*i)->content->end(_film)); + auto j = i; + ++j; + for (; j != _pieces.end(); ++j) { + if ((*j)->use_video()) { + (*i)->ignore_video = DCPTimePeriod((*j)->content->position(), (*j)->content->end(_film)).overlap(period); } } } @@ -772,7 +770,7 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video) return; } - if (!piece->content->video->use()) { + if (!piece->use_video()) { return; } |
