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());
return _intrinsic_duration;
}
- std::string language () const {
+ boost::optional<std::string> language () const {
return _language;
}
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;
};
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;
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);
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()});
}