Fix a number of missing fopen_boost replacements; might fix problems with adding...
[dcpomatic.git] / src / lib / dcp_video_frame.cc
index e719d7ef4f4be87d205796a1d03d521c968722f8..78d73ad00c0a035d9156059e29de9e5c8ab4b093 100644 (file)
@@ -111,7 +111,7 @@ DCPVideoFrame::DCPVideoFrame (shared_ptr<const Image> image, shared_ptr<const cx
        _conversion = ColourConversion (node->node_child ("ColourConversion"));
        _frames_per_second = node->number_child<int> ("FramesPerSecond");
        _j2k_bandwidth = node->number_child<int> ("J2KBandwidth");
-       _resolution = Resolution (node->optional_number_child<int>("J2KBandwidth").get_value_or (RESOLUTION_2K));
+       _resolution = Resolution (node->optional_number_child<int>("Resolution").get_value_or (RESOLUTION_2K));
 }
 
 /** J2K-encode this frame on the local host.
@@ -197,6 +197,24 @@ DCPVideoFrame::encode_locally ()
        parameters.tcp_numlayers++;
        parameters.cp_disto_alloc = 1;
        parameters.cp_rsiz = _resolution == RESOLUTION_2K ? CINEMA2K : CINEMA4K;
+       if (_resolution == RESOLUTION_4K) {
+               parameters.numpocs = 2;
+               parameters.POC[0].tile = 1;
+               parameters.POC[0].resno0 = 0; 
+               parameters.POC[0].compno0 = 0;
+               parameters.POC[0].layno1 = 1;
+               parameters.POC[0].resno1 = parameters.numresolution - 1;
+               parameters.POC[0].compno1 = 3;
+               parameters.POC[0].prg1 = CPRL;
+               parameters.POC[1].tile = 1;
+               parameters.POC[1].resno0 = parameters.numresolution - 1; 
+               parameters.POC[1].compno0 = 0;
+               parameters.POC[1].layno1 = 1;
+               parameters.POC[1].resno1 = parameters.numresolution;
+               parameters.POC[1].compno1 = 3;
+               parameters.POC[1].prg1 = CPRL;
+       }
+       
        parameters.cp_comment = strdup (N_("DCP-o-matic"));
        parameters.cp_cinema = _resolution == RESOLUTION_2K ? CINEMA2K_24 : CINEMA4K_24;
 
@@ -334,7 +352,7 @@ EncodedData::EncodedData (boost::filesystem::path file)
        _size = boost::filesystem::file_size (file);
        _data = new uint8_t[_size];
 
-       FILE* f = fopen (file.string().c_str(), N_("rb"));
+       FILE* f = fopen_boost (file, "rb");
        if (!f) {
                throw FileError (_("could not open file for reading"), file);
        }
@@ -363,7 +381,7 @@ EncodedData::write (shared_ptr<const Film> film, int frame, Eyes eyes) const
 {
        boost::filesystem::path const tmp_j2c = film->j2c_path (frame, eyes, true);
 
-       FILE* f = fopen (tmp_j2c.string().c_str (), N_("wb"));
+       FILE* f = fopen_boost (tmp_j2c, "wb");
        
        if (!f) {
                throw WriteFileError (tmp_j2c, errno);