summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-06-17 01:04:05 +0200
committerCarl Hetherington <cth@carlh.net>2020-06-17 01:04:05 +0200
commitcdb664d5be551715d9f55d00920ed92b4e2123e0 (patch)
tree235e90df3ed57962f7bc4afc7b3a605c3875a7ea
parentcb71ba31eaf66b4e451fb68d186097c4b8b71d23 (diff)
Allow specification of the JPEG2000 comment string.
-rw-r--r--src/j2k.cc5
-rw-r--r--src/j2k.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/j2k.cc b/src/j2k.cc
index f2335f08..fc60acfa 100644
--- a/src/j2k.cc
+++ b/src/j2k.cc
@@ -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;
diff --git a/src/j2k.h b/src/j2k.h
index 4f802a5a..9ca5147b 100644
--- 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");
}