X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fvideo_waveform_plot.cc;h=c6fa883fa871c227b321dea92819d126998cd922;hb=3044ef060894c62e8a1cef15ad14078001093982;hp=c3d44a0cd265afa9c1324c396d9d8e4800132640;hpb=23583dfb56181c76126e652042e9d1940367aa27;p=dcpomatic.git diff --git a/src/wx/video_waveform_plot.cc b/src/wx/video_waveform_plot.cc index c3d44a0cd..c6fa883fa 100644 --- a/src/wx/video_waveform_plot.cc +++ b/src/wx/video_waveform_plot.cc @@ -19,10 +19,12 @@ */ #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 @@ -42,7 +44,7 @@ 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) @@ -54,7 +56,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)); @@ -189,7 +194,11 @@ VideoWaveformPlot::set_image (weak_ptr image) } shared_ptr pv = image.lock (); - _image = DCPVideo::convert_to_xyz (pv, boost::bind (¬e)); + DCPOMATIC_ASSERT (pv); + /* 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 (pv->shallow_copy(), boost::bind (¬e)); _dirty = true; Refresh (); }