X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplaylist.cc;h=703a14663448c5468dc10910a3ca5c978d3a96df;hb=c1bae7f0dac684147e00f5f51dcd5544ba13ee53;hp=9cc1789d135d5c38a66e416b4c90888421d7142e;hpb=5fd5e78c51bd5630f6777001db5aa25103218c22;p=dcpomatic.git diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 9cc1789d1..703a14663 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -94,19 +94,14 @@ Playlist::content_changed (weak_ptr c, int p) } string -Playlist::video_digest () const +Playlist::video_identifier () const { string t; for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) { - if (!dynamic_pointer_cast (*i)) { - continue; - } - - t += (*i)->digest (); - shared_ptr fc = dynamic_pointer_cast (*i); - if (fc && fc->subtitle_stream()) { - t += fc->subtitle_stream()->id; + shared_ptr vc = dynamic_pointer_cast (*i); + if (vc) { + t += vc->identifier (); } } @@ -226,20 +221,21 @@ Playlist::best_dcp_frame_rate () const candidates.push_back (FrameRateCandidate (float (*i) * 2, *i)); } - /* Pick the best one, bailing early if we hit an exact match */ + /* Pick the best one */ float error = std::numeric_limits::max (); optional best; list::iterator i = candidates.begin(); while (i != candidates.end()) { - float this_error = std::numeric_limits::max (); + float this_error = 0; for (ContentList::const_iterator j = _content.begin(); j != _content.end(); ++j) { shared_ptr vc = dynamic_pointer_cast (*j); if (!vc) { continue; } - this_error += fabs (i->source - vc->video_frame_rate ()); + /* Use the largest difference between DCP and source as the "error" */ + this_error = max (this_error, float (fabs (i->source - vc->video_frame_rate ()))); } if (this_error < error) {