X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fj2k_image_proxy.h;h=78f291e5d87426b7e910fb224167aee721627840;hb=5a649b6d803697388925d7cd64ec5f0da345f865;hp=3133aac20c055642f9667657b920812d9fc52eeb;hpb=3e230d3785f19bc707fd7ea2b1f55321b93f536f;p=dcpomatic.git diff --git a/src/lib/j2k_image_proxy.h b/src/lib/j2k_image_proxy.h index 3133aac20..78f291e5d 100644 --- a/src/lib/j2k_image_proxy.h +++ b/src/lib/j2k_image_proxy.h @@ -32,12 +32,25 @@ class J2KImageProxy : public ImageProxy { public: J2KImageProxy (boost::filesystem::path path, dcp::Size, AVPixelFormat pixel_format); - J2KImageProxy (boost::shared_ptr frame, dcp::Size, AVPixelFormat pixel_format); - J2KImageProxy (boost::shared_ptr frame, dcp::Size, dcp::Eye, AVPixelFormat pixel_format); + + J2KImageProxy ( + boost::shared_ptr frame, + dcp::Size, + AVPixelFormat pixel_format, + boost::optional forced_reduction + ); + + J2KImageProxy ( + boost::shared_ptr frame, + dcp::Size, + dcp::Eye, + AVPixelFormat pixel_format, + boost::optional forced_reduction + ); + J2KImageProxy (boost::shared_ptr xml, boost::shared_ptr socket); - boost::shared_ptr image ( - boost::optional note = boost::optional (), + Result image ( boost::optional size = boost::optional () ) const; @@ -45,10 +58,7 @@ public: void send_binary (boost::shared_ptr) const; /** @return true if our image is definitely the same as another, false if it is probably not */ bool same (boost::shared_ptr) const; - void prepare (boost::optional = boost::optional()) const; - AVPixelFormat pixel_format () const { - return _pixel_format; - } + int prepare (boost::optional = boost::optional()) const; dcp::Data j2k () const { return _data; @@ -58,6 +68,8 @@ public: return _size; } + size_t memory_used () const; + private: friend struct client_server_test_j2k; @@ -67,8 +79,12 @@ private: dcp::Data _data; dcp::Size _size; boost::optional _eye; - mutable boost::shared_ptr _decompressed; + mutable boost::shared_ptr _image; mutable boost::optional _target_size; + mutable boost::optional _reduce; AVPixelFormat _pixel_format; mutable boost::mutex _mutex; + boost::optional _forced_reduction; + /** true if an error occurred while decoding the JPEG2000 data, false if not */ + mutable bool _error; };