From f8aaf84b234227c02070c7a84e7e90320d118a6a Mon Sep 17 00:00:00 2001 From: Joshua Minor Date: Thu, 14 Nov 2024 00:04:36 -0800 Subject: [PATCH] Explained timecode rate snapping Signed-off-by: Joshua Minor --- src/opentime/rationalTime.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/opentime/rationalTime.cpp b/src/opentime/rationalTime.cpp index 8e3e8025e5..0082e91394 100644 --- a/src/opentime/rationalTime.cpp +++ b/src/opentime/rationalTime.cpp @@ -453,6 +453,10 @@ RationalTime::to_timecode( return std::string(); } + // It is common practice to use truncated or rounded values + // like 29.97 instead of exact SMPTE rates like 30000/1001 + // so as a convenience we will snap the rate to the nearest + // SMPTE rate if it is close enough. double nearest_smpte_rate = nearest_smpte_timecode_rate(rate); if (abs(nearest_smpte_rate - rate) > 0.1) {