summaryrefslogtreecommitdiff
path: root/src/lib/dcp_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-10-16 14:38:44 +0100
committerCarl Hetherington <cth@carlh.net>2015-10-16 14:38:44 +0100
commit9e025d3f85f9d6d855b3d5e6c90bca0eac3a3d49 (patch)
treeafc3e4a093a357bc7144a554c139e71b05fca9c5 /src/lib/dcp_decoder.cc
parente7811b466eff496db7f63842df2fa4a4410afe14 (diff)
Avoid decoding other packets when looking for subs.
The "accumulation" of, for example, video data when we are looking for audio data is an *optimisation* to reduce the number of seeks. It should not be necessary for correctness (the output should be right even if we never kept anything except what we were looking for). Doing this accumulation is not always an optimisation; sometimes not doing it is better. Avoiding it when going back for subtitles is one of these cases.
Diffstat (limited to 'src/lib/dcp_decoder.cc')
-rw-r--r--src/lib/dcp_decoder.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc
index 21eb2f7ea..ada0d01d1 100644
--- a/src/lib/dcp_decoder.cc
+++ b/src/lib/dcp_decoder.cc
@@ -59,7 +59,7 @@ DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, bool fast)
}
bool
-DCPDecoder::pass ()
+DCPDecoder::pass (PassReason reason)
{
if (_reel == _reels.end () || !_dcp_content->can_be_played ()) {
return true;
@@ -68,7 +68,7 @@ DCPDecoder::pass ()
double const vfr = _dcp_content->video_frame_rate ();
int64_t const frame = _next.frames_round (vfr);
- if ((*_reel)->main_picture ()) {
+ if ((*_reel)->main_picture () && reason != PASS_REASON_SUBTITLE) {
shared_ptr<dcp::PictureAsset> asset = (*_reel)->main_picture()->asset ();
shared_ptr<dcp::MonoPictureAsset> mono = dynamic_pointer_cast<dcp::MonoPictureAsset> (asset);
shared_ptr<dcp::StereoPictureAsset> stereo = dynamic_pointer_cast<dcp::StereoPictureAsset> (asset);
@@ -88,7 +88,7 @@ DCPDecoder::pass ()
}
}
- if ((*_reel)->main_sound ()) {
+ if ((*_reel)->main_sound () && reason != PASS_REASON_SUBTITLE) {
int64_t const entry_point = (*_reel)->main_sound()->entry_point ();
shared_ptr<const dcp::SoundFrame> sf = (*_reel)->main_sound()->asset()->get_frame (entry_point + frame);
uint8_t const * from = sf->data ();