summaryrefslogtreecommitdiff
path: root/src/lib/writer.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/writer.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/writer.cc')
-rw-r--r--src/lib/writer.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index dd5223670..3a6547207 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -263,7 +263,7 @@ Writer::write (shared_ptr<const AudioBuffers> audio, DCPTime const time)
int const afr = film()->audio_frame_rate();
- DCPTime const end = time + DCPTime::from_frames(audio->frames(), afr);
+ DCPTime const end = time + DCPTime(audio->frames(), afr);
/* The audio we get might span a reel boundary, and if so we have to write it in bits */
@@ -771,9 +771,9 @@ Writer::write(PlayerText text, TextType type, optional<DCPTextTrack> track, DCPT
auto back_off = [this](DCPTimePeriod period) {
auto const vfr = film()->video_frame_rate();
- period.to -= DCPTime::from_frames(2, vfr);
+ period.to -= DCPTime(2, vfr);
if (period.duration().frames_floor(vfr) <= 0) {
- period.to = period.from + DCPTime::from_frames(1, vfr);
+ period.to = period.from + DCPTime(1, vfr);
}
return period;
};
@@ -887,7 +887,7 @@ Writer::write(ReferencedReelAsset asset)
size_t
Writer::video_reel(int frame) const
{
- auto t = DCPTime::from_frames(frame, film()->video_frame_rate());
+ auto t = DCPTime(frame, film()->video_frame_rate());
size_t reel_index = 0;
while (reel_index < _reels.size() && !_reels[reel_index].period().contains(t)) {
++reel_index;