summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-08-29 11:55:10 +0100
committerCarl Hetherington <cth@carlh.net>2018-08-29 11:55:10 +0100
commit367b43df1630a5e4e4173fb50e234803f248f00f (patch)
treee115091f93b20fa1fbb1f2c16a2bdf26c9e73e63 /src
parent9f75a44df591954519ac828a1b50b6d5ebd2a3a1 (diff)
Allow CCAP reel nodes to have language tags.
Diffstat (limited to 'src')
-rw-r--r--src/reel_asset.cc3
-rw-r--r--src/reel_asset.h6
-rw-r--r--src/reel_atmos_asset.cc10
-rw-r--r--src/reel_atmos_asset.h2
-rw-r--r--src/reel_closed_caption_asset.cc20
-rw-r--r--src/reel_closed_caption_asset.h16
-rw-r--r--src/reel_picture_asset.cc19
-rw-r--r--src/reel_picture_asset.h2
-rw-r--r--src/reel_sound_asset.cc12
-rw-r--r--src/reel_sound_asset.h2
-rw-r--r--src/reel_subtitle_asset.cc15
-rw-r--r--src/reel_subtitle_asset.h2
12 files changed, 63 insertions, 46 deletions
diff --git a/src/reel_asset.cc b/src/reel_asset.cc
index f96ee2c0..72a1937c 100644
--- a/src/reel_asset.cc
+++ b/src/reel_asset.cc
@@ -92,7 +92,7 @@ ReelAsset::ReelAsset (shared_ptr<const cxml::Node> node)
}
-void
+xmlpp::Node*
ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
xmlpp::Element* a = node->add_child (cpl_node_name (standard));
@@ -113,6 +113,7 @@ ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
if (_hash) {
a->add_child("Hash")->add_child_text (_hash.get());
}
+ return a;
}
pair<string, string>
diff --git a/src/reel_asset.h b/src/reel_asset.h
index af367cd3..42409ab9 100644
--- a/src/reel_asset.h
+++ b/src/reel_asset.h
@@ -69,7 +69,7 @@ public:
ReelAsset (boost::shared_ptr<Asset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
explicit ReelAsset (boost::shared_ptr<const cxml::Node>);
- virtual void write_to_cpl (xmlpp::Node* node, Standard standard) const;
+ virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
virtual bool equals (boost::shared_ptr<const ReelAsset>, EqualityOptions, NoteHandler) const;
/** @return a Ref to our actual asset */
@@ -113,6 +113,10 @@ public:
return _hash;
}
+ std::string annotation_text () const {
+ return _annotation_text;
+ }
+
void set_annotation_text (std::string at) {
_annotation_text = at;
}
diff --git a/src/reel_atmos_asset.cc b/src/reel_atmos_asset.cc
index 8c1c21ae..9b59c56c 100644
--- a/src/reel_atmos_asset.cc
+++ b/src/reel_atmos_asset.cc
@@ -77,12 +77,10 @@ ReelAtmosAsset::key_type () const
return "MDEK";
}
-void
+xmlpp::Node *
ReelAtmosAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
- ReelAsset::write_to_cpl (node, standard);
-
- /* Find <axd:AuxData> */
- xmlpp::Node* mp = find_child (node, cpl_node_name (standard));
- mp->add_child("axd:DataType")->add_child_text ("urn:smpte:ul:060e2b34.04010105.0e090604.00000000");
+ xmlpp::Node* asset = ReelAsset::write_to_cpl (node, standard);
+ asset->add_child("axd:DataType")->add_child_text("urn:smpte:ul:060e2b34.04010105.0e090604.00000000");
+ return asset;
}
diff --git a/src/reel_atmos_asset.h b/src/reel_atmos_asset.h
index 31f5293e..e93a5414 100644
--- a/src/reel_atmos_asset.h
+++ b/src/reel_atmos_asset.h
@@ -59,7 +59,7 @@ public:
return asset_of_type<AtmosAsset> ();
}
- void write_to_cpl (xmlpp::Node* node, Standard standard) const;
+ xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
private:
std::string key_type () const;
diff --git a/src/reel_closed_caption_asset.cc b/src/reel_closed_caption_asset.cc
index 4fb729c6..b7629011 100644
--- a/src/reel_closed_caption_asset.cc
+++ b/src/reel_closed_caption_asset.cc
@@ -60,7 +60,7 @@ ReelClosedCaptionAsset::ReelClosedCaptionAsset (boost::shared_ptr<const cxml::No
: ReelAsset (node)
, ReelMXF (node)
{
- node->ignore_child ("Language");
+ _language = node->optional_string_child ("Language");
node->done ();
}
@@ -96,16 +96,20 @@ ReelClosedCaptionAsset::key_type () const
return "MDSK";
}
-void
+xmlpp::Node *
ReelClosedCaptionAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
- ReelAsset::write_to_cpl (node, standard);
+ xmlpp::Node* asset = ReelAsset::write_to_cpl (node, standard);
- if (key_id ()) {
- /* Find our main tag */
- xmlpp::Node* ms = find_child (node, cpl_node_name (standard));
+ if (key_id()) {
/* Find <Hash> */
- xmlpp::Node* hash = find_child (ms, "Hash");
- ms->add_child_before (hash, "KeyId")->add_child_text ("urn:uuid:" + key_id().get ());
+ xmlpp::Node* hash = find_child (asset, "Hash");
+ asset->add_child_before(hash, "KeyId")->add_child_text("urn:uuid:" + key_id().get());
}
+
+ if (_language) {
+ asset->add_child("Language")->add_child_text(*_language);
+ }
+
+ return asset;
}
diff --git a/src/reel_closed_caption_asset.h b/src/reel_closed_caption_asset.h
index 2cf65ad8..80e444d9 100644
--- a/src/reel_closed_caption_asset.h
+++ b/src/reel_closed_caption_asset.h
@@ -55,16 +55,30 @@ public:
ReelClosedCaptionAsset (boost::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t instrinsic_duration, int64_t entry_point);
explicit ReelClosedCaptionAsset (boost::shared_ptr<const cxml::Node>);
- void write_to_cpl (xmlpp::Node* node, Standard standard) const;
+ xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
boost::shared_ptr<SubtitleAsset> asset () const {
return asset_of_type<SubtitleAsset> ();
}
+ void set_language (std::string l) {
+ _language = l;
+ }
+
+ void unset_language () {
+ _language = boost::optional<std::string> ();
+ }
+
+ boost::optional<std::string> language () const {
+ return _language;
+ }
+
private:
std::string key_type () const;
std::string cpl_node_name (Standard standard) const;
std::pair<std::string, std::string> cpl_node_namespace (Standard standard) const;
+
+ boost::optional<std::string> _language;
};
}
diff --git a/src/reel_picture_asset.cc b/src/reel_picture_asset.cc
index 644024ec..1933c769 100644
--- a/src/reel_picture_asset.cc
+++ b/src/reel_picture_asset.cc
@@ -86,15 +86,12 @@ ReelPictureAsset::ReelPictureAsset (shared_ptr<const cxml::Node> node)
}
}
-void
+xmlpp::Node*
ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
- ReelAsset::write_to_cpl (node, standard);
+ xmlpp::Node* asset = ReelAsset::write_to_cpl (node, standard);
- /* Find <MainPicture> */
- xmlpp::Node* mp = find_child (node, cpl_node_name (standard));
-
- mp->add_child ("FrameRate")->add_child_text (String::compose ("%1 %2", _frame_rate.numerator, _frame_rate.denominator));
+ asset->add_child("FrameRate")->add_child_text(String::compose("%1 %2", _frame_rate.numerator, _frame_rate.denominator));
if (standard == INTEROP) {
/* Allowed values for this tag from the standard */
@@ -115,18 +112,20 @@ ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
}
}
- mp->add_child ("ScreenAspectRatio")->add_child_text (raw_convert<string> (closest.get(), 2, true));
+ asset->add_child ("ScreenAspectRatio")->add_child_text (raw_convert<string> (closest.get(), 2, true));
} else {
- mp->add_child ("ScreenAspectRatio")->add_child_text (
+ asset->add_child ("ScreenAspectRatio")->add_child_text (
String::compose ("%1 %2", _screen_aspect_ratio.numerator, _screen_aspect_ratio.denominator)
);
}
if (key_id ()) {
/* Find <Hash> */
- xmlpp::Node* hash = find_child (mp, "Hash");
- mp->add_child_before (hash, "KeyId")->add_child_text ("urn:uuid:" + key_id().get ());
+ xmlpp::Node* hash = find_child (asset, "Hash");
+ asset->add_child_before(hash, "KeyId")->add_child_text("urn:uuid:" + key_id().get());
}
+
+ return asset;
}
string
diff --git a/src/reel_picture_asset.h b/src/reel_picture_asset.h
index 979bd8f6..a20c216f 100644
--- a/src/reel_picture_asset.h
+++ b/src/reel_picture_asset.h
@@ -54,7 +54,7 @@ public:
ReelPictureAsset (boost::shared_ptr<PictureAsset> asset, int64_t entry_point);
explicit ReelPictureAsset (boost::shared_ptr<const cxml::Node>);
- virtual void write_to_cpl (xmlpp::Node* node, Standard standard) const;
+ virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
virtual bool equals (boost::shared_ptr<const ReelAsset>, EqualityOptions, NoteHandler) const;
/** @return the PictureAsset that this object refers to */
diff --git a/src/reel_sound_asset.cc b/src/reel_sound_asset.cc
index 178b0a08..baacfe72 100644
--- a/src/reel_sound_asset.cc
+++ b/src/reel_sound_asset.cc
@@ -71,16 +71,16 @@ ReelSoundAsset::key_type () const
return "MDAK";
}
-void
+xmlpp::Node *
ReelSoundAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
- ReelAsset::write_to_cpl (node, standard);
+ xmlpp::Node* asset = ReelAsset::write_to_cpl (node, standard);
if (key_id ()) {
- /* Find <MainSound> */
- xmlpp::Node* ms = find_child (node, cpl_node_name (standard));
/* Find <Hash> */
- xmlpp::Node* hash = find_child (ms, "Hash");
- ms->add_child_before (hash, "KeyId")->add_child_text ("urn:uuid:" + key_id().get ());
+ xmlpp::Node* hash = find_child (asset, "Hash");
+ asset->add_child_before(hash, "KeyId")->add_child_text("urn:uuid:" + key_id().get());
}
+
+ return asset;
}
diff --git a/src/reel_sound_asset.h b/src/reel_sound_asset.h
index d95b83dc..2fb01c8d 100644
--- a/src/reel_sound_asset.h
+++ b/src/reel_sound_asset.h
@@ -52,7 +52,7 @@ public:
ReelSoundAsset (boost::shared_ptr<dcp::SoundAsset> content, int64_t entry_point);
explicit ReelSoundAsset (boost::shared_ptr<const cxml::Node>);
- void write_to_cpl (xmlpp::Node* node, Standard standard) const;
+ xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
/** @return the SoundAsset that this object refers to */
boost::shared_ptr<SoundAsset> asset () {
diff --git a/src/reel_subtitle_asset.cc b/src/reel_subtitle_asset.cc
index 77c001d5..75116b2b 100644
--- a/src/reel_subtitle_asset.cc
+++ b/src/reel_subtitle_asset.cc
@@ -73,19 +73,16 @@ ReelSubtitleAsset::key_type () const
return "MDSK";
}
-void
+xmlpp::Node *
ReelSubtitleAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
- ReelAsset::write_to_cpl (node, standard);
+ xmlpp::Node* asset = ReelAsset::write_to_cpl (node, standard);
- /* XXX: couldn't this stuff be in the parent class? All child
- classes seem to do the same thing...?
- */
if (key_id ()) {
- /* Find <MainSubtitle> */
- xmlpp::Node* ms = find_child (node, cpl_node_name (standard));
/* Find <Hash> */
- xmlpp::Node* hash = find_child (ms, "Hash");
- ms->add_child_before (hash, "KeyId")->add_child_text ("urn:uuid:" + key_id().get ());
+ xmlpp::Node* hash = find_child (asset, "Hash");
+ asset->add_child_before(hash, "KeyId")->add_child_text("urn:uuid:" + key_id().get());
}
+
+ return asset;
}
diff --git a/src/reel_subtitle_asset.h b/src/reel_subtitle_asset.h
index 976ff56d..8e0edc49 100644
--- a/src/reel_subtitle_asset.h
+++ b/src/reel_subtitle_asset.h
@@ -55,7 +55,7 @@ public:
ReelSubtitleAsset (boost::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
explicit ReelSubtitleAsset (boost::shared_ptr<const cxml::Node>);
- void write_to_cpl (xmlpp::Node* node, Standard standard) const;
+ xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
boost::shared_ptr<SubtitleAsset> asset () const {
return asset_of_type<SubtitleAsset> ();