diff options
Diffstat (limited to 'src/lib/dcp_subtitle_content.cc')
| -rw-r--r-- | src/lib/dcp_subtitle_content.cc | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index 21159fcac..ac8c4245b 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -38,22 +38,25 @@ using std::list; using std::make_shared; using std::shared_ptr; using std::string; +using std::vector; using boost::optional; using namespace dcpomatic; -DCPSubtitleContent::DCPSubtitleContent (boost::filesystem::path path) - : Content (path) +DCPSubtitleContent::DCPSubtitleContent(boost::filesystem::path path) + : Content(path) { - text.push_back (make_shared<TextContent>(this, TextType::OPEN_SUBTITLE, TextType::OPEN_SUBTITLE)); + text = vector<shared_ptr<TextContent>>{make_shared<TextContent>(this, TextType::OPEN_SUBTITLE, TextType::OPEN_SUBTITLE)}; + /* Default to turning these subtitles on */ + only_text()->set_use(true); } DCPSubtitleContent::DCPSubtitleContent(cxml::ConstNodePtr node, boost::optional<boost::filesystem::path> film_directory, int version) - : Content (node, film_directory) - , _length (node->number_child<ContentTime::Type> ("Length")) + : Content(node, film_directory) + , _length(node->number_child<ContentTime::Type>("Length")) { list<string> notes; - text = TextContent::from_xml (this, node, version, notes); + text = TextContent::from_xml(this, node, version, notes); } void @@ -63,20 +66,16 @@ DCPSubtitleContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bo auto subtitle_asset = load(path(0)); - auto iop = dynamic_pointer_cast<dcp::InteropTextAsset>(subtitle_asset); - auto smpte = dynamic_pointer_cast<dcp::SMPTETextAsset>(subtitle_asset); - if (smpte) { + if (auto smpte = dynamic_pointer_cast<dcp::SMPTETextAsset>(subtitle_asset)) { set_video_frame_rate(film, smpte->edit_rate().numerator); } - boost::mutex::scoped_lock lm (_mutex); - - /* Default to turning these subtitles on */ - only_text()->set_use (true); + boost::mutex::scoped_lock lm(_mutex); _length = ContentTime::from_seconds(subtitle_asset->latest_text_out().as_seconds()); subtitle_asset->fix_empty_font_ids(); + only_text()->clear_fonts(); add_fonts(only_text(), subtitle_asset); } @@ -115,26 +114,26 @@ DCPSubtitleContent::add_fonts(shared_ptr<TextContent> content, shared_ptr<dcp::T DCPTime -DCPSubtitleContent::full_length (shared_ptr<const Film> film) const +DCPSubtitleContent::full_length(shared_ptr<const Film> film) const { - FrameRateChange const frc (film, shared_from_this()); - return DCPTime (_length, frc); + FrameRateChange const frc(film, shared_from_this()); + return DCPTime(_length, frc); } DCPTime -DCPSubtitleContent::approximate_length () const +DCPSubtitleContent::approximate_length() const { - return DCPTime (_length, FrameRateChange()); + return DCPTime(_length, FrameRateChange()); } string -DCPSubtitleContent::summary () const +DCPSubtitleContent::summary() const { return path_summary() + " " + _("[subtitles]"); } string -DCPSubtitleContent::technical_summary () const +DCPSubtitleContent::technical_summary() const { return Content::technical_summary() + " - " + _("DCP XML subtitles"); } |
