class LoadFont;
/** @class SubtitleContent
- * @brief A representation of an XML or MXF file containing subtitles.
- *
- * XXX: perhaps this should inhert from MXF, or there should be different
- * classes for XML and MXF subs.
+ * @brief A parent for classes representing a file containing subtitles.
*/
class SubtitleContent : public Content
{
public:
- /** Construct a SubtitleContent.
- * @param file Filename.
- * @param mxf true if the file is an MXF file, false for XML.
- */
- SubtitleContent (boost::filesystem::path file, bool mxf);
- SubtitleContent (std::string movie_title, std::string language);
+ SubtitleContent ();
+ SubtitleContent (boost::filesystem::path file);
bool equals (
boost::shared_ptr<const Asset>,
EqualityOptions,
- boost::function<void (NoteType, std::string)> note
- ) const {
- /* XXX */
- note (DCP_ERROR, "subtitle content not compared yet");
- return true;
- }
+ NoteHandler note
+ ) const;
std::string language () const {
return _language;
}
- std::list<SubtitleString> subtitles_at (Time t) const;
+ std::list<SubtitleString> subtitles_during (Time from, Time to) const;
std::list<SubtitleString> const & subtitles () const {
return _subtitles;
}
void add (SubtitleString);
void write_xml (boost::filesystem::path) const;
- Glib::ustring xml_as_string () const;
+ virtual Glib::ustring xml_as_string () const {
+ /* XXX: this should be pure virtual when SMPTE writing is implemented */
+ return "";
+ }
Time latest_subtitle_out () const;
+ virtual std::list<boost::shared_ptr<LoadFont> > load_font_nodes () const = 0;
+
protected:
+ void parse_common (boost::shared_ptr<cxml::Document> xml, std::list<boost::shared_ptr<Font> > font_nodes);
+
std::string pkl_type (Standard) const {
return "text/xml";
}
return "Subtitle";
}
-private:
- std::string font_id_to_name (std::string id) const;
+ /* strangely, this is sometimes a string */
+ std::string _reel_number;
+ std::string _language;
+ std::list<SubtitleString> _subtitles;
+
+private:
struct ParseState {
std::list<boost::shared_ptr<Font> > font_nodes;
std::list<boost::shared_ptr<Text> > text_nodes;
std::list<boost::shared_ptr<Text> > const & text_nodes,
ParseState& parse_state
);
-
- boost::optional<std::string> _movie_title;
- /* strangely, this is sometimes a string */
- std::string _reel_number;
- std::string _language;
- std::list<boost::shared_ptr<LoadFont> > _load_font_nodes;
-
- std::list<SubtitleString> _subtitles;
};
}