}
if (film()->audio_channels()) {
+ auto langs = film()->audio_languages();
_sound_asset = make_shared<dcp::SoundAsset> (
- dcp::Fraction(film()->video_frame_rate(), 1), film()->audio_frame_rate(), film()->audio_channels(), film()->audio_language(), standard
+ dcp::Fraction(film()->video_frame_rate(), 1),
+ film()->audio_frame_rate(),
+ film()->audio_channels(),
+ langs.empty() ? dcp::LanguageTag("en-US") : langs.front(),
+ standard
);
_sound_asset->set_metadata (mxf_metadata());
DCPOMATIC_ASSERT (film()->directory());
- vector<dcp::Channel> active;
- for (auto i: film()->mapped_audio_channels()) {
- active.push_back (static_cast<dcp::Channel>(i));
- }
-
/* Write the sound asset into the film directory so that we leave the creation
of the DCP directory until the last minute.
*/
_sound_asset_writer = _sound_asset->start_write (
film()->directory().get() / audio_asset_filename (_sound_asset, _reel_index, _reel_count, _content_summary),
- active,
film()->contains_atmos_content()
);
}
if (subtitle) {
/* We have a subtitle asset that we either made or are referencing */
- if (!film()->subtitle_languages().empty()) {
- subtitle->set_language (film()->subtitle_languages().front());
+ if (auto main_language = film()->subtitle_languages().first) {
+ subtitle->set_language (*main_language);
}
} else if (ensure_subtitles) {
/* We had no subtitle asset, but we've been asked to make sure there is one */
if (!reel_markers.empty ()) {
auto ma = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(film()->video_frame_rate(), 1), reel->duration(), 0);
for (auto const& i: reel_markers) {
- int h, m, s, f;
DCPTime relative = i.second - _period.from;
- relative.split (film()->video_frame_rate(), h, m, s, f);
- ma->set (i.first, dcp::Time(h, m, s, f, film()->video_frame_rate()));
+ auto hmsf = relative.split (film()->video_frame_rate());
+ ma->set (i.first, dcp::Time(hmsf.h, hmsf.m, hmsf.s, hmsf.f, film()->video_frame_rate()));
}
reel->add (ma);
}
auto s = make_shared<dcp::InteropSubtitleAsset>();
s->set_movie_title (film()->name());
if (type == TextType::OPEN_SUBTITLE) {
- s->set_language (lang.empty() ? "Unknown" : lang.front().to_string());
+ s->set_language (lang.first ? lang.first->to_string() : "Unknown");
} else if (!track->language.empty()) {
s->set_language (track->language);
}
s->set_reel_number (raw_convert<string> (_reel_index + 1));
asset = s;
} else {
- shared_ptr<dcp::SMPTESubtitleAsset> s (new dcp::SMPTESubtitleAsset ());
+ auto s = make_shared<dcp::SMPTESubtitleAsset>();
s->set_content_title_text (film()->name());
s->set_metadata (mxf_metadata());
- if (type == TextType::OPEN_SUBTITLE && !lang.empty()) {
- s->set_language (lang.front());
+ if (type == TextType::OPEN_SUBTITLE && lang.first) {
+ s->set_language (*lang.first);
} else if (track && !track->language.empty()) {
s->set_language (dcp::LanguageTag(track->language));
}
if (film()->encrypted()) {
s->set_key (film()->key());
}
+ s->add (
+ std::make_shared<dcp::SubtitleString>(
+ optional<std::string>(),
+ false,
+ false,
+ false,
+ dcp::Colour(),
+ 42,
+ 1.0,
+ dcp::Time(0, 0, 0, 0, 24),
+ dcp::Time(0, 0, 1, 0, 24),
+ 0.5,
+ dcp::HAlign::CENTER,
+ 0.5,
+ dcp::VAlign::CENTER,
+ dcp::Direction::LTR,
+ "",
+ dcp::Effect::NONE,
+ dcp::Colour(),
+ dcp::Time(),
+ dcp::Time()
+ )
+ );
asset = s;
}
DCPOMATIC_ASSERT (false);
}
+ /* timecode rate for subtitles we emit; we might as well stick to ms accuracy here, I think */
+ auto const tcr = 1000;
+
for (auto i: subs.string) {
- /* XXX: couldn't / shouldn't we use period here rather than getting time from the subtitle? */
- i.set_in (i.in() - dcp::Time (_period.from.seconds(), i.in().tcr));
- i.set_out (i.out() - dcp::Time (_period.from.seconds(), i.out().tcr));
- asset->add (shared_ptr<dcp::Subtitle>(new dcp::SubtitleString(i)));
+ i.set_in (dcp::Time(period.from.seconds() - _period.from.seconds(), tcr));
+ i.set_out (dcp::Time(period.to.seconds() - _period.from.seconds(), tcr));
+ asset->add (make_shared<dcp::SubtitleString>(i));
}
for (auto i: subs.bitmap) {
asset->add (
make_shared<dcp::SubtitleImage>(
i.image->as_png(),
- dcp::Time(period.from.seconds() - _period.from.seconds(), film()->video_frame_rate()),
- dcp::Time(period.to.seconds() - _period.from.seconds(), film()->video_frame_rate()),
+ dcp::Time(period.from.seconds() - _period.from.seconds(), tcr),
+ dcp::Time(period.to.seconds() - _period.from.seconds(), tcr),
i.rectangle.x, dcp::HAlign::LEFT, i.rectangle.y, dcp::VAlign::TOP,
dcp::Time(), dcp::Time()
)