X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fhints.cc;h=581d63972a1cac97b0c257243b0482a1fded12f5;hb=001ba1644fc6aa54f91fcaaa62ae7e5de2313bc1;hp=a9b9d6f54b34562b8bd6858edeac8c12ce8e66c5;hpb=6ca34bc1ef59dd206379f35eb940e607a59c9804;p=dcpomatic.git diff --git a/src/lib/hints.cc b/src/lib/hints.cc index a9b9d6f54..581d63972 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -53,7 +53,6 @@ using namespace dcpomatic; Hints::Hints (weak_ptr film) : _film (film) - , _thread (0) , _long_ccap (false) , _overlap_ccap (false) , _too_many_ccap_lines (false) @@ -65,27 +64,22 @@ Hints::Hints (weak_ptr film) void Hints::start () { - _thread = new boost::thread (bind(&Hints::thread, this)); + _thread = boost::thread (bind(&Hints::thread, this)); } Hints::~Hints () { - if (!_thread) { + if (!_thread.joinable()) { return; } try { - { - boost::mutex::scoped_lock lm (_mutex); - _stop = true; - } - _thread->interrupt (); - _thread->join (); + _stop = true; + _thread.interrupt (); + _thread.join (); } catch (...) { } - - delete _thread; } void @@ -117,7 +111,7 @@ Hints::thread () } if (film->audio_channels() < 6) { - hint (_("Your DCP has fewer than 6 audio channels. This may cause problems on some projectors.")); + hint (_("Your DCP has fewer than 6 audio channels. This may cause problems on some projectors. You may want to set the DCP to have 6 channels. It does not matter if your content has fewer channels, as DCP-o-matic will fill the extras with silence.")); } AudioProcessor const * ap = film->audio_processor(); @@ -241,7 +235,7 @@ Hints::thread () for (size_t i = 0; i < sample_peak.size(); ++i) { float const peak = max (sample_peak[i].peak, true_peak.empty() ? 0 : true_peak[i]); - float const peak_dB = 20 * log10 (peak) + an->gain_correction (film->playlist ()); + float const peak_dB = linear_to_db(peak) + an->gain_correction(film->playlist()); if (peak_dB > -3) { ch += dcp::raw_convert (short_audio_channel_name (i)) + ", "; } @@ -265,7 +259,7 @@ Hints::thread () emit (bind(boost::ref(Progress), _("Examining closed captions"))); - shared_ptr player (new Player (film, film->playlist ())); + shared_ptr player (new Player(film)); player->set_ignore_video (); player->set_ignore_audio (); player->Text.connect (bind(&Hints::text, this, _1, _2, _4)); @@ -279,11 +273,8 @@ Hints::thread () struct timeval now; gettimeofday (&now, 0); if ((seconds(now) - seconds(last_pulse)) > 1) { - { - boost::mutex::scoped_lock lm (_mutex); - if (_stop) { - break; - } + if (_stop) { + break; } emit (bind (boost::ref(Pulse))); last_pulse = now;