Pass Piece instead of Content.
authorCarl Hetherington <cth@carlh.net>
Mon, 22 Jun 2020 23:29:48 +0000 (01:29 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 22 Jun 2020 23:29:48 +0000 (01:29 +0200)
src/lib/player.cc
src/lib/player_video.cc
src/lib/player_video.h
test/client_server_test.cc

index 0cf47263d92d2657c89735237a0f05987b5f9f69..fbf3c2674fce1581857b5f545723e8eb673599b3 100644 (file)
@@ -371,7 +371,7 @@ Player::black_player_video_frame (Eyes eyes) const
                        PART_WHOLE,
                        PresetColourConversion::all().front().conversion,
                        VIDEO_RANGE_FULL,
-                       boost::weak_ptr<Content>(),
+                       boost::weak_ptr<Piece>(),
                        boost::optional<Frame>(),
                        false
                )
@@ -823,7 +823,7 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
                        video.part,
                        piece->video_colour_conversion(),
                        piece->video_range(),
-                       piece->content,
+                       piece,
                        video.frame,
                        false
                        )
index 10e798ed510644a86e03d11249d737139268d3b0..9ea987634d37ef0558a7229a6edc3ca42a2e52bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -25,6 +25,7 @@
 #include "image_proxy.h"
 #include "j2k_image_proxy.h"
 #include "film.h"
+#include "piece.h"
 #include <dcp/raw_convert.h>
 extern "C" {
 #include <libavutil/pixfmt.h>
@@ -53,7 +54,7 @@ PlayerVideo::PlayerVideo (
        Part part,
        optional<ColourConversion> colour_conversion,
        VideoRange video_range,
-       weak_ptr<Content> content,
+       weak_ptr<Piece> piece,
        optional<Frame> video_frame,
        bool error
        )
@@ -66,7 +67,7 @@ PlayerVideo::PlayerVideo (
        , _part (part)
        , _colour_conversion (colour_conversion)
        , _video_range (video_range)
-       , _content (content)
+       , _piece (piece)
        , _video_frame (video_frame)
        , _error (error)
 {
@@ -319,7 +320,7 @@ PlayerVideo::shallow_copy () const
                        _part,
                        _colour_conversion,
                        _video_range,
-                       _content,
+                       _piece,
                        _video_frame,
                        _error
                        )
@@ -332,17 +333,17 @@ PlayerVideo::shallow_copy () const
 bool
 PlayerVideo::reset_metadata (shared_ptr<const Film> film, dcp::Size video_container_size, dcp::Size film_frame_size)
 {
-       shared_ptr<Content> content = _content.lock();
-       if (!content || !_video_frame) {
+       shared_ptr<Piece> piece = _piece.lock();
+       if (!piece || !_video_frame) {
                return false;
        }
 
-       _crop = content->video->crop();
-       _fade = content->video->fade(film, _video_frame.get());
-       _inter_size = scale_for_display(content->video->scaled_size(film_frame_size), video_container_size, film_frame_size);
+       _crop = piece->video_crop();
+       _fade = piece->video_fade(film, _video_frame.get());
+       _inter_size = scale_for_display(piece->video_scaled_size(film_frame_size), video_container_size, film_frame_size);
        _out_size = video_container_size;
-       _colour_conversion = content->video->colour_conversion();
-       _video_range = content->video->range();
+       _colour_conversion = piece->video_colour_conversion();
+       _video_range = piece->video_range();
 
        return true;
 }
index 1a4a01d58cd8af449647a7f222a66e83f16b7146..6a1daef754e47754148dc1d114f9964b41967688 100644 (file)
@@ -38,6 +38,7 @@ class Image;
 class ImageProxy;
 class Film;
 class Socket;
+class Piece;
 
 /** Everything needed to describe a video frame coming out of the player, but with the
  *  bits still their raw form.  We may want to combine the bits on a remote machine,
@@ -56,7 +57,7 @@ public:
                Part,
                boost::optional<ColourConversion>,
                VideoRange video_range,
-               boost::weak_ptr<Content>,
+               boost::weak_ptr<Piece>,
                boost::optional<Frame>,
                bool error
                );
@@ -105,8 +106,8 @@ public:
 
        size_t memory_used () const;
 
-       boost::weak_ptr<Content> content () const {
-               return _content;
+       boost::weak_ptr<Piece> piece () const {
+               return _piece;
        }
 
        bool error () const {
@@ -126,10 +127,10 @@ private:
        boost::optional<ColourConversion> _colour_conversion;
        VideoRange _video_range;
        boost::optional<PositionImage> _text;
-       /** Content that we came from.  This is so that reset_metadata() can work, and also
+       /** Piece that we came from.  This is so that reset_metadata() can work, and also
         *  for variant:swaroop's non-skippable ads.
         */
-       boost::weak_ptr<Content> _content;
+       boost::weak_ptr<Piece> _piece;
        /** Video frame that we came from.  Again, this is for reset_metadata() */
        boost::optional<Frame> _video_frame;
 
index 75cee85b325e5e4d2b452463af3ca21231edd67f..e70314f0fbd0d825da43327d4de9b1d8db28f5ad 100644 (file)
@@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
                        PART_WHOLE,
                        ColourConversion(),
                        VIDEO_RANGE_FULL,
-                       weak_ptr<Content>(),
+                       weak_ptr<Piece>(),
                        optional<Frame>(),
                        false
                        )
@@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
                        PART_WHOLE,
                        ColourConversion(),
                        VIDEO_RANGE_FULL,
-                       weak_ptr<Content>(),
+                       weak_ptr<Piece>(),
                        optional<Frame>(),
                        false
                        )
@@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
                        PART_WHOLE,
                        ColourConversion(),
                        VIDEO_RANGE_FULL,
-                       weak_ptr<Content>(),
+                       weak_ptr<Piece>(),
                        optional<Frame>(),
                        false
                        )
@@ -287,7 +287,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
                        PART_WHOLE,
                        PresetColourConversion::all().front().conversion,
                        VIDEO_RANGE_FULL,
-                       weak_ptr<Content>(),
+                       weak_ptr<Piece>(),
                        optional<Frame>(),
                        false
                        )