Rename TYPE_DEBUG_PLAYER to TYPE_DEBUG_VIDEO_VIEW.
[dcpomatic.git] / src / wx / simple_video_view.cc
index 6eabbc0b033018f11737e5648443ef4bbb6f77e4..d68ea48ddf679c38c818e8394e00004882ca4620 100644 (file)
@@ -85,10 +85,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,6 +130,15 @@ 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<dcpomatic::Rect<double> > 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();
 }
 
@@ -150,16 +159,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 ();