diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-02-23 01:48:53 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-02-23 01:48:53 +0100 |
| commit | 75e86accf241dc6e2d2c2235e21093a05b01b335 (patch) | |
| tree | e18db446b6b90677df23e4329cc1584f03a6a2c5 /src/sound_asset_writer.cc | |
| parent | 20200f69bbf5bf611eb301b1e793384ee7cd568d (diff) | |
More hacks - MCA descriptors in CPL but not MXF.edgecode
Diffstat (limited to 'src/sound_asset_writer.cc')
| -rw-r--r-- | src/sound_asset_writer.cc | 84 |
1 files changed, 20 insertions, 64 deletions
diff --git a/src/sound_asset_writer.cc b/src/sound_asset_writer.cc index 0c04e771..bad4842c 100644 --- a/src/sound_asset_writer.cc +++ b/src/sound_asset_writer.cc @@ -44,6 +44,7 @@ #include "exceptions.h" #include "filesystem.h" #include "main_sound_configuration.h" +#include "mca_sub_descriptor.h" #include "sound_asset.h" #include "sound_asset_writer.h" #include "warnings.h" @@ -154,6 +155,7 @@ SoundAssetWriter::start () throw_from_asdcplib(r, _file, FileError("could not open audio MXF for writing", _file.string(), r)); } +#if 0 if (_asset->standard() == Standard::SMPTE && _include_mca_subdescriptors) { ASDCP::MXF::WaveAudioDescriptor* essence_descriptor = nullptr; @@ -163,81 +165,35 @@ SoundAssetWriter::start () DCP_ASSERT (essence_descriptor); essence_descriptor->ChannelAssignment = asdcp_smpte_dict->ul(ASDCP::MDD_DCAudioChannelCfg_4_WTF); - auto soundfield = new ASDCP::MXF::SoundfieldGroupLabelSubDescriptor(asdcp_smpte_dict); - GenRandomValue (soundfield->MCALinkID); - if (auto lang = _asset->language()) { - soundfield->RFC5646SpokenLanguage = *lang; - } - - MCASoundField const field = - ( - find(_extra_active_channels.begin(), _extra_active_channels.end(), dcp::Channel::BSL) != _extra_active_channels.end() || - find(_extra_active_channels.begin(), _extra_active_channels.end(), dcp::Channel::BSR) != _extra_active_channels.end() - ) ? MCASoundField::SEVEN_POINT_ONE : MCASoundField::FIVE_POINT_ONE; + auto descriptors = create_mca_subdescriptors(_extra_active_channels, _asset->channels(), _asset->language()); - if (field == MCASoundField::SEVEN_POINT_ONE) { - soundfield->MCATagSymbol = "sg71"; - soundfield->MCATagName = "7.1DS"; -LIBDCP_DISABLE_WARNINGS - soundfield->MCALabelDictionaryID = asdcp_smpte_dict->ul(ASDCP::MDD_DCAudioSoundfield_71); -LIBDCP_ENABLE_WARNINGS - } else { - soundfield->MCATagSymbol = "sg51"; - soundfield->MCATagName = "5.1"; -LIBDCP_DISABLE_WARNINGS - soundfield->MCALabelDictionaryID = asdcp_smpte_dict->ul(ASDCP::MDD_DCAudioSoundfield_51); -LIBDCP_ENABLE_WARNINGS + auto soundfield = new ASDCP::MXF::SoundfieldGroupLabelSubDescriptor(asdcp_smpte_dict); + soundfield->MCALinkID = descriptors.first.mca_link_id; + if (descriptors.first.rfc5646_spoken_language) { + soundfield->RFC5646SpokenLanguage = *descriptors.first.rfc5646_spoken_language); } - + soundfield->MCATagSymbol = descriptors.first.mca_tag_symbol; + soundfield->MCATagName = *descriptors.first.mca_tag_name; + soundfield->MCALabelDictionaryID = descriptors.first.mca_label_dictionary_id; _state->mxf_writer.OP1aHeader().AddChildObject(soundfield); essence_descriptor->SubDescriptors.push_back(soundfield->InstanceUID); - /* We always make a descriptor for these channels if they are present in the asset; - * there's no way for the caller to tell us whether they are active or not. - */ - std::vector<dcp::Channel> dcp_channels = { - Channel::LEFT, - Channel::RIGHT, - Channel::CENTRE, - Channel::LFE, - Channel::LS, - Channel::RS - }; - - /* We add descriptors for some extra channels that the caller gave us (we made sure earlier - * that nothing "bad" is in this list). - */ - std::copy(_extra_active_channels.begin(), _extra_active_channels.end(), back_inserter(dcp_channels)); - - /* Remove duplicates */ - std::sort(dcp_channels.begin(), dcp_channels.end()); - dcp_channels.erase(std::unique(dcp_channels.begin(), dcp_channels.end()), dcp_channels.end()); - - /* Remove channels that aren't actually in this MXF at all */ - dcp_channels.erase( - std::remove_if(dcp_channels.begin(), dcp_channels.end(), [this](dcp::Channel channel) { - return static_cast<int>(channel) >= _asset->channels(); - }), - dcp_channels.end() - ); - - for (auto dcp_channel: dcp_channels) { - auto channel = new ASDCP::MXF::AudioChannelLabelSubDescriptor(asdcp_smpte_dict); - GenRandomValue (channel->MCALinkID); - channel->SoundfieldGroupLinkID = soundfield->MCALinkID; - channel->MCAChannelID = static_cast<int>(dcp_channel) + 1; - channel->MCATagSymbol = "ch" + channel_to_mca_id(dcp_channel, field); - channel->MCATagName = channel_to_mca_name(dcp_channel, field); + for (auto const& channel: descriptors.second) { + auto mxf_descriptor = new ASDCP::MXF::AudioChannelLabelSubDescriptor(asdcp_smpte_dict); + mxf_descriptor->MCALinkID = channel.mca_link_id; + channel->SoundfieldGroupLinkID = *channel.soundfield_group_link_id; + channel->MCAChannelID = channel.mca_channel_id; + channel->MCATagSymbol = channel.mca_tag_symbol; + channel->MCATagName = channel.mca_tag_name; if (auto lang = _asset->language()) { - channel->RFC5646SpokenLanguage = *lang; + channel->RFC5646SpokenLanguage = *channel.rfc5646_spoken_language; } -LIBDCP_DISABLE_WARNINGS - channel->MCALabelDictionaryID = channel_to_mca_universal_label(dcp_channel, field, asdcp_smpte_dict); -LIBDCP_ENABLE_WARNINGS + channel->MCALabelDictionaryID = *channel.mca_label_dictionary_id; _state->mxf_writer.OP1aHeader().AddChildObject(channel); essence_descriptor->SubDescriptors.push_back(channel->InstanceUID); } } +#endif _asset->set_file (_file); _started = true; |
