summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-05-17 23:07:03 +0200
committerCarl Hetherington <cth@carlh.net>2024-05-17 23:07:05 +0200
commit4347717803d202a41792faf42e846fd73a0586bf (patch)
treeabc717a630e4768f3b05376274b8d47aaa059c57 /src
parent47b82590f5d1538b599e323daa5e0c792e4d4695 (diff)
Introduce SMPTEFlavour and use it to decide which optional things to write.
This also adds a possibly-correct idea of what "SMPTE A" is supposed to mean.
Diffstat (limited to 'src')
-rw-r--r--src/cpl.cc20
-rw-r--r--src/cpl.h9
-rw-r--r--src/dcp.cc12
-rw-r--r--src/dcp.h5
-rw-r--r--src/smpte_flavour.h54
-rw-r--r--src/sound_asset.cc4
-rw-r--r--src/sound_asset.h8
-rw-r--r--src/wscript1
8 files changed, 89 insertions, 24 deletions
diff --git a/src/cpl.cc b/src/cpl.cc
index 6a25863a..5d85b071 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -203,7 +203,11 @@ CPL::set (std::vector<std::shared_ptr<Reel>> reels)
void
-CPL::write_xml(boost::filesystem::path file, shared_ptr<const CertificateChain> signer, bool include_mca_subdescriptors) const
+CPL::write_xml(
+ boost::filesystem::path file,
+ shared_ptr<const CertificateChain> signer,
+ SMPTEFlavour flavour
+ ) const
{
xmlpp::Document doc;
xmlpp::Element* root;
@@ -247,8 +251,8 @@ CPL::write_xml(boost::filesystem::path file, shared_ptr<const CertificateChain>
bool first = true;
for (auto i: _reels) {
auto asset_list = i->write_to_cpl (reel_list, _standard);
- if (first && _standard == Standard::SMPTE) {
- maybe_write_composition_metadata_asset(asset_list, include_mca_subdescriptors);
+ if (first && _standard == Standard::SMPTE && flavour != SMPTEFlavour::A) {
+ maybe_write_composition_metadata_asset(asset_list, flavour);
first = false;
}
}
@@ -469,7 +473,7 @@ CPL::write_mca_subdescriptors(xmlpp::Element* parent, shared_ptr<const SoundAsse
* is missing this method will do nothing.
*/
void
-CPL::maybe_write_composition_metadata_asset(xmlpp::Element* node, bool include_mca_subdescriptors) const
+CPL::maybe_write_composition_metadata_asset(xmlpp::Element* node, SMPTEFlavour flavour) const
{
if (
!_main_sound_configuration ||
@@ -581,8 +585,10 @@ CPL::maybe_write_composition_metadata_asset(xmlpp::Element* node, bool include_m
property->add_child("Value", "meta")->add_child_text(property_value);
};
- /* SMPTE Bv2.1 8.6.3 */
- add_extension_metadata ("http://isdcf.com/ns/cplmd/app", "Application", "DCP Constraints Profile", "SMPTE-RDD-52:2020-Bv2.1");
+ if (flavour == SMPTEFlavour::BV21) {
+ /* SMPTE Bv2.1 8.6.3 */
+ add_extension_metadata("http://isdcf.com/ns/cplmd/app", "Application", "DCP Constraints Profile", "SMPTE-RDD-52:2020-Bv2.1");
+ }
if (_sign_language_video_language) {
add_extension_metadata ("http://isdcf.com/2017/10/SignLanguageVideo", "Sign Language Video", "Language Tag", *_sign_language_video_language);
@@ -594,7 +600,7 @@ CPL::maybe_write_composition_metadata_asset(xmlpp::Element* node, bool include_m
if (_reels.front()->main_sound()) {
auto asset = _reels.front()->main_sound()->asset();
- if (asset && include_mca_subdescriptors) {
+ if (asset && flavour == SMPTEFlavour::BV21) {
write_mca_subdescriptors(meta, asset);
}
}
diff --git a/src/cpl.h b/src/cpl.h
index 824faaa1..a7c33d59 100644
--- a/src/cpl.h
+++ b/src/cpl.h
@@ -47,6 +47,7 @@
#include "key.h"
#include "language_tag.h"
#include "rating.h"
+#include "smpte_flavour.h"
#include "verify.h"
#include <boost/filesystem.hpp>
#include <boost/function.hpp>
@@ -127,13 +128,11 @@ public:
*
* @param file Filename to write
* @param signer Signer to sign the CPL, or 0 to add no signature
- * @param include_mca_subdescriptors true to add a MCASubDescriptors tag to metadata,
- * false to omit it.
*/
- void write_xml (
+ void write_xml(
boost::filesystem::path file,
std::shared_ptr<const CertificateChain>,
- bool include_mca_subdescriptors = true
+ SMPTEFlavour flavour = SMPTEFlavour::BV21
) const;
void resolve_refs (std::vector<std::shared_ptr<Asset>>);
@@ -358,7 +357,7 @@ protected:
private:
friend struct ::verify_invalid_language3;
- void maybe_write_composition_metadata_asset(xmlpp::Element* node, bool include_mca_subdescriptors) const;
+ void maybe_write_composition_metadata_asset(xmlpp::Element* node, SMPTEFlavour flavour) const;
void read_composition_metadata_asset (cxml::ConstNodePtr node);
void write_mca_subdescriptors(xmlpp::Element* parent, std::shared_ptr<const SoundAsset> asset) const;
diff --git a/src/dcp.cc b/src/dcp.cc
index eb21b47d..2b44b6c1 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -447,7 +447,11 @@ DCP::write_volindex (Standard standard) const
void
-DCP::write_xml(shared_ptr<const CertificateChain> signer, bool include_mca_subdescriptors, NameFormat name_format)
+DCP::write_xml(
+ shared_ptr<const CertificateChain> signer,
+ SMPTEFlavour flavour,
+ NameFormat name_format
+ )
{
if (_cpls.empty()) {
throw MiscError ("Cannot write DCP with no CPLs.");
@@ -466,7 +470,11 @@ DCP::write_xml(shared_ptr<const CertificateChain> signer, bool include_mca_subde
for (auto i: cpls()) {
NameFormat::Map values;
values['t'] = "cpl";
- i->write_xml(_directory / (name_format.get(values, "_" + i->id() + ".xml")), signer, include_mca_subdescriptors);
+ i->write_xml(
+ _directory / (name_format.get(values, "_" + i->id() + ".xml")),
+ signer,
+ flavour
+ );
}
if (_pkls.empty()) {
diff --git a/src/dcp.h b/src/dcp.h
index 21cc3aac..88621c9e 100644
--- a/src/dcp.h
+++ b/src/dcp.h
@@ -46,6 +46,7 @@
#include "compose.hpp"
#include "metadata.h"
#include "name_format.h"
+#include "smpte_flavour.h"
#include "util.h"
#include "verify.h"
#include "version.h"
@@ -157,9 +158,9 @@ public:
*/
void write_xml(
std::shared_ptr<const CertificateChain> signer = std::shared_ptr<const CertificateChain>(),
- bool include_mca_subdescriptors = true,
+ SMPTEFlavour flavour = SMPTEFlavour::BV21,
NameFormat name_format = NameFormat("%t")
- );
+ );
void resolve_refs (std::vector<std::shared_ptr<Asset>> assets);
diff --git a/src/smpte_flavour.h b/src/smpte_flavour.h
new file mode 100644
index 00000000..07a3afe0
--- /dev/null
+++ b/src/smpte_flavour.h
@@ -0,0 +1,54 @@
+/*
+ Copyright (C) 2024 Carl Hetherington <cth@carlh.net>
+
+ This file is part of libdcp.
+
+ libdcp is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ libdcp is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libdcp. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations
+ including the two.
+
+ You must obey the GNU General Public License in all respects
+ for all of the code used other than OpenSSL. If you modify
+ file(s) with this exception, you may extend this exception to your
+ version of the file(s), but you are not obligated to do so. If you
+ do not wish to do so, delete this exception statement from your
+ version. If you delete this exception statement from all source
+ files in the program, then also delete it here.
+*/
+
+
+#ifndef LIBDCP_SMPTE_FLAVOUR_H
+#define LIBDCP_SMPTE_FLAVOUR_H
+
+
+namespace dcp {
+
+
+enum class SMPTEFlavour
+{
+ A,
+ BV20,
+ BV21
+};
+
+
+}
+
+
+#endif
+
diff --git a/src/sound_asset.cc b/src/sound_asset.cc
index 0ceba53d..0d691b42 100644
--- a/src/sound_asset.cc
+++ b/src/sound_asset.cc
@@ -241,7 +241,7 @@ SoundAsset::start_write(
boost::filesystem::path file,
vector<dcp::Channel> extra_active_channels,
AtmosSync atmos_sync,
- MCASubDescriptors include_mca_subdescriptors
+ SMPTEFlavour flavour
)
{
if (atmos_sync == AtmosSync::ENABLED && _channels < 14) {
@@ -249,7 +249,7 @@ SoundAsset::start_write(
}
return shared_ptr<SoundAssetWriter>(
- new SoundAssetWriter(this, file, extra_active_channels, atmos_sync == AtmosSync::ENABLED, include_mca_subdescriptors == MCASubDescriptors::ENABLED)
+ new SoundAssetWriter(this, file, extra_active_channels, atmos_sync == AtmosSync::ENABLED, flavour == SMPTEFlavour::BV21)
);
}
diff --git a/src/sound_asset.h b/src/sound_asset.h
index e69c3988..d087efac 100644
--- a/src/sound_asset.h
+++ b/src/sound_asset.h
@@ -44,6 +44,7 @@
#include "mxf.h"
#include "language_tag.h"
#include "metadata.h"
+#include "smpte_flavour.h"
#include "sound_frame.h"
#include "sound_asset_reader.h"
@@ -79,11 +80,6 @@ public:
DISABLED
};
- enum class MCASubDescriptors {
- ENABLED,
- DISABLED
- };
-
/** @param extra_active_channels list of channels that are active in the asset, other than the basic 5.1
* which are assumed always to be active.
*/
@@ -91,7 +87,7 @@ public:
boost::filesystem::path file,
std::vector<dcp::Channel> extra_active_channels,
AtmosSync atmos_sync,
- MCASubDescriptors mca_subdescriptors
+ SMPTEFlavour flavour
);
std::shared_ptr<SoundAssetReader> start_read () const;
diff --git a/src/wscript b/src/wscript
index c2d499c8..afbab118 100644
--- a/src/wscript
+++ b/src/wscript
@@ -210,6 +210,7 @@ def build(bld):
s_gamut3_transfer_function.h
scope_guard.h
search.h
+ smpte_flavour.h
smpte_load_font_node.h
smpte_subtitle_asset.h
sound_frame.h