summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2022-04-27 17:16:35 +0200
committerSlávek Banko <slavek.banko@axis.cz>2022-04-29 00:50:33 +0200
commitcd6707c1d23f0c552b12a09691cc8696c7212dea (patch)
tree93ee7a271c796ac55dc4a0f1ef4e70310603ac2e
parent3344fc9a6458fb8306a128b6c8d82909b6f59d24 (diff)
downloaddigikam-cd6707c1d23f0c552b12a09691cc8696c7212dea.tar.gz
digikam-cd6707c1d23f0c552b12a09691cc8696c7212dea.zip
Add support for Jasper 3.x.r14.0.12
This resolves issue #4. Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit d9d028f1e239546736bd4303133b180fc037d1a2)
-rw-r--r--digikam/libs/dimg/loaders/jp2kloader.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/digikam/libs/dimg/loaders/jp2kloader.cpp b/digikam/libs/dimg/loaders/jp2kloader.cpp
index 10353919..66351c25 100644
--- a/digikam/libs/dimg/loaders/jp2kloader.cpp
+++ b/digikam/libs/dimg/loaders/jp2kloader.cpp
@@ -660,7 +660,17 @@ bool JP2KLoader::save(const TQString& filePath, DImgLoaderObserver *observer)
DDebug() << "JPEG2000 quality: " << quality << endl;
DDebug() << "JPEG2000 " << rate << endl;
+# if defined(JAS_VERSION_MAJOR) && (JAS_VERSION_MAJOR >= 3)
+ const jas_image_fmtinfo_t *jp2_fmtinfo = jas_image_lookupfmtbyname("jp2");
+ int ret = -1;
+ if (jp2_fmtinfo)
+ {
+ ret = jas_image_encode(jp2_image, jp2_stream, jp2_fmtinfo->id, rate.utf8().data());
+ }
+# else
int ret = jp2_encode(jp2_image, jp2_stream, rate.utf8().data());
+# endif
+
if (ret != 0)
{
DDebug() << "Unable to encode JPEG2000 image" << endl;