summaryrefslogtreecommitdiff
path: root/src/subtitle_asset.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-12-02 10:09:30 +0100
committerCarl Hetherington <cth@carlh.net>2020-12-02 10:09:30 +0100
commit2b522d0382a6d4534f1504123a9d16700fe50f0a (patch)
tree63d5c8ee3a82ee739f98957ef425afc8286778b5 /src/subtitle_asset.cc
parent3c90f397bf2222e0249ba169df0dac75b556f989 (diff)
Fix equals() with image subtitles to not compare unique IDs.
Also add an option to save subtitle images to PNGs when they differ.
Diffstat (limited to 'src/subtitle_asset.cc')
-rw-r--r--src/subtitle_asset.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc
index c6d2e790..96e5cba5 100644
--- a/src/subtitle_asset.cc
+++ b/src/subtitle_asset.cc
@@ -452,7 +452,7 @@ SubtitleAsset::equals (shared_ptr<const Asset> other_asset, EqualityOptions opti
}
if (_subtitles.size() != other->_subtitles.size()) {
- note (DCP_ERROR, "subtitles differ");
+ note (DCP_ERROR, String::compose("different number of subtitles: %1 vs %2", _subtitles.size(), other->_subtitles.size()));
return false;
}
@@ -466,17 +466,16 @@ SubtitleAsset::equals (shared_ptr<const Asset> other_asset, EqualityOptions opti
shared_ptr<SubtitleImage> image_j = dynamic_pointer_cast<SubtitleImage> (*j);
if ((string_i && !string_j) || (image_i && !image_j)) {
- note (DCP_ERROR, "subtitles differ");
+ note (DCP_ERROR, "subtitles differ: string vs. image");
return false;
}
if (string_i && *string_i != *string_j) {
- note (DCP_ERROR, "subtitles differ");
+ note (DCP_ERROR, String::compose("subtitles differ in text or metadata: %1 vs %2", string_i->text(), string_j->text()));
return false;
}
- if (image_i && *image_i != *image_j) {
- note (DCP_ERROR, "subtitles differ");
+ if (image_i && !image_i->equals(image_j, options, note)) {
return false;
}