From c76095e572fdf85e42db834c9bdb84f2bdb6fee3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 1 Mar 2023 19:44:25 +0100 Subject: Add include_mca_subdescriptors flag to SoundAsset writer. --- src/sound_asset.cc | 4 ++-- src/sound_asset.h | 2 +- src/sound_asset_writer.cc | 5 +++-- src/sound_asset_writer.h | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/sound_asset.cc b/src/sound_asset.cc index e24aced2..e3b8e382 100644 --- a/src/sound_asset.cc +++ b/src/sound_asset.cc @@ -220,13 +220,13 @@ SoundAsset::equals (shared_ptr other, EqualityOptions opt, NoteHand shared_ptr -SoundAsset::start_write (boost::filesystem::path file, bool atmos_sync) +SoundAsset::start_write(boost::filesystem::path file, bool atmos_sync, bool include_mca_subdescriptors) { if (atmos_sync && _channels < 14) { throw MiscError ("Insufficient channels to write ATMOS sync (there must be at least 14)"); } - return shared_ptr (new SoundAssetWriter(this, file, atmos_sync)); + return shared_ptr(new SoundAssetWriter(this, file, atmos_sync, include_mca_subdescriptors)); } diff --git a/src/sound_asset.h b/src/sound_asset.h index 717aab82..e9a2736d 100644 --- a/src/sound_asset.h +++ b/src/sound_asset.h @@ -75,7 +75,7 @@ public: explicit SoundAsset (boost::filesystem::path file); SoundAsset (Fraction edit_rate, int sampling_rate, int channels, LanguageTag language, Standard standard); - std::shared_ptr start_write (boost::filesystem::path file, bool atmos_sync = false); + std::shared_ptr start_write(boost::filesystem::path file, bool atmos_sync = false, bool include_mca_subdescriptors = true); std::shared_ptr start_read () const; bool equals ( diff --git a/src/sound_asset_writer.cc b/src/sound_asset_writer.cc index ff14407d..a0414aba 100644 --- a/src/sound_asset_writer.cc +++ b/src/sound_asset_writer.cc @@ -69,11 +69,12 @@ struct SoundAssetWriter::ASDCPState }; -SoundAssetWriter::SoundAssetWriter (SoundAsset* asset, boost::filesystem::path file, bool sync) +SoundAssetWriter::SoundAssetWriter (SoundAsset* asset, boost::filesystem::path file, bool sync, bool include_mca_subdescriptors) : AssetWriter (asset, file) , _state (new SoundAssetWriter::ASDCPState) , _asset (asset) , _sync (sync) + , _include_mca_subdescriptors(include_mca_subdescriptors) { DCP_ASSERT (!_sync || _asset->channels() >= 14); DCP_ASSERT (!_sync || _asset->standard() == Standard::SMPTE); @@ -130,7 +131,7 @@ SoundAssetWriter::start () boost::throw_exception (FileError("could not open audio MXF for writing", _file.string(), r)); } - if (_asset->standard() == Standard::SMPTE) { + if (_asset->standard() == Standard::SMPTE && _include_mca_subdescriptors) { ASDCP::MXF::WaveAudioDescriptor* essence_descriptor = nullptr; _state->mxf_writer.OP1aHeader().GetMDObjectByType( diff --git a/src/sound_asset_writer.h b/src/sound_asset_writer.h index 031af5c9..0435b85f 100644 --- a/src/sound_asset_writer.h +++ b/src/sound_asset_writer.h @@ -80,7 +80,7 @@ private: friend class SoundAsset; friend struct ::sync_test1; - SoundAssetWriter (SoundAsset *, boost::filesystem::path, bool sync); + SoundAssetWriter(SoundAsset *, boost::filesystem::path, bool sync, bool include_mca_subdescriptors); void start (); void write_current_frame (); @@ -101,6 +101,7 @@ private: /** index of the sync packet (0-3) which starts the next edit unit */ int _sync_packet = 0; FSK _fsk; + bool _include_mca_subdescriptors = true; }; } -- cgit v1.2.3