X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fvideo_waveform_plot.cc;h=cf07a2ea7fca10d5b19d1223de492a58d6887d8c;hb=dd9be86db6cde0afa5da0d1d1ac43b42e05dca26;hp=339689a2ebdbdaeea28ef45ab4482ec7520c93b3;hpb=54ef7357a87885ec329a25e758fb6b132816ec67;p=dcpomatic.git diff --git a/src/wx/video_waveform_plot.cc b/src/wx/video_waveform_plot.cc index 339689a2e..cf07a2ea7 100644 --- a/src/wx/video_waveform_plot.cc +++ b/src/wx/video_waveform_plot.cc @@ -19,31 +19,37 @@ */ #include "video_waveform_plot.h" -#include "control_film_viewer.h" +#include "film_viewer.h" #include "wx_util.h" #include "lib/image.h" #include "lib/film.h" #include "lib/dcp_video.h" +#include "lib/player_video.h" #include #include #include #include -#include +#include #include using std::cout; using std::min; using std::max; using std::string; -using boost::weak_ptr; -using boost::shared_ptr; +using std::weak_ptr; +using std::shared_ptr; +#if BOOST_VERSION >= 106100 +using namespace boost::placeholders; +#endif using dcp::locale_convert; + int const VideoWaveformPlot::_vertical_margin = 8; int const VideoWaveformPlot::_pixel_values = 4096; int const VideoWaveformPlot::_x_axis_width = 52; -VideoWaveformPlot::VideoWaveformPlot (wxWindow* parent, weak_ptr film, ControlFilmViewer* viewer) + +VideoWaveformPlot::VideoWaveformPlot (wxWindow* parent, weak_ptr film, weak_ptr viewer) : wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE) , _film (film) , _dirty (true) @@ -55,7 +61,10 @@ VideoWaveformPlot::VideoWaveformPlot (wxWindow* parent, weak_ptr fil SetDoubleBuffered (true); #endif - _viewer_connection = viewer->ImageChanged.connect (boost::bind (&VideoWaveformPlot::set_image, this, _1)); + shared_ptr fv = viewer.lock (); + DCPOMATIC_ASSERT (fv); + + _viewer_connection = fv->ImageChanged.connect (boost::bind (&VideoWaveformPlot::set_image, this, _1)); Bind (wxEVT_PAINT, boost::bind (&VideoWaveformPlot::paint, this)); Bind (wxEVT_SIZE, boost::bind (&VideoWaveformPlot::sized, this, _1)); @@ -183,14 +192,16 @@ note () } void -VideoWaveformPlot::set_image (weak_ptr image) +VideoWaveformPlot::set_image (shared_ptr image) { if (!_enabled) { return; } - shared_ptr pv = image.lock (); - _image = DCPVideo::convert_to_xyz (pv, boost::bind (¬e)); + /* We must copy the PlayerVideo here as we will call ::image() on it, potentially + with a different pixel_format than was used when ::prepare() was called. + */ + _image = DCPVideo::convert_to_xyz (image->shallow_copy(), boost::bind(¬e)); _dirty = true; Refresh (); }