X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ffilm_viewer.cc;h=90f8c9fd2d885c20c974c13eb96835ade8b6866f;hb=8ae2dcecc765df1a98a5dc686473ac46f5e08c3e;hp=01963372061d8ddef25851b78a375c036b8e2cb3;hpb=ed68bfad5c795afb342c5228f3c1dc7770a6d646;p=dcpomatic.git diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 019633720..90f8c9fd2 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -121,8 +121,9 @@ FilmViewer::set_film (shared_ptr film) } _film = film; - - FilmChanged (); + _video_position = DCPTime (); + _player_video.first.reset (); + _player_video.second = DCPTime (); _frame.reset (); _closed_captions_dialog->clear (); @@ -193,7 +194,7 @@ FilmViewer::recreate_butler () map.set (dcp::RS, 1, 1 / sqrt(2)); // Rs -> Rt } - _butler.reset (new Butler (_player, _film->log(), map, _audio_channels)); + _butler.reset (new Butler(_player, map, _audio_channels, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true)); if (!Config::instance()->sound() && !_audio.isStreamOpen()) { _butler->disable_audio (); } @@ -271,10 +272,7 @@ FilmViewer::display_player_video () * image and convert it (from whatever the user has said it is) to RGB. */ - _frame = _player_video.first->image ( - bind (&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), - false, true - ); + _frame = _player_video.first->image (bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true); ImageChanged (_player_video.first); @@ -300,6 +298,8 @@ FilmViewer::timer () if (next >= _film->length()) { stop (); + Finished (); + return; } _timer.Start (max ((next.seconds() - time().seconds()) * 1000, 1.0), wxTIMER_ONE_SHOT); @@ -309,6 +309,22 @@ FilmViewer::timer () } } +bool +FilmViewer::maybe_draw_background_image (wxPaintDC& dc) +{ +#ifdef DCPOMATIC_VARIANT_SWAROOP + optional bg = Config::instance()->player_background_image(); + if (bg) { + wxImage image (std_to_wx(bg->string())); + wxBitmap bitmap (image); + dc.DrawBitmap (bitmap, max(0, (_panel_size.width - image.GetSize().GetWidth()) / 2), max(0, (_panel_size.height - image.GetSize().GetHeight()) / 2)); + return true; + } +#endif + + return false; +} + void FilmViewer::paint_panel () { @@ -316,14 +332,11 @@ FilmViewer::paint_panel () if (!_frame || !_film || !_out_size.width || !_out_size.height || _out_size != _frame->size()) { dc.Clear (); -#ifdef DCPOMATIC_VARIANT_SWAROOP - optional bg = Config::instance()->player_background_image(); - if (bg) { - wxImage image (std_to_wx(bg->string())); - wxBitmap bitmap (image); - dc.DrawBitmap (bitmap, max(0, (_panel_size.width - image.GetSize().GetWidth()) / 2), max(0, (_panel_size.height - image.GetSize().GetHeight()) / 2)); - } -#endif + maybe_draw_background_image (dc); + return; + } + + if (_video_position == DCPTime() && maybe_draw_background_image (dc)) { return; } @@ -534,7 +547,7 @@ FilmViewer::quick_refresh () return false; } - if (!_player_video.first->reset_metadata (_player->video_container_size(), _film->frame_size())) { + if (!_player_video.first->reset_metadata (_film, _player->video_container_size(), _film->frame_size())) { return false; }