Fix video waveform view with GL backend.
authorCarl Hetherington <cth@carlh.net>
Thu, 5 Nov 2020 21:12:27 +0000 (22:12 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 5 Nov 2020 21:56:23 +0000 (22:56 +0100)
src/wx/film_viewer.cc
src/wx/film_viewer.h
src/wx/gl_video_view.cc
src/wx/simple_video_view.cc
src/wx/video_waveform_plot.cc
src/wx/video_waveform_plot.h

index ff278d8a958f13882bf6ff49af78f52fb419bba9..997fe88c8b8c4dba04c7885a79ce54e4261a65ac 100644 (file)
@@ -732,3 +732,10 @@ FilmViewer::content_change (ChangeType type, int property)
        }
 }
 
+
+void
+FilmViewer::image_changed (shared_ptr<PlayerVideo> pv)
+{
+       emit (boost::bind(boost::ref(ImageChanged), pv));
+}
+
index 11a4731fca82648c1fbf5a47593d1572d51bd526..a0edafe955e38912de638dc98f86ee3a36fb7f92 100644 (file)
@@ -140,12 +140,13 @@ public:
                return _closed_captions_dialog;
        }
        void finished ();
+       void image_changed (boost::shared_ptr<PlayerVideo> video);
 
        bool pending_idle_get () const {
                return _idle_get;
        }
 
-       boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged;
+       boost::signals2::signal<void (boost::shared_ptr<PlayerVideo>)> ImageChanged;
        boost::signals2::signal<void (dcpomatic::DCPTime)> Started;
        boost::signals2::signal<void (dcpomatic::DCPTime)> Stopped;
        /** While playing back we reached the end of the film (emitted from GUI thread) */
index d3388282181bba2073a66278d260ac0863f587b0..38270a7b7ba1fc42c6ca2fa7e99d493bc702ba74 100644 (file)
@@ -327,6 +327,7 @@ GLVideoView::set_image_and_draw ()
        if (pv) {
                set_image (pv->image(bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true));
                draw (pv->inter_position(), pv->inter_size());
+               _viewer->image_changed (pv);
        }
 }
 
index 97e582ce7fcd4cad8c848e509d67152bf12710fd..2e79deee8c1f689f571bc8bf4cb6b471a6a3bcfd 100644 (file)
@@ -258,7 +258,7 @@ SimpleVideoView::update ()
                );
 
        _state_timer.set ("ImageChanged");
-       _viewer->ImageChanged (player_video().first);
+       _viewer->image_changed (player_video().first);
        _state_timer.unset ();
 
        _inter_position = player_video().first->inter_position ();
index 9674d0af27015879bccd38fb5cc7b4941c91442b..866f5f568a528f2d769593bb16f23842f151dd08 100644 (file)
@@ -192,18 +192,16 @@ note ()
 }
 
 void
-VideoWaveformPlot::set_image (weak_ptr<PlayerVideo> image)
+VideoWaveformPlot::set_image (shared_ptr<PlayerVideo> image)
 {
        if (!_enabled) {
                return;
        }
 
-       shared_ptr<PlayerVideo> pv = image.lock ();
-       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 (&note));
+       _image = DCPVideo::convert_to_xyz (image->shallow_copy(), boost::bind(&note));
        _dirty = true;
        Refresh ();
 }
index 1e38f58906b35d4b7f5d7b00802bcb1126943785..f107f0399dcd21d97be622df483c6b9d1b9670d9 100644 (file)
@@ -55,7 +55,7 @@ private:
        void paint ();
        void sized (wxSizeEvent &);
        void create_waveform ();
-       void set_image (boost::weak_ptr<PlayerVideo>);
+       void set_image (boost::shared_ptr<PlayerVideo>);
        void mouse_moved (wxMouseEvent &);
 
        boost::weak_ptr<const Film> _film;