Cleanup: some const-correctness.
authorCarl Hetherington <cth@carlh.net>
Thu, 6 Oct 2022 22:39:40 +0000 (00:39 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 18 Oct 2022 18:25:57 +0000 (20:25 +0200)
src/lib/raw_image_proxy.cc
src/lib/raw_image_proxy.h
src/lib/video_filter_graph.cc
src/lib/video_filter_graph.h

index 9b486dd5cc669966f8e600c26c24579bbcb0f4bd..c606ddd9906520b128c1009517d2c706dd180659 100644 (file)
@@ -45,7 +45,7 @@ using boost::optional;
 using dcp::raw_convert;
 
 
-RawImageProxy::RawImageProxy (shared_ptr<Image> image)
+RawImageProxy::RawImageProxy(shared_ptr<const Image> image)
        : _image (image)
 {
 
@@ -58,8 +58,9 @@ RawImageProxy::RawImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> soc
                xml->number_child<int>("Width"), xml->number_child<int>("Height")
                );
 
-       _image = make_shared<Image>(static_cast<AVPixelFormat>(xml->number_child<int>("PixelFormat")), size, Image::Alignment::PADDED);
-       _image->read_from_socket (socket);
+       auto image = make_shared<Image>(static_cast<AVPixelFormat>(xml->number_child<int>("PixelFormat")), size, Image::Alignment::PADDED);
+       image->read_from_socket (socket);
+       _image = image;
 }
 
 
index 1111b66c09dea38b64b46189042fa030ba7cb33a..d5ae2457d265ed156da08da1b9a269d10408e437 100644 (file)
@@ -29,7 +29,7 @@
 class RawImageProxy : public ImageProxy
 {
 public:
-       explicit RawImageProxy (std::shared_ptr<Image>);
+       explicit RawImageProxy(std::shared_ptr<const Image>);
        RawImageProxy (std::shared_ptr<cxml::Node> xml, std::shared_ptr<Socket> socket);
 
        Result image (
@@ -43,7 +43,7 @@ public:
        size_t memory_used () const override;
 
 private:
-       std::shared_ptr<Image> _image;
+       std::shared_ptr<const Image> _image;
 };
 
 
index 1cc1425202d190f6c5937a16fb4fd29d209bd7a1..64f7deb192d31b4a584cc3aac41b0401340e4e77 100644 (file)
@@ -51,10 +51,10 @@ VideoFilterGraph::VideoFilterGraph (dcp::Size s, AVPixelFormat p, dcp::Fraction
 /** Take an AVFrame and process it using our configured filters, returning a
  *  set of Images.  Caller handles memory management of the input frame.
  */
-list<pair<shared_ptr<Image>, int64_t>>
+list<pair<shared_ptr<const Image>, int64_t>>
 VideoFilterGraph::process (AVFrame* frame)
 {
-       list<pair<shared_ptr<Image>, int64_t>> images;
+       list<pair<shared_ptr<const Image>, int64_t>> images;
 
        if (_copy) {
                images.push_back (make_pair(make_shared<Image>(frame, Image::Alignment::PADDED), frame->best_effort_timestamp));
index d887e551bda8e586b5bcedd67137048b0ca6a019..e120fb467f02c1d0fd075fdb88a04a4bae8e991b 100644 (file)
@@ -28,7 +28,7 @@ public:
        VideoFilterGraph (dcp::Size s, AVPixelFormat p, dcp::Fraction r);
 
        bool can_process (dcp::Size s, AVPixelFormat p) const;
-       std::list<std::pair<std::shared_ptr<Image>, int64_t>> process (AVFrame * frame);
+       std::list<std::pair<std::shared_ptr<const Image>, int64_t>> process (AVFrame * frame);
 
 protected:
        std::string src_parameters () const override;