+
+dcpomatic::DCPTime
+VideoView::one_video_frame () const
+{
+ return dcpomatic::DCPTime::from_frames (1, video_frame_rate());
+}
+
+/** @return Time in ms until the next frame is due, or empty if nothing is due */
+optional<int>
+VideoView::time_until_next_frame () const
+{
+ if (length() == dcpomatic::DCPTime()) {
+ /* There's no content, so this doesn't matter */
+ return optional<int>();
+ }
+
+ dcpomatic::DCPTime const next = position() + one_video_frame();
+ dcpomatic::DCPTime const time = _viewer->audio_time().get_value_or(position());
+ if (next < time) {
+ return 0;
+ }
+ return (next.seconds() - time.seconds()) * 1000;
+}
+
+void
+VideoView::start ()
+{
+ boost::mutex::scoped_lock lm (_mutex);
+ _dropped = 0;
+ _errored = 0;
+}
+
+bool
+VideoView::refresh_metadata (shared_ptr<const Film> film, dcp::Size video_container_size, dcp::Size film_frame_size)
+{
+ pair<shared_ptr<PlayerVideo>, dcpomatic::DCPTime> pv = player_video ();
+ if (!pv.first) {
+ return false;
+ }
+
+ if (!pv.first->reset_metadata (film, video_container_size, film_frame_size)) {
+ return false;
+ }
+
+ update ();
+ return true;
+}
+