Cleanup: move EqualityOptions into its own file.
authorCarl Hetherington <cth@carlh.net>
Tue, 25 Jul 2023 13:28:11 +0000 (15:28 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 25 Jul 2023 13:28:11 +0000 (15:28 +0200)
24 files changed:
src/asset.cc
src/asset.h
src/cpl.cc
src/dcp.h
src/equality_options.h [new file with mode: 0644]
src/interop_subtitle_asset.cc
src/mono_picture_asset.cc
src/picture_asset.cc
src/reel.cc
src/reel_asset.cc
src/reel_file_asset.cc
src/smpte_subtitle_asset.cc
src/sound_asset.cc
src/stereo_picture_asset.cc
src/subtitle.cc
src/subtitle.h
src/subtitle_image.cc
src/types.h
src/wscript
test/asset_test.cc
test/combine_test.cc
test/dcp_test.cc
test/markers_test.cc
tools/dcpdiff.cc

index abf9c9c8d0d795cd1d3e1825d65e889aee7aa2b2..213d4878410e2553f7b48963da1ea185432d9f06 100644 (file)
@@ -41,6 +41,7 @@
 #include "asset_map.h"
 #include "compose.hpp"
 #include "dcp_assert.h"
+#include "equality_options.h"
 #include "exceptions.h"
 #include "pkl.h"
 #include "raw_convert.h"
index b88b1167d3c110f1087424805d972d2225667164..06e129368a7e2f16a8951b05a32fd48a414fe086 100644 (file)
@@ -61,6 +61,7 @@ namespace dcp {
 
 
 class AssetMap;
+class EqualityOptions;
 
 
 /** @class Asset
index f1f01b42a7c3a9ca9ee384eb83a0386820c7da64..bbdaee18f77cd03aa443c35236b37c91d5863090 100644 (file)
@@ -41,6 +41,7 @@
 #include "compose.hpp"
 #include "cpl.h"
 #include "dcp_assert.h"
+#include "equality_options.h"
 #include "local_time.h"
 #include "metadata.h"
 #include "raw_convert.h"
index d5ffa6891a1c790af7f6bc35ddc75bd3bc0e754f..5c72040de133f8efe114c67ccb405519fd112d5f 100644 (file)
--- a/src/dcp.h
+++ b/src/dcp.h
@@ -72,6 +72,7 @@ class CPL;
 class CertificateChain;
 class Content;
 class DecryptedKDM;
+class EqualityOptions;
 class PKL;
 class ReadError;
 class Reel;
diff --git a/src/equality_options.h b/src/equality_options.h
new file mode 100644 (file)
index 0000000..f20e1eb
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+    Copyright (C) 2012-2023 Carl Hetherington <cth@carlh.net>
+
+    This file is part of libdcp.
+
+    libdcp is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    libdcp is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with libdcp.  If not, see <http://www.gnu.org/licenses/>.
+
+    In addition, as a special exception, the copyright holders give
+    permission to link the code of portions of this program with the
+    OpenSSL library under certain conditions as described in each
+    individual source file, and distribute linked combinations
+    including the two.
+
+    You must obey the GNU General Public License in all respects
+    for all of the code used other than OpenSSL.  If you modify
+    file(s) with this exception, you may extend this exception to your
+    version of the file(s), but you are not obligated to do so.  If you
+    do not wish to do so, delete this exception statement from your
+    version.  If you delete this exception statement from all source
+    files in the program, then also delete it here.
+*/
+
+
+/** @file  src/equality_options.h
+ *  @brief Class to describe what equality means when calling Asset::equals().
+ */
+
+
+#ifndef LIBDCP_EQUALITY_OPTIONS_H
+#define LIBDCP_EQUALITY_OPTIONS_H
+
+
+namespace dcp {
+
+
+/** @class EqualityOptions
+ *  @brief A class to describe what "equality" means for a particular test.
+ *
+ *  When comparing things, we want to be able to ignore some differences;
+ *  this class expresses those differences.
+ *
+ *  It also contains some settings for how the comparison should be done.
+ */
+class EqualityOptions
+{
+public:
+       /** Construct an EqualityOptions where nothing at all can differ */
+       EqualityOptions() = default;
+
+       /** The maximum allowable mean difference in pixel value between two images */
+       double max_mean_pixel_error = 0;
+       /** The maximum standard deviation of the differences in pixel value between two images */
+       double max_std_dev_pixel_error = 0;
+       /** The maximum difference in audio sample value between two soundtracks */
+       int max_audio_sample_error = 0;
+       /** true if the &lt;AnnotationText&gt; nodes of CPLs are allowed to differ */
+       bool cpl_annotation_texts_can_differ = false;
+       /** true if the &lt;AnnotationText&gt; nodes of Reels are allowed to differ */
+       bool reel_annotation_texts_can_differ = false;
+       /** true if <Hash>es in Reels can differ */
+       bool reel_hashes_can_differ = false;
+       /** true if asset hashes can differ */
+       bool asset_hashes_can_differ = false;
+       /** true if IssueDate nodes can differ */
+       bool issue_dates_can_differ = false;
+       bool load_font_nodes_can_differ = false;
+       bool keep_going = false;
+       /** true to save the last pair of different image subtitles to the current working directory */
+       bool export_differing_subtitles = false;
+       /** The maximum allowable absolute difference between the vertical position of subtitles */
+       float max_subtitle_vertical_position_error = 0;
+};
+
+
+}
+
+
+#endif
+
index e7c1432b75ee56b6972020a85c4c93175aaa275e..d26143a4435d658405591115a77739910f0346cf 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "compose.hpp"
 #include "dcp_assert.h"
+#include "equality_options.h"
 #include "font_asset.h"
 #include "file.h"
 #include "interop_load_font_node.h"
index 934d3aa9af310167861bcd0b2972a4b8b9e510f7..55d3f6badbc811238680d9282cad6a456f5dcc77 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "compose.hpp"
 #include "dcp_assert.h"
+#include "equality_options.h"
 #include "exceptions.h"
 #include "mono_picture_asset.h"
 #include "mono_picture_asset_reader.h"
index 426dbdb1312ae4475c492a5ccb38682ddf496f38..8dc472eabcc295704fe92347c18c96b3f02251c2 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "compose.hpp"
 #include "dcp_assert.h"
+#include "equality_options.h"
 #include "exceptions.h"
 #include "j2k_transcode.h"
 #include "openjpeg_image.h"
index 33a852cce6a5c22c5dd1d7aba10f65434959c513..a8481d593f03db5a8f60517353da65a7d8fd3508 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "decrypted_kdm.h"
 #include "decrypted_kdm_key.h"
+#include "equality_options.h"
 #include "interop_subtitle_asset.h"
 #include "mono_picture_asset.h"
 #include "picture_asset.h"
index 5b8f3126b5f01a97a18133a36a1ee6581d9e8a94..3a3ae7312fd131b070085b41577ca1db8349d0db 100644 (file)
@@ -40,6 +40,7 @@
 #include "asset.h"
 #include "compose.hpp"
 #include "dcp_assert.h"
+#include "equality_options.h"
 #include "raw_convert.h"
 #include "reel_asset.h"
 #include "warnings.h"
index 51b94879400e57b1a37a3f8ce440d25331c5e454..5fefda2752daebcaadac5553dec8b6c952d3863c 100644 (file)
@@ -38,6 +38,7 @@
 
 
 #include "asset.h"
+#include "equality_options.h"
 #include "reel_file_asset.h"
 #include "warnings.h"
 LIBDCP_DISABLE_WARNINGS
index d5838cd521430bd0e0b00a3079afd1b48d27736d..7e2bcb73abda0c42998cf42a81712b24dccd8ef5 100644 (file)
@@ -40,6 +40,7 @@
 #include "compose.hpp"
 #include "crypto_context.h"
 #include "dcp_assert.h"
+#include "equality_options.h"
 #include "exceptions.h"
 #include "raw_convert.h"
 #include "smpte_load_font_node.h"
index d14d3702b6efe12f2421c910776973d6f03325cc..57110b4f82e3b16a78913e7c7f6792b8366b8551 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "compose.hpp"
 #include "dcp_assert.h"
+#include "equality_options.h"
 #include "exceptions.h"
 #include "sound_asset.h"
 #include "sound_asset_reader.h"
index 193829024683808dcac50616006c898b6721c593..3fec58ffaf8971e02ce5c7df5ce7bd0b5bd06acd 100644 (file)
@@ -38,6 +38,7 @@
 
 
 #include "dcp_assert.h"
+#include "equality_options.h"
 #include "exceptions.h"
 #include "stereo_picture_asset.h"
 #include "stereo_picture_asset_reader.h"
index ecf364646cc9a861b37e19ad4e257b7bd511c8ce..248d0cffed8df9010f95c215800b12cb726f7a30 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "compose.hpp"
 #include "dcp_time.h"
+#include "equality_options.h"
 #include "subtitle.h"
 
 
index 5b7a4f1320acde70931d93f5ad726c740db55fe9..7dae7f1d360d9053001bd074a00c920fb62e8679 100644 (file)
@@ -47,6 +47,9 @@
 namespace dcp {
 
 
+class EqualityOptions;
+
+
 class Subtitle
 {
 public:
index f8f8b570293f2f893c6e1603df06847a839c3270..1ef2e6970e46fb4c7a9def254520933507e46d1f 100644 (file)
@@ -37,6 +37,7 @@
  */
 
 
+#include "equality_options.h"
 #include "subtitle_image.h"
 #include "util.h"
 
index c7256d0f6ce0470ea7a7235cac9547f63424562c..98c269554e9a948fe7b88684ae35245b8758fda6 100644 (file)
@@ -229,45 +229,6 @@ extern bool operator== (Fraction const & a, Fraction const & b);
 extern bool operator!= (Fraction const & a, Fraction const & b);
 
 
-/** @class EqualityOptions
- *  @brief A class to describe what "equality" means for a particular test.
- *
- *  When comparing things, we want to be able to ignore some differences;
- *  this class expresses those differences.
- *
- *  It also contains some settings for how the comparison should be done.
- */
-class EqualityOptions
-{
-public:
-       /** Construct an EqualityOptions where nothing at all can differ */
-       EqualityOptions() = default;
-
-       /** The maximum allowable mean difference in pixel value between two images */
-       double max_mean_pixel_error = 0;
-       /** The maximum standard deviation of the differences in pixel value between two images */
-       double max_std_dev_pixel_error = 0;
-       /** The maximum difference in audio sample value between two soundtracks */
-       int max_audio_sample_error = 0;
-       /** true if the &lt;AnnotationText&gt; nodes of CPLs are allowed to differ */
-       bool cpl_annotation_texts_can_differ = false;
-       /** true if the &lt;AnnotationText&gt; nodes of Reels are allowed to differ */
-       bool reel_annotation_texts_can_differ = false;
-       /** true if <Hash>es in Reels can differ */
-       bool reel_hashes_can_differ = false;
-       /** true if asset hashes can differ */
-       bool asset_hashes_can_differ = false;
-       /** true if IssueDate nodes can differ */
-       bool issue_dates_can_differ = false;
-       bool load_font_nodes_can_differ = false;
-       bool keep_going = false;
-       /** true to save the last pair of different image subtitles to the current working directory */
-       bool export_differing_subtitles = false;
-       /** The maximum allowable absolute difference between the vertical position of subtitles */
-       float max_subtitle_vertical_position_error = 0;
-};
-
-
 enum class NoteType {
        PROGRESS,
        ERROR,
index d16e15fc32a3064786e33900fb5645c2fdee58ae..a90b2d4eedc2d067b2ba219add159344f89c1403 100644 (file)
@@ -151,6 +151,7 @@ def build(bld):
               decrypted_kdm.h
               decrypted_kdm_key.h
               encrypted_kdm.h
+              equality_options.h
               exceptions.h
               file.h
               font_asset.h
index d6257ebc9939d0683c9a9f472e929e852e5b0e3f..c52ebdd11c5b0ef61c1b598c5da874136ccbc88a 100644 (file)
@@ -33,6 +33,7 @@
 
 
 #include "asset.h"
+#include "equality_options.h"
 #include <boost/bind.hpp>
 #include <boost/test/unit_test.hpp>
 
index 23d4869c933f2fb72c08b80e0214dfa9d81d4a1b..231b859da96da12e2cfc45a310b38f40120f3ed0 100644 (file)
@@ -35,6 +35,7 @@
 #include "combine.h"
 #include "cpl.h"
 #include "dcp.h"
+#include "equality_options.h"
 #include "interop_subtitle_asset.h"
 #include "reel_subtitle_asset.h"
 #include "reel_mono_picture_asset.h"
index 51ce7961268ed461a23494d48824dfb4d0f5d2a2..5456092c9838ae1844adebb1c85a84230a15037e 100644 (file)
@@ -36,6 +36,7 @@
 #include "compose.hpp"
 #include "cpl.h"
 #include "dcp.h"
+#include "equality_options.h"
 #include "metadata.h"
 #include "mono_picture_asset.h"
 #include "picture_asset_writer.h"
index f572ed015b80c63137acc3066700a97808314b32..0537cbe85885370d397581f8bb8fa64da1b7966a 100644 (file)
@@ -33,6 +33,7 @@
 
 
 #include "cpl.h"
+#include "equality_options.h"
 #include "reel.h"
 #include "reel_markers_asset.h"
 #include <boost/bind.hpp>
index a7138b67659ab15bfe8d8c84d71ec7949bc60499..3dace12adb1a00dcae366822ac6a1fdc30703fd5 100644 (file)
@@ -31,7 +31,9 @@
     files in the program, then also delete it here.
 */
 
+
 #include "dcp.h"
+#include "equality_options.h"
 #include "exceptions.h"
 #include "common.h"
 #include "mxf.h"
@@ -42,6 +44,7 @@
 #include <iostream>
 #include <list>
 
+
 using std::list;
 using std::cerr;
 using std::cout;