summaryrefslogtreecommitdiff
path: root/src/reel_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_text_asset.cc
parentb64644327bff333569bf4a60f1d7c3d46f058b48 (diff)
Merge ReelClosedCaptionAsset into ReelTextAsset.
Diffstat (limited to 'src/reel_text_asset.cc')
-rw-r--r--src/reel_text_asset.cc30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/reel_text_asset.cc b/src/reel_text_asset.cc
index 1802ad51..87a8ae58 100644
--- a/src/reel_text_asset.cc
+++ b/src/reel_text_asset.cc
@@ -54,7 +54,7 @@ using boost::optional;
using namespace dcp;
-ReelTextAsset::ReelTextAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
+ReelTextAsset::ReelTextAsset(TextType type, std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
: ReelFileAsset (
asset,
dynamic_pointer_cast<SMPTESubtitleAsset>(asset) ? dynamic_pointer_cast<SMPTESubtitleAsset>(asset)->key_id() : boost::none,
@@ -63,6 +63,7 @@ ReelTextAsset::ReelTextAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit
intrinsic_duration,
entry_point
)
+ , _type(type)
{
}
@@ -71,14 +72,15 @@ ReelTextAsset::ReelTextAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit
ReelTextAsset::ReelTextAsset(std::shared_ptr<const cxml::Node> node)
: ReelFileAsset (node)
{
- _language = node->optional_string_child("Language");
-}
-
+ if (node->name() == "MainSubtitle") {
+ _type = TextType::SUBTITLE;
+ } else if (node->name() == "MainClosedCaption" || node->name() == "ClosedCaption") {
+ _type = TextType::CAPTION;
+ } else {
+ DCP_ASSERT(false);
+ }
-string
-ReelTextAsset::cpl_node_name(Standard) const
-{
- return "MainSubtitle";
+ _language = node->optional_string_child("Language");
}
@@ -102,15 +104,3 @@ ReelTextAsset::equals(shared_ptr<const ReelTextAsset> other, EqualityOptions con
return true;
}
-
-xmlpp::Element *
-ReelTextAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
-{
- auto asset = ReelFileAsset::write_to_cpl (node, standard);
- if (_language) {
- cxml::add_text_child(asset, "Language", *_language);
- }
- return asset;
-}
-
-