diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-06-03 20:07:57 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-06-03 22:40:59 +0200 |
| commit | 6fa6f0a7ca116c6cf5dc5b8d2e8ed3a0fd4a6127 (patch) | |
| tree | 04c01959d9849967460a9c2e780009c2986299f3 /src | |
| parent | 12f089b89fff8409cd012cab1ba4eb8b619e554e (diff) | |
Make subtitle asset filename obey custom settings (#2260).
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/reel_writer.cc | 28 | ||||
| -rw-r--r-- | src/lib/util.cc | 7 | ||||
| -rw-r--r-- | src/lib/util.h | 2 |
3 files changed, 32 insertions, 5 deletions
diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 94920b95b..d64cfb81a 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -459,6 +459,9 @@ maybe_add_text ( shared_ptr<dcp::SubtitleAsset> asset, int64_t picture_duration, shared_ptr<dcp::Reel> reel, + int reel_index, + int reel_count, + optional<string> content_summary, list<ReferencedReelAsset> const & refs, vector<FontData> const & fonts, dcp::ArrayData default_font, @@ -481,7 +484,7 @@ maybe_add_text ( if (auto interop = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(asset)) { auto directory = output_dcp / interop->id (); boost::filesystem::create_directories (directory); - interop->write (directory / ("sub_" + interop->id() + ".xml")); + interop->write (directory / subtitle_asset_filename(asset, reel_index, reel_count, content_summary)); reel_asset = make_shared<Interop> ( interop, dcp::Fraction(film->video_frame_rate(), 1), @@ -496,7 +499,7 @@ maybe_add_text ( */ smpte->set_intrinsic_duration(picture_duration); smpte->write ( - output_dcp / ("sub_" + asset->id() + ".mxf") + output_dcp / subtitle_asset_filename(asset, reel_index, reel_count, content_summary) ); reel_asset = make_shared<SMPTE> ( smpte, @@ -643,7 +646,7 @@ ReelWriter::create_reel_text ( ) const { auto subtitle = maybe_add_text<dcp::ReelInteropSubtitleAsset, dcp::ReelSMPTESubtitleAsset, dcp::ReelSubtitleAsset> ( - _subtitle_asset, duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only + _subtitle_asset, duration, reel, _reel_index, _reel_count, _content_summary, refs, fonts, _default_font, film(), _period, output_dcp, _text_only ); if (subtitle) { @@ -657,6 +660,9 @@ ReelWriter::create_reel_text ( empty_text_asset(TextType::OPEN_SUBTITLE, optional<DCPTextTrack>(), true), duration, reel, + _reel_index, + _reel_count, + _content_summary, refs, fonts, _default_font, @@ -669,7 +675,7 @@ ReelWriter::create_reel_text ( for (auto const& i: _closed_caption_assets) { auto a = maybe_add_text<dcp::ReelInteropClosedCaptionAsset, dcp::ReelSMPTEClosedCaptionAsset, dcp::ReelClosedCaptionAsset> ( - i.second, duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only + i.second, duration, reel, _reel_index, _reel_count, _content_summary, refs, fonts, _default_font, film(), _period, output_dcp, _text_only ); DCPOMATIC_ASSERT (a); a->set_annotation_text (i.first.name); @@ -683,7 +689,19 @@ ReelWriter::create_reel_text ( /* Make empty tracks for anything we've been asked to ensure but that we haven't added */ for (auto i: ensure_closed_captions) { auto a = maybe_add_text<dcp::ReelInteropClosedCaptionAsset, dcp::ReelSMPTEClosedCaptionAsset, dcp::ReelClosedCaptionAsset> ( - empty_text_asset(TextType::CLOSED_CAPTION, i, true), duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only + empty_text_asset(TextType::CLOSED_CAPTION, i, true), + duration, + reel, + _reel_index, + _reel_count, + _content_summary, + refs, + fonts, + _default_font, + film(), + _period, + output_dcp, + _text_only ); DCPOMATIC_ASSERT (a); a->set_annotation_text (i.name); diff --git a/src/lib/util.cc b/src/lib/util.cc index e1eb7323c..2c38257b4 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -736,6 +736,13 @@ audio_asset_filename (shared_ptr<dcp::SoundAsset> asset, int reel_index, int ree string +subtitle_asset_filename (shared_ptr<dcp::SubtitleAsset> asset, int reel_index, int reel_count, optional<string> summary) +{ + return asset_filename(asset, "sub", reel_index, reel_count, summary); +} + + +string atmos_asset_filename (shared_ptr<dcp::AtmosAsset> asset, int reel_index, int reel_count, optional<string> summary) { return asset_filename(asset, "atmos", reel_index, reel_count, summary); diff --git a/src/lib/util.h b/src/lib/util.h index 233b3cb2a..cd5a1c2c5 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -49,6 +49,7 @@ namespace dcp { class PictureAsset; class SoundAsset; + class SubtitleAsset; } /** The maximum number of audio channels that we can have in a DCP */ @@ -107,6 +108,7 @@ extern void set_backtrace_file (boost::filesystem::path); extern std::map<std::string, std::string> split_get_request (std::string url); extern std::string video_asset_filename (std::shared_ptr<dcp::PictureAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary); extern std::string audio_asset_filename (std::shared_ptr<dcp::SoundAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary); +extern std::string subtitle_asset_filename (std::shared_ptr<dcp::SubtitleAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary); extern std::string atmos_asset_filename (std::shared_ptr<dcp::AtmosAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary); extern float relaxed_string_to_float (std::string); extern std::string careful_string_filter (std::string); |
