Some const correctness.
authorCarl Hetherington <cth@carlh.net>
Tue, 14 Sep 2021 22:42:15 +0000 (00:42 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 27 Sep 2021 11:41:46 +0000 (13:41 +0200)
src/lib/bitmap_text.h
src/lib/content_text.h
src/lib/image_proxy.h
src/lib/player_video.h
src/lib/position_image.h
src/lib/text_decoder.cc
src/lib/text_decoder.h

index b8861c10a651986795a57e0cdca5f6aa914dbad0..46b6fd142ff541908d3e299a47632576cbb01e66 100644 (file)
@@ -31,12 +31,12 @@ class Image;
 class BitmapText
 {
 public:
-       BitmapText (std::shared_ptr<Image> i, dcpomatic::Rect<double> r)
+       BitmapText (std::shared_ptr<const Image> i, dcpomatic::Rect<double> r)
                : image (i)
                , rectangle (r)
        {}
 
-       std::shared_ptr<Image> image;
+       std::shared_ptr<const Image> image;
        /** Area that the subtitle covers on its corresponding video, expressed in
         *  proportions of the image size; e.g. rectangle.x = 0.5 would mean that
         *  the rectangle starts half-way across the video.
index c6d7d6ec2ec06bdee841365ebbaa89eb53527b41..5edb9af2083be0993339caefa876dc09e3627e7d 100644 (file)
@@ -48,7 +48,7 @@ private:
 class ContentBitmapText : public ContentText
 {
 public:
-       ContentBitmapText (dcpomatic::ContentTime f, std::shared_ptr<Image> im, dcpomatic::Rect<double> r)
+       ContentBitmapText (dcpomatic::ContentTime f, std::shared_ptr<const Image> im, dcpomatic::Rect<double> r)
                : ContentText (f)
                , sub (im, r)
        {}
index 22946ed98a56b1272421e053ceae35df58cdf811..cf1fb9a2dc6035ccfe65e5e3caf0215d8bd0cce1 100644 (file)
@@ -64,7 +64,7 @@ public:
        ImageProxy& operator= (ImageProxy const&) = delete;
 
        struct Result {
-               Result (std::shared_ptr<Image> image_, int log2_scaling_)
+               Result (std::shared_ptr<const Image> image_, int log2_scaling_)
                        : image (image_)
                        , log2_scaling (log2_scaling_)
                        , error (false)
@@ -76,8 +76,7 @@ public:
                        , error (error_)
                {}
 
-               /** Image (which will be aligned) */
-               std::shared_ptr<Image> image;
+               std::shared_ptr<const Image> image;
                /** log2 of any scaling down that has already been applied to the image;
                 *  e.g. if the image is already half the size of the original, this value
                 *  will be 1.
index 347d10667de69d97584a4dccb0ec9ddc1d194970..872bc9864725a7ae2f89176798446b7f96b1ceae 100644 (file)
@@ -76,7 +76,7 @@ public:
 
        void prepare (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast, bool proxy_only);
        std::shared_ptr<Image> image (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast) const;
-       std::shared_ptr<Image> raw_image () const;
+       std::shared_ptr<const Image> raw_image () const;
 
        static AVPixelFormat force (AVPixelFormat, AVPixelFormat);
        static AVPixelFormat keep_xyz_or_rgb (AVPixelFormat);
index 2b7e7080a68df0bcb8e7228ae21cd2f6827c344b..ee352647ca83826e0e359d857ad2928a9d96ea4b 100644 (file)
@@ -35,12 +35,12 @@ class PositionImage
 public:
        PositionImage () {}
 
-       PositionImage (std::shared_ptr<Image> i, Position<int> p)
+       PositionImage (std::shared_ptr<const Image> i, Position<int> p)
                : image (i)
                , position (p)
        {}
 
-       std::shared_ptr<Image> image;
+       std::shared_ptr<const Image> image;
        Position<int> position;
 
        bool same (PositionImage const & other) const;
index 6ee6ed079879e014c33df5c2c4bc36e79b336881..8111154e348f00b619e0f81229f3d9e7b04993a2 100644 (file)
@@ -61,7 +61,7 @@ TextDecoder::TextDecoder (
  *  of the video frame)
  */
 void
-TextDecoder::emit_bitmap_start (ContentTime from, shared_ptr<Image> image, dcpomatic::Rect<double> rect)
+TextDecoder::emit_bitmap_start (ContentTime from, shared_ptr<const Image> image, dcpomatic::Rect<double> rect)
 {
        BitmapStart (ContentBitmapText (from, image, rect));
        _position = from;
@@ -286,7 +286,7 @@ TextDecoder::emit_plain (ContentTimePeriod period, sub::Subtitle const & s)
  *  of the video frame)
  */
 void
-TextDecoder::emit_bitmap (ContentTimePeriod period, shared_ptr<Image> image, dcpomatic::Rect<double> rect)
+TextDecoder::emit_bitmap (ContentTimePeriod period, shared_ptr<const Image> image, dcpomatic::Rect<double> rect)
 {
        emit_bitmap_start (period.from, image, rect);
        emit_stop (period.to);
index 6e96b6b914abd109f52a2c3f4af4c161a9cc385f..d1355afb02c4b7eaf135917e5dccc487641d7947 100644 (file)
@@ -52,8 +52,8 @@ public:
                return _position;
        }
 
-       void emit_bitmap_start (dcpomatic::ContentTime from, std::shared_ptr<Image> image, dcpomatic::Rect<double> rect);
-       void emit_bitmap (dcpomatic::ContentTimePeriod period, std::shared_ptr<Image> image, dcpomatic::Rect<double> rect);
+       void emit_bitmap_start (dcpomatic::ContentTime from, std::shared_ptr<const Image> image, dcpomatic::Rect<double> rect);
+       void emit_bitmap (dcpomatic::ContentTimePeriod period, std::shared_ptr<const Image> image, dcpomatic::Rect<double> rect);
        void emit_plain_start (dcpomatic::ContentTime from, std::list<dcp::SubtitleString> s);
        void emit_plain_start (dcpomatic::ContentTime from, sub::Subtitle const & subtitle);
        void emit_plain (dcpomatic::ContentTimePeriod period, std::list<dcp::SubtitleString> s);