#include "audio_buffers.h"
#include "compose.hpp"
#include "config.h"
+#include "constants.h"
#include "cross.h"
#include "dcpomatic_log.h"
#include "digester.h"
}
_picture_asset->set_file (asset);
- _picture_asset_writer = _picture_asset->start_write (asset, _first_nonexistent_frame > 0);
+ _picture_asset_writer = _picture_asset->start_write(asset, _first_nonexistent_frame > 0 ? dcp::PictureAsset::Behaviour::OVERWRITE_EXISTING : dcp::PictureAsset::Behaviour::MAKE_NEW);
} else if (!text_only) {
/* We already have a complete picture asset that we can just re-use */
/* XXX: what about if the encryption key changes? */
_sound_asset = make_shared<dcp::SoundAsset> (
dcp::Fraction(film()->video_frame_rate(), 1),
film()->audio_frame_rate(),
- film()->audio_channels(),
+ /* Always make 16-channel sound assets for SMPTE; libdcp will pad unused channels for us */
+ standard == dcp::Standard::SMPTE ? MAX_DCP_AUDIO_CHANNELS : film()->audio_channels(),
lang ? *lang : dcp::LanguageTag("en-US"),
standard
);
DCPOMATIC_ASSERT (film()->directory());
+ auto mapped = film()->mapped_audio_channels();
+ std::vector<dcp::Channel> extra_active_channels;
+ auto add_if_mapped = [mapped, &extra_active_channels](dcp::Channel channel) {
+ if (std::find(mapped.begin(), mapped.end(), static_cast<int>(channel)) != mapped.end()) {
+ extra_active_channels.push_back(channel);
+ }
+ };
+
+ add_if_mapped(dcp::Channel::HI);
+ add_if_mapped(dcp::Channel::VI);
+ add_if_mapped(dcp::Channel::BSL);
+ add_if_mapped(dcp::Channel::BSR);
+
/* 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),
- film()->contains_atmos_content()
+ extra_active_channels,
+ film()->contains_atmos_content() ? dcp::SoundAsset::AtmosSync::ENABLED : dcp::SoundAsset::AtmosSync::DISABLED,
+ film()->limit_to_smpte_bv20() ? dcp::SoundAsset::MCASubDescriptors::DISABLED : dcp::SoundAsset::MCASubDescriptors::ENABLED
);
}
shared_ptr<Result> reel_asset;
if (asset) {
- if (film->interop()) {
- if (chosen_interop_font) {
- /* We only add one font, as Interop will ignore subsequent ones (and some validators will
- * complain if they are even present)
- */
- asset->add_font(fonts.get(chosen_interop_font), chosen_interop_font->data().get_value_or(default_font));
- }
- } else {
- for (auto const& font: fonts.map()) {
- asset->add_font(font.second, font.first->data().get_value_or(default_font));
+ if (!std::is_same<Result, dcp::ReelClosedCaptionAsset>::value) {
+ if (film->interop()) {
+ if (chosen_interop_font) {
+ /* We only add one font, as Interop will ignore subsequent ones (and some validators will
+ * complain if they are even present)
+ */
+ asset->add_font(fonts.get(chosen_interop_font), chosen_interop_font->data().get_value_or(default_font));
+ }
+ } else {
+ for (auto const& font: fonts.map()) {
+ asset->add_font(font.second, font.first->data().get_value_or(default_font));
+ }
}
}
}
DCPOMATIC_ASSERT (audio);
- _sound_asset_writer->write (audio->data(), audio->frames());
+ _sound_asset_writer->write(audio->data(), audio->channels(), audio->frames());
}