summaryrefslogtreecommitdiff
path: root/src/lib/film.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-12-19 12:45:38 +0100
committerCarl Hetherington <cth@carlh.net>2024-03-12 23:41:00 +0100
commit521424e747dced3ade9600fc62c48526e199ef16 (patch)
tree5855a0b0a522bce947b7db6d7bc7e192ca5b6ea7 /src/lib/film.cc
parent4fa9f7e81789b44e5e61b01e4c5352a616d9ae6d (diff)
Add custom reels option to Film.
Diffstat (limited to 'src/lib/film.cc')
-rw-r--r--src/lib/film.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index d94ef0af3..835f3efdf 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -413,6 +413,9 @@ Film::metadata (bool with_content_paths) const
}
root->add_child("ReelType")->add_child_text (raw_convert<string> (static_cast<int> (_reel_type)));
root->add_child("ReelLength")->add_child_text (raw_convert<string> (_reel_length));
+ for (auto boundary: _custom_reel_boundaries) {
+ root->add_child("CustomReelBoundary")->add_child_text(raw_convert<string>(boundary.get()));
+ }
root->add_child("ReencodeJ2K")->add_child_text (_reencode_j2k ? "1" : "0");
root->add_child("UserExplicitVideoFrameRate")->add_child_text(_user_explicit_video_frame_rate ? "1" : "0");
for (auto const& marker: _markers) {
@@ -600,6 +603,9 @@ Film::read_metadata (optional<boost::filesystem::path> path)
_reel_type = static_cast<ReelType> (f.optional_number_child<int>("ReelType").get_value_or (static_cast<int>(ReelType::SINGLE)));
_reel_length = f.optional_number_child<int64_t>("ReelLength").get_value_or (2000000000);
+ for (auto boundary: f.node_children("CustomReelBoundary")) {
+ _custom_reel_boundaries.push_back(DCPTime(raw_convert<int64_t>(boundary->content())));
+ }
_reencode_j2k = f.optional_bool_child("ReencodeJ2K").get_value_or(false);
_user_explicit_video_frame_rate = f.optional_bool_child("UserExplicitVideoFrameRate").get_value_or(false);
@@ -1233,6 +1239,16 @@ Film::set_reel_length (int64_t r)
_reel_length = r;
}
+
+void
+Film::set_custom_reel_boundaries(vector<DCPTime> boundaries)
+{
+ FilmChangeSignaller ch(this, FilmProperty::CUSTOM_REEL_BOUNDARIES);
+ std::sort(boundaries.begin(), boundaries.end());
+ _custom_reel_boundaries = std::move(boundaries);
+}
+
+
void
Film::set_reencode_j2k (bool r)
{
@@ -1865,6 +1881,18 @@ Film::reels () const
}
break;
}
+ case ReelType::CUSTOM:
+ {
+ DCPTimePeriod current;
+ for (auto boundary: _custom_reel_boundaries) {
+ current.to = boundary;
+ periods.push_back(current);
+ current.from = boundary;
+ }
+ current.to = len;
+ periods.push_back(current);
+ break;
+ }
}
return periods;