A parent for classes representing a file containing subtitles or captions.
More...
#include <text_asset.h>
|
class | Font |
|
struct | ParseState |
|
|
| TextAsset (boost::filesystem::path file) |
|
bool | equals (std::shared_ptr< const Asset >, EqualityOptions const &, NoteHandler note) const override |
|
std::vector< std::shared_ptr< const Text > > | texts_during (Time from, Time to, bool starting) const |
|
std::vector< std::shared_ptr< const Text > > | texts () const |
|
virtual void | add (std::shared_ptr< Text >) |
|
virtual void | add_font (std::string id, dcp::ArrayData data)=0 |
|
void | ensure_font (std::string id, dcp::ArrayData data) |
|
std::map< std::string, ArrayData > | font_data () const |
|
std::map< std::string, boost::filesystem::path > | font_filenames () const |
|
virtual void | write (boost::filesystem::path) const =0 |
|
virtual std::string | xml_as_string () const =0 |
|
Time | latest_text_out () const |
|
void | fix_empty_font_ids () |
|
virtual std::vector< std::shared_ptr< LoadFontNode > > | load_font_nodes () const =0 |
|
virtual int | time_code_rate () const =0 |
|
virtual boost::optional< std::string > | raw_xml () const |
|
virtual SubtitleStandard | subtitle_standard () const =0 |
|
| Asset () |
|
| Asset (boost::filesystem::path file) |
|
| Asset (std::string id, boost::filesystem::path file) |
|
virtual void | add_to_assetmap (AssetMap &asset_map, boost::filesystem::path root) const |
|
virtual void | add_to_pkl (std::shared_ptr< PKL > pkl, boost::filesystem::path root) const |
|
boost::optional< boost::filesystem::path > | file () const |
|
void | set_file (boost::filesystem::path file) const |
|
void | set_file_preserving_hash (boost::filesystem::path file) const |
|
void | rename_file (boost::filesystem::path file) |
|
std::string | hash (boost::function< void(int64_t, int64_t)> progress={}) const |
|
void | set_hash (std::string hash) |
|
void | unset_hash () |
|
| Object () |
|
| Object (std::string id) |
|
| Object (Object const &other) |
|
Object & | operator= (Object const &other) |
|
std::string | id () const |
|
|
static std::string | format_xml (xmlpp::Document const &document, boost::optional< std::pair< std::string, std::string >> xml_namespace) |
|
|
void | parse_texts (xmlpp::Element const *node, std::vector< ParseState > &state, boost::optional< int > tcr, Standard standard) |
|
ParseState | font_node_state (xmlpp::Element const *node, Standard standard) const |
|
ParseState | text_node_state (xmlpp::Element const *node) const |
|
ParseState | image_node_state (xmlpp::Element const *node) const |
|
ParseState | subtitle_node_state (xmlpp::Element const *node, boost::optional< int > tcr) const |
|
Time | fade_time (xmlpp::Element const *node, std::string name, boost::optional< int > tcr) const |
|
void | position_align (ParseState &ps, xmlpp::Element const *node) const |
|
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 |
|
boost::optional< std::string > | _raw_xml |
|
boost::optional< boost::filesystem::path > | _file |
|
std::string | _id |
|
|
void | maybe_add_text (std::string text, std::vector< ParseState > const &parse_state, float space_before, Standard standard, std::vector< Ruby > const &rubies) |
|
|
static void | pull_fonts (std::shared_ptr< order::Part > part) |
|
|
struct | ::interop_dcp_font_test |
|
struct | ::smpte_dcp_font_test |
|
struct | ::pull_fonts_test1 |
|
struct | ::pull_fonts_test2 |
|
struct | ::pull_fonts_test3 |
|
|
static void | add_file_to_assetmap (AssetMap &asset_map, boost::filesystem::path root, boost::filesystem::path file, std::string id) |
|
A parent for classes representing a file containing subtitles or captions.
This class holds a list of Text objects which it can extract from the appropriate part of either an Interop or SMPTE XML file. Its subclasses InteropTextAsset and SMPTETextAsset handle the differences between the two types.
Definition at line 96 of file text_asset.h.
◆ fix_empty_font_ids()
void TextAsset::fix_empty_font_ids |
( |
| ) |
|
Replace empty IDs in any <LoadFontId> and <Font> tags with a dummy string. Some systems give errors with empty font IDs (see DCP-o-matic bug #1689).
Definition at line 854 of file text_asset.cc.
◆ format_xml()
string TextAsset::format_xml |
( |
xmlpp::Document const & |
document, |
|
|
boost::optional< std::pair< std::string, std::string >> |
xml_namespace |
|
) |
| |
|
static |
Format XML much as write_to_string_formatted() would do, except without adding any white space to <Text> nodes. This is an attempt to avoid changing what is actually displayed while also formatting the XML in such a way as to avoid DoM bug 2205.
xml_namespace is an optional namespace for the root node; it would be nicer to set this up with set_namespace_declaration in the caller and then to extract it here but I couldn't find a way to get all namespaces with the libxml++ API.
Definition at line 967 of file text_asset.cc.
◆ raw_xml()
virtual boost::optional<std::string> dcp::TextAsset::raw_xml |
( |
| ) |
const |
|
inlinevirtual |
- Returns
- Raw XML loaded from, or written to, an on-disk asset, or boost::none if
- this object was not created from an existing on-disk asset and has not been written to one, or
- this asset is encrypted and no key is available.
Definition at line 132 of file text_asset.h.
◆ texts_as_xml()
void TextAsset::texts_as_xml |
( |
xmlpp::Element * |
xml_root, |
|
|
int |
time_code_rate, |
|
|
Standard |
standard |
|
) |
| const |
|
protected |
- Parameters
-
standard | Standard (INTEROP or SMPTE); this is used rather than putting things in the child class because the differences between the two are fairly subtle. |
Definition at line 727 of file text_asset.cc.
◆ _fonts
std::vector<Font> dcp::TextAsset::_fonts |
|
protected |
◆ _raw_xml
boost::optional<std::string> dcp::TextAsset::_raw_xml |
|
mutableprotected |
The raw XML data that we read from or wrote to our asset; useful for validation
Definition at line 212 of file text_asset.h.
◆ _texts
std::vector<std::shared_ptr<Text> > dcp::TextAsset::_texts |
|
protected |
All our texts, in no particular order
Definition at line 183 of file text_asset.h.
The documentation for this class was generated from the following files: