From 33b0928b20618da5bc295711bfdf3d638863afa5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 22 Dec 2024 00:09:57 +0100 Subject: Untested conversion to num/den DCPTime. 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. --- src/lib/reel_writer.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib/reel_writer.cc') diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 01a798676..9ec8522ac 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -514,7 +514,7 @@ ReelWriter::create_reel_picture(shared_ptr reel, list(j.asset); if (k) { - LOG_GENERAL("candidate picture asset period is {}-{}", j.period.from.get(), j.period.to.get()); + LOG_GENERAL("candidate picture asset period is {}-{}", j.period.from.to_debug_string(), j.period.to.to_debug_string()); } if (k && j.period == _period) { reel_asset = k; @@ -556,7 +556,7 @@ ReelWriter::create_reel_sound(shared_ptr reel, list(j.asset); if (k) { - LOG_GENERAL("candidate sound asset period is {}-{}", j.period.from.get(), j.period.to.get()); + LOG_GENERAL("candidate sound asset period is {}-{}", j.period.from.to_debug_string(), j.period.to.to_debug_string()); } if (k && j.period == _period) { reel_asset = k; @@ -682,7 +682,7 @@ ReelWriter::create_reel_markers(shared_ptr reel) const auto ma = make_shared(dcp::Fraction(film()->video_frame_rate(), 1), reel->duration()); for (auto const& i: reel_markers) { DCPTime relative = i.second - _period.from; - auto hmsf = relative.split(film()->video_frame_rate()); + auto const hmsf = relative.splitX(film()->video_frame_rate()); ma->set(i.first, dcp::Time(hmsf.h, hmsf.m, hmsf.s, hmsf.f, film()->video_frame_rate())); } reel->add(ma); @@ -701,7 +701,7 @@ ReelWriter::create_reel( set ensure_closed_captions ) { - LOG_GENERAL("create_reel for {}-{}; {} of {}", _period.from.get(), _period.to.get(), _reel_index, _reel_count); + LOG_GENERAL("create_reel for {}-{}; {} of {}", _period.from.to_debug_string(), _period.to.to_debug_string(), _reel_index, _reel_count); auto reel = make_shared(); -- cgit v1.2.3