From e46870be9e7544d102b9612680b321fbf52c73f2 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 24 Nov 2022 09:54:03 +0100 Subject: Add equality option for vertical subtitle position. --- src/subtitle.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/subtitle.cc') diff --git a/src/subtitle.cc b/src/subtitle.cc index 522b0e5f..de3fe03f 100644 --- a/src/subtitle.cc +++ b/src/subtitle.cc @@ -37,6 +37,7 @@ */ +#include "compose.hpp" #include "subtitle.h" #include "dcp_time.h" @@ -72,7 +73,7 @@ Subtitle::Subtitle ( bool -Subtitle::equals(shared_ptr other, EqualityOptions, NoteHandler note) const +Subtitle::equals(shared_ptr other, EqualityOptions options, NoteHandler note) const { bool same = true; @@ -96,8 +97,12 @@ Subtitle::equals(shared_ptr other, EqualityOptions, NoteHandler same = false; } - if (v_position() != other->v_position()) { - note(NoteType::ERROR, "subtitle vertical positions differ"); + auto const vpos = std::abs(v_position() - other->v_position()); + if (vpos > options.max_subtitle_vertical_position_error) { + note( + NoteType::ERROR, + String::compose("subtitle vertical positions differ by %1 (more than the allowed difference of %2)", vpos, options.max_subtitle_vertical_position_error) + ); same = false; } -- cgit v1.2.3