From d73bea50fba97958c2ddba99d150d4540d2264ba Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 5 Jun 2015 18:13:20 +0100 Subject: Small tidy-ups and comments. --- src/interop_subtitle_asset.cc | 2 +- src/smpte_subtitle_asset.cc | 2 +- src/subtitle_asset.cc | 2 +- src/subtitle_asset.h | 19 +++++++++++-------- 4 files changed, 14 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc index 528b7d90..96ccb68a 100644 --- a/src/interop_subtitle_asset.cc +++ b/src/interop_subtitle_asset.cc @@ -53,7 +53,7 @@ InteropSubtitleAsset::InteropSubtitleAsset (boost::filesystem::path file) font_nodes.push_back (shared_ptr (new FontNode (i, 250))); } - parse_common (xml, font_nodes); + parse_subtitles (xml, font_nodes); } InteropSubtitleAsset::InteropSubtitleAsset (string movie_title, string language) diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc index 40afc76d..a81b84eb 100644 --- a/src/smpte_subtitle_asset.cc +++ b/src/smpte_subtitle_asset.cc @@ -101,7 +101,7 @@ SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file, bool mxf) font_nodes.push_back (shared_ptr (new FontNode (i, _time_code_rate))); } - parse_common (xml, font_nodes); + parse_subtitles (xml, font_nodes); } list > diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc index 1c341de4..45177b95 100644 --- a/src/subtitle_asset.cc +++ b/src/subtitle_asset.cc @@ -54,7 +54,7 @@ SubtitleAsset::SubtitleAsset (boost::filesystem::path file) } void -SubtitleAsset::parse_common (shared_ptr xml, list > font_nodes) +SubtitleAsset::parse_subtitles (shared_ptr xml, list > font_nodes) { /* Make Subtitle objects to represent the raw XML nodes in a sane way */ ParseState parse_state; diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index c8100d58..5fdb5f7a 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -40,6 +40,11 @@ class LoadFontNode; /** @class SubtitleAsset * @brief A parent for classes representing a file containing subtitles. + * + * This class holds a list of SubtitleString objects which it can extract + * from the appropriate part of either an Interop or SMPTE XML file. + * Its subclasses InteropSubtitleAsset and SMPTESubtitleAsset handle the + * differences between the two types. */ class SubtitleAsset : public Asset { @@ -68,19 +73,17 @@ public: virtual std::list > load_font_nodes () const = 0; protected: - void parse_common (boost::shared_ptr xml, std::list > font_nodes); - - virtual std::string pkl_type (Standard) const = 0; - - std::string asdcp_kind () const { - return "Subtitle"; - } + void parse_subtitles (boost::shared_ptr xml, std::list > font_nodes); void subtitles_as_xml (xmlpp::Element* root, int time_code_rate, std::string xmlns) const; - + + /** All our subtitles, in no particular order */ std::list _subtitles; private: + /** @struct ParseState + * @brief A struct to hold state when parsing a subtitle XML file. + */ struct ParseState { std::list > font_nodes; std::list > text_nodes; -- cgit v1.2.3