summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-09 00:02:09 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-09 00:02:09 +0200
commit45525875fef67ec1885968c0c5692307b16a279b (patch)
tree6bd741331b33020bf40982e9cb82f7faa5b48669 /src
parent3a328b69a4770687fa16a113f33882217a59a142 (diff)
Make sound asset language optional.
Diffstat (limited to 'src')
-rw-r--r--src/sound_asset.cc5
-rw-r--r--src/sound_asset.h4
-rw-r--r--src/sound_asset_writer.cc8
-rw-r--r--src/verify.cc4
4 files changed, 11 insertions, 10 deletions
diff --git a/src/sound_asset.cc b/src/sound_asset.cc
index fe0c5dd0..4f0166d8 100644
--- a/src/sound_asset.cc
+++ b/src/sound_asset.cc
@@ -63,11 +63,6 @@ using namespace dcp;
SoundAsset::SoundAsset (boost::filesystem::path file)
: Asset (file)
- /* XXX: this is a fallback language, which will be used if we can't find the RFC5646SpokenLanguage
- * in the MXF header. Perhaps RFC5646SpokenLanguage is optional and we should just not write it
- * if we don't know it.
- */
- , _language ("en-US")
{
ASDCP::PCM::MXFReader reader;
auto r = reader.OpenRead (file.string().c_str());
diff --git a/src/sound_asset.h b/src/sound_asset.h
index e58773e4..79edea96 100644
--- a/src/sound_asset.h
+++ b/src/sound_asset.h
@@ -102,7 +102,7 @@ public:
return _intrinsic_duration;
}
- std::string language () const {
+ boost::optional<std::string> language () const {
return _language;
}
@@ -126,7 +126,7 @@ private:
int64_t _intrinsic_duration = 0;
int _channels = 0; ///< number of channels
int _sampling_rate = 0; ///< sampling rate in Hz
- std::string _language;
+ boost::optional<std::string> _language;
};
diff --git a/src/sound_asset_writer.cc b/src/sound_asset_writer.cc
index 205a45ab..0d7d2074 100644
--- a/src/sound_asset_writer.cc
+++ b/src/sound_asset_writer.cc
@@ -127,7 +127,9 @@ SoundAssetWriter::start ()
auto soundfield = new ASDCP::MXF::SoundfieldGroupLabelSubDescriptor(asdcp_smpte_dict);
GenRandomValue (soundfield->MCALinkID);
- soundfield->RFC5646SpokenLanguage = _asset->language();
+ if (auto lang = _asset->language()) {
+ soundfield->RFC5646SpokenLanguage = *lang;
+ }
const MCASoundField field = _asset->channels() > 10 ? MCASoundField::SEVEN_POINT_ONE : MCASoundField::FIVE_POINT_ONE;
@@ -162,7 +164,9 @@ SoundAssetWriter::start ()
channel->MCAChannelID = i + 1;
channel->MCATagSymbol = "ch" + channel_to_mca_id(dcp_channel, field);
channel->MCATagName = channel_to_mca_name(dcp_channel, field);
- channel->RFC5646SpokenLanguage = _asset->language();
+ if (auto lang = _asset->language()) {
+ channel->RFC5646SpokenLanguage = *lang;
+ }
channel->MCALabelDictionaryID = channel_to_mca_universal_label(dcp_channel, field, asdcp_smpte_dict);
_state->mxf_writer.OP1aHeader().AddChildObject(channel);
essence_descriptor->SubDescriptors.push_back(channel->InstanceUID);
diff --git a/src/verify.cc b/src/verify.cc
index 35ec69f8..e5743995 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -586,7 +586,9 @@ verify_main_sound_asset (
stage ("Checking sound asset metadata", asset->file());
- verify_language_tag (asset->language(), notes);
+ if (auto lang = asset->language()) {
+ verify_language_tag (*lang, notes);
+ }
if (asset->sampling_rate() != 48000) {
notes.push_back ({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_SOUND_FRAME_RATE, raw_convert<string>(asset->sampling_rate()), *asset->file()});
}