X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fhints.cc;h=e936332a27b6465bbdadd9c9d0cfa3eb79dabc5e;hb=e3c7656f9dc0acbaf518c051b847ee2e4eb7ba23;hp=ad81e8d59eee1e7499e151c091e184c5d1f56331;hpb=89ec77ff82b231445f2c5a4cf50d86e6cd910332;p=dcpomatic.git diff --git a/src/lib/hints.cc b/src/lib/hints.cc index ad81e8d59..e936332a2 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,18 @@ 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) { - return; - } + boost::this_thread::disable_interruption dis; try { - { - boost::mutex::scoped_lock lm (_mutex); - _stop = true; - } - _thread->interrupt (); - _thread->join (); - } catch (...) { - - } - - delete _thread; + _stop = true; + _thread.interrupt (); + _thread.join (); + } catch (...) {} } void @@ -129,10 +119,10 @@ Hints::thread () int scope = 0; BOOST_FOREACH (shared_ptr i, content) { if (i->video) { - Ratio const * r = i->video->scale().ratio (); + Ratio const * r = Ratio::nearest_from_ratio(i->video->scaled_size(film->frame_size()).ratio()); if (r && r->id() == "239") { ++scope; - } else if (r && r->id() != "239" && r->id() != "190") { + } else if (r && r->id() != "239" && r->id() != "235" && r->id() != "190") { ++narrower_than_scope; } } @@ -145,7 +135,7 @@ Hints::thread () } if (!scope && narrower_than_scope && film_container == "239") { - hint (_("All of your content is 2.35:1 or narrower but your DCP's container is Scope (2.39:1). This will pillar-box your content. You may prefer to set your DCP's container to have the same ratio as your content.")); + hint (_("All of your content narrower than 1.90:1 but your DCP's container is Scope (2.39:1). This will pillar-box your content. You may prefer to set your DCP's container to have the same ratio as your content.")); } if (film_container != "185" && film_container != "239" && film_container != "190") { @@ -241,7 +231,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 +255,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 +269,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;