summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/verify.cc20
-rw-r--r--src/verify.h8
-rw-r--r--test/verify_test.cc10
3 files changed, 17 insertions, 21 deletions
diff --git a/src/verify.cc b/src/verify.cc
index 64f3cac4..e9952c30 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -587,9 +587,7 @@ verify_main_picture_asset(Context& context, shared_ptr<const ReelPictureAsset> r
(asset->edit_rate() != Fraction(24, 1) && asset->edit_rate() != Fraction(25, 1) && asset->edit_rate() != Fraction(48, 1))
) {
context.add_note(
- VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K,
- String::compose("%1/%2", asset->edit_rate().numerator, asset->edit_rate().denominator),
- file
+ dcp::VerificationNote(dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K, file).set_frame_rate(asset->edit_rate())
);
}
@@ -597,9 +595,7 @@ verify_main_picture_asset(Context& context, shared_ptr<const ReelPictureAsset> r
/* Only 24fps allowed for 4K */
if (asset->edit_rate() != Fraction(24, 1)) {
context.add_note(
- VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_4K,
- String::compose("%1/%2", asset->edit_rate().numerator, asset->edit_rate().denominator),
- file
+ dcp::VerificationNote(dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_4K, file).set_frame_rate(asset->edit_rate())
);
}
@@ -655,7 +651,7 @@ verify_main_sound_asset(Context& context, shared_ptr<const ReelSoundAsset> reel_
verify_language_tag(context, *lang);
}
if (asset->sampling_rate() != 48000) {
- context.add_note(VerificationNote::Code::INVALID_SOUND_FRAME_RATE, fmt::to_string(asset->sampling_rate()), file);
+ context.add_note(VerificationNote(VerificationNote::Code::INVALID_SOUND_FRAME_RATE, file).set_frame_rate(dcp::Fraction(asset->sampling_rate(), 1)));
}
if (asset->bit_depth() != 24) {
context.add_note(VerificationNote::Code::INVALID_SOUND_BIT_DEPTH, fmt::to_string(asset->bit_depth()), file);
@@ -1443,7 +1439,7 @@ verify_reel(
frame_rate.numerator != 50 &&
frame_rate.numerator != 60 &&
frame_rate.numerator != 96)) {
- context.add_note(VerificationNote::Code::INVALID_PICTURE_FRAME_RATE, String::compose("%1/%2", frame_rate.numerator, frame_rate.denominator));
+ context.add_note(dcp::VerificationNote(dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE).set_frame_rate(frame_rate));
}
/* Check asset */
if (reel->main_picture()->asset_ref().resolved()) {
@@ -1945,7 +1941,7 @@ dcp::note_to_string(VerificationNote note, function<string (string)> process_str
case VerificationNote::Code::MISMATCHED_CPL_HASHES:
return compose("The hash (%1) of the CPL (%2) in the PKL does not agree with the CPL file (%3).", note.reference_hash().get(), note.cpl_id().get(), note.calculated_hash().get());
case VerificationNote::Code::INVALID_PICTURE_FRAME_RATE:
- return compose("The picture in a reel has an invalid frame rate %1.", note.note().get());
+ return compose("The picture in a reel has an invalid frame rate %1/%2.", note.frame_rate()->numerator, note.frame_rate()->denominator);
case VerificationNote::Code::INCORRECT_PICTURE_HASH:
return compose("The hash (%1) of the picture asset %2 does not agree with the PKL file (%3).", note.calculated_hash().get(), filename(), note.reference_hash().get());
case VerificationNote::Code::CORRECT_PICTURE_HASH:
@@ -1999,9 +1995,9 @@ dcp::note_to_string(VerificationNote note, function<string (string)> process_str
case VerificationNote::Code::INVALID_PICTURE_SIZE_IN_PIXELS:
return compose("The size %1 of picture asset %2 is not allowed.", note.note().get(), filename());
case VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K:
- return compose("The frame rate %1 of picture asset %2 is not allowed for 2K DCPs.", note.note().get(), filename());
+ return compose("The frame rate %1/%2 of picture asset %3 is not allowed for 2K DCPs.", note.frame_rate()->numerator, note.frame_rate()->denominator, filename());
case VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_4K:
- return compose("The frame rate %1 of picture asset %2 is not allowed for 4K DCPs.", note.note().get(), filename());
+ return compose("The frame rate %1/%2 of picture asset %3 is not allowed for 4K DCPs.", note.frame_rate()->numerator, note.frame_rate()->denominator, filename());
case VerificationNote::Code::INVALID_PICTURE_ASSET_RESOLUTION_FOR_3D:
return process_string("3D 4K DCPs are not allowed.");
case VerificationNote::Code::INVALID_CLOSED_CAPTION_XML_SIZE_IN_BYTES:
@@ -2039,7 +2035,7 @@ dcp::note_to_string(VerificationNote note, function<string (string)> process_str
case VerificationNote::Code::INVALID_CLOSED_CAPTION_LINE_LENGTH:
return process_string("There are more than 32 characters in at least one closed caption line.");
case VerificationNote::Code::INVALID_SOUND_FRAME_RATE:
- return compose("The sound asset %1 has a sampling rate of %2", filename(), note.note().get());
+ return compose("The sound asset %1 has a sampling rate of %2", filename(), note.frame_rate()->numerator);
case VerificationNote::Code::INVALID_SOUND_BIT_DEPTH:
return compose("The sound asset %1 has a bit depth of %2", filename(), note.note().get());
case VerificationNote::Code::MISSING_CPL_ANNOTATION_TEXT:
diff --git a/src/verify.h b/src/verify.h
index ad74f1f2..6246bc14 100644
--- a/src/verify.h
+++ b/src/verify.h
@@ -115,7 +115,7 @@ public:
*/
MISMATCHED_CPL_HASHES,
/** The frame rate given in a reel for the main picture is not 24, 25, 30, 48, 50 or 60
- * note contains the invalid frame rate as "<numerator>/<denominator>"
+ * frame_rate contains the invalid frame rate
* reel_index contains the reel index (starting from 0)
*/
INVALID_PICTURE_FRAME_RATE,
@@ -212,13 +212,13 @@ public:
*/
INVALID_PICTURE_SIZE_IN_PIXELS,
/** A picture asset is 2K but is not at 24, 25 or 48 fps as required by Bv2.1 [Bv2.1_7.1]
- * note contains the invalid frame rate as "<numerator>/<denominator>"
+ * frame_rate contains the invalid frame rate
* file contains the asset filename
* reel_index contains the reel index (starting from 0)
*/
INVALID_PICTURE_FRAME_RATE_FOR_2K,
/** A picture asset is 4K but is not at 24fps as required by Bv2.1 [Bv2.1_7.1]
- * note contains the invalid frame rate as "<numerator>/<denominator>"
+ * frame_rate contains the invalid frame rate
* file contains the asset filename
* reel_index contains the reel index (starting from 0)
*/
@@ -283,7 +283,7 @@ public:
/** There are more than 32 characters in at least one closed caption line [Bv2.1_7.2.6] */
INVALID_CLOSED_CAPTION_LINE_LENGTH,
/** The audio sampling rate must be 48kHz [Bv2.1_7.3]
- * note contains the invalid frame rate
+ * frame_rate contains the invalid frame rate
* file contains the asset filename
* reel_index contains the reel index (starting from 0)
*/
diff --git a/test/verify_test.cc b/test/verify_test.cc
index 3d7da1b5..e10a7fca 100644
--- a/test/verify_test.cc
+++ b/test/verify_test.cc
@@ -686,7 +686,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_picture_frame_rate)
VN(
VC::MISMATCHED_CPL_HASHES, canonical(cpl_path)
).set_cpl_id(cpl->id()).set_calculated_hash("7n7GQ2TbxQbmHYuAR8ml7XDOep8=").set_reference_hash("skI+5b/9LA/y6h0mcyxysJYanxI="),
- VN(VC::INVALID_PICTURE_FRAME_RATE, string{"99/1"}).set_cpl_id(cpl->id()).set_reel_index(0),
+ VN(VC::INVALID_PICTURE_FRAME_RATE).set_cpl_id(cpl->id()).set_reel_index(0).set_frame_rate({99, 1}),
};
check_verify_result(dcp::verify({dir}, {}, &stage, &progress, {}, xsd_test).notes, expected);
@@ -1977,8 +1977,8 @@ check_picture_size_bad_2k_frame_rate (int width, int height, int frame_rate, boo
).set_cpl_id(cpl->id()),
note(VC::CORRECT_PICTURE_HASH, canonical(dir / "video.mxf"), cpl).set_reel_index(0),
note(VC::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(dir / "video.mxf"), cpl).set_reel_index(0),
- VN(VC::INVALID_PICTURE_FRAME_RATE, dcp::String::compose("%1/1", frame_rate * (three_d ? 2 : 1))).set_cpl_id(cpl->id()).set_reel_index(0),
- VN(VC::INVALID_PICTURE_FRAME_RATE_FOR_2K, dcp::String::compose("%1/1", frame_rate), canonical(dir / "video.mxf")).set_cpl_id(cpl->id()).set_reel_index(0),
+ VN(VC::INVALID_PICTURE_FRAME_RATE).set_cpl_id(cpl->id()).set_reel_index(0).set_frame_rate({frame_rate * (three_d ? 2 : 1), 1}),
+ VN(VC::INVALID_PICTURE_FRAME_RATE_FOR_2K, canonical(dir / "video.mxf")).set_cpl_id(cpl->id()).set_reel_index(0).set_frame_rate({frame_rate, 1})
};
check_verify_result(notes, expected);
@@ -2011,7 +2011,7 @@ check_picture_size_bad_4k_frame_rate (int width, int height, int frame_rate, boo
).set_cpl_id(cpl->id()),
note(VC::CORRECT_PICTURE_HASH, canonical(dir / "video.mxf"), cpl).set_reel_index(0),
note(VC::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(dir / "video.mxf"), cpl).set_reel_index(0),
- VN(VC::INVALID_PICTURE_FRAME_RATE_FOR_4K, dcp::String::compose("%1/1", frame_rate), canonical(dir / "video.mxf")).set_cpl_id(cpl->id()).set_reel_index(0),
+ VN(VC::INVALID_PICTURE_FRAME_RATE_FOR_4K, canonical(dir / "video.mxf")).set_cpl_id(cpl->id()).set_reel_index(0).set_frame_rate({frame_rate, 1})
};
check_verify_result(notes, expected);
@@ -3445,7 +3445,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_sound_frame_rate)
note(VC::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(dir / "videofoo.mxf"), cpl).set_reel_index(0),
note(VC::MATCHING_CPL_HASHES, cpl),
note(VC::CORRECT_PICTURE_HASH, canonical(dir / "videofoo.mxf"), cpl).set_reel_index(0),
- VN(VC::INVALID_SOUND_FRAME_RATE, string("96000"), canonical(dir / "audiofoo.mxf")).set_cpl_id(cpl->id()).set_reel_index(0),
+ VN(VC::INVALID_SOUND_FRAME_RATE, canonical(dir / "audiofoo.mxf")).set_cpl_id(cpl->id()).set_reel_index(0).set_frame_rate({96000, 1}),
VN(VC::MISSING_CPL_METADATA, cpl->file().get()).set_cpl_id(cpl->id())
});
}