diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-06-22 01:05:29 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-06-22 01:05:29 +0200 |
| commit | ad01cbdca9a1976e234ac17d27d0f544f876e1d5 (patch) | |
| tree | f11d472ce9f8e396a10e1e68c54a0775df1c5424 /src/lib | |
| parent | 20caf8930ef95badaa3fef822dfc5932af788481 (diff) | |
Add and use Piece::end().
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/piece.h | 4 | ||||
| -rw-r--r-- | src/lib/player.cc | 20 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/lib/piece.h b/src/lib/piece.h index f4496c08e..1b2889e5d 100644 --- a/src/lib/piece.h +++ b/src/lib/piece.h @@ -43,6 +43,10 @@ public: return content->position (); } + dcpomatic::DCPTime end (boost::shared_ptr<const Film> film) const { + return content->end (film); + } + boost::shared_ptr<Content> content; boost::shared_ptr<Decoder> decoder; FrameRateChange frc; diff --git a/src/lib/player.cc b/src/lib/player.cc index c9679adfe..3d9c3efc7 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -597,7 +597,7 @@ Player::pass () } DCPTime const t = content_time_to_dcp (i, max(i->decoder->position(), i->content->trim_start())); - if (t > i->content->end(_film)) { + if (t > i->end(_film)) { i->done = true; } else { @@ -802,7 +802,7 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video) /* Fill gaps that we discover now that we have some video which needs to be emitted. This is where we need to fill to. */ - DCPTime fill_to = min (time, piece->content->end(_film)); + DCPTime fill_to = min (time, piece->end(_film)); if (_last_video_time) { DCPTime fill_from = max (*_last_video_time, piece->position()); @@ -815,7 +815,7 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video) if (fill_to_eyes == EYES_BOTH) { fill_to_eyes = EYES_LEFT; } - if (fill_to == piece->content->end(_film)) { + if (fill_to == piece->end(_film)) { /* Don't fill after the end of the content */ fill_to_eyes = EYES_LEFT; } @@ -870,7 +870,7 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video) DCPTime t = time; for (int i = 0; i < frc.repeat; ++i) { - if (t < piece->content->end(_film)) { + if (t < piece->end(_film)) { emit_video (_last_video[wp], t); } t += one_video_frame (); @@ -906,11 +906,11 @@ Player::audio (weak_ptr<Piece> wp, AudioStreamPtr stream, ContentAudio content_a } content_audio.audio = cut.first; time = cut.second; - } else if (time > piece->content->end(_film)) { + } else if (time > piece->end(_film)) { /* Discard it all */ return; - } else if (end > piece->content->end(_film)) { - Frame const remaining_frames = DCPTime(piece->content->end(_film) - time).frames_round(rfr); + } else if (end > piece->end(_film)) { + Frame const remaining_frames = DCPTime(piece->end(_film) - time).frames_round(rfr); if (remaining_frames == 0) { return; } @@ -994,7 +994,7 @@ Player::plain_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, Co PlayerText ps; DCPTime const from (content_time_to_dcp (piece, subtitle.from())); - if (from > piece->content->end(_film)) { + if (from > piece->end(_film)) { return; } @@ -1045,7 +1045,7 @@ Player::subtitle_stop (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, Conte DCPTime const dcp_to = content_time_to_dcp (piece, to); - if (dcp_to > piece->content->end(_film)) { + if (dcp_to > piece->end(_film)) { return; } @@ -1091,7 +1091,7 @@ Player::seek (DCPTime time, bool accurate) */ i->decoder->seek (dcp_to_content_time (i, i->content->position()), true); i->done = false; - } else if (i->content->position() <= time && time < i->content->end(_film)) { + } else if (i->content->position() <= time && time < i->end(_film)) { /* During; seek to position */ i->decoder->seek (dcp_to_content_time (i, time), accurate); i->done = false; |
