X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Freel_writer.cc;h=9ffe1cdc53f1a2f9f45344cd86bbbaa778cbcd30;hb=bb1c1b89260cf36c621f7f2b471eb23f2ff15b0c;hp=e0279725bc79b50a43c4bb95d25a2e1cda504610;hpb=a8c53b9b792a8740cbf856d784e7643623c4359c;p=dcpomatic.git diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index e0279725b..9ffe1cdc5 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -22,6 +22,7 @@ #include "audio_buffers.h" #include "compose.hpp" #include "config.h" +#include "constants.h" #include "cross.h" #include "dcpomatic_log.h" #include "digester.h" @@ -161,7 +162,7 @@ ReelWriter::ReelWriter ( } _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? */ @@ -177,7 +178,8 @@ ReelWriter::ReelWriter ( _sound_asset = make_shared ( 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 ); @@ -195,7 +197,9 @@ ReelWriter::ReelWriter ( */ _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() + film()->audio_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 ); } @@ -820,7 +824,7 @@ ReelWriter::write (shared_ptr audio) } DCPOMATIC_ASSERT (audio); - _sound_asset_writer->write (audio->data(), audio->frames()); + _sound_asset_writer->write(audio->data(), audio->channels(), audio->frames()); } @@ -892,9 +896,10 @@ ReelWriter::empty_text_asset (TextType type, optional track, bool float -ReelWriter::convert_vertical_position(StringText const& subtitle, dcp::Standard to) const +ReelWriter::convert_vertical_position(StringText const& subtitle, dcp::SubtitleStandard to) const { - if (subtitle.valign_standard == to) { + if (dcp::uses_baseline(subtitle.valign_standard) == dcp::uses_baseline(to)) { + /* The from and to standards use the same alignment reference */ return subtitle.v_position(); } @@ -914,7 +919,7 @@ ReelWriter::convert_vertical_position(StringText const& subtitle, dcp::Standard break; } - return subtitle.v_position() + ((subtitle.valign_standard == dcp::Standard::SMPTE) ? correction : -correction); + return subtitle.v_position() + (dcp::uses_bounding_box(subtitle.valign_standard) ? correction : -correction); } @@ -957,7 +962,7 @@ ReelWriter::write (PlayerText subs, TextType type, optional track, for (auto i: subs.string) { i.set_in (dcp::Time(period.from.seconds() - _period.from.seconds(), tcr)); i.set_out (dcp::Time(period.to.seconds() - _period.from.seconds(), tcr)); - i.set_v_position(convert_vertical_position(i, film()->interop() ? dcp::Standard::INTEROP : dcp::Standard::SMPTE)); + i.set_v_position(convert_vertical_position(i, film()->interop() ? dcp::SubtitleStandard::INTEROP : dcp::SubtitleStandard::SMPTE_2014)); auto sub = make_shared(i); if (type == TextType::OPEN_SUBTITLE) { sub->set_font(fonts.get(i.font));