summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-12-09 01:11:59 +0100
committerCarl Hetherington <cth@carlh.net>2025-12-09 02:41:38 +0100
commit7987b15d5555adc506b207f32617798f85315961 (patch)
tree20ed24a9846a46dc1739ed0a061d22b0df372a8b
parent783991b0f89d948f760829b923490210fb52f56a (diff)
Move CPLSummary into a faster version in libdcp.
-rw-r--r--cscript2
-rw-r--r--src/lib/film.cc15
-rw-r--r--src/lib/film.h3
-rw-r--r--src/lib/types.cc35
-rw-r--r--src/lib/types.h22
-rw-r--r--src/wx/dkdm_dialog.cc2
-rw-r--r--src/wx/kdm_cpl_panel.cc6
-rw-r--r--src/wx/kdm_cpl_panel.h5
-rw-r--r--src/wx/kdm_dialog.cc2
9 files changed, 20 insertions, 72 deletions
diff --git a/cscript b/cscript
index 757663691..9e00d764c 100644
--- a/cscript
+++ b/cscript
@@ -502,7 +502,7 @@ def build_with_cpp17(target):
def dependencies(target, options):
- deps = [('libdcp', 'v1.10.41', {'c++17': build_with_cpp17(target)})]
+ deps = [('libdcp', 'v1.10.42', {'c++17': build_with_cpp17(target)})]
deps.append(('libsub', 'v1.6.58'))
deps.append(('leqm-nrt', 'd75d0af984d9c14bfefca8f1bdbc215c3bf3a388'))
if target.platform != 'linux' or target.distro != 'arch':
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 (&notes);
- 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
diff --git a/src/wx/dkdm_dialog.cc b/src/wx/dkdm_dialog.cc
index f8afa3d71..584aff405 100644
--- a/src/wx/dkdm_dialog.cc
+++ b/src/wx/dkdm_dialog.cc
@@ -94,7 +94,7 @@ DKDMDialog::DKDMDialog (wxWindow* parent, shared_ptr<const Film> film)
h->SetFont (subheading_font);
right->Add (h);
- vector<CPLSummary> cpls;
+ vector<dcp::CPLSummary> cpls;
for (auto const& i: film->cpls()) {
if (i.encrypted) {
cpls.push_back (i);
diff --git a/src/wx/kdm_cpl_panel.cc b/src/wx/kdm_cpl_panel.cc
index eb02638a2..45ed865dc 100644
--- a/src/wx/kdm_cpl_panel.cc
+++ b/src/wx/kdm_cpl_panel.cc
@@ -34,7 +34,7 @@ LIBDCP_ENABLE_WARNINGS
using std::vector;
-KDMCPLPanel::KDMCPLPanel (wxWindow* parent, vector<CPLSummary> cpls)
+KDMCPLPanel::KDMCPLPanel(wxWindow* parent, vector<dcp::CPLSummary> cpls)
: wxPanel (parent, wxID_ANY)
, _cpls (cpls)
{
@@ -94,7 +94,7 @@ KDMCPLPanel::update_cpl_summary ()
return;
}
- _dcp_directory->SetLabel (std_to_wx (_cpls[n].dcp_directory));
+ _dcp_directory->SetLabel(std_to_wx(_cpls[n].dcp_directory.string()));
_cpl_id->SetLabel (std_to_wx (_cpls[n].cpl_id));
_cpl_annotation_text->SetLabel (std_to_wx(_cpls[n].cpl_annotation_text.get_value_or("")));
@@ -140,7 +140,7 @@ KDMCPLPanel::cpl_browse_clicked ()
*/
_cpls.push_back (
- CPLSummary (
+ dcp::CPLSummary(
dcp_dir.filename().string(),
cpl_document.string_child("Id").substr (9),
cpl_document.string_child("ContentTitleText"),
diff --git a/src/wx/kdm_cpl_panel.h b/src/wx/kdm_cpl_panel.h
index 91821d7a3..441823afa 100644
--- a/src/wx/kdm_cpl_panel.h
+++ b/src/wx/kdm_cpl_panel.h
@@ -20,6 +20,7 @@
#include "lib/types.h"
+#include <dcp/cpl_summary.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/wx.h>
@@ -31,7 +32,7 @@ LIBDCP_ENABLE_WARNINGS
class KDMCPLPanel : public wxPanel
{
public:
- KDMCPLPanel (wxWindow* parent, std::vector<CPLSummary> cpls);
+ KDMCPLPanel(wxWindow* parent, std::vector<dcp::CPLSummary> cpls);
boost::filesystem::path cpl () const;
bool has_selected () const;
@@ -49,5 +50,5 @@ private:
wxStaticText* _cpl_id;
wxStaticText* _cpl_annotation_text;
- std::vector<CPLSummary> _cpls;
+ std::vector<dcp::CPLSummary> _cpls;
};
diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc
index c2dce905f..97aa835c6 100644
--- a/src/wx/kdm_dialog.cc
+++ b/src/wx/kdm_dialog.cc
@@ -99,7 +99,7 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr<const Film> film)
h->SetFont (subheading_font);
right->Add (h);
- vector<CPLSummary> cpls;
+ vector<dcp::CPLSummary> cpls;
for (auto const& i: film->cpls()) {
if (i.encrypted) {
cpls.push_back (i);