summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-06-23 20:35:15 +0100
committerCarl Hetherington <cth@carlh.net>2017-06-23 20:35:15 +0100
commit4fbe44913582d6cc48a7d61145f3170fb0eec595 (patch)
tree509d824e0e21820b54559beff168637178e4c823 /src
parent931b81e323c41a05b5f5612350ebc42ff20e97cb (diff)
Add a OV/VF test; tidy up a bit.
Diffstat (limited to 'src')
-rw-r--r--src/lib/player.cc57
-rw-r--r--src/lib/player.h3
2 files changed, 19 insertions, 41 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 5bb073177..523475160 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -156,20 +156,6 @@ Player::setup_pieces ()
}
}
- if (!_play_referenced) {
- BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
- shared_ptr<DCPContent> dc = dynamic_pointer_cast<DCPContent> (i->content);
- if (dc) {
- if (dc->reference_video()) {
- _no_video.push_back (DCPTimePeriod (dc->position(), dc->end()));
- }
- if (dc->reference_audio()) {
- _no_audio.push_back (DCPTimePeriod (dc->position(), dc->end()));
- }
- }
- }
- }
-
_last_video_time = DCPTime ();
_last_audio_time = DCPTime ();
_have_valid_pieces = true;
@@ -582,6 +568,9 @@ Player::pass ()
}
if (_last_audio_time) {
+ /* Fill in the gap before delayed audio; this doesn't need to take into account
+ periods with no audio as it should only occur in delayed audio case.
+ */
fill_audio (DCPTimePeriod (*_last_audio_time, i->second));
}
@@ -635,21 +624,15 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
/* Fill gaps that we discover now that we have some video which needs to be emitted */
- optional<DCPTime> fill_to;
if (_last_video_time) {
- fill_to = _last_video_time;
- }
-
- if (fill_to) {
/* XXX: this may not work for 3D */
- BOOST_FOREACH (DCPTimePeriod i, subtract(DCPTimePeriod (*fill_to, time), _no_video)) {
- for (DCPTime j = i.from; j < i.to; j += one_video_frame()) {
- LastVideoMap::const_iterator k = _last_video.find (wp);
- if (k != _last_video.end ()) {
- emit_video (k->second, j);
- } else {
- emit_video (black_player_video_frame(), j);
- }
+ DCPTime fill_from = max (*_last_video_time, piece->content->position());
+ for (DCPTime j = fill_from; j < time; j += one_video_frame()) {
+ LastVideoMap::const_iterator k = _last_video.find (wp);
+ if (k != _last_video.end ()) {
+ emit_video (k->second, j);
+ } else {
+ emit_video (black_player_video_frame(), j);
}
}
}
@@ -909,18 +892,16 @@ Player::fill_audio (DCPTimePeriod period)
DCPOMATIC_ASSERT (period.from < period.to);
- BOOST_FOREACH (DCPTimePeriod i, subtract(period, _no_audio)) {
- DCPTime t = i.from;
- while (t < i.to) {
- DCPTime block = min (DCPTime::from_seconds (0.5), i.to - t);
- Frame const samples = block.frames_round(_film->audio_frame_rate());
- if (samples) {
- shared_ptr<AudioBuffers> silence (new AudioBuffers (_film->audio_channels(), samples));
- silence->make_silent ();
- emit_audio (silence, t);
- }
- t += block;
+ DCPTime t = period.from;
+ while (t < period.to) {
+ DCPTime block = min (DCPTime::from_seconds (0.5), period.to - t);
+ Frame const samples = block.frames_round(_film->audio_frame_rate());
+ if (samples) {
+ shared_ptr<AudioBuffers> silence (new AudioBuffers (_film->audio_channels(), samples));
+ silence->make_silent ();
+ emit_audio (silence, t);
}
+ t += block;
}
}
diff --git a/src/lib/player.h b/src/lib/player.h
index 20d9c9388..b4d00223b 100644
--- a/src/lib/player.h
+++ b/src/lib/player.h
@@ -165,9 +165,6 @@ private:
};
std::map<AudioStreamPtr, StreamState> _stream_states;
- std::list<DCPTimePeriod> _no_video;
- std::list<DCPTimePeriod> _no_audio;
-
ActiveSubtitles _active_subtitles;
boost::shared_ptr<AudioProcessor> _audio_processor;