41 #include "compose.hpp"
48 #include <asdcp/AS_DCP.h>
49 #include <asdcp/KM_fileio.h>
53 using std::shared_ptr;
54 using std::make_shared;
58 StereoPictureFrame::Part::Part (shared_ptr<ASDCP::JP2K::SFrameBuffer> buffer, Eye eye)
66 ASDCP::JP2K::FrameBuffer &
67 StereoPictureFrame::Part::mono ()
const
69 return _eye == Eye::LEFT ? _buffer->Left : _buffer->Right;
74 StereoPictureFrame::Part::data ()
const
76 return mono().RoData();
81 StereoPictureFrame::Part::data ()
88 StereoPictureFrame::Part::size ()
const
99 StereoPictureFrame::StereoPictureFrame (ASDCP::JP2K::MXFSReader* reader,
int n, shared_ptr<DecryptionContext> c,
bool check_hmac)
102 _buffer = make_shared<ASDCP::JP2K::SFrameBuffer>(4 * Kumu::Megabyte);
104 if (ASDCP_FAILURE (reader->ReadFrame (n, *_buffer, c->context(), check_hmac ? c->hmac() :
nullptr))) {
105 boost::throw_exception (
ReadError (String::compose (
"could not read video frame %1 of %2", n)));
110 StereoPictureFrame::StereoPictureFrame ()
112 _buffer = make_shared<ASDCP::JP2K::SFrameBuffer>(4 * Kumu::Megabyte);
121 shared_ptr<OpenJPEGImage>
126 return decompress_j2k (
const_cast<uint8_t*
>(_buffer->Left.RoData()), _buffer->Left.Size(), reduce);
128 return decompress_j2k (
const_cast<uint8_t*
>(_buffer->Right.RoData()), _buffer->Right.Size(), reduce);
135 shared_ptr<StereoPictureFrame::Part>
136 StereoPictureFrame::right ()
const
138 return make_shared<Part>(_buffer, Eye::RIGHT);
142 shared_ptr<StereoPictureFrame::Part>
143 StereoPictureFrame::left ()
const
145 return make_shared<Part>(_buffer, Eye::LEFT);
Any error that occurs when reading data from a DCP.
std::shared_ptr< OpenJPEGImage > xyz_image(Eye eye, int reduce=0) const
Exceptions thrown by libdcp.
Methods to encode and decode JPEG2000.
Namespace for everything in libdcp.
std::shared_ptr< OpenJPEGImage > decompress_j2k(uint8_t const *data, int64_t size, int reduce)
Conversion between RGB and XYZ.
StereoPictureFrame class.
Utility methods and classes.