X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fanalyse_subtitles_job.cc;h=0b003427c54115af0b6771017c410af5b12d52d4;hb=c59981ce92898f6be6987f10ebb29161e36e6766;hp=df3cb3181a6b62ad66993c7c184c1cb541090640;hpb=dd9be86db6cde0afa5da0d1d1ac43b42e05dca26;p=dcpomatic.git diff --git a/src/lib/analyse_subtitles_job.cc b/src/lib/analyse_subtitles_job.cc index df3cb3181..0b003427c 100644 --- a/src/lib/analyse_subtitles_job.cc +++ b/src/lib/analyse_subtitles_job.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2020 Carl Hetherington + Copyright (C) 2020-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,25 +18,29 @@ */ + #include "analyse_subtitles_job.h" -#include "playlist.h" -#include "player.h" -#include "subtitle_analysis.h" #include "bitmap_text.h" +#include "image.h" +#include "player.h" +#include "playlist.h" #include "render_text.h" +#include "subtitle_analysis.h" #include "text_content.h" -#include "image.h" #include #include "i18n.h" -using std::string; + +using std::make_shared; using std::shared_ptr; +using std::string; using std::weak_ptr; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif + AnalyseSubtitlesJob::AnalyseSubtitlesJob (shared_ptr film, shared_ptr content) : Job (film) , _content (content) @@ -62,12 +66,12 @@ AnalyseSubtitlesJob::json_name () const void AnalyseSubtitlesJob::run () { - shared_ptr playlist (new Playlist()); - shared_ptr content = _content.lock (); + auto playlist = make_shared(); + auto content = _content.lock (); DCPOMATIC_ASSERT (content); playlist->add (_film, content); - shared_ptr player (new Player(_film, playlist)); + auto player = make_shared(_film, playlist); player->set_ignore_audio (); player->set_fast (); player->set_play_referenced (); @@ -90,11 +94,11 @@ AnalyseSubtitlesJob::run () void AnalyseSubtitlesJob::analyse (PlayerText text, TextType type) { - if (type != TEXT_OPEN_SUBTITLE) { + if (type != TextType::OPEN_SUBTITLE) { return; } - BOOST_FOREACH (BitmapText const& i, text.bitmap) { + for (auto const& i: text.bitmap) { if (!_bounding_box) { _bounding_box = i.rectangle; } else { @@ -105,7 +109,7 @@ AnalyseSubtitlesJob::analyse (PlayerText text, TextType type) if (!text.string.empty()) { /* We can provide dummy values for time and frame rate here as they are only used to calculate fades */ dcp::Size const frame = _film->frame_size(); - BOOST_FOREACH (PositionImage i, render_text(text.string, text.fonts, frame, dcpomatic::DCPTime(), 24)) { + for (auto i: render_text(text.string, text.fonts, frame, dcpomatic::DCPTime(), 24)) { dcpomatic::Rect rect ( double(i.position.x) / frame.width, double(i.position.y) / frame.height, double(i.image->size().width) / frame.width, double(i.image->size().height) / frame.height