Add new LocalTime constructor.
[libdcp.git] / src / stereo_picture_frame.cc
index ac7d7bf19acd8095eb1fc5da12f0a7026018dd85..5a90e0a13a898952e2751da141c72fef05bc8615 100644 (file)
 #include "colour_conversion.h"
 #include "AS_DCP.h"
 #include "KM_fileio.h"
+#include "compose.hpp"
+#include "j2k.h"
 #include <openjpeg.h>
 
-#define DCI_GAMMA 2.6
-
 using std::string;
 using boost::shared_ptr;
 using namespace dcp;
@@ -36,19 +36,19 @@ using namespace dcp;
  *  @param mxf_path Path to the asset's MXF file.
  *  @param n Frame within the asset, not taking EntryPoint into account.
  */
-StereoPictureFrame::StereoPictureFrame (boost::filesystem::path mxf_path, int n)
+StereoPictureFrame::StereoPictureFrame (boost::filesystem::path path, int n)
 {
        ASDCP::JP2K::MXFSReader reader;
-       Kumu::Result_t r = reader.OpenRead (mxf_path.string().c_str());
+       Kumu::Result_t r = reader.OpenRead (path.string().c_str());
        if (ASDCP_FAILURE (r)) {
-               boost::throw_exception (FileError ("could not open MXF file for reading", mxf_path, r));
+               boost::throw_exception (FileError ("could not open MXF file for reading", path, r));
        }
 
        /* XXX: unfortunate guesswork on this buffer size */
        _buffer = new ASDCP::JP2K::SFrameBuffer (4 * Kumu::Megabyte);
 
        if (ASDCP_FAILURE (reader.ReadFrame (n, *_buffer))) {
-               boost::throw_exception (DCPReadError ("could not read video frame"));
+               boost::throw_exception (DCPReadError (String::compose ("could not read video frame %1 of %2", n, path.string())));
        }
 }
 
@@ -67,7 +67,7 @@ StereoPictureFrame::~StereoPictureFrame ()
  *  of the image, expressed as a power of two (pass 0 for no
  *  reduction).
  */
-shared_ptr<XYZImage>
+shared_ptr<OpenJPEGImage>
 StereoPictureFrame::xyz_image (Eye eye, int reduce) const
 {
        switch (eye) {
@@ -76,8 +76,8 @@ StereoPictureFrame::xyz_image (Eye eye, int reduce) const
        case RIGHT:
                return decompress_j2k (const_cast<uint8_t*> (_buffer->Right.RoData()), _buffer->Right.Size(), reduce);
        }
-       
-       return shared_ptr<XYZImage> ();
+
+       return shared_ptr<OpenJPEGImage> ();
 }
 
 uint8_t const *