From 56a6028a20ef36a1772d5cc7fbe75aa53e6317d8 Mon Sep 17 00:00:00 2001 From: Darby Johnston Date: Mon, 7 Sep 2026 16:52:39 -0700 Subject: [PATCH] Update the dependencies to match tlRender The super build pins move to what tlRender builds against: - Imath 3.1.12 -> 3.2.1 - OpenEXR 3.3.5 -> 3.4.15, with OpenJPH 0.31.0 built ahead of it so the HTJ2K codec is found in the prefix rather than vendored. - OpenColorIO 2.4.2 -> 2.5.2 - OpenImageIO 3.0.10.0 -> 3.1.16.0 - OpenTimelineIO 0.18.0 -> the commit with core otioz and otiod support, patched as tlRender patches it so it links the super build's minizip-ng. - FFmpeg 8.0 -> 8.1.2, from the GitHub tag archive. The library versions in the install names and the package move with it. - minizip-ng 3.0.7 -> 4.0.10, built without the compatibility layer, so the target is MINIZIP::minizip-ng and the reader handle is returned rather than filled in. - yaml-cpp 0.7.0 -> 0.8.0, with the include newer compilers need. - expat 2.5.0 -> 2.7.2 - libtiff 4.5.0 -> 4.7.2 and SVT-AV1 2.3.0 -> 4.0.1, both as release tarballs rather than gitlab.com clones, which fail often enough to matter. SVT-AV1 no longer needs the pkg-config patch. - FreeType 2.13.3 -> 2.14.1 The new OpenTimelineIO gives markers an RGBA color in place of a name, so the marker item draws that color directly and the details tool shows the name when there is one and the hex value otherwise. Signed-off-by: Darby Johnston --- CMakeLists.txt | 2 +- cmake/Package.cmake | 24 +- cmake/SuperBuild/BuildFFmpeg.cmake | 36 +- cmake/SuperBuild/BuildFreetype.cmake | 2 +- cmake/SuperBuild/BuildImath.cmake | 2 +- cmake/SuperBuild/BuildOpenColorIO.cmake | 2 +- cmake/SuperBuild/BuildOpenEXR.cmake | 12 +- cmake/SuperBuild/BuildOpenImageIO.cmake | 2 +- cmake/SuperBuild/BuildOpenJPH.cmake | 25 + cmake/SuperBuild/BuildOpenTimelineIO.cmake | 34 +- cmake/SuperBuild/BuildTIFF.cmake | 13 +- cmake/SuperBuild/Buildexpat.cmake | 2 +- cmake/SuperBuild/Buildminizip-ng.cmake | 3 +- cmake/SuperBuild/Buildsvt-av1.cmake | 21 +- cmake/SuperBuild/Buildyaml-cpp.cmake | 5 +- cmake/SuperBuild/CMakeLists.txt | 1 + cmake/SuperBuild/OTIO-patch/otio.patch | 600 ++++++++++++++++++ cmake/SuperBuild/OTIOApplyPatch.cmake | 35 + .../svt-av1-patch/Source/Lib/pkg-config.pc.in | 12 - .../yaml-cpp-patch/src/emitterutils.cpp | 498 +++++++++++++++ legal/LICENSE_OpenJPH.txt | 27 + lib/toucanRender/CMakeLists.txt | 2 +- lib/toucanRender/TimelineWrapper.cpp | 4 +- lib/toucanView/DetailsTool.cpp | 9 +- lib/toucanView/MarkerItem.cpp | 46 +- lib/toucanView/MarkerItem.h | 4 +- plugins/CMakeLists.txt | 2 +- toucanConfig.cmake.in | 2 +- 28 files changed, 1313 insertions(+), 114 deletions(-) create mode 100644 cmake/SuperBuild/BuildOpenJPH.cmake create mode 100644 cmake/SuperBuild/OTIO-patch/otio.patch create mode 100644 cmake/SuperBuild/OTIOApplyPatch.cmake delete mode 100644 cmake/SuperBuild/svt-av1-patch/Source/Lib/pkg-config.pc.in create mode 100644 cmake/SuperBuild/yaml-cpp-patch/src/emitterutils.cpp create mode 100644 legal/LICENSE_OpenJPH.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 75f65c1..5faf737 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ set(TOUCAN_PLUGINS enable_testing() find_package(ZLIB) -find_package(minizip) +find_package(minizip-ng) find_package(Imath) find_package(PNG) find_package(JPEG) diff --git a/cmake/Package.cmake b/cmake/Package.cmake index bb3cd9e..750ca46 100644 --- a/cmake/Package.cmake +++ b/cmake/Package.cmake @@ -25,22 +25,22 @@ elseif(APPLE) #set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(INSTALL_DYLIBS - ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.11.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.28.102.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.62.1.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.62.3.102.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.62.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.3.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.12.102.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavformat.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.8.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.26.102.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavutil.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.1.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.3.102.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswresample.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.1.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.5.102.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswscale.dylib) @@ -55,22 +55,22 @@ else() set(INSTALL_LIBS ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.so ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.so.62 - ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.so.62.11.100 + ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.so.62.28.102 ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.so ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.so.62 - ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.so.62.1.100 + ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.so.62.3.102 ${CMAKE_INSTALL_PREFIX}/lib/libavformat.so ${CMAKE_INSTALL_PREFIX}/lib/libavformat.so.62 - ${CMAKE_INSTALL_PREFIX}/lib/libavformat.so.62.3.100 + ${CMAKE_INSTALL_PREFIX}/lib/libavformat.so.62.12.102 ${CMAKE_INSTALL_PREFIX}/lib/libavutil.so ${CMAKE_INSTALL_PREFIX}/lib/libavutil.so.60 - ${CMAKE_INSTALL_PREFIX}/lib/libavutil.so.60.8.100 + ${CMAKE_INSTALL_PREFIX}/lib/libavutil.so.60.26.102 ${CMAKE_INSTALL_PREFIX}/lib/libswresample.so ${CMAKE_INSTALL_PREFIX}/lib/libswresample.so.6 - ${CMAKE_INSTALL_PREFIX}/lib/libswresample.so.6.1.100 + ${CMAKE_INSTALL_PREFIX}/lib/libswresample.so.6.3.102 ${CMAKE_INSTALL_PREFIX}/lib/libswscale.so ${CMAKE_INSTALL_PREFIX}/lib/libswscale.so.9 - ${CMAKE_INSTALL_PREFIX}/lib/libswscale.so.9.1.100) + ${CMAKE_INSTALL_PREFIX}/lib/libswscale.so.9.5.102) install( FILES ${INSTALL_LIBS} diff --git a/cmake/SuperBuild/BuildFFmpeg.cmake b/cmake/SuperBuild/BuildFFmpeg.cmake index 0ab8904..0c1d32d 100644 --- a/cmake/SuperBuild/BuildFFmpeg.cmake +++ b/cmake/SuperBuild/BuildFFmpeg.cmake @@ -5,6 +5,18 @@ if(WIN32) find_package(Msys REQUIRED) endif() +# The GitHub mirror rather than ffmpeg.org, which has been failing to serve +# the releases. Still a download rather than a clone, so the build steps +# behind it are not disturbed. What it does not carry is the VERSION file the +# release tarballs have, nor a .git to read a tag from, so FFmpeg builds +# itself as version "unknown" -- av_version_info() is not read anywhere here, +# and the library versions come from the source. +# +# The library versions are written out in the install names in Package.cmake, +# so check them against libavutil/version.h and its siblings when this moves: +# a point release bumps them. +set(FFmpeg_URL https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n8.1.2.tar.gz) + set(FFmpeg_DEPS ZLIB) if(toucan_svt-av1) list(APPEND FFmpeg_DEPS svt-av1) @@ -352,34 +364,34 @@ else() set(FFmpeg_INSTALL make install) if(APPLE) list(APPEND FFmpeg_INSTALL - COMMAND install_name_tool -id @rpath/libavcodec.62.11.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.dylib - COMMAND install_name_tool -id @rpath/libavdevice.62.1.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.62.dylib - COMMAND install_name_tool -id @rpath/libavformat.62.3.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.dylib - COMMAND install_name_tool -id @rpath/libavutil.60.8.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib - COMMAND install_name_tool -id @rpath/libswresample.6.1.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.dylib - COMMAND install_name_tool -id @rpath/libswscale.9.1.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.dylib + COMMAND install_name_tool -id @rpath/libavcodec.62.28.102.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.dylib + COMMAND install_name_tool -id @rpath/libavdevice.62.3.102.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.62.dylib + COMMAND install_name_tool -id @rpath/libavformat.62.12.102.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.dylib + COMMAND install_name_tool -id @rpath/libavutil.60.26.102.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib + COMMAND install_name_tool -id @rpath/libswresample.6.3.102.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.dylib + COMMAND install_name_tool -id @rpath/libswscale.9.5.102.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.dylib COMMAND install_name_tool -change ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.dylib @rpath/libswresample.6.dylib -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib @rpath/libavutil.60.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.11.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.28.102.dylib COMMAND install_name_tool -change ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.dylib @rpath/libswscale.9.dylib -change ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.dylib @rpath/libavformat.62.dylib -change ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.dylib @rpath/libavcodec.62.dylib -change ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.dylib @rpath/libswresample.6.dylib -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib @rpath/libavutil.60.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.62.1.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.62.3.102.dylib COMMAND install_name_tool -change ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.dylib @rpath/libavcodec.62.dylib -change ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.dylib @rpath/libswresample.6.dylib -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib @rpath/libavutil.60.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.3.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.12.102.dylib COMMAND install_name_tool -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib @rpath/libavutil.60.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.1.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.3.102.dylib COMMAND install_name_tool -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib @rpath/libavutil.60.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.1.100.dylib) + ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.5.102.dylib) endif() endif() @@ -387,7 +399,7 @@ ExternalProject_Add( FFmpeg PREFIX ${CMAKE_CURRENT_BINARY_DIR}/FFmpeg DEPENDS ${FFmpeg_DEPS} - URL https://ffmpeg.org/releases/ffmpeg-8.0.tar.bz2 + URL ${FFmpeg_URL} CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/lib/pkgconfig ${FFmpeg_CONFIGURE} BUILD_COMMAND ${FFmpeg_BUILD} INSTALL_COMMAND ${FFmpeg_INSTALL} diff --git a/cmake/SuperBuild/BuildFreetype.cmake b/cmake/SuperBuild/BuildFreetype.cmake index fad1b2c..1683209 100644 --- a/cmake/SuperBuild/BuildFreetype.cmake +++ b/cmake/SuperBuild/BuildFreetype.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(Freetype_GIT_REPOSITORY "https://github.com/freetype/freetype.git") -set(Freetype_GIT_TAG "VER-2-13-3") +set(Freetype_GIT_TAG "VER-2-14-1") set(Freetype_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} diff --git a/cmake/SuperBuild/BuildImath.cmake b/cmake/SuperBuild/BuildImath.cmake index fc8486a..88ceec8 100644 --- a/cmake/SuperBuild/BuildImath.cmake +++ b/cmake/SuperBuild/BuildImath.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(Imath_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/Imath.git") -set(Imath_GIT_TAG "v3.1.12") +set(Imath_GIT_TAG "v3.2.1") set(Imath_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} diff --git a/cmake/SuperBuild/BuildOpenColorIO.cmake b/cmake/SuperBuild/BuildOpenColorIO.cmake index cb6da3e..d447cf3 100644 --- a/cmake/SuperBuild/BuildOpenColorIO.cmake +++ b/cmake/SuperBuild/BuildOpenColorIO.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(OpenColorIO_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/OpenColorIO.git") -set(OpenColorIO_GIT_TAG "v2.4.2") +set(OpenColorIO_GIT_TAG "v2.5.2") set(OpenColorIO_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} diff --git a/cmake/SuperBuild/BuildOpenEXR.cmake b/cmake/SuperBuild/BuildOpenEXR.cmake index 0b34e3f..86d11c8 100644 --- a/cmake/SuperBuild/BuildOpenEXR.cmake +++ b/cmake/SuperBuild/BuildOpenEXR.cmake @@ -1,19 +1,23 @@ include(ExternalProject) set(OpenEXR_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/openexr.git") -set(OpenEXR_GIT_TAG "v3.3.5") +set(OpenEXR_GIT_TAG "v3.4.15") set(OpenEXR_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} -DOPENEXR_BUILD_TOOLS=OFF - -DOPENEXR_INSTALL_EXAMPLES=OFF + -DOPENEXR_BUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF - -DOPENEXR_FORCE_INTERNAL_DEFLATE=ON) + -DOPENEXR_FORCE_INTERNAL_DEFLATE=ON + # OFF is the default, said out loud because it is what makes OpenEXR + # look for the OpenJPH built above rather than quietly building its + # own vendored copy. + -DOPENEXR_FORCE_INTERNAL_OPENJPH=OFF) ExternalProject_Add( OpenEXR PREFIX ${CMAKE_CURRENT_BINARY_DIR}/OpenEXR - DEPENDS Imath ZLIB + DEPENDS Imath ZLIB OpenJPH GIT_REPOSITORY ${OpenEXR_GIT_REPOSITORY} GIT_TAG ${OpenEXR_GIT_TAG} CMAKE_ARGS ${OpenEXR_ARGS}) diff --git a/cmake/SuperBuild/BuildOpenImageIO.cmake b/cmake/SuperBuild/BuildOpenImageIO.cmake index 8e4b840..1723734 100644 --- a/cmake/SuperBuild/BuildOpenImageIO.cmake +++ b/cmake/SuperBuild/BuildOpenImageIO.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(OpenImageIO_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/OpenImageIO.git") -set(OpenImageIO_GIT_TAG "v3.0.10.0") +set(OpenImageIO_GIT_TAG "v3.1.16.0") set(OpenImageIO_DEPS) if(toucan_PNG) diff --git a/cmake/SuperBuild/BuildOpenJPH.cmake b/cmake/SuperBuild/BuildOpenJPH.cmake new file mode 100644 index 0000000..191303e --- /dev/null +++ b/cmake/SuperBuild/BuildOpenJPH.cmake @@ -0,0 +1,25 @@ +include(ExternalProject) + +# The HTJ2K codec behind OpenEXR's HTJ2K compression. OpenEXR carries a +# vendored copy and falls back to it silently when it cannot find an +# installed one, so this is built into the prefix ahead of OpenEXR and +# found there -- one copy, at a version written down here. +set(OpenJPH_VERSION "0.31.0") +set(OpenJPH_URL "https://github.com/aous72/OpenJPH/archive/refs/tags/${OpenJPH_VERSION}.tar.gz") +set(OpenJPH_HASH "SHA256=fe169dbbaae71a169a0a6a68dccb346616193252c1ca044217afa0d5d1dc436f") + +set(OpenJPH_ARGS + ${toucan_EXTERNAL_PROJECT_ARGS} + -DOJPH_BUILD_EXECUTABLES=OFF + -DOJPH_BUILD_TESTS=OFF + # The codec does not read or write TIFF; only the command line tools + # above do, and they are not built. + -DOJPH_ENABLE_TIFF_SUPPORT=OFF) + +ExternalProject_Add( + OpenJPH + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/OpenJPH + URL ${OpenJPH_URL} + URL_HASH ${OpenJPH_HASH} + LIST_SEPARATOR | + CMAKE_ARGS ${OpenJPH_ARGS}) diff --git a/cmake/SuperBuild/BuildOpenTimelineIO.cmake b/cmake/SuperBuild/BuildOpenTimelineIO.cmake index 43f5ef8..7f1be1f 100644 --- a/cmake/SuperBuild/BuildOpenTimelineIO.cmake +++ b/cmake/SuperBuild/BuildOpenTimelineIO.cmake @@ -1,17 +1,45 @@ include(ExternalProject) +find_package(Git REQUIRED) + set(OpenTimelineIO_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/OpenTimelineIO.git") -set(OpenTimelineIO_GIT_TAG "v0.18.0") +# "Add core C++ support for otioz and otiod, take 2 (#2021)", which also adds +# bundle support for multiple media references and image sequences. Newer than +# v0.18.1, which does not have it. +set(OpenTimelineIO_GIT_TAG "0eebd211b2055f111e2c53d04b5581adc594c1fc") set(OpenTimelineIO_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} -DOTIO_SHARED_LIBS=${BUILD_SHARED_LIBS} - -DOTIO_FIND_IMATH=ON) + -DOTIO_FIND_IMATH=ON + # Use the minizip-ng and zlib from the super build; without this OTIO + # builds its own copies of both for its otioz and otiod support. This + # depends on the patch below. + -DOTIO_FIND_MINIZIP_NG=ON) +# OTIO is patched, with two changes; see the notes in the patch itself. +# +# The first has it link whichever minizip-ng target is present rather than +# assuming the one from the compatibility layer. Without it OTIO cannot be +# built against the super build's minizip-ng, which is built without that +# layer. +# +# The second is what a shared build on Windows needs: the export macros become +# PRIVATE and the members that lacked OTIO_API get it. A static build does not +# need it, and it is carried unchanged so that the patch stays the one +# tlRender uses. +# +# It goes away once these are upstream. ExternalProject_Add( OpenTimelineIO PREFIX ${CMAKE_CURRENT_BINARY_DIR}/OpenTimelineIO - DEPENDS Imath + DEPENDS Imath minizip-ng GIT_REPOSITORY ${OpenTimelineIO_GIT_REPOSITORY} GIT_TAG ${OpenTimelineIO_GIT_TAG} + PATCH_COMMAND ${CMAKE_COMMAND} + -DGIT_EXECUTABLE=${GIT_EXECUTABLE} + -DOTIO_SOURCE_DIR=${CMAKE_CURRENT_BINARY_DIR}/OpenTimelineIO/src/OpenTimelineIO + -DOTIO_PATCH=${CMAKE_CURRENT_SOURCE_DIR}/OTIO-patch/otio.patch + -P ${CMAKE_CURRENT_LIST_DIR}/OTIOApplyPatch.cmake + LIST_SEPARATOR | CMAKE_ARGS ${OpenTimelineIO_ARGS}) diff --git a/cmake/SuperBuild/BuildTIFF.cmake b/cmake/SuperBuild/BuildTIFF.cmake index e66bbd4..5410c4f 100644 --- a/cmake/SuperBuild/BuildTIFF.cmake +++ b/cmake/SuperBuild/BuildTIFF.cmake @@ -1,7 +1,12 @@ include(ExternalProject) -set(TIFF_GIT_REPOSITORY "https://gitlab.com/libtiff/libtiff.git") -set(TIFF_GIT_TAG "v4.5.0") +# The release tarball rather than a clone of the repository. gitlab.com +# answers git over HTTPS with 403 often enough to fail a build -- three +# attempts in a row, on a runner that had done nothing else -- and this is +# the project's own download host, which does not. +set(TIFF_VERSION "4.7.2") +set(TIFF_URL "https://download.osgeo.org/libtiff/tiff-${TIFF_VERSION}.tar.gz") +set(TIFF_HASH "SHA256=672bd7d10aee4606171afb864f3570b83340f6a33e2c186dc0512f7145ffdf6a") set(TIFF_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} @@ -24,6 +29,6 @@ ExternalProject_Add( TIFF PREFIX ${CMAKE_CURRENT_BINARY_DIR}/TIFF DEPENDS ZLIB - GIT_REPOSITORY ${TIFF_GIT_REPOSITORY} - GIT_TAG ${TIFF_GIT_TAG} + URL ${TIFF_URL} + URL_HASH ${TIFF_HASH} CMAKE_ARGS ${TIFF_ARGS}) diff --git a/cmake/SuperBuild/Buildexpat.cmake b/cmake/SuperBuild/Buildexpat.cmake index 7fdb743..8c12eb3 100644 --- a/cmake/SuperBuild/Buildexpat.cmake +++ b/cmake/SuperBuild/Buildexpat.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(expat_GIT_REPOSITORY "https://github.com/libexpat/libexpat.git") -set(expat_GIT_TAG "R_2_5_0") +set(expat_GIT_TAG "R_2_7_2") set(expat_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} diff --git a/cmake/SuperBuild/Buildminizip-ng.cmake b/cmake/SuperBuild/Buildminizip-ng.cmake index 56f8350..d861ae0 100644 --- a/cmake/SuperBuild/Buildminizip-ng.cmake +++ b/cmake/SuperBuild/Buildminizip-ng.cmake @@ -1,10 +1,11 @@ include(ExternalProject) set(minizip-ng_GIT_REPOSITORY "https://github.com/zlib-ng/minizip-ng.git") -set(minizip-ng_GIT_TAG "3.0.7") +set(minizip-ng_GIT_TAG "4.0.10") set(minizip-ng_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} + -DMZ_COMPAT=OFF -DMZ_BZIP2=OFF -DMZ_LZMA=OFF -DMZ_ZSTD=OFF diff --git a/cmake/SuperBuild/Buildsvt-av1.cmake b/cmake/SuperBuild/Buildsvt-av1.cmake index 818d36e..b447c10 100644 --- a/cmake/SuperBuild/Buildsvt-av1.cmake +++ b/cmake/SuperBuild/Buildsvt-av1.cmake @@ -1,27 +1,30 @@ include(ExternalProject) -set(svt-av1_GIT_REPOSITORY "https://gitlab.com/AOMediaCodec/SVT-AV1.git") -set(svt-av1_GIT_TAG "v2.3.0") +# The tag's tarball rather than a clone, for the same reason as TIFF: this +# project also lives on gitlab.com, whose git over HTTPS returns 403 often +# enough to fail a build. The GitHub repository is the project's own mirror, +# and NASM is already fetched from a GitHub tag archive here. +set(svt-av1_VERSION "4.0.1") +set(svt-av1_URL "https://github.com/AOMediaCodec/SVT-AV1/archive/refs/tags/v${svt-av1_VERSION}.tar.gz") +set(svt-av1_HASH "SHA256=fb3e983b82955575e01bce260d2bee6551f329db8154e4a0f69947093354d3dc") set(svt-av1_DEPS) if(NOT WIN32) list(APPEND svt-av1_DEPS NASM) endif() -set(svt-av1_PATCH ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_SOURCE_DIR}/svt-av1-patch/Source/Lib/pkg-config.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/svt-av1/src/svt-av1/Source/Lib/pkg-config.pc.in) - set(svt-av1_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} -DBUILD_APPS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON) +if(NOT WIN32) + list(APPEND svt-av1_ARGS -DCMAKE_ASM_NASM_COMPILER=${CMAKE_INSTALL_PREFIX}/bin/nasm) +endif() ExternalProject_Add( svt-av1 PREFIX ${CMAKE_CURRENT_BINARY_DIR}/svt-av1 DEPENDS ${svt-av1_DEPS} - GIT_REPOSITORY ${svt-av1_GIT_REPOSITORY} - GIT_TAG ${svt-av1_GIT_TAG} - PATCH_COMMAND ${svt-av1_PATCH} + URL ${svt-av1_URL} + URL_HASH ${svt-av1_HASH} CMAKE_ARGS ${svt-av1_ARGS}) diff --git a/cmake/SuperBuild/Buildyaml-cpp.cmake b/cmake/SuperBuild/Buildyaml-cpp.cmake index 718f8b1..49f79c0 100644 --- a/cmake/SuperBuild/Buildyaml-cpp.cmake +++ b/cmake/SuperBuild/Buildyaml-cpp.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(yaml-cpp_GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp.git") -set(yaml-cpp_GIT_TAG "yaml-cpp-0.7.0") +set(yaml-cpp_GIT_TAG "0.8.0") set(yaml-cpp_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} @@ -15,5 +15,8 @@ ExternalProject_Add( PREFIX ${CMAKE_CURRENT_BINARY_DIR}/yaml-cpp GIT_REPOSITORY ${yaml-cpp_GIT_REPOSITORY} GIT_TAG ${yaml-cpp_GIT_TAG} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-patch/src/emitterutils.cpp + ${CMAKE_CURRENT_BINARY_DIR}/yaml-cpp/src/yaml-cpp/src/emitterutils.cpp LIST_SEPARATOR | CMAKE_ARGS ${yaml-cpp_ARGS}) diff --git a/cmake/SuperBuild/CMakeLists.txt b/cmake/SuperBuild/CMakeLists.txt index 9c1bcaf..734d5db 100644 --- a/cmake/SuperBuild/CMakeLists.txt +++ b/cmake/SuperBuild/CMakeLists.txt @@ -96,6 +96,7 @@ if(toucan_Imath) include(BuildImath) endif() if(toucan_OpenEXR) + include(BuildOpenJPH) include(BuildOpenEXR) endif() if(toucan_svt-av1) diff --git a/cmake/SuperBuild/OTIO-patch/otio.patch b/cmake/SuperBuild/OTIO-patch/otio.patch new file mode 100644 index 0000000..4347647 --- /dev/null +++ b/cmake/SuperBuild/OTIO-patch/otio.patch @@ -0,0 +1,600 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ea11696..41dc22b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -191,12 +191,20 @@ else() + message(STATUS "Building C++ with Coverage: OFF") + endif() + +-if(WIN32) +- # Windows debug builds for Python require a d in order for the module to +- # load. This also helps ensure that debug builds in general are matched +- # to the Microsoft debug CRT. +- set(OTIO_DEBUG_POSTFIX "_d") +-endif() ++# No debug postfix, where upstream sets "_d" on Windows. That is for a debug ++# interpreter, which looks for _opentime_d.pyd and nothing else, and there is ++# no debug interpreter here: pybind11 undefines _DEBUG around Python.h, so a ++# module is compiled against the release ABI in every configuration, and the ++# continuous integration runners ship no python_d.exe to load it with either. ++# The postfix only hides the module from the release interpreter that does ++# run the tests: ++# ++# ModuleNotFoundError: No module named 'opentimelineio._opentime' ++# ++# The C++ libraries lose the postfix with it, which costs nothing. Debug and ++# Release install to separate prefixes, so the names do not meet, and both ++# tlRender and OTIO's own Python package reach these through the exported ++# OTIO::opentimelineio target rather than by file name. + + set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +@@ -295,6 +303,25 @@ endif() + # set up the internally hosted dependencies + add_subdirectory(src/deps) + ++# minizip-ng names its target for how it was built: with the compatibility ++# layer it is MINIZIP::minizip, and without it MINIZIP::minizip-ng. Only an ++# installed one found by find_package can be missing the compatibility name -- ++# the copy in src/deps aliases it either way -- but that is the configuration ++# find_package can actually resolve, so probe rather than assume. The probe has ++# to come after src/deps, which is where that target is defined. ++if(TARGET MINIZIP::minizip-ng) ++ set(OTIO_MINIZIP_TARGET MINIZIP::minizip-ng) ++else() ++ set(OTIO_MINIZIP_TARGET MINIZIP::minizip) ++endif() ++ ++# Installing the bundled copy needs the library itself: install(TARGETS) does ++# not accept an alias. ++get_target_property(OTIO_MINIZIP_LIB ${OTIO_MINIZIP_TARGET} ALIASED_TARGET) ++if(NOT OTIO_MINIZIP_LIB) ++ set(OTIO_MINIZIP_LIB ${OTIO_MINIZIP_TARGET}) ++endif() ++ + add_subdirectory(src/opentime) + add_subdirectory(src/opentimelineio) + +diff --git a/src/opentime/CMakeLists.txt b/src/opentime/CMakeLists.txt +index 4f07106..7674d22 100644 +--- a/src/opentime/CMakeLists.txt ++++ b/src/opentime/CMakeLists.txt +@@ -28,9 +28,15 @@ if(OTIO_SHARED_LIBS) + set_target_properties(opentime PROPERTIES + SOVERSION ${OTIO_SOVERSION} + VERSION ${OTIO_VERSION}) ++ # Private: this says the library is being built, not consumed. Public it ++ # reaches everything that links opentime, and their headers then declare ++ # the API dllexport where it has to be dllimport. OPENTIME_STATIC below ++ # stays public, which is the opposite case: a consumer does have to know ++ # the API carries no declspec at all. Same split as the opentimelineio ++ # library beside it, and as feather-tk, tlRender and DJV. + target_compile_definitions( + opentime +- PUBLIC ++ PRIVATE + OPENTIME_EXPORTS) + else() + target_compile_definitions( +diff --git a/src/opentimelineio/CMakeLists.txt b/src/opentimelineio/CMakeLists.txt +index dd1c881..2c527cc 100644 +--- a/src/opentimelineio/CMakeLists.txt ++++ b/src/opentimelineio/CMakeLists.txt +@@ -94,7 +94,7 @@ endif() + + target_link_libraries(opentimelineio + PUBLIC opentime Imath::Imath +- PRIVATE MINIZIP::minizip) ++ PRIVATE ${OTIO_MINIZIP_TARGET}) + + set_target_properties(opentimelineio PROPERTIES + DEBUG_POSTFIX "${OTIO_DEBUG_POSTFIX}" +@@ -105,9 +105,21 @@ if(OTIO_SHARED_LIBS) + set_target_properties(opentimelineio PROPERTIES + SOVERSION ${OTIO_SOVERSION} + VERSION ${OTIO_VERSION}) ++ # Private: this says the library is being built, not consumed. Public it ++ # reaches everything that links opentimelineio, and their headers then ++ # declare the API dllexport where it has to be dllimport -- the bindings ++ # stop with the symbols the library does hold: ++ # ++ # error LNK2001: unresolved external symbol ++ # opentimelineio::v0_19::Color::black ++ # error LNK1120: 74 unresolved externals [_otio.vcxproj] ++ # ++ # OTIO_STATIC below stays public, which is the opposite case: a consumer ++ # does have to know the API carries no declspec at all. Same split as ++ # feather-tk, tlRender and DJV. + target_compile_definitions( + opentimelineio +- PUBLIC ++ PRIVATE + OTIO_EXPORTS) + else() + target_compile_definitions( +@@ -137,7 +149,7 @@ if(OTIO_CXX_INSTALL) + set(OPENTIMELINEIO_INCLUDES ${OTIO_RESOLVED_CXX_INSTALL_DIR}/include) + + if(NOT OTIO_FIND_MINIZIP_NG) +- install(TARGETS minizip ++ install(TARGETS ${OTIO_MINIZIP_LIB} + EXPORT OpenTimelineIOTargets + ARCHIVE DESTINATION "${OTIO_RESOLVED_CXX_DYLIB_INSTALL_DIR}" + LIBRARY DESTINATION "${OTIO_RESOLVED_CXX_DYLIB_INSTALL_DIR}" +diff --git a/src/opentimelineio/bundle.h b/src/opentimelineio/bundle.h +index daa46a7..d708ed3 100644 +--- a/src/opentimelineio/bundle.h ++++ b/src/opentimelineio/bundle.h +@@ -37,7 +37,7 @@ namespace bundle { + }; + + /// @brief Get a file from a URL. +- std::optional file_from_url(std::string const& url); ++ OTIO_API std::optional file_from_url(std::string const& url); + + /// @brief Options for writing bundles. + struct OTIO_API_TYPE WriteOptions +diff --git a/src/opentimelineio/color.h b/src/opentimelineio/color.h +index d20bf87..48c3552 100644 +--- a/src/opentimelineio/color.h ++++ b/src/opentimelineio/color.h +@@ -39,23 +39,23 @@ public: + + OTIO_API Color(Color const& other); + +- static const Color pink; +- static const Color red; +- static const Color orange; +- static const Color yellow; +- static const Color green; +- static const Color cyan; +- static const Color blue; +- static const Color purple; +- static const Color magenta; +- static const Color black; +- static const Color white; +- static const Color transparent; +- +- static Color* from_hex(std::string const& color); +- static Color* from_int_list(std::vector const& color, int bit_depth); +- static Color* from_agbr_int(unsigned int agbr) noexcept; +- static Color* from_float_list(std::vector const& color); ++ OTIO_API static const Color pink; ++ OTIO_API static const Color red; ++ OTIO_API static const Color orange; ++ OTIO_API static const Color yellow; ++ OTIO_API static const Color green; ++ OTIO_API static const Color cyan; ++ OTIO_API static const Color blue; ++ OTIO_API static const Color purple; ++ OTIO_API static const Color magenta; ++ OTIO_API static const Color black; ++ OTIO_API static const Color white; ++ OTIO_API static const Color transparent; ++ ++ OTIO_API static Color* from_hex(std::string const& color); ++ OTIO_API static Color* from_int_list(std::vector const& color, int bit_depth); ++ OTIO_API static Color* from_agbr_int(unsigned int agbr) noexcept; ++ OTIO_API static Color* from_float_list(std::vector const& color); + + friend bool operator==(Color lhs, Color rhs) noexcept + { +diff --git a/src/opentimelineio/composition.h b/src/opentimelineio/composition.h +index e2a72a4..4133c08 100644 +--- a/src/opentimelineio/composition.h ++++ b/src/opentimelineio/composition.h +@@ -157,7 +157,7 @@ public: + /// @param shallow_search The search is recursive unless shallow_search is + /// set to true. + template +- OTIO_API std::vector> find_children( ++ std::vector> find_children( + ErrorStatus* error_status = nullptr, + std::optional search_range = std::nullopt, + bool shallow_search = false) const; +diff --git a/src/opentimelineio/deserialization.cpp b/src/opentimelineio/deserialization.cpp +index 51f85c6..151cac9 100644 +--- a/src/opentimelineio/deserialization.cpp ++++ b/src/opentimelineio/deserialization.cpp +@@ -1,6 +1,8 @@ + // SPDX-License-Identifier: Apache-2.0 + // Copyright Contributors to the OpenTimelineIO project + ++#include "opentimelineio/deserialization.h" ++ + #include "opentime/rationalTime.h" + #include "opentime/timeRange.h" + #include "opentime/timeTransform.h" +diff --git a/src/opentimelineio/imageSequenceReference.h b/src/opentimelineio/imageSequenceReference.h +index 007a9f6..4ff1ead 100644 +--- a/src/opentimelineio/imageSequenceReference.h ++++ b/src/opentimelineio/imageSequenceReference.h +@@ -136,23 +136,23 @@ public: + } + + /// @brief Return the end frame. +- int end_frame() const; ++ OTIO_API int end_frame() const; + + /// @brief Return the number of images in the sequence. +- int number_of_images_in_sequence() const; ++ OTIO_API int number_of_images_in_sequence() const; + + /// @brief Return the frame for the given time. +- int frame_for_time( ++ OTIO_API int frame_for_time( + RationalTime const& time, + ErrorStatus* error_status = nullptr) const; + + /// @brief Return the target URL for the given image number. +- std::string target_url_for_image_number( ++ OTIO_API std::string target_url_for_image_number( + int image_number, + ErrorStatus* error_status = nullptr) const; + + /// @brief Return the presentation time for the given image number. +- RationalTime presentation_time_for_image_number( ++ OTIO_API RationalTime presentation_time_for_image_number( + int image_number, + ErrorStatus* error_status = nullptr) const; + +diff --git a/src/opentimelineio/safely_typed_any.h b/src/opentimelineio/safely_typed_any.h +index f9586b9..6aa6151 100644 +--- a/src/opentimelineio/safely_typed_any.h ++++ b/src/opentimelineio/safely_typed_any.h +@@ -19,6 +19,7 @@ + /// common library. That's why the seemingly silly code in safely_typed_any.cpp + /// exists. + ++#include "opentimelineio/export.h" + #include "opentime/rationalTime.h" + #include "opentime/timeRange.h" + #include "opentime/timeTransform.h" +@@ -31,48 +32,48 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION_NS { + /// @name Any Create + ///@{ + +-std::any create_safely_typed_any(bool&&); +-std::any create_safely_typed_any(int&&); +-std::any create_safely_typed_any(int64_t&&); +-std::any create_safely_typed_any(uint64_t&&); +-std::any create_safely_typed_any(double&&); +-std::any create_safely_typed_any(std::string&&); +-std::any create_safely_typed_any(RationalTime&&); +-std::any create_safely_typed_any(TimeRange&&); +-std::any create_safely_typed_any(Color&&); +-std::any create_safely_typed_any(TimeTransform&&); +-std::any create_safely_typed_any(IMATH_NAMESPACE::V2d&&); +-std::any create_safely_typed_any(IMATH_NAMESPACE::Box2d&&); +-std::any create_safely_typed_any(AnyVector&&); +-std::any create_safely_typed_any(AnyDictionary&&); +-std::any create_safely_typed_any(SerializableObject*); ++OTIO_API std::any create_safely_typed_any(bool&&); ++OTIO_API std::any create_safely_typed_any(int&&); ++OTIO_API std::any create_safely_typed_any(int64_t&&); ++OTIO_API std::any create_safely_typed_any(uint64_t&&); ++OTIO_API std::any create_safely_typed_any(double&&); ++OTIO_API std::any create_safely_typed_any(std::string&&); ++OTIO_API std::any create_safely_typed_any(RationalTime&&); ++OTIO_API std::any create_safely_typed_any(TimeRange&&); ++OTIO_API std::any create_safely_typed_any(Color&&); ++OTIO_API std::any create_safely_typed_any(TimeTransform&&); ++OTIO_API std::any create_safely_typed_any(IMATH_NAMESPACE::V2d&&); ++OTIO_API std::any create_safely_typed_any(IMATH_NAMESPACE::Box2d&&); ++OTIO_API std::any create_safely_typed_any(AnyVector&&); ++OTIO_API std::any create_safely_typed_any(AnyDictionary&&); ++OTIO_API std::any create_safely_typed_any(SerializableObject*); + + ///@} + + /// @name Any Casting + ///@{ + +-bool safely_cast_bool_any(std::any const& a); +-int safely_cast_int_any(std::any const& a); +-int64_t safely_cast_int64_any(std::any const& a); +-uint64_t safely_cast_uint64_any(std::any const& a); +-double safely_cast_double_any(std::any const& a); +-std::string safely_cast_string_any(std::any const& a); +-RationalTime safely_cast_rational_time_any(std::any const& a); +-TimeRange safely_cast_time_range_any(std::any const& a); +-TimeTransform safely_cast_time_transform_any(std::any const& a); +-Color safely_cast_color_any(std::any const& a); +-IMATH_NAMESPACE::V2d safely_cast_point_any(std::any const& a); +-IMATH_NAMESPACE::Box2d safely_cast_box_any(std::any const& a); ++OTIO_API bool safely_cast_bool_any(std::any const& a); ++OTIO_API int safely_cast_int_any(std::any const& a); ++OTIO_API int64_t safely_cast_int64_any(std::any const& a); ++OTIO_API uint64_t safely_cast_uint64_any(std::any const& a); ++OTIO_API double safely_cast_double_any(std::any const& a); ++OTIO_API std::string safely_cast_string_any(std::any const& a); ++OTIO_API RationalTime safely_cast_rational_time_any(std::any const& a); ++OTIO_API TimeRange safely_cast_time_range_any(std::any const& a); ++OTIO_API TimeTransform safely_cast_time_transform_any(std::any const& a); ++OTIO_API Color safely_cast_color_any(std::any const& a); ++OTIO_API IMATH_NAMESPACE::V2d safely_cast_point_any(std::any const& a); ++OTIO_API IMATH_NAMESPACE::Box2d safely_cast_box_any(std::any const& a); + +-SerializableObject* safely_cast_retainer_any(std::any const& a); ++OTIO_API SerializableObject* safely_cast_retainer_any(std::any const& a); + +-AnyDictionary safely_cast_any_dictionary_any(std::any const& a); ++OTIO_API AnyDictionary safely_cast_any_dictionary_any(std::any const& a); + AnyVector safely_cast_any_vector_any(std::any const& a); + + /// @bug Don't use these unless you know what you're doing... +-AnyDictionary& temp_safely_cast_any_dictionary_any(std::any const& a); +-AnyVector& temp_safely_cast_any_vector_any(std::any const& a); ++OTIO_API AnyDictionary& temp_safely_cast_any_dictionary_any(std::any const& a); ++OTIO_API AnyVector& temp_safely_cast_any_vector_any(std::any const& a); + + ///@} + +diff --git a/src/opentimelineio/serializableCollection.h b/src/opentimelineio/serializableCollection.h +index cf2d008..d0760e5 100644 +--- a/src/opentimelineio/serializableCollection.h ++++ b/src/opentimelineio/serializableCollection.h +@@ -98,7 +98,7 @@ public: + /// @param shallow_search The search is recursive unless shallow_search is + /// set to true. + template +- OTIO_API std::vector> find_children( ++ std::vector> find_children( + ErrorStatus* error_status = nullptr, + std::optional search_range = std::nullopt, + bool shallow_search = false) const; +diff --git a/src/opentimelineio/serializableObject.h b/src/opentimelineio/serializableObject.h +index 4f2e6c6..91d8d5c 100644 +--- a/src/opentimelineio/serializableObject.h ++++ b/src/opentimelineio/serializableObject.h +@@ -604,13 +604,13 @@ public: + }; + + /// @brief Deserialize from the given reader. +- virtual bool read_from(Reader&); ++ OTIO_API virtual bool read_from(Reader&); + + /// @brief Serialize to the given writer. +- virtual void write_to(Writer&) const; ++ OTIO_API virtual void write_to(Writer&) const; + + /// @brief Return whether this schema is unknown. +- virtual bool is_unknown_schema() const; ++ OTIO_API virtual bool is_unknown_schema() const; + + /// @brief Return the schema name. + std::string schema_name() const { return _type_record()->schema_name; } +@@ -675,9 +675,9 @@ public: + protected: + virtual ~SerializableObject(); + +- virtual bool _is_deletable(); ++ OTIO_API virtual bool _is_deletable(); + +- virtual std::string _schema_name_for_reference() const; ++ OTIO_API virtual std::string _schema_name_for_reference() const; + + private: + SerializableObject(SerializableObject const&) = delete; +@@ -700,12 +700,12 @@ public: + }; + + /// @todo Add comment. +- void install_external_keepalive_monitor( ++ OTIO_API void install_external_keepalive_monitor( + std::function monitor, + bool apply_now); + + /// @brief Return the current reference count. +- int current_ref_count() const; ++ OTIO_API int current_ref_count() const; + + /// @brief This struct provides an unknown type. + struct UnknownType +@@ -719,7 +719,7 @@ private: + _cached_type_record = type_record; + } + +- TypeRegistry::_TypeRecord const* _type_record() const; ++ OTIO_API TypeRegistry::_TypeRecord const* _type_record() const; + + mutable TypeRegistry::_TypeRecord const* _cached_type_record; + int _managed_ref_count; +diff --git a/src/opentimelineio/serializableObjectWithMetadata.h b/src/opentimelineio/serializableObjectWithMetadata.h +index 4eeac3f..a7e558c 100644 +--- a/src/opentimelineio/serializableObjectWithMetadata.h ++++ b/src/opentimelineio/serializableObjectWithMetadata.h +@@ -42,10 +42,10 @@ public: + AnyDictionary metadata() const noexcept { return _metadata; } + + protected: +- virtual ~SerializableObjectWithMetadata(); ++ OTIO_API virtual ~SerializableObjectWithMetadata(); + +- bool read_from(Reader&) override; +- void write_to(Writer&) const override; ++ OTIO_API bool read_from(Reader&) override; ++ OTIO_API void write_to(Writer&) const override; + + private: + std::string _name; +diff --git a/src/opentimelineio/stringUtils.cpp b/src/opentimelineio/stringUtils.cpp +index 20ac2c2..c6b6051 100644 +--- a/src/opentimelineio/stringUtils.cpp ++++ b/src/opentimelineio/stringUtils.cpp +@@ -1,6 +1,8 @@ + // SPDX-License-Identifier: Apache-2.0 + // Copyright Contributors to the OpenTimelineIO project + ++#include "stringUtils.h" ++ + #include "opentimelineio/serializableObject.h" + #include + #include +diff --git a/src/opentimelineio/stringUtils.h b/src/opentimelineio/stringUtils.h +index 709b5c1..aee94a2 100644 +--- a/src/opentimelineio/stringUtils.h ++++ b/src/opentimelineio/stringUtils.h +@@ -4,6 +4,7 @@ + #pragma once + + #include "opentime/stringPrintf.h" ++#include "opentimelineio/export.h" + #include "opentimelineio/version.h" + using opentime::string_printf; + +@@ -17,9 +18,9 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION_NS { + + void fatal_error(std::string const& errMsg); + +-std::string type_name_for_error_message(std::type_info const&); +-std::string type_name_for_error_message(std::any const& a); +-std::string type_name_for_error_message(class SerializableObject*); ++OTIO_API std::string type_name_for_error_message(std::type_info const&); ++OTIO_API std::string type_name_for_error_message(std::any const& a); ++OTIO_API std::string type_name_for_error_message(class SerializableObject*); + + template + std::string +diff --git a/src/opentimelineio/timeline.h b/src/opentimelineio/timeline.h +index 9273ad5..470dcff 100644 +--- a/src/opentimelineio/timeline.h ++++ b/src/opentimelineio/timeline.h +@@ -44,7 +44,7 @@ public: + }*/ + + /// @brief Set the timeline stack. +- void set_tracks(Stack* stack); ++ OTIO_API void set_tracks(Stack* stack); + + /// @brief Return the global start time. + std::optional global_start_time() const noexcept +@@ -97,7 +97,7 @@ public: + /// @param shallow_search The search is recursive unless shallow_search is + /// set to true. + template +- OTIO_API std::vector> find_children( ++ std::vector> find_children( + ErrorStatus* error_status = nullptr, + std::optional search_range = std::nullopt, + bool shallow_search = false) const; +diff --git a/src/opentimelineio/transition.h b/src/opentimelineio/transition.h +index 2dd75cf..187eb78 100644 +--- a/src/opentimelineio/transition.h ++++ b/src/opentimelineio/transition.h +@@ -82,11 +82,11 @@ public: + RationalTime duration(ErrorStatus* error_status = nullptr) const override; + + /// @brief Return the range in the parent's time. +- std::optional ++ OTIO_API std::optional + range_in_parent(ErrorStatus* error_status = nullptr) const; + + /// @brief Return the range trimmed in the parent's time. +- std::optional ++ OTIO_API std::optional + trimmed_range_in_parent(ErrorStatus* error_status = nullptr) const; + + protected: +diff --git a/src/opentimelineio/typeRegistry.cpp b/src/opentimelineio/typeRegistry.cpp +index 3950796..560a7ff 100644 +--- a/src/opentimelineio/typeRegistry.cpp ++++ b/src/opentimelineio/typeRegistry.cpp +@@ -410,7 +410,12 @@ TypeRegistry::_instance_from_schema( + { + for (const auto& e: type_record->upgrade_functions) + { +- if (schema_version <= e.first ++ // Strictly below: a function registered for version N upgrades ++ // a dictionary from version N-1, so a file already at N must ++ // not run it. Re-running the Marker version 2 upgrade on a ++ // Marker.2 file assigns the missing "range" key -- which ++ // operator[] creates as a null -- over the good "marked_range". ++ if (schema_version < e.first + && e.first <= type_record->schema_version) + { + e.second(&dict); +diff --git a/src/opentimelineio/typeRegistry.h b/src/opentimelineio/typeRegistry.h +index 2f9182a..77d9d3e 100644 +--- a/src/opentimelineio/typeRegistry.h ++++ b/src/opentimelineio/typeRegistry.h +@@ -33,7 +33,7 @@ using label_to_schema_version_map = + + ///@} + +-extern const label_to_schema_version_map CORE_VERSION_MAP; ++extern OTIO_API const label_to_schema_version_map CORE_VERSION_MAP; + + /// @brief Type registry. + class OTIO_API_TYPE TypeRegistry +@@ -42,7 +42,7 @@ public: + /// @brief Get the type registry singleton. + /// + /// Access to functions are thread-safe. +- static TypeRegistry& instance(); ++ OTIO_API static TypeRegistry& instance(); + + /// @brief Register a new schema. + /// +@@ -51,7 +51,7 @@ public: + /// the templated form of this call. + /// + /// If the specified schema_name has already been registered, this function does nothing and returns false. +- bool register_type( ++ OTIO_API bool register_type( + std::string const& schema_name, + int schema_version, + std::type_info const* type, +@@ -98,7 +98,7 @@ public: + /// + /// Returns false if an upgrade function has been registered for this (schema_name, version) + /// pair, or if schema_name itself has not been registered, and true otherwise. +- bool register_upgrade_function( ++ OTIO_API bool register_upgrade_function( + std::string const& schema_name, + int version_to_upgrade_to, + std::function upgrade_function); +@@ -119,7 +119,7 @@ public: + + /// @brief Downgrade function from version_to_downgrade_from to + /// version_to_downgrade_from - 1 +- bool register_downgrade_function( ++ OTIO_API bool register_downgrade_function( + std::string const& schema_name, + int version_to_downgrade_from, + std::function downgrade_function); +@@ -154,13 +154,13 @@ public: + } + + /// @brief For use by external bridging systems. +- bool set_type_record( ++ OTIO_API bool set_type_record( + SerializableObject*, + std::string const& schema_name, + ErrorStatus* error_status = nullptr); + + /// @brief For inspecting the type registry, build a map of schema name to version. +- void type_version_map(schema_version_map& result); ++ OTIO_API void type_version_map(schema_version_map& result); + + private: + TypeRegistry(); +@@ -204,7 +204,7 @@ private: + return it == _type_records.end() ? nullptr : it->second; + } + +- SerializableObject* _instance_from_schema( ++ OTIO_API SerializableObject* _instance_from_schema( + std::string schema_name, + int schema_version, + AnyDictionary& dict, +diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt +index 510df88..4c73a81 100644 +--- a/tests/CMakeLists.txt ++++ b/tests/CMakeLists.txt +@@ -40,4 +40,4 @@ foreach(test ${tests_opentimelineio}) + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + endforeach() + +-target_link_libraries(test_bundle MINIZIP::minizip) ++target_link_libraries(test_bundle ${OTIO_MINIZIP_TARGET}) diff --git a/cmake/SuperBuild/OTIOApplyPatch.cmake b/cmake/SuperBuild/OTIOApplyPatch.cmake new file mode 100644 index 0000000..78c6397 --- /dev/null +++ b/cmake/SuperBuild/OTIOApplyPatch.cmake @@ -0,0 +1,35 @@ +# Apply the OpenTimelineIO patch, and do nothing if it is already applied. +# +# The patch step runs again whenever its stamp is cleared, which is not always +# accompanied by a fresh clone, and "git apply" fails on a tree it has already +# been applied to. Asking whether it reverses tells the two apart: a tree that +# the patch can be taken back out of is a tree it is already in. +# +# Run with -DOTIO_SOURCE_DIR=... -DOTIO_PATCH=... -DGIT_EXECUTABLE=... + +execute_process( + COMMAND ${GIT_EXECUTABLE} apply --reverse --check ${OTIO_PATCH} + WORKING_DIRECTORY ${OTIO_SOURCE_DIR} + RESULT_VARIABLE alreadyApplied + OUTPUT_QUIET ERROR_QUIET) +if(alreadyApplied EQUAL 0) + message(STATUS "OTIO patch is already applied") + return() +endif() + +execute_process( + COMMAND ${GIT_EXECUTABLE} apply ${OTIO_PATCH} + WORKING_DIRECTORY ${OTIO_SOURCE_DIR} + RESULT_VARIABLE result + ERROR_VARIABLE error) +if(NOT result EQUAL 0) + # Most likely the change has landed upstream, or OTIO_GIT_TAG moved and the + # file the patch expects is no longer what is there. Either way the patch + # has to be looked at rather than worked around: see the notes in + # BuildOTIO.cmake. + message(FATAL_ERROR + "Could not apply ${OTIO_PATCH}:\n${error}\n" + "If OTIO_GIT_TAG moved, re-make the patch against the new source. If " + "the change is upstream now, drop the patch and this step with it.") +endif() +message(STATUS "OTIO patch applied") diff --git a/cmake/SuperBuild/svt-av1-patch/Source/Lib/pkg-config.pc.in b/cmake/SuperBuild/svt-av1-patch/Source/Lib/pkg-config.pc.in deleted file mode 100644 index a55ce28..0000000 --- a/cmake/SuperBuild/svt-av1-patch/Source/Lib/pkg-config.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -includedir=@SVT_AV1_INCLUDEDIR@ -libdir=@SVT_AV1_LIBDIR@ - -Name: SvtAv1Enc -Description: SVT (Scalable Video Technology) for AV1 encoder library -Version: @ENC_VERSION_MAJOR@.@ENC_VERSION_MINOR@.@ENC_VERSION_PATCH@ -Libs: -L${libdir} -lSvtAv1Enc @LIBS_PRIVATE@ -Libs.private: @LIBS_PRIVATE@ -Cflags: -I${includedir}/svt-av1@ENC_PKG_CONFIG_EXTRA_CFLAGS@ -Cflags.private: -UEB_DLL diff --git a/cmake/SuperBuild/yaml-cpp-patch/src/emitterutils.cpp b/cmake/SuperBuild/yaml-cpp-patch/src/emitterutils.cpp new file mode 100644 index 0000000..dbd2590 --- /dev/null +++ b/cmake/SuperBuild/yaml-cpp-patch/src/emitterutils.cpp @@ -0,0 +1,498 @@ +#include +#include +#include +#include + +#include "emitterutils.h" +#include "exp.h" +#include "indentation.h" +#include "regex_yaml.h" +#include "regeximpl.h" +#include "stringsource.h" +#include "yaml-cpp/binary.h" // IWYU pragma: keep +#include "yaml-cpp/null.h" +#include "yaml-cpp/ostream_wrapper.h" + +namespace YAML { +namespace Utils { +namespace { +enum { REPLACEMENT_CHARACTER = 0xFFFD }; + +bool IsAnchorChar(int ch) { // test for ns-anchor-char + switch (ch) { + case ',': + case '[': + case ']': + case '{': + case '}': // c-flow-indicator + case ' ': + case '\t': // s-white + case 0xFEFF: // c-byte-order-mark + case 0xA: + case 0xD: // b-char + return false; + case 0x85: + return true; + } + + if (ch < 0x20) { + return false; + } + + if (ch < 0x7E) { + return true; + } + + if (ch < 0xA0) { + return false; + } + if (ch >= 0xD800 && ch <= 0xDFFF) { + return false; + } + if ((ch & 0xFFFE) == 0xFFFE) { + return false; + } + if ((ch >= 0xFDD0) && (ch <= 0xFDEF)) { + return false; + } + if (ch > 0x10FFFF) { + return false; + } + + return true; +} + +int Utf8BytesIndicated(char ch) { + int byteVal = static_cast(ch); + switch (byteVal >> 4) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + return 1; + case 12: + case 13: + return 2; + case 14: + return 3; + case 15: + return 4; + default: + return -1; + } +} + +bool IsTrailingByte(char ch) { return (ch & 0xC0) == 0x80; } + +bool GetNextCodePointAndAdvance(int& codePoint, + std::string::const_iterator& first, + std::string::const_iterator last) { + if (first == last) + return false; + + int nBytes = Utf8BytesIndicated(*first); + if (nBytes < 1) { + // Bad lead byte + ++first; + codePoint = REPLACEMENT_CHARACTER; + return true; + } + + if (nBytes == 1) { + codePoint = *first++; + return true; + } + + // Gather bits from trailing bytes + codePoint = static_cast(*first) & ~(0xFF << (7 - nBytes)); + ++first; + --nBytes; + for (; nBytes > 0; ++first, --nBytes) { + if ((first == last) || !IsTrailingByte(*first)) { + codePoint = REPLACEMENT_CHARACTER; + break; + } + codePoint <<= 6; + codePoint |= *first & 0x3F; + } + + // Check for illegal code points + if (codePoint > 0x10FFFF) + codePoint = REPLACEMENT_CHARACTER; + else if (codePoint >= 0xD800 && codePoint <= 0xDFFF) + codePoint = REPLACEMENT_CHARACTER; + else if ((codePoint & 0xFFFE) == 0xFFFE) + codePoint = REPLACEMENT_CHARACTER; + else if (codePoint >= 0xFDD0 && codePoint <= 0xFDEF) + codePoint = REPLACEMENT_CHARACTER; + return true; +} + +void WriteCodePoint(ostream_wrapper& out, int codePoint) { + if (codePoint < 0 || codePoint > 0x10FFFF) { + codePoint = REPLACEMENT_CHARACTER; + } + if (codePoint <= 0x7F) { + out << static_cast(codePoint); + } else if (codePoint <= 0x7FF) { + out << static_cast(0xC0 | (codePoint >> 6)) + << static_cast(0x80 | (codePoint & 0x3F)); + } else if (codePoint <= 0xFFFF) { + out << static_cast(0xE0 | (codePoint >> 12)) + << static_cast(0x80 | ((codePoint >> 6) & 0x3F)) + << static_cast(0x80 | (codePoint & 0x3F)); + } else { + out << static_cast(0xF0 | (codePoint >> 18)) + << static_cast(0x80 | ((codePoint >> 12) & 0x3F)) + << static_cast(0x80 | ((codePoint >> 6) & 0x3F)) + << static_cast(0x80 | (codePoint & 0x3F)); + } +} + +bool IsValidPlainScalar(const std::string& str, FlowType::value flowType, + bool allowOnlyAscii) { + // check against null + if (IsNullString(str)) { + return false; + } + + // check the start + const RegEx& start = (flowType == FlowType::Flow ? Exp::PlainScalarInFlow() + : Exp::PlainScalar()); + if (!start.Matches(str)) { + return false; + } + + // and check the end for plain whitespace (which can't be faithfully kept in a + // plain scalar) + if (!str.empty() && *str.rbegin() == ' ') { + return false; + } + + // then check until something is disallowed + static const RegEx& disallowed_flow = + Exp::EndScalarInFlow() | (Exp::BlankOrBreak() + Exp::Comment()) | + Exp::NotPrintable() | Exp::Utf8_ByteOrderMark() | Exp::Break() | + Exp::Tab() | Exp::Ampersand(); + static const RegEx& disallowed_block = + Exp::EndScalar() | (Exp::BlankOrBreak() + Exp::Comment()) | + Exp::NotPrintable() | Exp::Utf8_ByteOrderMark() | Exp::Break() | + Exp::Tab() | Exp::Ampersand(); + const RegEx& disallowed = + flowType == FlowType::Flow ? disallowed_flow : disallowed_block; + + StringCharSource buffer(str.c_str(), str.size()); + while (buffer) { + if (disallowed.Matches(buffer)) { + return false; + } + if (allowOnlyAscii && (0x80 <= static_cast(buffer[0]))) { + return false; + } + ++buffer; + } + + return true; +} + +bool IsValidSingleQuotedScalar(const std::string& str, bool escapeNonAscii) { + // TODO: check for non-printable characters? + return std::none_of(str.begin(), str.end(), [=](char ch) { + return (escapeNonAscii && (0x80 <= static_cast(ch))) || + (ch == '\n'); + }); +} + +bool IsValidLiteralScalar(const std::string& str, FlowType::value flowType, + bool escapeNonAscii) { + if (flowType == FlowType::Flow) { + return false; + } + + // TODO: check for non-printable characters? + return std::none_of(str.begin(), str.end(), [=](char ch) { + return (escapeNonAscii && (0x80 <= static_cast(ch))); + }); +} + +std::pair EncodeUTF16SurrogatePair(int codePoint) { + const uint32_t leadOffset = 0xD800 - (0x10000 >> 10); + + return { + leadOffset | (codePoint >> 10), + 0xDC00 | (codePoint & 0x3FF), + }; +} + +void WriteDoubleQuoteEscapeSequence(ostream_wrapper& out, int codePoint, StringEscaping::value stringEscapingStyle) { + static const char hexDigits[] = "0123456789abcdef"; + + out << "\\"; + int digits = 8; + if (codePoint < 0xFF && stringEscapingStyle != StringEscaping::JSON) { + out << "x"; + digits = 2; + } else if (codePoint < 0xFFFF) { + out << "u"; + digits = 4; + } else if (stringEscapingStyle != StringEscaping::JSON) { + out << "U"; + digits = 8; + } else { + auto surrogatePair = EncodeUTF16SurrogatePair(codePoint); + WriteDoubleQuoteEscapeSequence(out, surrogatePair.first, stringEscapingStyle); + WriteDoubleQuoteEscapeSequence(out, surrogatePair.second, stringEscapingStyle); + return; + } + + // Write digits into the escape sequence + for (; digits > 0; --digits) + out << hexDigits[(codePoint >> (4 * (digits - 1))) & 0xF]; +} + +bool WriteAliasName(ostream_wrapper& out, const std::string& str) { + int codePoint; + for (std::string::const_iterator i = str.begin(); + GetNextCodePointAndAdvance(codePoint, i, str.end());) { + if (!IsAnchorChar(codePoint)) { + return false; + } + + WriteCodePoint(out, codePoint); + } + return true; +} +} // namespace + +StringFormat::value ComputeStringFormat(const std::string& str, + EMITTER_MANIP strFormat, + FlowType::value flowType, + bool escapeNonAscii) { + switch (strFormat) { + case Auto: + if (IsValidPlainScalar(str, flowType, escapeNonAscii)) { + return StringFormat::Plain; + } + return StringFormat::DoubleQuoted; + case SingleQuoted: + if (IsValidSingleQuotedScalar(str, escapeNonAscii)) { + return StringFormat::SingleQuoted; + } + return StringFormat::DoubleQuoted; + case DoubleQuoted: + return StringFormat::DoubleQuoted; + case Literal: + if (IsValidLiteralScalar(str, flowType, escapeNonAscii)) { + return StringFormat::Literal; + } + return StringFormat::DoubleQuoted; + default: + break; + } + + return StringFormat::DoubleQuoted; +} + +bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str) { + out << "'"; + int codePoint; + for (std::string::const_iterator i = str.begin(); + GetNextCodePointAndAdvance(codePoint, i, str.end());) { + if (codePoint == '\n') { + return false; // We can't handle a new line and the attendant indentation + // yet + } + + if (codePoint == '\'') { + out << "''"; + } else { + WriteCodePoint(out, codePoint); + } + } + out << "'"; + return true; +} + +bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str, + StringEscaping::value stringEscaping) { + out << "\""; + int codePoint; + for (std::string::const_iterator i = str.begin(); + GetNextCodePointAndAdvance(codePoint, i, str.end());) { + switch (codePoint) { + case '\"': + out << "\\\""; + break; + case '\\': + out << "\\\\"; + break; + case '\n': + out << "\\n"; + break; + case '\t': + out << "\\t"; + break; + case '\r': + out << "\\r"; + break; + case '\b': + out << "\\b"; + break; + case '\f': + out << "\\f"; + break; + default: + if (codePoint < 0x20 || + (codePoint >= 0x80 && + codePoint <= 0xA0)) { // Control characters and non-breaking space + WriteDoubleQuoteEscapeSequence(out, codePoint, stringEscaping); + } else if (codePoint == 0xFEFF) { // Byte order marks (ZWNS) should be + // escaped (YAML 1.2, sec. 5.2) + WriteDoubleQuoteEscapeSequence(out, codePoint, stringEscaping); + } else if (stringEscaping == StringEscaping::NonAscii && codePoint > 0x7E) { + WriteDoubleQuoteEscapeSequence(out, codePoint, stringEscaping); + } else { + WriteCodePoint(out, codePoint); + } + } + } + out << "\""; + return true; +} + +bool WriteLiteralString(ostream_wrapper& out, const std::string& str, + std::size_t indent) { + out << "|\n"; + int codePoint; + for (std::string::const_iterator i = str.begin(); + GetNextCodePointAndAdvance(codePoint, i, str.end());) { + if (codePoint == '\n') { + out << "\n"; + } else { + out<< IndentTo(indent); + WriteCodePoint(out, codePoint); + } + } + return true; +} + +bool WriteChar(ostream_wrapper& out, char ch, StringEscaping::value stringEscapingStyle) { + if (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')) { + out << ch; + } else if (ch == '\"') { + out << R"("\"")"; + } else if (ch == '\t') { + out << R"("\t")"; + } else if (ch == '\n') { + out << R"("\n")"; + } else if (ch == '\b') { + out << R"("\b")"; + } else if (ch == '\r') { + out << R"("\r")"; + } else if (ch == '\f') { + out << R"("\f")"; + } else if (ch == '\\') { + out << R"("\\")"; + } else if (0x20 <= ch && ch <= 0x7e) { + out << "\"" << ch << "\""; + } else { + out << "\""; + WriteDoubleQuoteEscapeSequence(out, ch, stringEscapingStyle); + out << "\""; + } + return true; +} + +bool WriteComment(ostream_wrapper& out, const std::string& str, + std::size_t postCommentIndent) { + const std::size_t curIndent = out.col(); + out << "#" << Indentation(postCommentIndent); + out.set_comment(); + int codePoint; + for (std::string::const_iterator i = str.begin(); + GetNextCodePointAndAdvance(codePoint, i, str.end());) { + if (codePoint == '\n') { + out << "\n" + << IndentTo(curIndent) << "#" << Indentation(postCommentIndent); + out.set_comment(); + } else { + WriteCodePoint(out, codePoint); + } + } + return true; +} + +bool WriteAlias(ostream_wrapper& out, const std::string& str) { + out << "*"; + return WriteAliasName(out, str); +} + +bool WriteAnchor(ostream_wrapper& out, const std::string& str) { + out << "&"; + return WriteAliasName(out, str); +} + +bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim) { + out << (verbatim ? "!<" : "!"); + StringCharSource buffer(str.c_str(), str.size()); + const RegEx& reValid = verbatim ? Exp::URI() : Exp::Tag(); + while (buffer) { + int n = reValid.Match(buffer); + if (n <= 0) { + return false; + } + + while (--n >= 0) { + out << buffer[0]; + ++buffer; + } + } + if (verbatim) { + out << ">"; + } + return true; +} + +bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix, + const std::string& tag) { + out << "!"; + StringCharSource prefixBuffer(prefix.c_str(), prefix.size()); + while (prefixBuffer) { + int n = Exp::URI().Match(prefixBuffer); + if (n <= 0) { + return false; + } + + while (--n >= 0) { + out << prefixBuffer[0]; + ++prefixBuffer; + } + } + + out << "!"; + StringCharSource tagBuffer(tag.c_str(), tag.size()); + while (tagBuffer) { + int n = Exp::Tag().Match(tagBuffer); + if (n <= 0) { + return false; + } + + while (--n >= 0) { + out << tagBuffer[0]; + ++tagBuffer; + } + } + return true; +} + +bool WriteBinary(ostream_wrapper& out, const Binary& binary) { + WriteDoubleQuotedString(out, EncodeBase64(binary.data(), binary.size()), + StringEscaping::None); + return true; +} +} // namespace Utils +} // namespace YAML diff --git a/legal/LICENSE_OpenJPH.txt b/legal/LICENSE_OpenJPH.txt new file mode 100644 index 0000000..d403b9c --- /dev/null +++ b/legal/LICENSE_OpenJPH.txt @@ -0,0 +1,27 @@ +BSD 2-Clause License + +Copyright (c) 2019, Aous Naman +Copyright (c) 2019, Kakadu Software Pty Ltd, Australia +Copyright (c) 2019, The University of New South Wales, Sydney, Australia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/lib/toucanRender/CMakeLists.txt b/lib/toucanRender/CMakeLists.txt index 02aa75c..89f224e 100644 --- a/lib/toucanRender/CMakeLists.txt +++ b/lib/toucanRender/CMakeLists.txt @@ -51,7 +51,7 @@ set(LIBS_PUBLIC OTIO::opentime lunasvg::lunasvg OpenImageIO::OpenImageIO - MINIZIP::minizip) + MINIZIP::minizip-ng) if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9) list(APPEND LIBS_PUBLIC stdc++fs) endif() diff --git a/lib/toucanRender/TimelineWrapper.cpp b/lib/toucanRender/TimelineWrapper.cpp index 18ba432..daf3419 100644 --- a/lib/toucanRender/TimelineWrapper.cpp +++ b/lib/toucanRender/TimelineWrapper.cpp @@ -26,7 +26,7 @@ namespace toucan public: ZipFile(const std::filesystem::path& path) { - mz_zip_reader_create(&handle); + handle = mz_zip_reader_create(); if (!handle) { throw std::runtime_error("Cannot create zip handle"); @@ -40,7 +40,7 @@ namespace toucan ZipFile(const void* data, size_t size) { - mz_zip_reader_create(&handle); + handle = mz_zip_reader_create(); if (!handle) { throw std::runtime_error("Cannot create zip handle"); diff --git a/lib/toucanView/DetailsTool.cpp b/lib/toucanView/DetailsTool.cpp index 1a1b442..d97e7ce 100644 --- a/lib/toucanView/DetailsTool.cpp +++ b/lib/toucanView/DetailsTool.cpp @@ -163,7 +163,14 @@ namespace toucan } else if (auto marker = OTIO_NS::dynamic_retainer_cast(_item.object)) { - _text.push_back(std::make_pair("Color:", marker->color())); + std::string color; + if (auto markerColor = marker->color()) + { + color = !markerColor->name().empty() ? + markerColor->name() : + markerColor->to_hex(); + } + _text.push_back(std::make_pair("Color:", color)); _text.push_back(std::make_pair("Range:", toString(marker->marked_range(), _timeUnits))); _text.push_back(std::make_pair("Comment:", marker->comment())); diff --git a/lib/toucanView/MarkerItem.cpp b/lib/toucanView/MarkerItem.cpp index 9b3a8a6..f004281 100644 --- a/lib/toucanView/MarkerItem.cpp +++ b/lib/toucanView/MarkerItem.cpp @@ -7,52 +7,12 @@ namespace toucan { - ftk::Color4F getMarkerColor(const std::string& color) + ftk::Color4F getMarkerColor(const std::optional& color) { ftk::Color4F out(1.F, 0.F, 0.F); - if (color == OTIO_NS::Marker::Color::pink) + if (color.has_value()) { - out = ftk::Color4F(1.F, 0.F, .5F); - } - else if (color == OTIO_NS::Marker::Color::red) - { - out = ftk::Color4F(1.F, 0.F, 0.F); - } - else if (color == OTIO_NS::Marker::Color::orange) - { - out = ftk::Color4F(1.F, .6F, 0.F); - } - else if (color == OTIO_NS::Marker::Color::yellow) - { - out = ftk::Color4F(1.F, 1.F, 0.F); - } - else if (color == OTIO_NS::Marker::Color::green) - { - out = ftk::Color4F(0.F, 1.F, 0.F); - } - else if (color == OTIO_NS::Marker::Color::cyan) - { - out = ftk::Color4F(0.F, 1.F, 1.F); - } - else if (color == OTIO_NS::Marker::Color::blue) - { - out = ftk::Color4F(0.F, 0.F, 1.F); - } - else if (color == OTIO_NS::Marker::Color::purple) - { - out = ftk::Color4F(.5F, 0.F, 1.F); - } - else if (color == OTIO_NS::Marker::Color::magenta) - { - out = ftk::Color4F(1.F, 0.F, 1.F); - } - else if (color == OTIO_NS::Marker::Color::black) - { - out = ftk::Color4F(0.F, 0.F, 0.F); - } - else if (color == OTIO_NS::Marker::Color::white) - { - out = ftk::Color4F(1.F, 1.F, 1.F); + out = ftk::Color4F(color->r(), color->g(), color->b(), color->a()); } return out; } diff --git a/lib/toucanView/MarkerItem.h b/lib/toucanView/MarkerItem.h index 6d68974..b07d8eb 100644 --- a/lib/toucanView/MarkerItem.h +++ b/lib/toucanView/MarkerItem.h @@ -10,10 +10,12 @@ #include +#include + namespace toucan { //! Get a marker color. - ftk::Color4F getMarkerColor(const std::string&); + ftk::Color4F getMarkerColor(const std::optional&); //! Timeline marker item. class MarkerItem : public IItem diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 033af43..041f4d9 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,5 +1,5 @@ add_library(toucanPlugin Plugin.h Util.h Plugin.cpp Util.cpp) -set(LIBS_PUBLIC OpenImageIO::OpenImageIO MINIZIP::minizip) +set(LIBS_PUBLIC OpenImageIO::OpenImageIO MINIZIP::minizip-ng) if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9) list(APPEND LIBS_PUBLIC stdc++fs) endif() diff --git a/toucanConfig.cmake.in b/toucanConfig.cmake.in index 4e2ff78..e7d9881 100644 --- a/toucanConfig.cmake.in +++ b/toucanConfig.cmake.in @@ -11,7 +11,7 @@ find_dependency(PNG) find_dependency(JPEG) find_dependency(TIFF) find_dependency(OpenEXR) -find_dependency(minizip) +find_dependency(minizip-ng) find_dependency(OpenColorIO) find_dependency(OpenImageIO) find_dependency(OTIO)