- ASDCP::JP2K::MXFReader reader;
- Kumu::Result_t r = reader.OpenRead (mxf_path.string().c_str());
- if (ASDCP_FAILURE (r)) {
- boost::throw_exception (FileError ("could not open MXF file for reading", mxf_path, r));
+ boost::uintmax_t const size = boost::filesystem::file_size (path);
+ _buffer = new ASDCP::JP2K::FrameBuffer (size);
+ FILE* f = fopen_boost (path, "rb");
+ if (!f) {
+ boost::throw_exception (FileError ("could not open JPEG2000 file", path, errno));
+ }
+
+ size_t n = fread (j2k_data(), 1, size, f);
+ if (n != size) {
+ boost::throw_exception (FileError ("could not read from JPEG2000 file", path, errno));