diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-11-24 09:54:03 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-11-24 09:54:03 +0100 |
| commit | e46870be9e7544d102b9612680b321fbf52c73f2 (patch) | |
| tree | 239548909916f9388e9ca8e259a7348738906e61 /src/subtitle.cc | |
| parent | 870b1613e1e6333db01185548574efb3277de060 (diff) | |
Add equality option for vertical subtitle position.v1.8.34
Diffstat (limited to 'src/subtitle.cc')
| -rw-r--r-- | src/subtitle.cc | 11 |
1 files changed, 8 insertions, 3 deletions
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<const Subtitle> other, EqualityOptions, NoteHandler note) const +Subtitle::equals(shared_ptr<const Subtitle> other, EqualityOptions options, NoteHandler note) const { bool same = true; @@ -96,8 +97,12 @@ Subtitle::equals(shared_ptr<const Subtitle> 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; } |
