diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-06-21 11:57:24 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-07-10 23:13:14 +0200 |
| commit | 9db2168dcc14a803dcd9da047ddd70e2142d82e2 (patch) | |
| tree | 452103b2ed3a65cbaf9f3b4bb731c2afdbd809f7 /src/lib | |
| parent | d1c151cfdedbf1946d30e9072dc4a5b2ea5f2f80 (diff) | |
Allow specification of player crop in playlist.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/spl.cc | 4 | ||||
| -rw-r--r-- | src/lib/spl_entry.cc | 12 | ||||
| -rw-r--r-- | src/lib/spl_entry.h | 4 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/lib/spl.cc b/src/lib/spl.cc index ff37e5cbf..652efe5b8 100644 --- a/src/lib/spl.cc +++ b/src/lib/spl.cc @@ -47,13 +47,13 @@ SPL::read (boost::filesystem::path path, ContentStore* store) for (auto i: doc.node_children("Entry")) { if (auto cpl = i->optional_string_child("CPL")) { if (auto c = store->get_by_cpl_id(*cpl)) { - add(SPLEntry(c)); + add(SPLEntry(c, i)); } else { _missing = true; } } else { if (auto c = store->get_by_digest(i->string_child("Digest"))) { - add(SPLEntry(c)); + add(SPLEntry(c, i)); } else { _missing = true; } diff --git a/src/lib/spl_entry.cc b/src/lib/spl_entry.cc index 03df91729..2fc179841 100644 --- a/src/lib/spl_entry.cc +++ b/src/lib/spl_entry.cc @@ -23,6 +23,7 @@ #include "dcpomatic_assert.h" #include "spl_entry.h" #include <dcp/warnings.h> +#include <fmt/format.h> LIBDCP_DISABLE_WARNINGS #include <libxml++/libxml++.h> LIBDCP_ENABLE_WARNINGS @@ -32,7 +33,7 @@ using std::dynamic_pointer_cast; using std::shared_ptr; -SPLEntry::SPLEntry(shared_ptr<Content> c) +SPLEntry::SPLEntry(shared_ptr<Content> c, cxml::ConstNodePtr node) : content(c) , digest(content->digest()) { @@ -46,6 +47,12 @@ SPLEntry::SPLEntry(shared_ptr<Content> c) name = content->path(0).filename().string(); kind = dcp::ContentKind::FEATURE; } + + if (node) { + if (auto crop = node->optional_number_child<float>("CropToRatio")) { + crop_to_ratio = *crop; + } + } } @@ -57,4 +64,7 @@ SPLEntry::as_xml(xmlpp::Element* e) } else { cxml::add_text_child(e, "Digest", digest); } + if (crop_to_ratio) { + cxml::add_text_child(e, "CropToRatio", fmt::to_string(*crop_to_ratio)); + } } diff --git a/src/lib/spl_entry.h b/src/lib/spl_entry.h index 02f1c03c9..dd304b374 100644 --- a/src/lib/spl_entry.h +++ b/src/lib/spl_entry.h @@ -25,6 +25,7 @@ #include <libcxml/cxml.h> #include <dcp/content_kind.h> +#include <libcxml/cxml.h> namespace xmlpp { @@ -37,7 +38,7 @@ class Content; class SPLEntry { public: - SPLEntry(std::shared_ptr<Content> c); + SPLEntry(std::shared_ptr<Content> c, cxml::ConstNodePtr node = {}); void as_xml(xmlpp::Element* e); @@ -49,6 +50,7 @@ public: boost::optional<std::string> id; boost::optional<dcp::ContentKind> kind; bool encrypted; + boost::optional<float> crop_to_ratio; private: void construct(std::shared_ptr<Content> content); |
