X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_subtitle_content.cc;h=f8d12d4e4a4c1130c932846aca7bbb40d0f6a591;hb=bcc4e2f7dc4cd5658e199ddacb7202b00ec72cf1;hp=a8e98d4264b3d82f12293b9f22c6eccbeebe4ceb;hpb=24dcab1d4d8d7a28a939c7c4d786197684f155f6;p=dcpomatic.git diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index a8e98d426..f8d12d4e4 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -36,24 +36,25 @@ using std::list; using boost::shared_ptr; using boost::dynamic_pointer_cast; using dcp::raw_convert; +using namespace dcpomatic; -DCPSubtitleContent::DCPSubtitleContent (shared_ptr film, boost::filesystem::path path) - : Content (film, path) +DCPSubtitleContent::DCPSubtitleContent (boost::filesystem::path path) + : Content (path) { text.push_back (shared_ptr (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_OPEN_SUBTITLE))); } -DCPSubtitleContent::DCPSubtitleContent (shared_ptr film, cxml::ConstNodePtr node, int version) - : Content (film, node) +DCPSubtitleContent::DCPSubtitleContent (cxml::ConstNodePtr node, int version) + : Content (node) , _length (node->number_child ("Length")) { text = TextContent::from_xml (this, node, version); } void -DCPSubtitleContent::examine (shared_ptr job) +DCPSubtitleContent::examine (shared_ptr film, shared_ptr job) { - Content::examine (job); + Content::examine (film, job); shared_ptr sc = load (path (0)); @@ -76,18 +77,26 @@ DCPSubtitleContent::examine (shared_ptr job) _length = ContentTime::from_seconds (sc->latest_subtitle_out().as_seconds ()); + sc->fix_empty_font_ids (); + BOOST_FOREACH (shared_ptr i, sc->load_font_nodes ()) { only_text()->add_font (shared_ptr (new Font (i->id))); } } DCPTime -DCPSubtitleContent::full_length () const +DCPSubtitleContent::full_length (shared_ptr film) const { - FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate()); + FrameRateChange const frc (film, shared_from_this()); return DCPTime (_length, frc); } +DCPTime +DCPSubtitleContent::approximate_length () const +{ + return DCPTime (_length, FrameRateChange()); +} + string DCPSubtitleContent::summary () const {