X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_subtitle_content.cc;h=8b09b6fee1628671403895879868f1fe150c582f;hb=a0614e6e3b566827381121fdb4ee73268281a70d;hp=83b0d200cee33146c6f92b33a1de1bd0b34df0da;hpb=f4030653da8f5a0b3daebe640f485b3daf9ef091;p=dcpomatic.git diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index 83b0d200c..8b09b6fee 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington + Copyright (C) 2014-2015 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,22 +17,26 @@ */ -#include -#include +#include "font.h" #include "dcp_subtitle_content.h" +#include "raw_convert.h" +#include +#include +#include +#include #include "i18n.h" using std::string; using std::list; using boost::shared_ptr; -using dcp::raw_convert; +using boost::dynamic_pointer_cast; DCPSubtitleContent::DCPSubtitleContent (shared_ptr film, boost::filesystem::path path) : Content (film, path) , SubtitleContent (film, path) { - + } DCPSubtitleContent::DCPSubtitleContent (shared_ptr film, cxml::ConstNodePtr node, int version) @@ -47,8 +51,28 @@ void DCPSubtitleContent::examine (shared_ptr job) { Content::examine (job); - dcp::SubtitleContent sc (path (0), false); - _length = DCPTime::from_seconds (sc.latest_subtitle_out().to_seconds ()); + + shared_ptr sc = load (path (0)); + + /* Default to turning these subtitles on */ + set_use_subtitles (true); + + boost::mutex::scoped_lock lm (_mutex); + + shared_ptr iop = dynamic_pointer_cast (sc); + if (iop) { + _subtitle_language = iop->language (); + } + shared_ptr smpte = dynamic_pointer_cast (sc); + if (smpte) { + _subtitle_language = smpte->language().get_value_or (""); + } + + _length = DCPTime::from_seconds (sc->latest_subtitle_out().as_seconds ()); + + BOOST_FOREACH (shared_ptr i, sc->load_font_nodes ()) { + add_font (shared_ptr (new Font (i->id))); + } } DCPTime @@ -71,12 +95,6 @@ DCPSubtitleContent::technical_summary () const { return Content::technical_summary() + " - " + _("DCP XML subtitles"); } - -string -DCPSubtitleContent::information () const -{ - -} void DCPSubtitleContent::as_xml (xmlpp::Node* node) const