Add include_mca_subdescriptors flag to SoundAsset writer. v1.8.64
authorCarl Hetherington <cth@carlh.net>
Wed, 1 Mar 2023 18:44:25 +0000 (19:44 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 1 Mar 2023 18:44:25 +0000 (19:44 +0100)
src/sound_asset.cc
src/sound_asset.h
src/sound_asset_writer.cc
src/sound_asset_writer.h

index e24aced20a27252efb8caabd74d036be53b13ef4..e3b8e38297c246b9570e87db8d5443f8f0430a87 100644 (file)
@@ -220,13 +220,13 @@ SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHand
 
 
 shared_ptr<SoundAssetWriter>
-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<SoundAssetWriter> (new SoundAssetWriter(this, file, atmos_sync));
+       return shared_ptr<SoundAssetWriter>(new SoundAssetWriter(this, file, atmos_sync, include_mca_subdescriptors));
 }
 
 
index 717aab82b809eb77ef2671dd21dd858a5c1d5911..e9a2736d4298c9ff186adab4b62989692a25feb2 100644 (file)
@@ -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<SoundAssetWriter> start_write (boost::filesystem::path file, bool atmos_sync = false);
+       std::shared_ptr<SoundAssetWriter> start_write(boost::filesystem::path file, bool atmos_sync = false, bool include_mca_subdescriptors = true);
        std::shared_ptr<SoundAssetReader> start_read () const;
 
        bool equals (
index ff14407d5ef7258ac267c19d555b7fa5a671a95b..a0414aba3e5a3d2f486e09ff3c06d42bbc68ecdf 100644 (file)
@@ -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(
index 031af5c9937967487c02bbb866d09df0ebbc00b1..0435b85f8dcb13e589cf010d7ab34c5fde42df86 100644 (file)
@@ -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;
 };
 
 }