diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-09-15 23:18:37 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-09-16 09:24:04 +0200 |
| commit | 6ce0728db56c78bf230eb1a05e2b5449428e14ab (patch) | |
| tree | f207222249a5911557fa4b74f81114f2354129dc /src/lib/reel_writer.cc | |
| parent | 5a664de0b001271e40b863603285b9b11c744833 (diff) | |
Add an advanced option to check data against the frame info file when making hashes (#2758).2758-safe-write-take2
Diffstat (limited to 'src/lib/reel_writer.cc')
| -rw-r--r-- | src/lib/reel_writer.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index a27d7f63e..3a8a95ab1 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -29,6 +29,7 @@ #include "film_util.h" #include "image.h" #include "image_png.h" +#include "info_file_checker.h" #include "job.h" #include "j2k_frame_info.h" #include "log.h" @@ -757,10 +758,23 @@ try } int64_t total_done = 0; + + auto progress = [&total_done, total_size, set_progress](int64_t done, int64_t) { + set_progress(total_done + done, total_size); + }; + for (auto asset: assets) { - asset->hash([&total_done, total_size, set_progress](int64_t done, int64_t) { - set_progress(total_done + done, total_size); - }); + if (asset == _j2k_picture_asset && Config::instance()->check_disk_writes()) { + try { + InfoFileChecker checker(_info_file); + asset->hash(progress, boost::bind(&InfoFileChecker::check, &checker, _1, _2, _3)); + } catch (OpenFileError&) { + LOG_ERROR_NC("Could not open info file to check disk writes"); + asset->hash(progress); + } + } else { + asset->hash(progress); + } total_done += asset->file() ? boost::filesystem::file_size(*asset->file()) : 0; } |
