summaryrefslogtreecommitdiff
path: root/src/reel_smpte_text_asset.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-06-28 20:12:51 +0200
committerCarl Hetherington <cth@carlh.net>2024-08-17 12:57:31 +0200
commit06c28c700f0a398a3289c4adfa83ceb2d0fc999d (patch)
tree00b58dcb854767d037e166a804360b4c19e034e9 /src/reel_smpte_text_asset.cc
parentb64644327bff333569bf4a60f1d7c3d46f058b48 (diff)
Merge ReelClosedCaptionAsset into ReelTextAsset.
Diffstat (limited to 'src/reel_smpte_text_asset.cc')
-rw-r--r--src/reel_smpte_text_asset.cc50
1 files changed, 48 insertions, 2 deletions
diff --git a/src/reel_smpte_text_asset.cc b/src/reel_smpte_text_asset.cc
index bbfa1b39..68f85586 100644
--- a/src/reel_smpte_text_asset.cc
+++ b/src/reel_smpte_text_asset.cc
@@ -45,14 +45,16 @@ LIBDCP_DISABLE_WARNINGS
LIBDCP_ENABLE_WARNINGS
+using std::make_pair;
+using std::pair;
using std::shared_ptr;
using std::string;
using boost::optional;
using namespace dcp;
-ReelSMPTETextAsset::ReelSMPTETextAsset(shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
- : ReelTextAsset(asset, edit_rate, intrinsic_duration, entry_point)
+ReelSMPTETextAsset::ReelSMPTETextAsset(TextType type, shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
+ : ReelTextAsset(type, asset, edit_rate, intrinsic_duration, entry_point)
{
}
@@ -64,3 +66,47 @@ ReelSMPTETextAsset::ReelSMPTETextAsset(shared_ptr<const cxml::Node> node)
node->done ();
}
+
+
+string
+ReelSMPTETextAsset::cpl_node_name(Standard) const
+{
+ switch (_type) {
+ case TextType::SUBTITLE:
+ return "MainSubtitle";
+ case TextType::CAPTION:
+ return "tt:ClosedCaption";
+ }
+
+ DCP_ASSERT(false);
+ return "";
+}
+
+
+pair<string, string>
+ReelSMPTETextAsset::cpl_node_namespace() const
+{
+ switch (_type) {
+ case TextType::SUBTITLE:
+ return {};
+ case TextType::CAPTION:
+ return make_pair("http://www.smpte-ra.org/schemas/429-12/2008/TT", "tt");
+ }
+
+ DCP_ASSERT(false);
+ return {};
+}
+
+
+xmlpp::Element *
+ReelSMPTETextAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
+{
+ auto asset = ReelFileAsset::write_to_cpl (node, standard);
+ string const ns = _type == TextType::CAPTION ? "tt" : "";
+ if (_language) {
+ cxml::add_child(asset, "Language", ns)->add_child_text(*_language);
+ }
+ return asset;
+}
+
+