add_accelerators ();
}
+ ~DOMFrame()
+ {
+ /* This holds a reference to FilmViewer, so get rid of it first */
+ _video_waveform_dialog.reset();
+ }
+
void add_accelerators ()
{
#ifdef __WXOSX__
});
/* Also update the dialog and view when we're looking at a different frame */
- _auto_crop_viewer_connection = _viewer.ImageChanged.connect([this, guess_crop_for_content, update_viewer](shared_ptr<PlayerVideo>) {
+ _auto_crop_viewer_connection = _viewer.ImageChanged.connect([this, guess_crop_for_content, update_viewer]() {
auto const crop = guess_crop_for_content();
_auto_crop_dialog->set(crop);
update_viewer(crop);
void
FilmViewer::image_changed (shared_ptr<PlayerVideo> pv)
{
- emit (boost::bind(boost::ref(ImageChanged), pv));
+ _last_image = pv;
+ emit(boost::bind(boost::ref(ImageChanged)));
+}
+
+
+shared_ptr<const PlayerVideo>
+FilmViewer::last_image() const
+{
+ return _last_image;
}
Frame average_latency() const;
- boost::signals2::signal<void (std::shared_ptr<PlayerVideo>)> ImageChanged;
+ /** The image we are viewing changed: call last_image() to get the image */
+ boost::signals2::signal<void ()> ImageChanged;
+ std::shared_ptr<const PlayerVideo> last_image() const;
+
boost::signals2::signal<void ()> Started;
boost::signals2::signal<void ()> Stopped;
/** While playing back we reached the end of the film (emitted from GUI thread) */
boost::optional<dcpomatic::Rect<float>> _crop_guess;
+ /** Keep track of the image that we were talking about with the last
+ * emission of ImageChanged.
+ */
+ std::shared_ptr<const PlayerVideo> _last_image;
+
boost::signals2::scoped_connection _config_changed_connection;
};
VideoWaveformPlot::VideoWaveformPlot(wxWindow* parent, weak_ptr<const Film> film, FilmViewer& viewer)
: wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE)
, _film (film)
+ , _viewer(viewer)
{
#ifndef __WXOSX__
SetDoubleBuffered (true);
#endif
- _viewer_connection = viewer.ImageChanged.connect(boost::bind(&VideoWaveformPlot::set_image, this, _1));
+ _viewer_connection = _viewer.ImageChanged.connect(boost::bind(&VideoWaveformPlot::set_image, this));
Bind (wxEVT_PAINT, boost::bind(&VideoWaveformPlot::paint, this));
Bind (wxEVT_SIZE, boost::bind(&VideoWaveformPlot::sized, this, _1));
void
-VideoWaveformPlot::set_image (shared_ptr<PlayerVideo> image)
+VideoWaveformPlot::set_image()
{
if (!_enabled) {
return;
/* 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());
+ _image = DCPVideo::convert_to_xyz(_viewer.last_image()->shallow_copy());
_dirty = true;
Refresh ();
}
void paint ();
void sized (wxSizeEvent &);
void create_waveform ();
- void set_image (std::shared_ptr<PlayerVideo>);
+ void set_image();
void mouse_moved (wxMouseEvent &);
std::weak_ptr<const Film> _film;
int _component = 0;
int _contrast = 0;
+ FilmViewer& _viewer;
+
static int const _vertical_margin;
static int const _pixel_values;
static int const _x_axis_width;