summaryrefslogtreecommitdiff
path: root/src/lib/dcp_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-06-22 01:53:18 +0100
committerCarl Hetherington <cth@carlh.net>2016-06-22 01:53:18 +0100
commit282caacdd0f9283ee8c52b2c67b4696e071eba03 (patch)
tree373da1539bd46e1b41d4e8a96add1210e27a494d /src/lib/dcp_decoder.cc
parent76f83b97c401c24b3c93baee0665e84be05f43ea (diff)
Don't bother decoding referenced DCP video if the player will ignore it.
Diffstat (limited to 'src/lib/dcp_decoder.cc')
-rw-r--r--src/lib/dcp_decoder.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc
index 7b4ef9fc7..35fe375e9 100644
--- a/src/lib/dcp_decoder.cc
+++ b/src/lib/dcp_decoder.cc
@@ -52,6 +52,7 @@ using boost::dynamic_pointer_cast;
DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, shared_ptr<Log> log)
: _dcp_content (c)
+ , _decode_referenced (false)
{
video.reset (new VideoDecoder (this, c, log));
audio.reset (new AudioDecoder (this, c->audio, log));
@@ -90,7 +91,7 @@ DCPDecoder::pass (PassReason reason, bool)
/* Frame within the (played part of the) reel that is coming up next */
int64_t const frame = _next.frames_round (vfr);
- if ((_mono_reader || _stereo_reader) && reason != PASS_REASON_SUBTITLE) {
+ if ((_mono_reader || _stereo_reader) && reason != PASS_REASON_SUBTITLE && (_decode_referenced || !_dcp_content->reference_video())) {
shared_ptr<dcp::PictureAsset> asset = (*_reel)->main_picture()->asset ();
int64_t const entry_point = (*_reel)->main_picture()->entry_point ();
if (_mono_reader) {
@@ -108,7 +109,7 @@ DCPDecoder::pass (PassReason reason, bool)
}
}
- if (_sound_reader && reason != PASS_REASON_SUBTITLE) {
+ if (_sound_reader && reason != PASS_REASON_SUBTITLE && (_decode_referenced || !_dcp_content->reference_audio())) {
int64_t const entry_point = (*_reel)->main_sound()->entry_point ();
shared_ptr<const dcp::SoundFrame> sf = _sound_reader->get_frame (entry_point + frame);
uint8_t const * from = sf->data ();
@@ -127,7 +128,7 @@ DCPDecoder::pass (PassReason reason, bool)
audio->give (_dcp_content->audio->stream(), data, ContentTime::from_frames (_offset, vfr) + _next);
}
- if ((*_reel)->main_subtitle ()) {
+ if ((*_reel)->main_subtitle() && (_decode_referenced || !_dcp_content->reference_subtitle())) {
int64_t const entry_point = (*_reel)->main_subtitle()->entry_point ();
list<dcp::SubtitleString> subs = (*_reel)->main_subtitle()->asset()->subtitles_during (
dcp::Time (entry_point + frame, vfr, vfr),
@@ -258,3 +259,9 @@ DCPDecoder::text_subtitles_during (ContentTimePeriod period, bool starting) cons
return ctp;
}
+
+void
+DCPDecoder::set_decode_referenced ()
+{
+ _decode_referenced = true;
+}