#include "compose.hpp"
#include "dcp_assert.h"
+#include "equality_options.h"
#include "exceptions.h"
#include "sound_asset.h"
#include "sound_asset_reader.h"
#include <stdexcept>
-using std::string;
-using std::vector;
+using std::dynamic_pointer_cast;
using std::list;
using std::shared_ptr;
-using std::dynamic_pointer_cast;
+using std::string;
+using std::vector;
+using boost::optional;
using namespace dcp;
}
}
+ list<ASDCP::MXF::InterchangeObject*> channel_labels;
+ rr = reader.OP1aHeader().GetMDObjectsByType(
+ asdcp_smpte_dict->ul(ASDCP::MDD_AudioChannelLabelSubDescriptor),
+ channel_labels
+ );
+
+ if (KM_SUCCESS(rr)) {
+ _active_channels = channel_labels.size();
+ }
+
_id = read_writer_info (info);
}
bool
-SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
+SoundAsset::equals(shared_ptr<const Asset> other, EqualityOptions const& opt, NoteHandler note) const
{
ASDCP::PCM::MXFReader reader_A;
DCP_ASSERT (file());
shared_ptr<SoundAssetWriter>
-SoundAsset::start_write(boost::filesystem::path file, bool atmos_sync, bool include_mca_subdescriptors)
+SoundAsset::start_write(
+ boost::filesystem::path file,
+ vector<dcp::Channel> extra_active_channels,
+ AtmosSync atmos_sync,
+ MCASubDescriptors include_mca_subdescriptors
+ )
{
- if (atmos_sync && _channels < 14) {
+ if (atmos_sync == AtmosSync::ENABLED && _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, include_mca_subdescriptors));
+ return shared_ptr<SoundAssetWriter>(
+ new SoundAssetWriter(this, file, extra_active_channels, atmos_sync == AtmosSync::ENABLED, include_mca_subdescriptors == MCASubDescriptors::ENABLED)
+ );
}
Kumu::Result_t r = reader.OpenRead (file.string().c_str());
return !ASDCP_FAILURE (r);
}
+
+
+int
+SoundAsset::active_channels() const
+{
+ return _active_channels.get_value_or(_channels);
+}
+