Make terminate_threads() less likely to leave _threads containing invalid pointers.
[dcpomatic.git] / src / lib / player_video.cc
index 6c0cf20c1f807b0c3b5fafcc2ff79b6d1874ee55..e36eb1984438add8e0ca4ac98f4d4daf7276b1dd 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, inter size, out size, fade) */
 
        boost::mutex::scoped_lock lm (_mutex);
-       if (!_image) {
+       if (!_image || _crop != _image_crop || _inter_size != _image_inter_size || _out_size != _image_out_size || _fade != _image_fade) {
                make_image (pixel_format, aligned, fast);
        }
        return _image;
@@ -124,6 +124,11 @@ 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;
+       _image_inter_size = _inter_size;
+       _image_out_size = _out_size;
+       _image_fade = _fade;
+
        pair<shared_ptr<Image>, int> prox = _in->image (_inter_size);
        shared_ptr<Image> im = prox.first;
        int const reduce = prox.second;
@@ -239,7 +244,7 @@ bool
 PlayerVideo::same (shared_ptr<const PlayerVideo> other) const
 {
        if (_crop != other->_crop ||
-           _fade.get_value_or(0) != other->_fade.get_value_or(0) ||
+           _fade != other->_fade ||
            _inter_size != other->_inter_size ||
            _out_size != other->_out_size ||
            _eyes != other->_eyes ||