From cc99556229bf35506c20377f4550665af6f5594a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 12 Apr 2021 22:18:47 +0200 Subject: [PATCH] Bump libdcp for some API improvements. --- cscript | 4 +-- src/lib/dcp_examiner.cc | 3 +- src/lib/film.cc | 5 +-- src/lib/reel_writer.cc | 73 ++++++++++++++++++++++------------------- src/lib/types.cc | 3 +- src/lib/writer.cc | 4 +-- 6 files changed, 50 insertions(+), 42 deletions(-) diff --git a/cscript b/cscript index 04b1a89f4..b8ff23e9d 100644 --- a/cscript +++ b/cscript @@ -385,8 +385,8 @@ def dependencies(target, options): # Use distro-provided FFmpeg on Arch deps = [] - deps.append(('libdcp', 'c59e6c0')) - deps.append(('libsub', '3fd82fc')) + deps.append(('libdcp', 'ee23803')) + deps.append(('libsub', 'e88528d')) deps.append(('leqm-nrt', '131f971')) deps.append(('rtaudio', 'f619b76')) # We get our OpenSSL libraries from the environment, but we diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index ad2220fc0..b431cec26 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -277,8 +277,7 @@ DCPExaminer::DCPExaminer (shared_ptr content, bool tolerant) _kdm_valid = false; } - DCPOMATIC_ASSERT (cpl->standard ()); - _standard = cpl->standard().get(); + _standard = cpl->standard(); _three_d = !cpl->reels().empty() && cpl->reels().front()->main_picture() && dynamic_pointer_cast (cpl->reels().front()->main_picture()->asset()); _ratings = cpl->ratings(); diff --git a/src/lib/film.cc b/src/lib/film.cc index 50472bf41..53d91a378 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -65,6 +65,7 @@ #include #include #include +#include #include #include #include @@ -1664,9 +1665,9 @@ Film::make_kdm ( } } - map, dcp::Key> keys; + map, dcp::Key> keys; - for (auto i: cpl->reel_file_assets()) { + for (auto i: cpl->reel_encryptable_assets()) { if (!i->key_id()) { continue; } diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 2d88d7162..cd6a1a4b9 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -32,24 +32,26 @@ #include "image.h" #include #include +#include +#include +#include +#include #include -#include -#include -#include +#include #include #include +#include +#include +#include #include -#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include +#include +#include +#include #include #include "i18n.h" @@ -438,8 +440,8 @@ ReelWriter::finish (boost::filesystem::path output_dcp) } } -template -shared_ptr +template +shared_ptr maybe_add_text ( shared_ptr asset, int64_t picture_duration, @@ -455,7 +457,7 @@ maybe_add_text ( { Frame const period_duration = period.duration().frames_round(film->video_frame_rate()); - shared_ptr reel_asset; + shared_ptr reel_asset; if (asset) { /* Add the font to the subtitle content */ @@ -463,33 +465,38 @@ maybe_add_text ( asset->add_font (j.id, j.data.get_value_or(default_font)); } - if (dynamic_pointer_cast (asset)) { - auto directory = output_dcp / asset->id (); + if (auto interop = dynamic_pointer_cast(asset)) { + auto directory = output_dcp / interop->id (); boost::filesystem::create_directories (directory); - asset->write (directory / ("sub_" + asset->id() + ".xml")); - } else { + interop->write (directory / ("sub_" + interop->id() + ".xml")); + reel_asset = make_shared ( + interop, + dcp::Fraction(film->video_frame_rate(), 1), + picture_duration, + 0 + ); + } else if (auto smpte = dynamic_pointer_cast(asset)) { /* All our assets should be the same length; use the picture asset length here as a reference to set the subtitle one. We'll use the duration rather than the intrinsic duration; we don't care if the picture asset has been trimmed, we're just interested in its presentation length. */ - dynamic_pointer_cast(asset)->set_intrinsic_duration (picture_duration); - - asset->write ( + smpte->set_intrinsic_duration(picture_duration); + smpte->write ( output_dcp / ("sub_" + asset->id() + ".mxf") ); + reel_asset = make_shared ( + smpte, + dcp::Fraction(film->video_frame_rate(), 1), + picture_duration, + 0 + ); } - reel_asset = make_shared ( - asset, - dcp::Fraction(film->video_frame_rate(), 1), - picture_duration, - 0 - ); } else { /* We don't have a subtitle asset of our own; hopefully we have one to reference */ for (auto j: refs) { - auto k = dynamic_pointer_cast (j.asset); + auto k = dynamic_pointer_cast (j.asset); if (k && j.period == period) { reel_asset = k; /* If we have a hash for this asset in the CPL, assume that it is correct */ @@ -622,7 +629,7 @@ ReelWriter::create_reel_text ( set ensure_closed_captions ) const { - auto subtitle = maybe_add_text ( + auto subtitle = maybe_add_text ( _subtitle_asset, duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only ); @@ -633,7 +640,7 @@ ReelWriter::create_reel_text ( } } else if (ensure_subtitles) { /* We had no subtitle asset, but we've been asked to make sure there is one */ - subtitle = maybe_add_text( + subtitle = maybe_add_text ( empty_text_asset(TextType::OPEN_SUBTITLE, optional()), duration, reel, @@ -648,7 +655,7 @@ ReelWriter::create_reel_text ( } for (auto const& i: _closed_caption_assets) { - auto a = maybe_add_text ( + auto a = maybe_add_text ( i.second, duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only ); DCPOMATIC_ASSERT (a); @@ -662,7 +669,7 @@ 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 ( + auto a = maybe_add_text ( empty_text_asset(TextType::CLOSED_CAPTION, i), duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only ); DCPOMATIC_ASSERT (a); diff --git a/src/lib/types.cc b/src/lib/types.cc index b7632a984..dbbae3e6a 100644 --- a/src/lib/types.cc +++ b/src/lib/types.cc @@ -26,6 +26,7 @@ #include #include #include +#include #include DCPOMATIC_DISABLE_WARNINGS #include @@ -213,7 +214,7 @@ CPLSummary::CPLSummary (boost::filesystem::path p) encrypted = false; for (auto j: dcp.cpls()) { - for (auto k: j->reel_file_assets()) { + for (auto k: j->reel_encryptable_assets()) { if (k->key_id()) { encrypted = true; } diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 0285255e0..81b77d5ce 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -555,7 +555,8 @@ Writer::finish (boost::filesystem::path output_dcp) auto cpl = make_shared( film()->dcp_name(), - film()->dcp_content_type()->libdcp_kind() + film()->dcp_content_type()->libdcp_kind(), + film()->interop() ? dcp::Standard::INTEROP : dcp::Standard::SMPTE ); dcp.add (cpl); @@ -676,7 +677,6 @@ Writer::finish (boost::filesystem::path output_dcp) } dcp.write_xml ( - film()->interop() ? dcp::Standard::INTEROP : dcp::Standard::SMPTE, issuer, creator, dcp::LocalTime().as_string(), -- 2.30.2