diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-01-20 23:42:28 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-01-20 23:42:28 +0100 |
| commit | cb6729aa79b555b219974207fbe2ff0510f9d3ea (patch) | |
| tree | 973024e5dbf8bd8d873850909665e6229138ef57 /src/lib | |
| parent | d24251b2e0d82236f93ee5415b72849dee2a0ac8 (diff) | |
Bump libdcp for better verification, and make API adjustments.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/dcp.cc | 10 | ||||
| -rw-r--r-- | src/lib/dcp_decoder.cc | 10 | ||||
| -rw-r--r-- | src/lib/dcp_decoder.h | 6 | ||||
| -rw-r--r-- | src/lib/dcp_examiner.cc | 2 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_decoder.cc | 16 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_decoder.h | 6 | ||||
| -rw-r--r-- | src/lib/hints.cc | 2 | ||||
| -rw-r--r-- | src/lib/reel_writer.cc | 3 | ||||
| -rw-r--r-- | src/lib/types.cc | 3 | ||||
| -rw-r--r-- | src/lib/types.h | 2 | ||||
| -rw-r--r-- | src/lib/verify_dcp_job.h | 4 |
11 files changed, 34 insertions, 30 deletions
diff --git a/src/lib/dcp.cc b/src/lib/dcp.cc index 421dbbf83..05b71557e 100644 --- a/src/lib/dcp.cc +++ b/src/lib/dcp.cc @@ -34,20 +34,22 @@ using std::list; using std::string; using std::shared_ptr; +using std::make_shared; using std::dynamic_pointer_cast; +using std::vector; /** Find all the CPLs in our directories, cross-add assets and return the CPLs */ list<shared_ptr<dcp::CPL> > DCP::cpls () const { - list<shared_ptr<dcp::DCP> > dcps; - list<shared_ptr<dcp::CPL> > cpls; + list<shared_ptr<dcp::DCP>> dcps; + list<shared_ptr<dcp::CPL>> cpls; LOG_GENERAL ("Reading %1 DCP directories", _dcp_content->directories().size()); for (auto i: _dcp_content->directories()) { - shared_ptr<dcp::DCP> dcp (new dcp::DCP (i)); - list<dcp::VerificationNote> notes; + auto dcp = make_shared<dcp::DCP>(i); + vector<dcp::VerificationNote> notes; dcp->read (¬es, true); if (!_tolerant) { /** We accept and ignore EMPTY_ASSET_PATH and EXTERNAL_ASSET but everything else is bad */ diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 71eb0bae0..4bc090bf4 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -280,7 +280,7 @@ DCPDecoder::pass_texts ( int64_t const frame = next.frames_round (vfr); if (_decode_referenced || !reference) { - list<shared_ptr<dcp::Subtitle> > subs = asset->subtitles_during ( + auto subs = asset->subtitles_during ( dcp::Time (entry_point + frame, vfr, vfr), dcp::Time (entry_point + frame + 1, vfr, vfr), true @@ -289,10 +289,10 @@ DCPDecoder::pass_texts ( list<dcp::SubtitleString> strings; for (auto i: subs) { - shared_ptr<dcp::SubtitleString> is = dynamic_pointer_cast<dcp::SubtitleString> (i); + auto is = dynamic_pointer_cast<const dcp::SubtitleString>(i); if (is) { if (!strings.empty() && (strings.back().in() != is->in() || strings.back().out() != is->out())) { - dcp::SubtitleString b = strings.back(); + auto b = strings.back(); decoder->emit_plain ( ContentTimePeriod ( ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.in().as_seconds()), @@ -310,7 +310,7 @@ DCPDecoder::pass_texts ( this would need to be done both here and in DCPSubtitleDecoder. */ - shared_ptr<dcp::SubtitleImage> ii = dynamic_pointer_cast<dcp::SubtitleImage> (i); + auto ii = dynamic_pointer_cast<const dcp::SubtitleImage>(i); if (ii) { emit_subtitle_image ( ContentTimePeriod ( @@ -325,7 +325,7 @@ DCPDecoder::pass_texts ( } if (!strings.empty()) { - dcp::SubtitleString b = strings.back(); + auto b = strings.back(); decoder->emit_plain ( ContentTimePeriod ( ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.in().as_seconds()), diff --git a/src/lib/dcp_decoder.h b/src/lib/dcp_decoder.h index 553f05aed..887f8ad5c 100644 --- a/src/lib/dcp_decoder.h +++ b/src/lib/dcp_decoder.h @@ -49,7 +49,7 @@ public: std::shared_ptr<DCPDecoder> old ); - std::list<std::shared_ptr<dcp::Reel> > reels () const { + std::vector<std::shared_ptr<dcp::Reel>> reels () const { return _reels; } @@ -85,9 +85,9 @@ private: /** Time of next thing to return from pass relative to the start of _reel */ dcpomatic::ContentTime _next; - std::list<std::shared_ptr<dcp::Reel> > _reels; + std::vector<std::shared_ptr<dcp::Reel>> _reels; - std::list<std::shared_ptr<dcp::Reel> >::iterator _reel; + std::vector<std::shared_ptr<dcp::Reel>>::iterator _reel; /** Offset of _reel from the start of the content in frames */ int64_t _offset; /** Reader for current mono picture asset, if applicable */ diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 191022f12..d0c3d1021 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -219,7 +219,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant) } } - _encrypted = cpl->encrypted (); + _encrypted = cpl->any_encrypted (); _kdm_valid = true; /* Check that we can read the first picture, sound and subtitle frames of each reel */ diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index 5372df0a5..1b144f204 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -67,7 +67,7 @@ DCPSubtitleDecoder::seek (ContentTime time, bool accurate) Decoder::seek (time, accurate); _next = _subtitles.begin (); - list<shared_ptr<dcp::Subtitle> >::const_iterator i = _subtitles.begin (); + auto i = _subtitles.begin (); while (i != _subtitles.end() && ContentTime::from_seconds ((*_next)->in().as_seconds()) < time) { ++i; } @@ -92,7 +92,7 @@ DCPSubtitleDecoder::pass () ContentTimePeriod const p = content_time_period (*_next); while (_next != _subtitles.end () && content_time_period (*_next) == p) { - shared_ptr<dcp::SubtitleString> ns = dynamic_pointer_cast<dcp::SubtitleString>(*_next); + auto ns = dynamic_pointer_cast<const dcp::SubtitleString>(*_next); if (ns) { s.push_back (*ns); ++_next; @@ -101,7 +101,7 @@ DCPSubtitleDecoder::pass () this would need to be done both here and in DCPDecoder. */ - shared_ptr<dcp::SubtitleImage> ni = dynamic_pointer_cast<dcp::SubtitleImage>(*_next); + auto ni = dynamic_pointer_cast<const dcp::SubtitleImage>(*_next); if (ni) { emit_subtitle_image (p, *ni, film()->frame_size(), only_text()); ++_next; @@ -114,12 +114,12 @@ DCPSubtitleDecoder::pass () } ContentTimePeriod -DCPSubtitleDecoder::content_time_period (shared_ptr<dcp::Subtitle> s) const +DCPSubtitleDecoder::content_time_period (shared_ptr<const dcp::Subtitle> s) const { - return ContentTimePeriod ( - ContentTime::from_seconds (s->in().as_seconds ()), - ContentTime::from_seconds (s->out().as_seconds ()) - ); + return { + ContentTime::from_seconds(s->in().as_seconds()), + ContentTime::from_seconds(s->out().as_seconds()) + }; } diff --git a/src/lib/dcp_subtitle_decoder.h b/src/lib/dcp_subtitle_decoder.h index 31b8e6a8e..a9540c3cf 100644 --- a/src/lib/dcp_subtitle_decoder.h +++ b/src/lib/dcp_subtitle_decoder.h @@ -35,10 +35,10 @@ public: std::vector<dcpomatic::FontData> fonts () const; private: - dcpomatic::ContentTimePeriod content_time_period (std::shared_ptr<dcp::Subtitle> s) const; + dcpomatic::ContentTimePeriod content_time_period (std::shared_ptr<const dcp::Subtitle> s) const; - std::list<std::shared_ptr<dcp::Subtitle> > _subtitles; - std::list<std::shared_ptr<dcp::Subtitle> >::const_iterator _next; + std::vector<std::shared_ptr<const dcp::Subtitle>> _subtitles; + std::vector<std::shared_ptr<const dcp::Subtitle>>::const_iterator _next; std::vector<dcpomatic::FontData> _fonts; }; diff --git a/src/lib/hints.cc b/src/lib/hints.cc index ca697ad74..58d33204c 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -534,7 +534,7 @@ void Hints::check_ffec_and_ffmc_in_smpte_feature () { shared_ptr<const Film> f = film(); - if (!f->interop() && f->dcp_content_type()->libdcp_kind() == dcp::FEATURE && (!f->marker(dcp::FFEC) || !f->marker(dcp::FFMC))) { + if (!f->interop() && f->dcp_content_type()->libdcp_kind() == dcp::FEATURE && (!f->marker(dcp::Marker::FFEC) || !f->marker(dcp::Marker::FFMC))) { hint (_("SMPTE DCPs with the type FTR (feature) should have markers for the first frame of end credits (FFEC) and the first frame of moving credits (FFMC). You should add these markers using the 'Markers' button in the DCP tab.")); } } diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index b81c225c2..8be31d09b 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -62,6 +62,7 @@ using std::map; using std::set; using std::vector; using std::shared_ptr; +using std::make_shared; using boost::optional; using std::dynamic_pointer_cast; #if BOOST_VERSION >= 106100 @@ -690,7 +691,7 @@ ReelWriter::create_reel_markers (shared_ptr<dcp::Reel> reel) const } if (!reel_markers.empty ()) { - shared_ptr<dcp::ReelMarkersAsset> ma (new dcp::ReelMarkersAsset(dcp::Fraction(film()->video_frame_rate(), 1), 0)); + auto ma = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(film()->video_frame_rate(), 1), reel->duration(), 0); for (map<dcp::Marker, DCPTime>::const_iterator i = reel_markers.begin(); i != reel_markers.end(); ++i) { int h, m, s, f; DCPTime relative = i->second - _period.from; diff --git a/src/lib/types.cc b/src/lib/types.cc index 68d97b8ff..9aba915e8 100644 --- a/src/lib/types.cc +++ b/src/lib/types.cc @@ -39,6 +39,7 @@ using std::min; using std::string; using std::list; using std::shared_ptr; +using std::vector; using dcp::raw_convert; bool operator== (Crop const & a, Crop const & b) @@ -197,7 +198,7 @@ CPLSummary::CPLSummary (boost::filesystem::path p) { dcp::DCP dcp (p); - list<dcp::VerificationNote> notes; + vector<dcp::VerificationNote> notes; dcp.read (¬es); for (auto i: notes) { if (i.code() != dcp::VerificationNote::EXTERNAL_ASSET) { diff --git a/src/lib/types.h b/src/lib/types.h index 87b3fc753..f8f23a300 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -236,7 +236,7 @@ struct CPLSummary std::string dcp_directory; std::string cpl_id; - std::string cpl_annotation_text; + boost::optional<std::string> cpl_annotation_text; boost::filesystem::path cpl_file; /** true if this CPL has any encrypted assets */ bool encrypted; diff --git a/src/lib/verify_dcp_job.h b/src/lib/verify_dcp_job.h index ab33b4f55..3372cd602 100644 --- a/src/lib/verify_dcp_job.h +++ b/src/lib/verify_dcp_job.h @@ -33,7 +33,7 @@ public: std::string json_name () const; void run (); - std::list<dcp::VerificationNote> notes () const { + std::vector<dcp::VerificationNote> notes () const { return _notes; } @@ -41,5 +41,5 @@ private: void update_stage (std::string s, boost::optional<boost::filesystem::path> path); std::vector<boost::filesystem::path> _directories; - std::list<dcp::VerificationNote> _notes; + std::vector<dcp::VerificationNote> _notes; }; |
