40 #ifndef LIBDCP_SUBTITLE_ASSET_H
41 #define LIBDCP_SUBTITLE_ASSET_H
48 #include <libcxml/cxml.h>
49 #include <boost/shared_array.hpp>
58 struct interop_dcp_font_test;
59 struct smpte_dcp_font_test;
60 struct pull_fonts_test1;
61 struct pull_fonts_test2;
62 struct pull_fonts_test3;
98 std::shared_ptr<const Asset>,
103 std::vector<std::shared_ptr<const Subtitle>> subtitles_during (
Time from,
Time to,
bool starting)
const;
104 std::vector<std::shared_ptr<const Subtitle>> subtitles_in_reel(std::shared_ptr<const dcp::ReelAsset> asset)
const;
105 std::vector<std::shared_ptr<const Subtitle>> subtitles ()
const;
107 virtual void add (std::shared_ptr<Subtitle>);
109 std::map<std::string, ArrayData> font_data ()
const;
110 std::map<std::string, boost::filesystem::path> font_filenames ()
const;
112 virtual void write (boost::filesystem::path)
const = 0;
113 virtual std::string xml_as_string ()
const = 0;
115 Time latest_subtitle_out ()
const;
119 virtual std::vector<std::shared_ptr<LoadFontNode>> load_font_nodes ()
const = 0;
121 virtual int time_code_rate ()
const = 0;
127 virtual boost::optional<std::string>
raw_xml ()
const {
132 friend struct ::interop_dcp_font_test;
133 friend struct ::smpte_dcp_font_test;
136 boost::optional<std::string> font_id;
137 boost::optional<int64_t> size;
138 boost::optional<float> aspect_adjust;
139 boost::optional<bool> italic;
140 boost::optional<bool> bold;
141 boost::optional<bool> underline;
142 boost::optional<Colour> colour;
143 boost::optional<Effect> effect;
144 boost::optional<Colour> effect_colour;
145 boost::optional<float> h_position;
146 boost::optional<HAlign> h_align;
147 boost::optional<float> v_position;
148 boost::optional<VAlign> v_align;
149 boost::optional<Direction> direction;
150 boost::optional<Time> in;
151 boost::optional<Time> out;
152 boost::optional<Time> fade_up_time;
153 boost::optional<Time> fade_down_time;
158 boost::optional<Type> type;
159 float space_before = 0;
162 void parse_subtitles (xmlpp::Element
const * node, std::vector<ParseState>& state, boost::optional<int> tcr, Standard standard);
163 ParseState font_node_state (xmlpp::Element
const * node, Standard standard)
const;
164 ParseState text_node_state (xmlpp::Element
const * node)
const;
165 ParseState image_node_state (xmlpp::Element
const * node)
const;
166 ParseState subtitle_node_state (xmlpp::Element
const * node, boost::optional<int> tcr)
const;
167 Time fade_time (xmlpp::Element
const * node, std::string name, boost::optional<int> tcr)
const;
168 void position_align (ParseState& ps, xmlpp::Element
const * node)
const;
170 void subtitles_as_xml (xmlpp::Element* root,
int time_code_rate, Standard standard)
const;
178 Font (std::string load_id_, std::string uuid_, boost::filesystem::path file_)
185 Font (std::string load_id_, std::string uuid_,
ArrayData data_)
195 mutable boost::optional<boost::filesystem::path>
file;
205 friend struct ::pull_fonts_test1;
206 friend struct ::pull_fonts_test2;
207 friend struct ::pull_fonts_test3;
209 void maybe_add_subtitle (std::string text, std::vector<ParseState>
const & parse_state,
float space_before, Standard standard);
211 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
boost::optional< boost::filesystem::path > file
A parent for classes representing a file containing subtitles.
std::vector< std::shared_ptr< Subtitle > > _subtitles
std::vector< Font > _fonts
void fix_empty_font_ids()
virtual boost::optional< std::string > raw_xml() const
void subtitles_as_xml(xmlpp::Element *root, int time_code_rate, Standard standard) const
boost::optional< std::string > _raw_xml
A representation of time within a DCP.
Namespace for everything in libdcp.
A class to describe what "equality" means for a particular test.