diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-12-09 01:11:59 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-12-09 02:41:38 +0100 |
| commit | 7987b15d5555adc506b207f32617798f85315961 (patch) | |
| tree | 20ed24a9846a46dc1739ed0a061d22b0df372a8b /src/lib | |
| parent | 783991b0f89d948f760829b923490210fb52f56a (diff) | |
Move CPLSummary into a faster version in libdcp.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/film.cc | 15 | ||||
| -rw-r--r-- | src/lib/film.h | 3 | ||||
| -rw-r--r-- | src/lib/types.cc | 35 | ||||
| -rw-r--r-- | src/lib/types.h | 22 |
4 files changed, 11 insertions, 64 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index 5e46d8615..56d7b47a6 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1414,14 +1414,14 @@ Film::j2c_path(int reel, Frame frame, Eyes eyes, bool tmp) const /** Find all the DCPs in our directory that can be dcp::DCP::read() and return details of their CPLs. * The list will be returned in reverse order of timestamp (i.e. most recent first). */ -vector<CPLSummary> +vector<dcp::CPLSummary> Film::cpls() const { if (!directory()) { return {}; } - vector<CPLSummary> out; + vector<dcp::CPLSummary> out; auto const dir = directory().get(); for (auto const& item: dcp::filesystem::directory_iterator(dir)) { @@ -1431,14 +1431,15 @@ Film::cpls() const ) { try { - out.push_back(CPLSummary(item)); - } catch (...) { - - } + dcp::DCP dcp(item.path()); + for (auto cpl: dcp.cpl_summaries()) { + out.push_back(cpl); + } + } catch (...) {} } } - sort(out.begin(), out.end(), [](CPLSummary const& a, CPLSummary const& b) { + sort(out.begin(), out.end(), [](dcp::CPLSummary const& a, dcp::CPLSummary const& b) { return a.last_write_time > b.last_write_time; }); diff --git a/src/lib/film.h b/src/lib/film.h index adaff3c52..258be7f31 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -45,6 +45,7 @@ #include "types.h" #include "util.h" #include "video_encoding.h" +#include <dcp/cpl_summary.h> #include <dcp/encrypted_kdm.h> #include <dcp/file.h> #include <dcp/key.h> @@ -140,7 +141,7 @@ public: dcp::Size frame_size() const; dcp::Size active_area() const; - std::vector<CPLSummary> cpls() const; + std::vector<dcp::CPLSummary> cpls() const; std::list<DCPTextTrack> closed_text_tracks() const; diff --git a/src/lib/types.cc b/src/lib/types.cc index 7247a726a..7f816b89a 100644 --- a/src/lib/types.cc +++ b/src/lib/types.cc @@ -18,6 +18,7 @@ */ +#include "timer.h" #include "types.h" #include "dcpomatic_assert.h" #include <dcp/cpl.h> @@ -41,40 +42,6 @@ using std::shared_ptr; using std::vector; -CPLSummary::CPLSummary (boost::filesystem::path p) - : dcp_directory(p.filename().string()) -{ - dcp::DCP dcp (p); - - vector<dcp::VerificationNote> notes; - dcp.read (¬es); - for (auto i: notes) { - if (i.code() != dcp::VerificationNote::Code::EXTERNAL_ASSET) { - /* It's not just a warning about this DCP being a VF */ - throw dcp::ReadError(dcp::note_to_string(i)); - } - } - - cpl_id = dcp.cpls().front()->id(); - cpl_annotation_text = dcp.cpls().front()->annotation_text(); - cpl_file = dcp.cpls().front()->file().get(); - - encrypted = false; - for (auto j: dcp.cpls()) { - for (auto k: j->reel_file_assets()) { - if (k->encrypted()) { - encrypted = true; - } - } - } - - boost::system::error_code ec; - auto last_write = dcp::filesystem::last_write_time(p, ec); - last_write_time = ec ? 0 : last_write; -} - - - ReelType string_to_reel_type(string type) { diff --git a/src/lib/types.h b/src/lib/types.h index f6b0fb3be..cb6d46369 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -117,28 +117,6 @@ std::string reel_type_to_string(ReelType type); ReelType string_to_reel_type(std::string type); -struct CPLSummary -{ - CPLSummary (boost::filesystem::path p); - - CPLSummary (std::string d, std::string i, std::string a, boost::filesystem::path f, bool e, time_t t) - : dcp_directory (d) - , cpl_id (i) - , cpl_annotation_text (a) - , cpl_file (f) - , encrypted (e) - , last_write_time (t) - {} - - std::string dcp_directory; - std::string cpl_id; - boost::optional<std::string> cpl_annotation_text; - boost::filesystem::path cpl_file; - /** true if this CPL has any encrypted assets */ - bool encrypted; - time_t last_write_time; -}; - enum class FileTransferProtocol { SCP, FTP |
