35 #include "compose.hpp"
44 #include "verify_report.h"
47 using std::shared_ptr;
50 using boost::optional;
54 void write_line(
File& file,
string format)
56 file.
puts(
string(format +
"\n").c_str());
60 template <
typename... Args>
61 void write_line(
File& file,
string format, Args... args)
63 file.
puts(String::compose(format +
"\n", std::forward<Args>(args)...).c_str());
70 auto document = formatter.document();
71 auto body = formatter.body();
73 formatter.heading(
"DCP verification report");
75 if (result.dcps.size() > 1) {
76 formatter.subheading(
"DCPs");
78 formatter.subheading(
"DCP");
81 auto reel_asset_details = [&formatter](shared_ptr<dcp::ReelAsset> asset) {
82 formatter.list_item(String::compose(
"UUID: %1", asset->id()));
83 formatter.list_item(String::compose(
"Intrinsic duration: %1", asset->intrinsic_duration()));
84 formatter.list_item(String::compose(
"Entry point: %1", asset->entry_point().get_value_or(0)));
85 formatter.list_item(String::compose(
"Duration: %1", asset->duration().get_value_or(0)));
86 if (asset->annotation_text()) {
87 formatter.list_item(String::compose(
"Annotation text: %1", *asset->annotation_text()));
92 for (
auto note: result.notes) {
93 if (note.cpl_id() == cpl_id) {
94 auto const note_as_string = dcp::note_to_string(note, formatter.process_string(), formatter.process_filename());
95 switch (note.type()) {
96 case dcp::VerificationNote::Type::OK:
97 formatter.list_item(note_as_string,
string(
"ok"));
99 case dcp::VerificationNote::Type::WARNING:
100 formatter.list_item(note_as_string,
string(
"warning"));
102 case dcp::VerificationNote::Type::ERROR:
103 formatter.list_item(note_as_string,
string(
"error"));
106 formatter.list_item(note_as_string,
string(
"bv21-error"));
113 for (
auto dcp: result.dcps) {
114 auto ul = formatter.unordered_list();
115 for (
auto cpl:
dcp->cpls()) {
116 formatter.list_item(String::compose(
"CPL ID: %1", cpl->id()));
118 for (
auto reel: cpl->reels()) {
119 formatter.list_item(String::compose(
"Reel: %1", reel_index++));
120 auto ul2 = formatter.unordered_list();
121 if (
auto pic = reel->main_picture()) {
122 formatter.list_item(
"Main picture");
123 auto ul3 = formatter.unordered_list();
124 reel_asset_details(pic);
125 formatter.list_item(String::compose(
"Frame rate: %1", pic->frame_rate().numerator));
126 formatter.list_item(String::compose(
"Screen aspect ratio: %1x%2", pic->screen_aspect_ratio().numerator, pic->screen_aspect_ratio().denominator));
128 if (
auto sound = reel->main_sound()) {
129 formatter.list_item(
"Main sound");
130 auto ul3 = formatter.unordered_list();
131 reel_asset_details(sound);
133 if (
auto sub = reel->main_subtitle()) {
134 formatter.list_item(
"Main subtitle");
135 auto ul3 = formatter.unordered_list();
136 reel_asset_details(sub);
137 if (sub->language()) {
138 formatter.list_item(String::compose(
"Language: %1", *sub->language()));
142 write_notes(result, cpl->id());
146 if (std::count_if(result.notes.begin(), result.notes.end(), [](
VerificationNote const& note) { return !note.cpl_id(); }) > 0) {
147 formatter.subheading(
"Report");
148 write_notes(result, {});
@ BV21_ERROR
may not always be considered an error, but violates a "shall" requirement of Bv2.1
Namespace for everything in libdcp.
dcp::verify() method and associated code