diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-01-27 23:20:35 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-02-16 01:20:17 +0100 |
| commit | 1f4f56b4d5e3d08be5ff823c9890a8b4e0af5967 (patch) | |
| tree | c73cd840eea3b320c3307f4dcd3449fc4e6f1bd1 /src/lib | |
| parent | f015d6b314a6bfc8534e3e2c331d6edd5f817e25 (diff) | |
Separate some things out from the examination process.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/content.h | 3 | ||||
| -rw-r--r-- | src/lib/dcp_content.cc | 24 | ||||
| -rw-r--r-- | src/lib/dcp_content.h | 1 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 23 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.h | 1 | ||||
| -rw-r--r-- | src/lib/film.cc | 3 | ||||
| -rw-r--r-- | src/lib/image_content.cc | 10 | ||||
| -rw-r--r-- | src/lib/image_content.h | 1 | ||||
| -rw-r--r-- | src/lib/image_examiner.cc | 6 |
9 files changed, 56 insertions, 16 deletions
diff --git a/src/lib/content.h b/src/lib/content.h index d036808c7..02973e8f7 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -93,6 +93,9 @@ public: */ virtual void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job> job, bool tolerant); + /** Adapt anything about this content just before it's added to the given film */ + virtual void prepare_for_add_to_film(std::shared_ptr<const Film>) {} + virtual void take_settings_from(std::shared_ptr<const Content> c); /** @return Quick one-line summary of the content, as will be presented in the diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index ce4b552f9..1f1e7294b 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -280,11 +280,10 @@ DCPContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool toler boost::mutex::scoped_lock lm(_mutex); audio = make_shared<AudioContent>(this); } - auto as = make_shared<AudioStream>(examiner->audio_frame_rate(), examiner->audio_length(), examiner->audio_channels(), 24); - audio->set_stream(as); - auto m = as->mapping(); - m.make_default(film ? film->audio_processor() : 0); - as->set_mapping(m); + + audio->set_stream( + make_shared<AudioStream>(examiner->audio_frame_rate(), examiner->audio_length(), examiner->audio_channels(), 24) + ); _active_audio_channels = examiner->active_audio_channels(); _audio_language = examiner->audio_language(); @@ -374,6 +373,21 @@ DCPContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool toler } } + +void +DCPContent::prepare_for_add_to_film(shared_ptr<const Film> film) +{ + boost::mutex::scoped_lock lm(_mutex); + + if (audio) { + auto as = audio->stream(); + auto m = as->mapping(); + m.make_default(film->audio_processor()); + as->set_mapping(m); + } +} + + string DCPContent::summary() const { diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index bac051eea..340ed1d14 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -75,6 +75,7 @@ public: dcpomatic::DCPTime approximate_length() const override; void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job>, bool tolerant) override; + void prepare_for_add_to_film(std::shared_ptr<const Film> film) override; std::string summary() const override; std::string technical_summary() const override; diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 1bc824877..8207ae5f9 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -300,15 +300,9 @@ FFmpegContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool to if (!examiner->audio_streams().empty()) { audio = make_shared<AudioContent>(this); - for (auto i: examiner->audio_streams()) { audio->add_stream(i); } - - auto as = audio->streams().front(); - auto m = as->mapping(); - m.make_default(film ? film->audio_processor() : 0, first_path); - as->set_mapping(m); } _subtitle_streams = examiner->subtitle_streams(); @@ -334,6 +328,23 @@ FFmpegContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool to } +void +FFmpegContent::prepare_for_add_to_film(shared_ptr<const Film> film) +{ + auto first_path = path(0); + + boost::mutex::scoped_lock lm(_mutex); + + if (audio && !audio->streams().empty()) { + auto as = audio->streams().front(); + auto m = as->mapping(); + m.make_default(film->audio_processor(), first_path); + as->set_mapping(m); + } +} + + + string FFmpegContent::summary() const { diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 975569ba6..006cdfb38 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -67,6 +67,7 @@ public: } void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job>, bool tolerant) override; + void prepare_for_add_to_film(std::shared_ptr<const Film> film) override; void take_settings_from(std::shared_ptr<const Content> c) override; std::string summary() const override; std::string technical_summary() const override; diff --git a/src/lib/film.cc b/src/lib/film.cc index 2f0026164..2be6d900c 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1551,12 +1551,15 @@ Film::maybe_add_content(weak_ptr<Job> j, vector<weak_ptr<Content>> const& weak_c } } + void Film::add_content(vector<shared_ptr<Content>> const& content) { bool any_atmos = false; for (auto c: content) { + c->prepare_for_add_to_film(shared_from_this()); + if (_template_film) { /* Take settings from the first piece of content of c's type in _template */ for (auto i: _template_film->content()) { diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index 8d3092196..d7f66672e 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -19,6 +19,7 @@ */ +#include "config.h" #include "exceptions.h" #include "film.h" #include "frame_rate_change.h" @@ -143,6 +144,15 @@ ImageContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool tol } +void +ImageContent::prepare_for_add_to_film(shared_ptr<const Film> film) +{ + if (still()) { + video->set_length(Config::instance()->default_still_length() * video_frame_rate().get_value_or(film->video_frame_rate())); + } +} + + DCPTime ImageContent::full_length (shared_ptr<const Film> film) const { diff --git a/src/lib/image_content.h b/src/lib/image_content.h index 4b3b13380..83ca94501 100644 --- a/src/lib/image_content.h +++ b/src/lib/image_content.h @@ -38,6 +38,7 @@ public: }; void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job>, bool tolerant) override; + void prepare_for_add_to_film(std::shared_ptr<const Film> film) override; std::string summary () const override; std::string technical_summary () const override; diff --git a/src/lib/image_examiner.cc b/src/lib/image_examiner.cc index 4a91a103f..cd4c754c6 100644 --- a/src/lib/image_examiner.cc +++ b/src/lib/image_examiner.cc @@ -70,11 +70,7 @@ ImageExaminer::ImageExaminer (shared_ptr<const Film> film, shared_ptr<const Imag _has_alpha = image.image->has_alpha(); } - if (content->still ()) { - _video_length = Config::instance()->default_still_length() * video_frame_rate().get_value_or (film->video_frame_rate ()); - } else { - _video_length = _image_content->number_of_paths (); - } + _video_length = _image_content->number_of_paths(); } |
