From 0b39df958f534068950669a763be7b4602740107 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 9 Dec 2020 13:12:21 +0100 Subject: Store sound asset language as a string, but set it as a dcp::LanguageTag. This makes it work the same as other language tags, and tolerates bad values while trying not to allow them to be created. --- src/sound_asset.cc | 4 ++-- src/sound_asset.h | 4 ++-- src/sound_asset_writer.cc | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/sound_asset.cc b/src/sound_asset.cc index 618574b6..ea44e806 100644 --- a/src/sound_asset.cc +++ b/src/sound_asset.cc @@ -98,7 +98,7 @@ SoundAsset::SoundAsset (boost::filesystem::path file) if (!soundfield->RFC5646SpokenLanguage.empty()) { char buffer[64]; soundfield->RFC5646SpokenLanguage.get().EncodeString(buffer, sizeof(buffer)); - _language = dcp::LanguageTag (buffer); + _language = buffer; } } @@ -111,7 +111,7 @@ SoundAsset::SoundAsset (Fraction edit_rate, int sampling_rate, int channels, Lan , _intrinsic_duration (0) , _channels (channels) , _sampling_rate (sampling_rate) - , _language (language) + , _language (language.to_string()) { } diff --git a/src/sound_asset.h b/src/sound_asset.h index 8e55aef7..91a213b8 100644 --- a/src/sound_asset.h +++ b/src/sound_asset.h @@ -86,7 +86,7 @@ public: return _intrinsic_duration; } - LanguageTag language () const { + std::string language () const { return _language; } @@ -107,7 +107,7 @@ private: int64_t _intrinsic_duration; int _channels; ///< number of channels int _sampling_rate; ///< sampling rate in Hz - LanguageTag _language; + std::string _language; }; } diff --git a/src/sound_asset_writer.cc b/src/sound_asset_writer.cc index ecc7f395..092acf0c 100644 --- a/src/sound_asset_writer.cc +++ b/src/sound_asset_writer.cc @@ -125,7 +125,7 @@ SoundAssetWriter::start () ASDCP::MXF::SoundfieldGroupLabelSubDescriptor* soundfield = new ASDCP::MXF::SoundfieldGroupLabelSubDescriptor(asdcp_smpte_dict); GenRandomValue (soundfield->MCALinkID); - soundfield->RFC5646SpokenLanguage = _asset->language().to_string(); + soundfield->RFC5646SpokenLanguage = _asset->language(); const MCASoundField field = _asset->channels() > 10 ? SEVEN_POINT_ONE : FIVE_POINT_ONE; @@ -149,7 +149,7 @@ SoundAssetWriter::start () channel->MCAChannelID = static_cast(i) + 1; channel->MCATagSymbol = "ch" + channel_to_mca_id(i, field); channel->MCATagName = channel_to_mca_name(i, field); - channel->RFC5646SpokenLanguage = _asset->language().to_string(); + channel->RFC5646SpokenLanguage = _asset->language(); channel->MCALabelDictionaryID = channel_to_mca_universal_label(i, field, asdcp_smpte_dict); _state->mxf_writer.OP1aHeader().AddChildObject(channel); essence_descriptor->SubDescriptors.push_back(channel->InstanceUID); -- cgit v1.2.3