X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fwx%2Fsimple_video_view.cc;h=97e582ce7fcd4cad8c848e509d67152bf12710fd;hb=refs%2Ftags%2Fv2.15.104;hp=22e4db887ef7cf11ecebfadba2f9e7a4cff2ffc5;hpb=b3b371294ed5e6cc18ef64ba1b06ca76726b903a;p=dcpomatic.git diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc index 22e4db887..97e582ce7 100644 --- a/src/wx/simple_video_view.cc +++ b/src/wx/simple_video_view.cc @@ -33,8 +33,12 @@ using std::max; using std::string; using boost::optional; using boost::shared_ptr; +#if BOOST_VERSION >= 106100 +using namespace boost::placeholders; +#endif using namespace dcpomatic; + SimpleVideoView::SimpleVideoView (FilmViewer* viewer, wxWindow* parent) : VideoView (viewer) { @@ -85,10 +89,10 @@ SimpleVideoView::paint () #ifdef DCPOMATIC_VARIANT_SWAROOP DCPTime const period = DCPTime::from_seconds(Config::instance()->player_watermark_period() * 60); - int64_t n = _viewer->position().get() / period.get(); + int64_t n = position().get() / period.get(); DCPTime from(n * period.get()); DCPTime to = from + DCPTime::from_seconds(Config::instance()->player_watermark_duration() / 1000.0); - if (from <= _viewer->position() && _viewer->position() <= to) { + if (from <= position() && position() <= to) { if (!_in_watermark) { _in_watermark = true; _watermark_x = rand() % panel_size.GetWidth(); @@ -130,13 +134,22 @@ SimpleVideoView::paint () dc.SetBrush (*wxTRANSPARENT_BRUSH); dc.DrawRectangle (_inter_position.x, _inter_position.y + (panel_size.GetHeight() - out_size.height) / 2, _inter_size.width, _inter_size.height); } + + optional > subs = _viewer->outline_subtitles(); + if (subs) { + wxPen p (wxColour(0, 255, 0), 2); + dc.SetPen (p); + dc.SetBrush (*wxTRANSPARENT_BRUSH); + dc.DrawRectangle (subs->x * out_size.width, subs->y * out_size.height, subs->width * out_size.width, subs->height * out_size.height); + } + _state_timer.unset(); } void -SimpleVideoView::update () +SimpleVideoView::refresh_panel () { - _state_timer.set ("update-view"); + _state_timer.set ("refresh-panel"); _panel->Refresh (); _panel->Update (); _state_timer.unset (); @@ -150,16 +163,15 @@ SimpleVideoView::timer () } display_next_frame (false); - DCPTime const next = _viewer->position() + _viewer->one_video_frame(); + DCPTime const next = position() + _viewer->one_video_frame(); if (next >= length()) { - _viewer->stop (); - _viewer->Finished (); + _viewer->finished (); return; } - LOG_DEBUG_PLAYER("%1 -> %2; delay %3", next.seconds(), _viewer->time().seconds(), max((next.seconds() - _viewer->time().seconds()) * 1000, 1.0)); - _timer.Start (time_until_next_frame(), wxTIMER_ONE_SHOT); + LOG_DEBUG_VIDEO_VIEW("%1 -> %2; delay %3", next.seconds(), _viewer->time().seconds(), max((next.seconds() - _viewer->time().seconds()) * 1000, 1.0)); + _timer.Start (max(1, time_until_next_frame().get_value_or(0)), wxTIMER_ONE_SHOT); if (_viewer->butler()) { _viewer->butler()->rethrow (); @@ -193,7 +205,7 @@ SimpleVideoView::display_next_frame (bool non_blocking) } } - display_player_video (); + update (); try { _viewer->butler()->rethrow (); @@ -205,11 +217,11 @@ SimpleVideoView::display_next_frame (bool non_blocking) } void -SimpleVideoView::display_player_video () +SimpleVideoView::update () { if (!player_video().first) { set_image (shared_ptr()); - update (); + refresh_panel (); return; } @@ -252,5 +264,5 @@ SimpleVideoView::display_player_video () _inter_position = player_video().first->inter_position (); _inter_size = player_video().first->inter_size (); - update (); + refresh_panel (); }