From 01bf601526da5d6eec21e8a54dbd82f646bfedb9 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 26 Mar 2026 12:00:54 +0100 Subject: Add asset ID to lots of notes. --- src/verify.cc | 23 +++++++++++++++++------ src/verify_internal.h | 4 ++++ 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/verify.cc b/src/verify.cc index e9952c30..8dcd6410 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -852,8 +852,7 @@ verify_closed_caption_asset ( /* Note: we must not use TextAsset::xml_as_string() here as that will mean the data on disk * gets passed through libdcp which may clean up and therefore hide errors. */ - auto raw_xml = asset->raw_xml(); - if (raw_xml) { + if (auto raw_xml = asset->raw_xml()) { validate_xml(context, *raw_xml); if (raw_xml->size() > 256 * 1024) { context.add_note(VerificationNote::Code::INVALID_CLOSED_CAPTION_XML_SIZE_IN_BYTES, fmt::to_string(raw_xml->size()), *asset->file()); @@ -862,13 +861,11 @@ verify_closed_caption_asset ( context.add_note(VerificationNote::Code::MISSED_CHECK_OF_ENCRYPTED); } - auto interop = dynamic_pointer_cast(asset); - if (interop) { + if (auto interop = dynamic_pointer_cast(asset)) { verify_interop_text_asset(context, interop); } - auto smpte = dynamic_pointer_cast(asset); - if (smpte) { + if (auto smpte = dynamic_pointer_cast(asset)) { verify_smpte_timed_text_asset(context, smpte, reel_asset_duration); } } @@ -1271,6 +1268,8 @@ verify_text_details(Context& context, vector> reels) } if (reels[0]->main_subtitle() && reels[0]->main_subtitle()->asset_ref().resolved()) { + context.asset_id = reels[0]->main_subtitle()->asset()->id(); + dcp::ScopeGuard sg = [&context]() { context.asset_id = boost::none; }; verify_text_details(context, reels, reels[0]->main_subtitle()->edit_rate().numerator, [](shared_ptr reel) { return static_cast(reel->main_subtitle()); @@ -1288,6 +1287,8 @@ verify_text_details(Context& context, vector> reels) } for (auto i = 0U; i < reels[0]->closed_captions().size(); ++i) { + context.asset_id = reels[0]->closed_captions()[i]->asset()->id(); + dcp::ScopeGuard sg = [&context]() { context.asset_id = boost::none; }; verify_text_details(context, reels, reels[0]->closed_captions()[i]->edit_rate().numerator, [i](shared_ptr reel) { return i < reel->closed_captions().size(); @@ -1443,6 +1444,8 @@ verify_reel( } /* Check asset */ if (reel->main_picture()->asset_ref().resolved()) { + context.asset_id = reel->main_picture()->asset()->id(); + dcp::ScopeGuard sg = [&context]() { context.asset_id = boost::none; }; verify_main_picture_asset(context, reel->main_picture(), start_frame); auto const asset_size = reel->main_picture()->asset()->size(); if (main_picture_active_area) { @@ -1466,12 +1469,16 @@ verify_reel( } if (reel->main_sound() && reel->main_sound()->asset_ref().resolved()) { + context.asset_id = reel->main_sound()->asset()->id(); + dcp::ScopeGuard sg = [&context]() { context.asset_id = boost::none; }; verify_main_sound_asset(context, reel->main_sound()); } if (reel->main_subtitle()) { verify_main_subtitle_reel(context, reel->main_subtitle()); if (reel->main_subtitle()->asset_ref().resolved()) { + context.asset_id = reel->main_subtitle()->asset()->id(); + dcp::ScopeGuard sg = [&context]() { context.asset_id = boost::none; }; verify_subtitle_asset(context, reel->main_subtitle()->asset(), reel->main_subtitle()->duration()); } *have_main_subtitle = true; @@ -1482,6 +1489,8 @@ verify_reel( for (auto i: reel->closed_captions()) { verify_closed_caption_reel(context, i); if (i->asset_ref().resolved()) { + context.asset_id = i->asset()->id(); + dcp::ScopeGuard sg = [&context]() { context.asset_id = boost::none; }; verify_closed_caption_asset(context, i->asset(), i->duration()); } } @@ -1725,6 +1734,8 @@ verify_cpl(Context& context, shared_ptr cpl) context.reel_index = reel_index; dcp::ScopeGuard sg = [&context]() { context.reel_index = boost::none; }; if (reel->main_subtitle() && reel->main_subtitle()->asset_ref().resolved()) { + context.asset_id = reel->main_subtitle()->asset()->id(); + dcp::ScopeGuard sg = [&context]() { context.asset_id = boost::none; }; verify_text_lines_and_characters(reel->main_subtitle()->asset(), 52, 79, &result); } ++reel_index; diff --git a/src/verify_internal.h b/src/verify_internal.h index 34d34751..3399dec1 100644 --- a/src/verify_internal.h +++ b/src/verify_internal.h @@ -101,6 +101,9 @@ public: if (reel_index) { note.set_reel_index(*reel_index); } + if (asset_id) { + note.set_asset_id(*asset_id); + } notes.push_back(std::move(note)); } @@ -128,6 +131,7 @@ public: std::shared_ptr dcp; std::shared_ptr cpl; boost::optional reel_index; + boost::optional asset_id; boost::filesystem::path xsd_dtd_directory; std::function)> stage; std::function progress; -- cgit v1.2.3