From cb6729aa79b555b219974207fbe2ff0510f9d3ea Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 20 Jan 2021 23:42:28 +0100 Subject: Bump libdcp for better verification, and make API adjustments. --- src/lib/dcp.cc | 10 ++++++---- src/lib/dcp_decoder.cc | 10 +++++----- src/lib/dcp_decoder.h | 6 +++--- src/lib/dcp_examiner.cc | 2 +- src/lib/dcp_subtitle_decoder.cc | 16 ++++++++-------- src/lib/dcp_subtitle_decoder.h | 6 +++--- src/lib/hints.cc | 2 +- src/lib/reel_writer.cc | 3 ++- src/lib/types.cc | 3 ++- src/lib/types.h | 2 +- src/lib/verify_dcp_job.h | 4 ++-- 11 files changed, 34 insertions(+), 30 deletions(-) (limited to 'src/lib') 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 > DCP::cpls () const { - list > dcps; - list > cpls; + list> dcps; + list> cpls; LOG_GENERAL ("Reading %1 DCP directories", _dcp_content->directories().size()); for (auto i: _dcp_content->directories()) { - shared_ptr dcp (new dcp::DCP (i)); - list notes; + auto dcp = make_shared(i); + vector 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 > 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 strings; for (auto i: subs) { - shared_ptr is = dynamic_pointer_cast (i); + auto is = dynamic_pointer_cast(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 ii = dynamic_pointer_cast (i); + auto ii = dynamic_pointer_cast(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 old ); - std::list > reels () const { + std::vector> 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 > _reels; + std::vector> _reels; - std::list >::iterator _reel; + std::vector>::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 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 >::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 ns = dynamic_pointer_cast(*_next); + auto ns = dynamic_pointer_cast(*_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 ni = dynamic_pointer_cast(*_next); + auto ni = dynamic_pointer_cast(*_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 s) const +DCPSubtitleDecoder::content_time_period (shared_ptr 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 fonts () const; private: - dcpomatic::ContentTimePeriod content_time_period (std::shared_ptr s) const; + dcpomatic::ContentTimePeriod content_time_period (std::shared_ptr s) const; - std::list > _subtitles; - std::list >::const_iterator _next; + std::vector> _subtitles; + std::vector>::const_iterator _next; std::vector _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 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 reel) const } if (!reel_markers.empty ()) { - shared_ptr ma (new dcp::ReelMarkersAsset(dcp::Fraction(film()->video_frame_rate(), 1), 0)); + auto ma = make_shared(dcp::Fraction(film()->video_frame_rate(), 1), reel->duration(), 0); for (map::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 notes; + vector 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 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 notes () const { + std::vector notes () const { return _notes; } @@ -41,5 +41,5 @@ private: void update_stage (std::string s, boost::optional path); std::vector _directories; - std::list _notes; + std::vector _notes; }; -- cgit v1.2.3