summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-05-24 22:58:32 +0200
committerCarl Hetherington <cth@carlh.net>2024-05-24 23:41:56 +0200
commitcc6a2fe7ee05718d549e72eb740d0eae290f8ecb (patch)
treec760229e4f187b914ec37593258172668b32b94f /src
parenta4930f8185f2d3f3a9dc93b938792fae758be4d7 (diff)
Check that DCPs have 24-bit audio.
Diffstat (limited to 'src')
-rw-r--r--src/sound_asset.cc1
-rw-r--r--src/sound_asset.h8
-rw-r--r--src/verify.cc5
-rw-r--r--src/verify.h5
4 files changed, 19 insertions, 0 deletions
diff --git a/src/sound_asset.cc b/src/sound_asset.cc
index 90075278..c73255b8 100644
--- a/src/sound_asset.cc
+++ b/src/sound_asset.cc
@@ -83,6 +83,7 @@ SoundAsset::SoundAsset (boost::filesystem::path file)
}
_sampling_rate = desc.AudioSamplingRate.Denominator ? (desc.AudioSamplingRate.Numerator / desc.AudioSamplingRate.Denominator) : 0;
+ _bit_depth = desc.QuantizationBits;
_channels = desc.ChannelCount;
_edit_rate = Fraction (desc.EditRate.Numerator, desc.EditRate.Denominator);
diff --git a/src/sound_asset.h b/src/sound_asset.h
index e69c3988..e5acb119 100644
--- a/src/sound_asset.h
+++ b/src/sound_asset.h
@@ -115,6 +115,13 @@ public:
return _sampling_rate;
}
+ /** @return Bit depth of samples. This should always be 24, but we return it
+ * so the verification code can check
+ */
+ int bit_depth() const {
+ return _bit_depth;
+ }
+
Fraction edit_rate () const {
return _edit_rate;
}
@@ -148,6 +155,7 @@ private:
int _channels = 0; ///< number of channels in the MXF
boost::optional<int> _active_channels; ///< estimate of the number of active channels
int _sampling_rate = 0; ///< sampling rate in Hz
+ int _bit_depth = 24;
boost::optional<std::string> _language;
};
diff --git a/src/verify.cc b/src/verify.cc
index 56e6b5b8..1f0d7790 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -714,6 +714,9 @@ verify_main_sound_asset(Context& context, shared_ptr<const ReelSoundAsset> reel_
if (asset->sampling_rate() != 48000) {
context.bv21_error(VerificationNote::Code::INVALID_SOUND_FRAME_RATE, raw_convert<string>(asset->sampling_rate()), file);
}
+ if (asset->bit_depth() != 24) {
+ context.error(VerificationNote::Code::INVALID_SOUND_BIT_DEPTH, raw_convert<string>(asset->bit_depth()), file);
+ }
}
@@ -2054,6 +2057,8 @@ dcp::note_to_string(VerificationNote note, function<string (string)> process_str
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());
+ 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:
return compose("The CPL %1 has no <AnnotationText> tag.", note.cpl_id().get());
case VerificationNote::Code::MISMATCHED_CPL_ANNOTATION_TEXT:
diff --git a/src/verify.h b/src/verify.h
index b9e3623f..d8681b73 100644
--- a/src/verify.h
+++ b/src/verify.h
@@ -255,6 +255,11 @@ public:
* file contains the asset filename
*/
INVALID_SOUND_FRAME_RATE,
+ /** The audio bit depth must be 24
+ * note contains the invalid bit depth
+ * file contains the asset filename
+ */
+ INVALID_SOUND_BIT_DEPTH,
/** The CPL has no _<AnnotationText>_ tag [Bv2.1_8.1]
* note contains the CPL ID
* file contains the CPL filename