X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fj2k_image_proxy.cc;h=269b01bca7457c65dfe0377240bb4b7fbbdc7348;hb=refs%2Fheads%2F2493-player-export-frame;hp=144da396d24ee619970c679de49731378a69963c;hpb=8963f0007af1a312017b9627c18b82ec2a577591;p=dcpomatic.git diff --git a/src/lib/j2k_image_proxy.cc b/src/lib/j2k_image_proxy.cc index 144da396d..269b01bca 100644 --- a/src/lib/j2k_image_proxy.cc +++ b/src/lib/j2k_image_proxy.cc @@ -19,22 +19,22 @@ */ -#include "j2k_image_proxy.h" +#include "dcpomatic_assert.h" #include "dcpomatic_socket.h" #include "image.h" -#include "dcpomatic_assert.h" -#include "warnings.h" -#include -#include -#include -#include +#include "j2k_image_proxy.h" #include -#include #include +#include +#include +#include +#include +#include +#include #include -DCPOMATIC_DISABLE_WARNINGS +LIBDCP_DISABLE_WARNINGS #include -DCPOMATIC_ENABLE_WARNINGS +LIBDCP_ENABLE_WARNINGS #include #include "i18n.h" @@ -42,10 +42,8 @@ DCPOMATIC_ENABLE_WARNINGS using std::cout; using std::dynamic_pointer_cast; -using std::make_pair; using std::make_shared; using std::max; -using std::pair; using std::shared_ptr; using std::string; using boost::optional; @@ -108,7 +106,7 @@ J2KImageProxy::J2KImageProxy (shared_ptr xml, shared_ptr soc if (xml->optional_number_child("Eye")) { _eye = static_cast(xml->number_child("Eye")); } - shared_ptr data(new ArrayData(xml->number_child("Size"))); + auto data = make_shared(xml->number_child("Size")); /* This only matters when we are using J2KImageProxy for the preview, which will never use this constructor (which is only used for passing data to encode servers). So we can put anything in here. It's a bit of a hack. @@ -120,7 +118,7 @@ J2KImageProxy::J2KImageProxy (shared_ptr xml, shared_ptr soc int -J2KImageProxy::prepare (optional target_size) const +J2KImageProxy::prepare (Image::Alignment alignment, optional target_size) const { boost::mutex::scoped_lock lm (_mutex); @@ -145,7 +143,7 @@ J2KImageProxy::prepare (optional target_size) const try { /* XXX: should check that potentially trashing _data here doesn't matter */ auto decompressed = dcp::decompress_j2k (const_cast(_data->data()), _data->size(), reduce); - _image.reset (new Image (_pixel_format, decompressed->size(), true)); + _image = make_shared(_pixel_format, decompressed->size(), alignment); int const shift = 16 - decompressed->precision (0); @@ -169,7 +167,7 @@ J2KImageProxy::prepare (optional target_size) const } } } catch (dcp::J2KDecompressionError& e) { - _image = make_shared(_pixel_format, _size, true); + _image = make_shared(_pixel_format, _size, alignment); _image->make_black (); _error = true; } @@ -182,9 +180,9 @@ J2KImageProxy::prepare (optional target_size) const ImageProxy::Result -J2KImageProxy::image (optional target_size) const +J2KImageProxy::image (Image::Alignment alignment, optional target_size) const { - int const r = prepare (target_size); + int const r = prepare (alignment, target_size); /* I think this is safe without a lock on mutex. _image is guaranteed to be set up when prepare() has happened.