Various alignment adjustments.
[dcpomatic.git] / src / lib / player_video.cc
index d3a2868293e8adac8ba74cfe058f8b9b7fb223ee..a687e7ea536a1622c4f037dfce1cdec3cdd442c7 100644 (file)
@@ -121,6 +121,14 @@ PlayerVideo::image (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoR
        return _image;
 }
 
+
+shared_ptr<const Image>
+PlayerVideo::raw_image () const
+{
+       return _in->image(false, _inter_size).image;
+}
+
+
 /** Create an image for this frame.  A lock must be held on _mutex.
  *  @param pixel_format Function which is called to decide what pixel format the output image should be;
  *  it is passed the pixel format of the input image from the ImageProxy, and should return the desired
@@ -136,7 +144,7 @@ PlayerVideo::make_image (function<AVPixelFormat (AVPixelFormat)> pixel_format, V
        _image_out_size = _out_size;
        _image_fade = _fade;
 
-       auto prox = _in->image (_inter_size);
+       auto prox = _in->image (true, _inter_size);
        _error = prox.error;
 
        auto total_crop = _crop;
@@ -176,7 +184,7 @@ PlayerVideo::make_image (function<AVPixelFormat (AVPixelFormat)> pixel_format, V
                );
 
        if (_text) {
-               _image->alpha_blend (Image::ensure_aligned (_text->image), _text->position);
+               _image->alpha_blend (Image::ensure_aligned(_text->image, true), _text->position);
        }
 
        if (_fade) {
@@ -230,7 +238,7 @@ PlayerVideo::has_j2k () const
                return false;
        }
 
-       return _crop == Crop() && _out_size == j2k->size() && !_text && !_fade && !_colour_conversion;
+       return _crop == Crop() && _out_size == j2k->size() && _inter_size == j2k->size() && !_text && !_fade && !_colour_conversion;
 }
 
 shared_ptr<const dcp::Data>
@@ -290,11 +298,11 @@ PlayerVideo::keep_xyz_or_rgb (AVPixelFormat p)
 }
 
 void
-PlayerVideo::prepare (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast)
+PlayerVideo::prepare (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast, bool proxy_only)
 {
-       _in->prepare (_inter_size);
+       _in->prepare (aligned, _inter_size);
        boost::mutex::scoped_lock lm (_mutex);
-       if (!_image) {
+       if (!_image && !proxy_only) {
                make_image (pixel_format, video_range, aligned, fast);
        }
 }