summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cpl.cc5
-rw-r--r--src/sound_asset.cc3
-rw-r--r--src/sound_asset_writer.cc20
-rw-r--r--src/util.cc11
-rw-r--r--src/util.h1
5 files changed, 23 insertions, 17 deletions
diff --git a/src/cpl.cc b/src/cpl.cc
index 711c9e1b..246ca21a 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -72,6 +72,7 @@ static string const mca_sub_descriptors_ns = "http://isdcf.com/ns/cplmd/mca";
static string const smpte_395_ns = "http://www.smpte-ra.org/reg/395/2014/13/1/aaf";
static string const smpte_335_ns = "http://www.smpte-ra.org/reg/335/2012";
+
CPL::CPL (string annotation_text, ContentKind content_kind)
/* default _content_title_text to annotation_text */
: _issuer ("libdcp" LIBDCP_VERSION)
@@ -405,7 +406,7 @@ CPL::maybe_write_composition_metadata_asset (xmlpp::Element* node) const
shared_ptr<SoundAssetReader> reader = asset->start_read ();
ASDCP::MXF::SoundfieldGroupLabelSubDescriptor* soundfield;
ASDCP::Result_t r = reader->reader()->OP1aHeader().GetMDObjectByType(
- ASDCP::DefaultSMPTEDict().ul(ASDCP::MDD_SoundfieldGroupLabelSubDescriptor),
+ asdcp_smpte_dict->ul(ASDCP::MDD_SoundfieldGroupLabelSubDescriptor),
reinterpret_cast<ASDCP::MXF::InterchangeObject**>(&soundfield)
);
if (KM_SUCCESS(r)) {
@@ -434,7 +435,7 @@ CPL::maybe_write_composition_metadata_asset (xmlpp::Element* node) const
list<ASDCP::MXF::InterchangeObject*> channels;
ASDCP::Result_t r = reader->reader()->OP1aHeader().GetMDObjectsByType(
- ASDCP::DefaultSMPTEDict().ul(ASDCP::MDD_AudioChannelLabelSubDescriptor),
+ asdcp_smpte_dict->ul(ASDCP::MDD_AudioChannelLabelSubDescriptor),
channels
);
diff --git a/src/sound_asset.cc b/src/sound_asset.cc
index 15626b9a..6752d9b1 100644
--- a/src/sound_asset.cc
+++ b/src/sound_asset.cc
@@ -57,6 +57,7 @@ using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using namespace dcp;
+
SoundAsset::SoundAsset (boost::filesystem::path file)
: Asset (file)
/* XXX: this is a fallback language, which will be used if we can't find the RFC5646SpokenLanguage
@@ -89,7 +90,7 @@ SoundAsset::SoundAsset (boost::filesystem::path file)
ASDCP::MXF::SoundfieldGroupLabelSubDescriptor* soundfield;
ASDCP::Result_t rr = reader.OP1aHeader().GetMDObjectByType(
- ASDCP::DefaultSMPTEDict().ul(ASDCP::MDD_SoundfieldGroupLabelSubDescriptor),
+ asdcp_smpte_dict->ul(ASDCP::MDD_SoundfieldGroupLabelSubDescriptor),
reinterpret_cast<ASDCP::MXF::InterchangeObject**>(&soundfield)
);
diff --git a/src/sound_asset_writer.cc b/src/sound_asset_writer.cc
index 3980dc62..aaa35116 100644
--- a/src/sound_asset_writer.cc
+++ b/src/sound_asset_writer.cc
@@ -51,12 +51,6 @@ using std::vector;
using namespace dcp;
-/* Some ASDCP objects store this as a *&, for reasons which are not
- * at all clear, so we have to keep this around forever.
- */
-static ASDCP::Dictionary const* smpte_dict = &ASDCP::DefaultSMPTEDict();
-
-
struct SoundAssetWriter::ASDCPState
{
ASDCP::PCM::MXFWriter mxf_writer;
@@ -124,12 +118,12 @@ SoundAssetWriter::start ()
ASDCP::MXF::WaveAudioDescriptor* essence_descriptor = 0;
_state->mxf_writer.OP1aHeader().GetMDObjectByType(
- smpte_dict->ul(ASDCP::MDD_WaveAudioDescriptor), reinterpret_cast<ASDCP::MXF::InterchangeObject**>(&essence_descriptor)
+ asdcp_smpte_dict->ul(ASDCP::MDD_WaveAudioDescriptor), reinterpret_cast<ASDCP::MXF::InterchangeObject**>(&essence_descriptor)
);
DCP_ASSERT (essence_descriptor);
- essence_descriptor->ChannelAssignment = smpte_dict->ul(ASDCP::MDD_DCAudioChannelCfg_MCA);
+ essence_descriptor->ChannelAssignment = asdcp_smpte_dict->ul(ASDCP::MDD_DCAudioChannelCfg_MCA);
- ASDCP::MXF::SoundfieldGroupLabelSubDescriptor* soundfield = new ASDCP::MXF::SoundfieldGroupLabelSubDescriptor(smpte_dict);
+ ASDCP::MXF::SoundfieldGroupLabelSubDescriptor* soundfield = new ASDCP::MXF::SoundfieldGroupLabelSubDescriptor(asdcp_smpte_dict);
GenRandomValue (soundfield->MCALinkID);
soundfield->RFC5646SpokenLanguage = _asset->language().to_string();
@@ -138,25 +132,25 @@ SoundAssetWriter::start ()
if (field == SEVEN_POINT_ONE) {
soundfield->MCATagSymbol = "sg71";
soundfield->MCATagName = "7.1DS";
- soundfield->MCALabelDictionaryID = smpte_dict->ul(ASDCP::MDD_DCAudioSoundfield_71);
+ soundfield->MCALabelDictionaryID = asdcp_smpte_dict->ul(ASDCP::MDD_DCAudioSoundfield_71);
} else {
soundfield->MCATagSymbol = "sg51";
soundfield->MCATagName = "5.1";
- soundfield->MCALabelDictionaryID = smpte_dict->ul(ASDCP::MDD_DCAudioSoundfield_51);
+ soundfield->MCALabelDictionaryID = asdcp_smpte_dict->ul(ASDCP::MDD_DCAudioSoundfield_51);
}
_state->mxf_writer.OP1aHeader().AddChildObject(soundfield);
essence_descriptor->SubDescriptors.push_back(soundfield->InstanceUID);
BOOST_FOREACH (Channel i, _active_channels) {
- ASDCP::MXF::AudioChannelLabelSubDescriptor* channel = new ASDCP::MXF::AudioChannelLabelSubDescriptor(smpte_dict);
+ ASDCP::MXF::AudioChannelLabelSubDescriptor* channel = new ASDCP::MXF::AudioChannelLabelSubDescriptor(asdcp_smpte_dict);
GenRandomValue (channel->MCALinkID);
channel->SoundfieldGroupLinkID = soundfield->MCALinkID;
channel->MCAChannelID = static_cast<int>(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->MCALabelDictionaryID = channel_to_mca_universal_label(i, field, smpte_dict);
+ 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);
}
diff --git a/src/util.cc b/src/util.cc
index c7d090ea..009d5bae 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -76,6 +76,13 @@ using boost::function;
using boost::algorithm::trim;
using namespace dcp;
+
+/* Some ASDCP objects store this as a *&, for reasons which are not
+ * at all clear, so we have to keep this around forever.
+ */
+ASDCP::Dictionary const* dcp::asdcp_smpte_dict = 0;
+
+
/** Create a UUID.
* @return UUID.
*/
@@ -164,7 +171,7 @@ dcp::empty_or_white_space (string s)
return true;
}
-/** Set up various bits that the library needs. Should be called one
+/** Set up various bits that the library needs. Should be called once
* by client applications.
*/
void
@@ -189,6 +196,8 @@ dcp::init ()
}
OpenSSL_add_all_algorithms();
+
+ asdcp_smpte_dict = &ASDCP::DefaultSMPTEDict();
}
/** Decode a base64 string. The base64 decode routine in KM_util.cpp
diff --git a/src/util.h b/src/util.h
index a14d7364..959cbbca 100644
--- a/src/util.h
+++ b/src/util.h
@@ -82,6 +82,7 @@ extern void indent (xmlpp::Element* element, int initial);
extern bool day_less_than_or_equal (LocalTime a, LocalTime b);
extern bool day_greater_than_or_equal (LocalTime a, LocalTime b);
extern std::string unique_string (std::list<std::string> existing, std::string base);
+extern ASDCP::Dictionary const* asdcp_smpte_dict;
class ASDCPErrorSuspender