summaryrefslogtreecommitdiff
path: root/src/lib/content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-12-22 00:09:57 +0100
committerCarl Hetherington <cth@carlh.net>2025-09-02 22:40:13 +0200
commit33b0928b20618da5bc295711bfdf3d638863afa5 (patch)
tree24af21c6a7b863d914991ae837c36b6b9b50bcce /src/lib/content.cc
parent6784eb8de2451afd2dedc15c05eac043011b5afb (diff)
Untested conversion to num/den DCPTime.arbitrary-hz
Summary of required changes: Replace ::from_frames with a constructor that takes num/den. Provide and use member to_debug_string() instead of to_string(). Provide and use member to_serializable_string() and string constructor instead of fmt::to_string on .get() and number constructor. Provide and use content_time() member instead of ContentTime constructor from DCPTime. Use frames_round(96000) instead of get() when comparing times to see if they are "close enough". Provide and use DCPTime(x, FrameRateChange) constructor when converting from ContentTime. Use .seconds() when calculating proportions or sometimes when dividing by HZ. Provide and use operator bool(). Pass explicit 96000 denominator in a lot of places. Add member max() and use it instead of static max() Change BOOST_CHECK_EQUAL to BOOST_CHECK Provide operator/ and use it instead of .get() / 2.
Diffstat (limited to 'src/lib/content.cc')
-rw-r--r--src/lib/content.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc
index 6bb7c02c9..bb9aa361e 100644
--- a/src/lib/content.cc
+++ b/src/lib/content.cc
@@ -87,7 +87,7 @@ Content::Content(cxml::ConstNodePtr node, boost::optional<boost::filesystem::pat
}
}
_digest = node->optional_string_child("Digest").get_value_or("X");
- _position = DCPTime(node->number_child<DCPTime::Type>("Position"));
+ _position = DCPTime(node->string_child("Position"));
_trim_start = ContentTime(node->number_child<ContentTime::Type>("TrimStart"));
_trim_end = ContentTime(node->number_child<ContentTime::Type>("TrimEnd"));
_video_frame_rate = node->optional_number_child<double>("VideoFrameRate");
@@ -146,7 +146,7 @@ Content::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour path_beh
}
}
cxml::add_text_child(element, "Digest", _digest);
- cxml::add_text_child(element, "Position", fmt::to_string(_position.get()));
+ cxml::add_text_child(element, "Position", _position.to_serialisable_string());
cxml::add_text_child(element, "TrimStart", fmt::to_string(_trim_start.get()));
cxml::add_text_child(element, "TrimEnd", fmt::to_string(_trim_end.get()));
if (_video_frame_rate) {
@@ -322,8 +322,8 @@ Content::identifier() const
{
char buffer[256];
snprintf(
- buffer, sizeof(buffer), "%s_%" PRId64 "_%" PRId64 "_%" PRId64,
- Content::digest().c_str(), position().get(), trim_start().get(), trim_end().get()
+ buffer, sizeof(buffer), "%s_%s_%" PRId64 "_%" PRId64,
+ Content::digest().c_str(), position().to_serialisable_string().c_str(), trim_start().get(), trim_end().get()
);
return buffer;
}