Skip to content

Commit 14c8c0a

Browse files
cytrinoxTurboGit
authored andcommitted
Enable exiv2 ISOBMFF support for CR3 and HEIF files
1 parent 4a4f175 commit 14c8c0a

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

DefineOptions.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ option(USE_OPENJPEG "Enable JPEG 2000 support" ON)
2121
option(USE_WEBP "Enable WebP export support" ON)
2222
option(USE_AVIF "Enable AVIF support" ON)
2323
option(USE_XCF "Enable XCF support" ON)
24+
option(USE_ISOBMFF "Enable ISOBMFF support" ON)
2425
option(BUILD_CMSTEST "Build a test program to check your system's color management setup" ON)
2526
option(USE_OPENEXR "Enable OpenEXR support" ON)
2627
option(BUILD_PRINT "Build the print module" ON)

cmake/modules/FindExiv2.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# EXIV2_INCLUDE_DIR, where to find png.h, etc.
55
# EXIV2_LIBRARIES, the libraries to link against to use exiv2
66
# EXIV2_FOUND, If false, do not try to use exiv2
7+
# EXIV2_VERSION, version string for exiv2
78
# also defined, but not for general use are
89
# EXIV2_LIBRARY, where to find the exiv2 library
910

@@ -50,4 +51,5 @@ find_package_handle_standard_args(Exiv2 DEFAULT_MSG Exiv2_LIBRARY Exiv2_INCLUDE_
5051
IF(Exiv2_FOUND)
5152
set(Exiv2_LIBRARIES ${Exiv2_LIBRARY})
5253
set(Exiv2_INCLUDE_DIRS ${Exiv2_INCLUDE_DIR})
54+
set(Exiv2_VERSION ${Exiv2_PKGCONF_VERSION})
5355
ENDIF(Exiv2_FOUND)

src/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ add_subdirectory(external)
33
include(CheckCCompilerFlag)
44
include(CheckCXXCompilerFlag)
55
include(CheckCSourceCompiles)
6+
include(CheckCXXSymbolExists)
67

78
#
89
# Add files for libdarktable
@@ -389,6 +390,25 @@ include_directories(SYSTEM ${Exiv2_INCLUDE_DIRS})
389390
list(APPEND LIBS ${Exiv2_LIBRARIES})
390391
add_definitions(${Exiv2_DEFINITIONS})
391392

393+
# Optionally enable ISOBMFF support in Exiv2
394+
if (USE_ISOBMFF)
395+
if(Exiv2_VERSION VERSION_GREATER_EQUAL "0.27.4")
396+
# exiv2 >= 0.27.4 provides optional support for ISOBMFF files.
397+
# This must be manually enabled during exiv2 build and can be checked with
398+
# the EXV_ENABLE_BMFF symbol.
399+
check_cxx_symbol_exists(EXV_ENABLE_BMFF "exiv2/exiv2.hpp" HAVE_EXV_ENABLE_BMFF)
400+
if(HAVE_EXV_ENABLE_BMFF)
401+
add_definitions(-DHAVE_LIBEXIV2_WITH_ISOBMFF=1)
402+
set(DT_SUPPORTED_EXTENSIONS ${DT_SUPPORTED_EXTENSIONS} cr3 heif CACHE INTERNAL "")
403+
message(STATUS "Exiv2 >= 0.27.4 found with ISOBMFF support (CR3, AVIF, HEIF)")
404+
else()
405+
message(STATUS "Exiv2 >= 0.27.4 found, but was not compiled with ISOBMFF support (CR3, AVIF, HEIF)")
406+
endif()
407+
else()
408+
message(STATUS "Exiv2 <= 0.27.4 found, no support for ISOBMFF files (CR3, AVIF, HEIF)")
409+
endif()
410+
endif()
411+
392412
if(USE_OPENJPEG)
393413
find_package(OpenJPEG)
394414
if(OpenJPEG_FOUND)

src/common/exif.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4223,6 +4223,10 @@ void dt_exif_init()
42234223
// preface the exiv2 messages with "[exiv2] "
42244224
Exiv2::LogMsg::setHandler(&dt_exif_log_handler);
42254225

4226+
#ifdef HAVE_LIBEXIV2_WITH_ISOBMFF
4227+
Exiv2::enableBMFF();
4228+
#endif
4229+
42264230
Exiv2::XmpParser::initialize();
42274231
// this has to stay with the old url (namespace already propagated outside dt)
42284232
Exiv2::XmpProperties::registerNs("http://darktable.sf.net/", "darktable");

0 commit comments

Comments
 (0)