summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-12-31 23:44:09 +0100
committerCarl Hetherington <cth@carlh.net>2023-01-07 22:48:57 +0100
commitc577f9fb422b4c49a01a13693de02df4c4f1efa5 (patch)
tree04a4cd83cffbb338bda04deb6c73a11456bb2044 /src
parentcb574824a2e5d280b421e8c4e81fa90b85b877ae (diff)
Allow specification of font UUID when adding a font to an asset.
Diffstat (limited to 'src')
-rw-r--r--src/interop_subtitle_asset.cc4
-rw-r--r--src/interop_subtitle_asset.h2
-rw-r--r--src/smpte_subtitle_asset.cc6
-rw-r--r--src/smpte_subtitle_asset.h2
-rw-r--r--src/subtitle_asset.h2
5 files changed, 8 insertions, 8 deletions
diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc
index d58e16a3..cd21f2af 100644
--- a/src/interop_subtitle_asset.cc
+++ b/src/interop_subtitle_asset.cc
@@ -131,9 +131,9 @@ InteropSubtitleAsset::xml_as_string () const
void
-InteropSubtitleAsset::add_font (string load_id, dcp::ArrayData data)
+InteropSubtitleAsset::add_font(string load_id,dcp::ArrayData data, optional<string> uuid)
{
- _fonts.push_back (Font(load_id, make_uuid(), data));
+ _fonts.push_back(Font(load_id, uuid.get_value_or(make_uuid()), data));
auto const uri = String::compose("font_%1.ttf", _load_font_nodes.size());
_load_font_nodes.push_back (make_shared<InteropLoadFontNode>(load_id, uri));
}
diff --git a/src/interop_subtitle_asset.h b/src/interop_subtitle_asset.h
index 670dee27..e89cc4c6 100644
--- a/src/interop_subtitle_asset.h
+++ b/src/interop_subtitle_asset.h
@@ -73,7 +73,7 @@ public:
std::vector<std::shared_ptr<LoadFontNode>> load_font_nodes () const override;
- void add_font (std::string load_id, dcp::ArrayData data) override;
+ void add_font(std::string load_id, dcp::ArrayData data, boost::optional<std::string> uuid = boost::none) override;
std::string xml_as_string () const override;
diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc
index 9d728cc6..776c8b9c 100644
--- a/src/smpte_subtitle_asset.cc
+++ b/src/smpte_subtitle_asset.cc
@@ -561,10 +561,10 @@ SMPTESubtitleAsset::equals (shared_ptr<const Asset> other_asset, EqualityOptions
void
-SMPTESubtitleAsset::add_font (string load_id, dcp::ArrayData data)
+SMPTESubtitleAsset::add_font(string load_id, dcp::ArrayData data, optional<string> optional_uuid)
{
- string const uuid = make_uuid ();
- _fonts.push_back (Font(load_id, uuid, data));
+ auto const uuid = optional_uuid.get_value_or(make_uuid());
+ _fonts.push_back(Font(load_id, uuid, data));
_load_font_nodes.push_back (make_shared<SMPTELoadFontNode>(load_id, uuid));
}
diff --git a/src/smpte_subtitle_asset.h b/src/smpte_subtitle_asset.h
index b707da12..e46beeb5 100644
--- a/src/smpte_subtitle_asset.h
+++ b/src/smpte_subtitle_asset.h
@@ -95,7 +95,7 @@ public:
void write (boost::filesystem::path path) const override;
void add (std::shared_ptr<Subtitle>) override;
- void add_font (std::string id, dcp::ArrayData data) override;
+ void add_font(std::string id, dcp::ArrayData data, boost::optional<std::string> font_uuid = boost::none) override;
void set_key (Key key) override;
void set_content_title_text (std::string t) {
diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h
index 7448ac9a..aebf3fd9 100644
--- a/src/subtitle_asset.h
+++ b/src/subtitle_asset.h
@@ -109,7 +109,7 @@ public:
std::vector<std::shared_ptr<const Subtitle>> subtitles () const;
virtual void add (std::shared_ptr<Subtitle>);
- virtual void add_font (std::string id, dcp::ArrayData data) = 0;
+ virtual void add_font(std::string id, dcp::ArrayData data, boost::optional<std::string> font_uuid = boost::none) = 0;
std::map<std::string, ArrayData> font_data () const;
std::map<std::string, boost::filesystem::path> font_filenames () const;