40 #ifndef LIBDCP_TEXT_ASSET_H
41 #define LIBDCP_TEXT_ASSET_H
47 #include "subtitle_standard.h"
49 #include <libcxml/cxml.h>
50 #include <boost/shared_array.hpp>
63 struct interop_dcp_font_test;
64 struct smpte_dcp_font_test;
65 struct pull_fonts_test1;
66 struct pull_fonts_test2;
67 struct pull_fonts_test3;
103 std::shared_ptr<const Asset>,
108 std::vector<std::shared_ptr<const Text>> texts_during(
Time from,
Time to,
bool starting)
const;
109 std::vector<std::shared_ptr<const Text>> texts()
const;
111 virtual void add(std::shared_ptr<Text>);
114 std::map<std::string, ArrayData> font_data ()
const;
115 std::map<std::string, boost::filesystem::path> font_filenames ()
const;
117 virtual void write (boost::filesystem::path)
const = 0;
118 virtual std::string xml_as_string ()
const = 0;
120 Time latest_text_out()
const;
124 virtual std::vector<std::shared_ptr<LoadFontNode>> load_font_nodes ()
const = 0;
126 virtual int time_code_rate ()
const = 0;
132 virtual boost::optional<std::string>
raw_xml ()
const {
136 virtual SubtitleStandard subtitle_standard()
const = 0;
138 static std::string
format_xml(xmlpp::Document
const& document, boost::optional<std::pair<std::string, std::string>> xml_namespace);
141 friend struct ::interop_dcp_font_test;
142 friend struct ::smpte_dcp_font_test;
145 boost::optional<std::string> font_id;
146 boost::optional<int64_t> size;
147 boost::optional<float> aspect_adjust;
148 boost::optional<bool> italic;
149 boost::optional<bool> bold;
150 boost::optional<bool> underline;
151 boost::optional<Colour> colour;
152 boost::optional<Effect> effect;
153 boost::optional<Colour> effect_colour;
154 boost::optional<float> h_position;
155 boost::optional<HAlign> h_align;
156 boost::optional<float> v_position;
157 boost::optional<VAlign> v_align;
158 boost::optional<float> z_position;
159 boost::optional<Direction> direction;
160 boost::optional<Time> in;
161 boost::optional<Time> out;
162 boost::optional<Time> fade_up_time;
163 boost::optional<Time> fade_down_time;
168 boost::optional<Type> type;
169 float space_before = 0;
172 void parse_texts(xmlpp::Element
const * node, std::vector<ParseState>& state, boost::optional<int> tcr, Standard standard);
173 ParseState font_node_state (xmlpp::Element
const * node, Standard standard)
const;
174 ParseState text_node_state (xmlpp::Element
const * node)
const;
175 ParseState image_node_state (xmlpp::Element
const * node)
const;
176 ParseState subtitle_node_state (xmlpp::Element
const * node, boost::optional<int> tcr)
const;
177 Time fade_time (xmlpp::Element
const * node, std::string name, boost::optional<int> tcr)
const;
178 void position_align (ParseState& ps, xmlpp::Element
const * node)
const;
180 void texts_as_xml(xmlpp::Element* root,
int time_code_rate, Standard standard)
const;
183 std::vector<std::shared_ptr<Text>>
_texts;
188 Font (std::string load_id_, std::string uuid_, boost::filesystem::path file_)
195 Font (std::string load_id_, std::string uuid_,
ArrayData data_)
205 mutable boost::optional<boost::filesystem::path>
file;
215 friend struct ::pull_fonts_test1;
216 friend struct ::pull_fonts_test2;
217 friend struct ::pull_fonts_test3;
221 std::vector<ParseState>
const & parse_state,
224 std::vector<Ruby>
const& rubies
227 static void pull_fonts (std::shared_ptr<order::Part> part);
Class to hold an arbitrary block of data.
Parent class for DCP assets, i.e. picture, sound, subtitles, closed captions, CPLs,...
boost::optional< boost::filesystem::path > file() const
A class to describe what "equality" means for a particular test.
boost::optional< boost::filesystem::path > file
A parent for classes representing a file containing subtitles or captions.
boost::optional< std::string > _raw_xml
void fix_empty_font_ids()
void texts_as_xml(xmlpp::Element *root, int time_code_rate, Standard standard) const
std::vector< std::shared_ptr< Text > > _texts
std::vector< Font > _fonts
static std::string format_xml(xmlpp::Document const &document, boost::optional< std::pair< std::string, std::string >> xml_namespace)
virtual boost::optional< std::string > raw_xml() const
A representation of time within a DCP.
Namespace for everything in libdcp.