Merge FilmState / Film.
[dcpomatic.git] / src / lib / dcp_video_frame.cc
index 24bf2173cb149aaa1c2b870eea98734f5dd6ffd7..4f84a83027a209c6bc1177fecd9aa63035b71250 100644 (file)
@@ -47,7 +47,6 @@
 #include "dcp_video_frame.h"
 #include "lut.h"
 #include "config.h"
-#include "film_state.h"
 #include "options.h"
 #include "exceptions.h"
 #include "server.h"
@@ -142,7 +141,6 @@ DCPVideoFrame::~DCPVideoFrame ()
 
        if (_parameters) {
                free (_parameters->cp_comment);
-               free (_parameters->cp_matrice);
        }
        
        delete _parameters;
@@ -276,6 +274,9 @@ DCPVideoFrame::encode_locally ()
 
        /* get a J2K compressor handle */
        _cinfo = opj_create_compress (CODEC_J2K);
+       if (_cinfo == 0) {
+               throw EncodeError ("could not create JPEG2000 encoder");
+       }
 
        /* Set event manager to null (openjpeg 1.3 bug) */
        _cinfo->event_mgr = 0;
@@ -284,10 +285,13 @@ DCPVideoFrame::encode_locally ()
        opj_setup_encoder (_cinfo, _parameters, _image);
 
        _cio = opj_cio_open ((opj_common_ptr) _cinfo, 0, 0);
+       if (_cio == 0) {
+               throw EncodeError ("could not open JPEG2000 stream");
+       }
 
        int const r = opj_encode (_cinfo, _cio, _image, 0);
        if (r == 0) {
-               throw EncodeError ("jpeg2000 encoding failed");
+               throw EncodeError ("JPEG2000 encoding failed");
        }
 
        _log->log (String::compose ("Finished locally-encoded frame %1", _frame));