Allow specification of the JPEG2000 comment string.
authorCarl Hetherington <cth@carlh.net>
Tue, 16 Jun 2020 23:04:05 +0000 (01:04 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 16 Jun 2020 23:04:05 +0000 (01:04 +0200)
src/j2k.cc
src/j2k.h

index f2335f08c6820993bea71ecd6d9cb284860356b9..fc60acfa54ca197f4042a29451f1eb41cd21a6a5 100644 (file)
@@ -43,6 +43,7 @@
 
 using std::min;
 using std::pow;
+using std::string;
 using boost::shared_ptr;
 using boost::shared_array;
 using namespace dcp;
@@ -273,7 +274,7 @@ seek_function (OPJ_OFF_T nb_bytes, void* data)
  *  after this call; see opj_j2k_encode where if l_reuse_data is false it will set l_tilec->data = l_img_comp->data.
  */
 Data
-dcp::compress_j2k (shared_ptr<const OpenJPEGImage> xyz, int bandwidth, int frames_per_second, bool threed, bool fourk)
+dcp::compress_j2k (shared_ptr<const OpenJPEGImage> xyz, int bandwidth, int frames_per_second, bool threed, bool fourk, string comment)
 {
        /* get a J2K compressor handle */
        opj_codec_t* encoder = opj_create_compress (OPJ_CODEC_J2K);
@@ -290,7 +291,7 @@ dcp::compress_j2k (shared_ptr<const OpenJPEGImage> xyz, int bandwidth, int frame
                parameters.numresolution = 7;
        }
        parameters.rsiz = fourk ? OPJ_PROFILE_CINEMA_4K : OPJ_PROFILE_CINEMA_2K;
-       parameters.cp_comment = strdup ("libdcp");
+       parameters.cp_comment = strdup (comment.c_str());
 
        /* set max image */
        parameters.max_cs_size = (bandwidth / 8) / frames_per_second;
index 4f802a5a98b2a368b43360c942a96e99d72fdc62..9ca5147b77574d99c2a2311eafd1b3281c9508c8 100644 (file)
--- a/src/j2k.h
+++ b/src/j2k.h
@@ -41,6 +41,6 @@ class OpenJPEGImage;
 
 extern boost::shared_ptr<OpenJPEGImage> decompress_j2k (uint8_t* data, int64_t size, int reduce);
 extern boost::shared_ptr<OpenJPEGImage> decompress_j2k (Data data, int reduce);
-extern Data compress_j2k (boost::shared_ptr<const OpenJPEGImage>, int bandwith, int frames_per_second, bool threed, bool fourk);
+extern Data compress_j2k (boost::shared_ptr<const OpenJPEGImage>, int bandwith, int frames_per_second, bool threed, bool fourk, std::string comment = "libdcp");
 
 }