Fix non-updating crop settings (#1421).
authorCarl Hetherington <cth@carlh.net>
Tue, 27 Nov 2018 23:24:33 +0000 (23:24 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 27 Nov 2018 23:24:33 +0000 (23:24 +0000)
src/lib/player_video.cc
src/lib/player_video.h

index 6c0cf20c1f807b0c3b5fafcc2ff79b6d1874ee55..1df8fb3e8745f370974b8c09740204a37d7da089 100644 (file)
@@ -105,10 +105,10 @@ PlayerVideo::set_text (PositionImage image)
 shared_ptr<Image>
 PlayerVideo::image (function<AVPixelFormat (AVPixelFormat)> pixel_format, bool aligned, bool fast) const
 {
-       /* XXX: this assumes that image() and prepare() are only ever called with the same parameters */
+       /* XXX: this assumes that image() and prepare() are only ever called with the same parameters (except crop) */
 
        boost::mutex::scoped_lock lm (_mutex);
-       if (!_image) {
+       if (!_image || _crop != _image_crop) {
                make_image (pixel_format, aligned, fast);
        }
        return _image;
@@ -124,6 +124,8 @@ PlayerVideo::image (function<AVPixelFormat (AVPixelFormat)> pixel_format, bool a
 void
 PlayerVideo::make_image (function<AVPixelFormat (AVPixelFormat)> pixel_format, bool aligned, bool fast) const
 {
+       _image_crop = _crop;
+
        pair<shared_ptr<Image>, int> prox = _in->image (_inter_size);
        shared_ptr<Image> im = prox.first;
        int const reduce = prox.second;
index a874fd3b262a0afb28459e7c44cbab31c6c123d0..1e214beeaaaf1fff6a1b9b06ba087f4b647f9d95 100644 (file)
@@ -126,6 +126,8 @@ private:
 
        mutable boost::mutex _mutex;
        mutable boost::shared_ptr<Image> _image;
+       /** crop that was used to make _image */
+       mutable Crop _image_crop;
 };
 
 #endif