X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_subtitle_content.cc;h=8e24cb4c660d43f28ed2e07e1fa68df43eecc512;hb=4685843ba4194d8b59ed6eb1335ae27052178726;hp=83b0d200cee33146c6f92b33a1de1bd0b34df0da;hpb=3e12c68dc0451e73b5bc1a84d1d70f4999f7b4b5;p=dcpomatic.git diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index 83b0d200c..8e24cb4c6 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,27 @@ */ -#include -#include +#include "font.h" #include "dcp_subtitle_content.h" +#include "raw_convert.h" +#include +#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 +52,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 +96,6 @@ DCPSubtitleContent::technical_summary () const { return Content::technical_summary() + " - " + _("DCP XML subtitles"); } - -string -DCPSubtitleContent::information () const -{ - -} void DCPSubtitleContent::as_xml (xmlpp::Node* node) const