diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-02-08 00:22:39 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-02-08 00:22:39 +0100 |
| commit | 55c53dd8621a30d3c39858216da6b5d2e6445fb0 (patch) | |
| tree | e6a3372466420e1eff96ab5ae23ea6954d6f27de /src | |
| parent | 764df6c7ae22534d971f7d3b6bf96c0b0011aed3 (diff) | |
Extract copy_file.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/reel_writer.cc | 20 | ||||
| -rw-r--r-- | src/lib/reel_writer.h | 2 |
2 files changed, 16 insertions, 6 deletions
diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 90c661864..67e707d52 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -190,12 +190,7 @@ ReelWriter::ReelWriter( /* XXX: what about if the encryption key changes? */ auto new_asset_filename = _output_dir / existing_asset_filename->filename(); if (new_asset_filename != *existing_asset_filename) { - if (job) { - job->sub(_("Copying existing asset")); - copy_in_bits(*existing_asset_filename, new_asset_filename, boost::bind(&Job::set_progress, job.get(), _1, false)); - } else { - dcp::filesystem::copy(*existing_asset_filename, new_asset_filename); - } + copy_file(*existing_asset_filename, new_asset_filename); remembered_assets.push_back(RememberedAsset(new_asset_filename, period, film()->video_identifier())); } film()->write_remembered_assets(remembered_assets); @@ -968,3 +963,16 @@ ReelWriter::existing_picture_frame_ok(dcp::File& asset_file, Frame frame) return ok; } + + +void +ReelWriter::copy_file(boost::filesystem::path from, boost::filesystem::path to) +{ + if (auto job = _job.lock()) { + job->sub(_("Copying existing asset")); + copy_in_bits(from, to, boost::bind(&Job::set_progress, job.get(), _1, false)); + } else { + dcp::filesystem::copy(from, to); + } +} + diff --git a/src/lib/reel_writer.h b/src/lib/reel_writer.h index a96a8319d..24d641a27 100644 --- a/src/lib/reel_writer.h +++ b/src/lib/reel_writer.h @@ -122,6 +122,8 @@ private: ) const; void create_reel_markers(std::shared_ptr<dcp::Reel> reel) const; float convert_vertical_position(StringText const& subtitle, dcp::SubtitleStandard to) const; + void copy_file(boost::filesystem::path from, boost::filesystem::path to); + std::shared_ptr<dcp::ReelTextAsset> maybe_add_text( std::shared_ptr<dcp::TextAsset> asset, |
