X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fvideo_view.cc;h=e1a8b7306681b12972b63abb5c5780f92ef0cf2b;hb=046d84f45621f7e128cb30160a315f98881c6f4b;hp=22cad3979dbdc44cb18375f51e9487aa2a7ee09c;hpb=805487369e57e5eb57911805ba6de78b653d79ad;p=dcpomatic.git diff --git a/src/wx/video_view.cc b/src/wx/video_view.cc index 22cad3979..e1a8b7306 100644 --- a/src/wx/video_view.cc +++ b/src/wx/video_view.cc @@ -26,6 +26,7 @@ void VideoView::clear () { + boost::mutex::scoped_lock lm (_mutex); _player_video.first.reset (); _player_video.second = dcpomatic::DCPTime (); } @@ -39,6 +40,8 @@ VideoView::get_next_frame (bool non_blocking) DCPOMATIC_ASSERT (_viewer->butler()); _viewer->_gets++; + boost::mutex::scoped_lock lm (_mutex); + do { Butler::Error e; _player_video = _viewer->butler()->get_video (!non_blocking, &e); @@ -60,3 +63,23 @@ VideoView::get_next_frame (bool non_blocking) return true; } + +dcpomatic::DCPTime +VideoView::one_video_frame () const +{ + return dcpomatic::DCPTime::from_frames (1, film()->video_frame_rate()); +} + +/* XXX_b: comment */ +int +VideoView::time_until_next_frame () const +{ + dcpomatic::DCPTime const next = position() + one_video_frame(); + dcpomatic::DCPTime const time = _viewer->audio_time().get_value_or(position()); + std::cout << to_string(next) << " " << to_string(time) << " " << ((next.seconds() - time.seconds()) * 1000) << "\n"; + if (next < time) { + return 0; + } + return (next.seconds() - time.seconds()) * 1000; +} +