+/** @return true if this PlayerVideo is definitely the same as another, false if it is probably not */
+bool
+PlayerVideo::same (shared_ptr<const PlayerVideo> other) const
+{
+ if (_crop != other->_crop ||
+ _fade != other->_fade ||
+ _inter_size != other->_inter_size ||
+ _out_size != other->_out_size ||
+ _eyes != other->_eyes ||
+ _part != other->_part ||
+ _colour_conversion != other->_colour_conversion ||
+ _video_range != other->_video_range) {
+ return false;
+ }
+
+ if ((!_text && other->_text) || (_text && !other->_text)) {
+ /* One has a text and the other doesn't */
+ return false;
+ }
+
+ if (_text && other->_text && !_text->same (other->_text.get ())) {
+ /* They both have texts but they are different */
+ return false;
+ }
+
+ /* Now neither has subtitles */
+
+ return _in->same (other->_in);
+}
+
+
+AVPixelFormat
+PlayerVideo::force (AVPixelFormat force_to)
+{
+ return force_to;
+}
+
+AVPixelFormat
+PlayerVideo::keep_xyz_or_rgb (AVPixelFormat p)
+{
+ return p == AV_PIX_FMT_XYZ12LE ? AV_PIX_FMT_XYZ12LE : AV_PIX_FMT_RGB48LE;
+}
+
+
+void
+PlayerVideo::prepare (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, Image::Alignment alignment, bool fast, bool proxy_only)
+{
+ _in->prepare (alignment, _inter_size);
+ boost::mutex::scoped_lock lm (_mutex);
+ if (!_image && !proxy_only) {
+ make_image (pixel_format, video_range, fast);
+ }
+}
+
+
+size_t
+PlayerVideo::memory_used () const
+{
+ return _in->memory_used();
+}
+
+
+/** @return Shallow copy of this; _in and _text are shared between the original and the copy */
+shared_ptr<PlayerVideo>
+PlayerVideo::shallow_copy () const
+{
+ return std::make_shared<PlayerVideo>(
+ _in,
+ _crop,
+ _fade,
+ _inter_size,
+ _out_size,
+ _eyes,
+ _part,
+ _colour_conversion,
+ _video_range,
+ _content,
+ _video_frame,
+ _error
+ );
+}
+
+
+/** Re-read crop, fade, inter/out size, colour conversion and video range from our content.
+ * @return true if this was possible, false if not.
+ */
+bool
+PlayerVideo::reset_metadata (shared_ptr<const Film> film, dcp::Size player_video_container_size)
+{
+ auto content = _content.lock();
+ if (!content || !_video_frame) {
+ return false;
+ }
+
+ _crop = content->video->actual_crop();
+ _fade = content->video->fade(film, _video_frame.get());
+ auto const size = content->video->scaled_size(film->frame_size());
+ if (!size) {
+ return false;
+ }
+
+ _inter_size = scale_for_display(
+ *size,
+ player_video_container_size,
+ film->frame_size(),
+ content->video->pixel_quanta()
+ );
+ _out_size = player_video_container_size;
+ _colour_conversion = content->video->colour_conversion();
+ _video_range = content->video->range();
+
+ return true;
+}