diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-09 11:13:02 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-09 11:13:02 +0100 |
| commit | 5c1b079a28941781c9cfa46d57e0c20b55681b32 (patch) | |
| tree | 35c0d2aac409ca1b52699e974f299a64aa5ffc1f /src/subtitle_asset.h | |
| parent | 6425742f95a4c2e539061b29016a4a5bd10ac9ae (diff) | |
Basically-working interop subtitle font handling.
Diffstat (limited to 'src/subtitle_asset.h')
| -rw-r--r-- | src/subtitle_asset.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index 5fdb5f7a..481556aa 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -24,11 +24,14 @@ #include "dcp_time.h" #include "subtitle_string.h" #include <libcxml/cxml.h> +#include <boost/shared_array.hpp> namespace xmlpp { class Element; } +struct interop_dcp_font_test; + namespace dcp { @@ -64,6 +67,7 @@ public: } void add (SubtitleString); + virtual void add_font (std::string id, boost::filesystem::path file) = 0; virtual void write (boost::filesystem::path) const = 0; virtual Glib::ustring xml_as_string () const = 0; @@ -73,13 +77,40 @@ public: virtual std::list<boost::shared_ptr<LoadFontNode> > load_font_nodes () const = 0; protected: + friend struct ::interop_dcp_font_test; + void parse_subtitles (boost::shared_ptr<cxml::Document> xml, std::list<boost::shared_ptr<FontNode> > font_nodes); - void subtitles_as_xml (xmlpp::Element* root, int time_code_rate, std::string xmlns) const; + void add_font_data (std::string id, boost::filesystem::path file); /** All our subtitles, in no particular order */ std::list<SubtitleString> _subtitles; + class FontData { + public: + FontData () {} + + FontData (boost::shared_array<uint8_t> data_, boost::uintmax_t size_) + : data (data_) + , size (size_) + {} + + FontData (boost::shared_array<uint8_t> data_, boost::uintmax_t size_, boost::filesystem::path file_) + : data (data_) + , size (size_) + , file (file_) + {} + + boost::shared_array<uint8_t> data; + boost::uintmax_t size; + mutable boost::filesystem::path file; + }; + + /** Font data, keyed by a subclass-dependent identifier. + * For Interop fonts, the string is the font ID from the subtitle file. + */ + std::map<std::string, FontData> _fonts; + private: /** @struct ParseState * @brief A struct to hold state when parsing a subtitle XML file. |
