summaryrefslogtreecommitdiff
path: root/src/lib/player.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-05-08 00:32:55 +0100
committerCarl Hetherington <cth@carlh.net>2017-05-08 00:35:55 +0100
commitb35baeb5ec29c2dee9d79a646bb9c3ad884a8db7 (patch)
tree6d0956d664b860719d0d0e920dcd14031a87006b /src/lib/player.cc
parent0584dfe5b8e74406b59ae5d05b74ecbf3c87ad20 (diff)
Small refactoring.
Diffstat (limited to 'src/lib/player.cc')
-rw-r--r--src/lib/player.cc33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 1f5639f68..081174acc 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -650,16 +650,7 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
)
);
- optional<PositionImage> subtitles = subtitles_for_frame (time);
- if (subtitles) {
- _last_video->set_subtitle (subtitles.get ());
- }
-
- Video (_last_video, time);
-
- _last_video_time = time + one_video_frame ();
-
- _active_subtitles.clear_before (time);
+ emit_video (_last_video, time);
}
void
@@ -950,21 +941,27 @@ Player::fill_video (DCPTimePeriod period)
BOOST_FOREACH (DCPTimePeriod i, subtract(period, _no_video)) {
for (DCPTime j = i.from; j < i.to; j += one_video_frame()) {
if (_playlist->video_content_at(j) && _last_video) {
- Video (shared_ptr<PlayerVideo> (new PlayerVideo (*_last_video)), j);
+ emit_video (shared_ptr<PlayerVideo> (new PlayerVideo (*_last_video)), j);
} else {
- shared_ptr<PlayerVideo> black = black_player_video_frame ();
- optional<PositionImage> subtitles = subtitles_for_frame (j);
- if (subtitles) {
- black->set_subtitle (subtitles.get ());
- }
- Video (black, j);
+ emit_video (black_player_video_frame(), j);
}
- _last_video_time = j;
}
}
}
void
+Player::emit_video (shared_ptr<PlayerVideo> pv, DCPTime time)
+{
+ optional<PositionImage> subtitles = subtitles_for_frame (time);
+ if (subtitles) {
+ pv->set_subtitle (subtitles.get ());
+ }
+ Video (pv, time);
+ _last_video_time = time + one_video_frame();
+ _active_subtitles.clear_before (time);
+}
+
+void
Player::fill_audio (DCPTimePeriod period)
{
BOOST_FOREACH (DCPTimePeriod i, subtract(period, _no_audio)) {