X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fsubtitle_content.h;h=945eb4d098bc99b179c3662053db32e2571a0ab3;hb=5aa66b7fd3e5256cd20eedde287a2124522610a0;hp=c4d0012bc9f7cbe76c08091bdb1c1f4ac7090c88;hpb=78c94420750c505e59d584c34b33acc953946c2a;p=libdcp.git diff --git a/src/subtitle_content.h b/src/subtitle_content.h index c4d0012b..945eb4d0 100644 --- a/src/subtitle_content.h +++ b/src/subtitle_content.h @@ -22,6 +22,7 @@ #include "content.h" #include "dcp_time.h" +#include "subtitle_string.h" #include namespace dcp @@ -34,21 +35,28 @@ class Subtitle; class LoadFont; /** @class SubtitleContent - * @brief A representation of an XML file containing subtitles. + * @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. */ class SubtitleContent : public Content { public: - SubtitleContent (boost::filesystem::path file); - SubtitleContent (Fraction edit_rate, std::string movie_title, std::string language); + /** 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); bool equals ( - boost::shared_ptr, + boost::shared_ptr, EqualityOptions, boost::function note ) const { /* XXX */ - note (ERROR, "subtitle content not compared yet"); + note (DCP_ERROR, "subtitle content not compared yet"); return true; } @@ -56,20 +64,26 @@ public: return _language; } - std::list > subtitles_at (Time t) const; - std::list > const & subtitles () const { + std::list subtitles_at (Time t) const; + std::list const & subtitles () const { return _subtitles; } - void add (boost::shared_ptr); + void add (SubtitleString); - void write_xml () const; + void write_xml (boost::filesystem::path) const; Glib::ustring xml_as_string () const; + Time latest_subtitle_out () const; + protected: - std::string pkl_type () const { + std::string pkl_type (Standard) const { return "text/xml"; } + + std::string asdcp_kind () const { + return "Subtitle"; + } private: std::string font_id_to_name (std::string id) const; @@ -94,14 +108,13 @@ private: ParseState& parse_state ); - std::string _movie_title; + boost::optional _movie_title; /* strangely, this is sometimes a string */ std::string _reel_number; std::string _language; std::list > _load_font_nodes; - std::list > _subtitles; - bool _need_sort; + std::list _subtitles; }; }