diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-07-25 11:37:52 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-07-25 11:37:52 +0100 |
| commit | 57f112a2bd073123a686141be6c16ba997349056 (patch) | |
| tree | ef4e181329049b447ae977157872029691b64f85 /src/lib/dcp_decoder.cc | |
| parent | 122111f680dc186f936960394f0720374d7d5dca (diff) | |
Optimise decoder_factory for DCPDecoder by offering the old decoder
(if available) to recover the list of reels from, rather than having
to scan the filesystem again.
Diffstat (limited to 'src/lib/dcp_decoder.cc')
| -rw-r--r-- | src/lib/dcp_decoder.cc | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 5a72fb228..b6947211c 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -56,7 +56,7 @@ using boost::dynamic_pointer_cast; using boost::optional; using namespace dcpomatic; -DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent> c, bool fast) +DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent> c, bool fast, shared_ptr<DCPDecoder> old) : DCP (c) , Decoder (film) , _decode_referenced (false) @@ -74,30 +74,35 @@ DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent } } - list<shared_ptr<dcp::CPL> > cpl_list = cpls (); + if (old) { + _reels = old->_reels; + } else { - if (cpl_list.empty()) { - throw DCPError (_("No CPLs found in DCP.")); - } + list<shared_ptr<dcp::CPL> > cpl_list = cpls (); - shared_ptr<dcp::CPL> cpl; - BOOST_FOREACH (shared_ptr<dcp::CPL> i, cpl_list) { - if (_dcp_content->cpl() && i->id() == _dcp_content->cpl().get()) { - cpl = i; + if (cpl_list.empty()) { + throw DCPError (_("No CPLs found in DCP.")); + } + + shared_ptr<dcp::CPL> cpl; + BOOST_FOREACH (shared_ptr<dcp::CPL> i, cpl_list) { + if (_dcp_content->cpl() && i->id() == _dcp_content->cpl().get()) { + cpl = i; + } } - } - if (!cpl) { - /* No CPL found; probably an old file that doesn't specify it; - just use the first one. - */ - cpl = cpls().front (); + if (!cpl) { + /* No CPL found; probably an old file that doesn't specify it; + just use the first one. + */ + cpl = cpls().front (); + } + + _reels = cpl->reels (); } set_decode_referenced (false); - _reels = cpl->reels (); - _reel = _reels.begin (); _offset = 0; get_readers (); |
