Encapsulate video support with compilation variable EXV_ENABLE_VIDEO (#2448)

* Encapsulate video support with compilation variable EXV_ENABLE_VIDEO

* Encapsulate video support with compilation variable EXV_ENABLE_VIDEO: add variable to unit test files

* Encapsulate video support with compilation variable EXV_ENABLE_VIDEO: encapsulate in makefile

* Encapsulate video support with compilation variable EXV_ENABLE_VIDEO: fix PR windows matrix

* Encapsulate video support with compilation variable EXV_ENABLE_VIDEO: activate only for concerned CI tests

* Encapsulate video support with compilation variable EXV_ENABLE_VIDEO: desable for linux release

* Encapsulate video support with compilation variable EXV_ENABLE_VIDEO: add to Fuzz PR
main
Mohamed Ali Chebbi 3 years ago committed by GitHub
parent 346e11493f
commit 1c764358bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,7 +28,7 @@ jobs:
- name: build and compile
run: |
cmake --preset linux-sanitizers -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=$(which clang++) -DEXIV2_BUILD_FUZZ_TESTS=ON -DEXIV2_BUILD_UNIT_TESTS=OFF
cmake --preset linux-sanitizers -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=$(which clang++) -DEXIV2_BUILD_FUZZ_TESTS=ON -DEXIV2_BUILD_UNIT_TESTS=OFF -DEXIV2_ENABLE_VIDEO=ON
cmake --build build --parallel
- name: Fuzz

@ -43,7 +43,7 @@ jobs:
- name: Build
run: |
cmake --preset base_linux -S . -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.shared_libraries}}
cmake --preset base_linux -S . -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.shared_libraries}} -DEXIV2_ENABLE_VIDEO=ON
cmake --build build-base_linux --parallel
- name: Install

@ -41,7 +41,7 @@ jobs:
- name: Build
run: |
cmake --preset linux-coverage -S . -B build
cmake --preset linux-coverage -S . -B build -DEXIV2_ENABLE_VIDEO=ON
cmake --build build --parallel
- name: Tests + Upload coverage
@ -121,7 +121,7 @@ jobs:
- name: Build
run: |
cmake --preset linux-sanitizers -S . -B build
cmake --preset linux-sanitizers -S . -B build -DEXIV2_ENABLE_VIDEO=ON
cmake --build build --parallel
- name: Tests

@ -38,7 +38,7 @@ jobs:
- name: Build
run: |
cmake --preset base_mac -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.shared_libraries}} -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations"
cmake --preset base_mac -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.shared_libraries}} -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" -DEXIV2_ENABLE_VIDEO=ON
cmake --build build --parallel
- name: Install

@ -33,7 +33,7 @@ jobs:
- name: Build
run: |
cmake --preset base_mac -S . -B build -DEXIV2_TEAM_USE_SANITIZERS=ON
cmake --preset base_mac -S . -B build -DEXIV2_TEAM_USE_SANITIZERS=ON -DEXIV2_ENABLE_VIDEO=ON
cmake --build build --parallel
- name: Tests

@ -78,7 +78,7 @@ jobs:
- name: Build
run: |
cmake --preset base_windows -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.shared_libraries}}
cmake --preset base_windows -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.shared_libraries}} -DEXIV2_ENABLE_VIDEO=ON
cmake --build build --parallel
- name: Install
@ -138,6 +138,7 @@ jobs:
-DBUILD_SHARED_LIBS=${{matrix.shared_libraries}} \
-DCONAN_AUTO_INSTALL=OFF \
-DCMAKE_CXX_FLAGS=-Wno-deprecated \
-DEXIV2_ENABLE_VIDEO=ON \
-DEXIV2_TEAM_WARNINGS_AS_ERRORS=OFF
cmake --build build --parallel
@ -205,6 +206,7 @@ jobs:
-DEXIV2_ENABLE_WEBREADY=ON \
-DEXIV2_ENABLE_CURL=ON \
-DEXIV2_ENABLE_BMFF=ON \
-DEXIV2_ENABLE_VIDEO=ON \
-DEXIV2_BUILD_UNIT_TESTS=OFF \
-S . -B build && \
cmake --build build --parallel

@ -54,7 +54,7 @@ jobs:
- name: Build
run: |
cmake --preset win-release -S . -B build
cmake --preset win-release -S . -B build -DEXIV2_ENABLE_VIDEO=ON
cmake --build build --parallel
@ -85,7 +85,7 @@ jobs:
- name: build and compile
run: |
cmake --preset linux-release-NoConan -S . -B build
cmake --preset linux-release-NoConan -S . -B build -DEXIV2_ENABLE_VIDEO=ON
cmake --build build --parallel
- name: Test
@ -115,7 +115,7 @@ jobs:
- name: build and compile
run: |
cmake --preset base_mac -S . -B build -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations"
cmake --preset base_mac -S . -B build -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" -DEXIV2_ENABLE_VIDEO=ON
cmake --build build --parallel
- name: Test

@ -42,7 +42,7 @@ jobs:
- name: Build
run: |
cmake --preset linux-coverage -S . -B build
cmake --preset linux-coverage -S . -B build -DEXIV2_ENABLE_VIDEO=ON
cmake --build build
- name: Tests + Upload coverage

@ -30,6 +30,7 @@ option( EXIV2_ENABLE_WEBREADY "Build webready support into library"
option( EXIV2_ENABLE_CURL "Use libcurl for HttpIo (WEBREADY)" OFF )
option( EXIV2_ENABLE_BMFF "Build with BMFF support" ON )
option( EXIV2_ENABLE_BROTLI "Use Brotli for JPEG XL compressed boxes (BMFF)" ON )
option( EXIV2_ENABLE_VIDEO "Build with video support" OFF )
option( EXIV2_BUILD_SAMPLES "Build sample applications" OFF )
option( EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" ON )

@ -18,7 +18,8 @@
"EXIV2_ENABLE_BMFF": true,
"EXIV2_BUILD_UNIT_TESTS": true,
"EXIV2_TEAM_WARNINGS_AS_ERRORS": true,
"EXIV2_ENABLE_NLS": false
"EXIV2_ENABLE_NLS": false,
"EXIV2_ENABLE_VIDEO": false
}
},
{
@ -141,6 +142,7 @@
"inherits": "linux-release-NoConan",
"cacheVariables": {
"EXIV2_ENABLE_NLS": true,
"EXIV2_ENABLE_VIDEO": false,
"EXIV2_BUILD_DOC": true
}
}

@ -181,6 +181,7 @@ Preset CMake variables:
EXIV2_ENABLE_BMFF:BOOL="TRUE"
EXIV2_ENABLE_CURL:BOOL="TRUE"
EXIV2_ENABLE_NLS:BOOL="FALSE"
EXIV2_ENABLE_VIDEO:BOOL="FALSE"
EXIV2_ENABLE_PNG:BOOL="TRUE"
EXIV2_ENABLE_WEBREADY:BOOL="TRUE"
EXIV2_TEAM_WARNINGS_AS_ERRORS:BOOL="TRUE"
@ -986,7 +987,7 @@ Except for the `unitTests`, CMake needs to find a python3 interpreter in the sy
| Name | Language | Location | Command<br>_(in build directory)_ | CMake Option to Build |
|:-- |:-- |:-- |:-- |:-- |
| bashTests | python | tests/bash_tests | $ ctest -R bash | -DEXIV2_BUILD_SAMPLES=ON |
| bugfixTests | python | tests/bugfixes | $ ctest -R bugfix | |
| bugfixTests | python | tests/bugfixes | $ ctest -R bugfix | -DEXIV2_ENBALE_VIDEO=ON |
| lensTest | C++ | tests/lens_tests | $ ctest -R lens | |
| tiffTests | python | tests/tiff_test | $ ctest -R tiff | |
| unitTests | C++ | unitTests/ | $ ctest -R unit | -DEXIV2_BUILD_UNIT_TESTS=ON |

@ -15,6 +15,9 @@
// Define if you want translation of program messages to the user's native language
#cmakedefine EXV_ENABLE_NLS
// Define if you want to enable the decoding of video metadata
#cmakedefine EXV_ENABLE_VIDEO
// Define if you want BMFF support.
#cmakedefine EXV_ENABLE_BMFF

@ -40,5 +40,6 @@ check_include_file_cxx( "unistd.h" EXV_HAVE_UNISTD_H )
check_include_file_cxx( "sys/mman.h" EXV_HAVE_SYS_MMAN_H )
set(EXV_ENABLE_NLS ${EXIV2_ENABLE_NLS})
set(EXV_ENABLE_VIDEO ${EXIV2_ENABLE_VIDEO})
configure_file(cmake/config.h.cmake ${CMAKE_BINARY_DIR}/exv_conf.h @ONLY)

@ -53,6 +53,7 @@ endif()
OptionOutput( "Building BMFF support: " EXIV2_ENABLE_BMFF )
OptionOutput( "Brotli support for JPEG XL: " EXIV2_ENABLE_BMFF AND BROTLI_FOUND )
OptionOutput( "Native language support: " EXIV2_ENABLE_NLS )
OptionOutput( "Building video support: " EXIV2_ENABLE_VIDEO )
OptionOutput( "Nikon lens database: " EXIV2_ENABLE_LENSDATA )
OptionOutput( "Building webready support: " EXIV2_ENABLE_WEBREADY )
if ( EXIV2_ENABLE_WEBREADY )

@ -18,6 +18,9 @@
// Define if you want translation of program messages to the user's native language
#define EXV_ENABLE_NLS
// Define if you want to support video metadata
#define EXV_ENABLE_VIDEO
// Define if you have the strerror_r function.
/* #undef EXV_HAVE_STRERROR_R */

@ -39,7 +39,6 @@ add_library( exiv2lib_int OBJECT
)
set(PUBLIC_HEADERS
../include/exiv2/asfvideo.hpp
../include/exiv2/basicio.hpp
../include/exiv2/bmffimage.hpp
../include/exiv2/bmpimage.hpp
@ -61,7 +60,6 @@ set(PUBLIC_HEADERS
../include/exiv2/iptc.hpp
../include/exiv2/jp2image.hpp
../include/exiv2/jpgimage.hpp
../include/exiv2/matroskavideo.hpp
../include/exiv2/metadatum.hpp
../include/exiv2/mrwimage.hpp
../include/exiv2/orfimage.hpp
@ -71,7 +69,6 @@ set(PUBLIC_HEADERS
../include/exiv2/properties.hpp
../include/exiv2/psdimage.hpp
../include/exiv2/rafimage.hpp
../include/exiv2/riffvideo.hpp
../include/exiv2/rw2image.hpp
../include/exiv2/slice.hpp
../include/exiv2/tags.hpp
@ -83,7 +80,6 @@ set(PUBLIC_HEADERS
../include/exiv2/webpimage.hpp
../include/exiv2/xmp_exiv2.hpp
../include/exiv2/xmpsidecar.hpp
../include/exiv2/quicktimevideo.hpp
)
add_library( exiv2lib
@ -107,7 +103,6 @@ add_library( exiv2lib
iptc.cpp
jp2image.cpp
jpgimage.cpp
matroskavideo.cpp
metadatum.cpp
mrwimage.cpp
orfimage.cpp
@ -117,7 +112,6 @@ add_library( exiv2lib
properties.cpp
psdimage.cpp
rafimage.cpp
riffvideo.cpp
rw2image.cpp
tags.cpp
tgaimage.cpp
@ -128,7 +122,6 @@ add_library( exiv2lib
webpimage.cpp
xmp.cpp
xmpsidecar.cpp
quicktimevideo.cpp
${PUBLIC_HEADERS}
$<TARGET_OBJECTS:exiv2lib_int>
)
@ -148,6 +141,19 @@ if( EXIV2_ENABLE_PNG )
target_sources(exiv2lib PRIVATE pngimage.cpp ../include/exiv2/pngimage.hpp)
endif()
if( EXV_ENABLE_VIDEO )
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/asfvideo.hpp)
target_sources(exiv2lib PRIVATE asfvideo.cpp ../include/exiv2/asfvideo.hpp)
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/matroskavideo.hpp)
target_sources(exiv2lib PRIVATE matroskavideo.cpp ../include/exiv2/matroskavideo.hpp)
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/quicktimevideo.hpp)
target_sources(exiv2lib PRIVATE quicktimevideo.cpp ../include/exiv2/quicktimevideo.hpp)
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/riffvideo.hpp)
target_sources(exiv2lib PRIVATE riffvideo.cpp ../include/exiv2/riffvideo.hpp)
endif()
# Other library target properties
# ---------------------------------------------------------

@ -28,7 +28,6 @@
#include <iostream>
#include "config.h"
// #ifdef EXV_ENABLE_VIDEO
#include "asfvideo.hpp"
#include "basicio.hpp"
#include "convert.hpp"
@ -713,4 +712,3 @@ bool isAsfType(BasicIo& iIo, bool advance) {
}
} // namespace Exiv2
// #endif // EXV_ENABLE_VIDEO

@ -14,7 +14,7 @@
#ifdef EXV_ENABLE_BMFF
#include "bmffimage.hpp"
#endif // EXV_ENABLE_BMFF
#include "asfvideo.hpp"
#include "cr2image.hpp"
#include "crwimage.hpp"
#include "epsimage.hpp"
@ -26,20 +26,23 @@
#include "bmpimage.hpp"
#include "gifimage.hpp"
#include "jp2image.hpp"
#include "matroskavideo.hpp"
#include "nikonmn_int.hpp"
#include "orfimage.hpp"
#include "pgfimage.hpp"
#include "psdimage.hpp"
#include "quicktimevideo.hpp"
#include "rafimage.hpp"
#include "riffvideo.hpp"
#include "rw2image.hpp"
#include "tags_int.hpp"
#include "tgaimage.hpp"
#include "tiffimage.hpp"
#include "webpimage.hpp"
#include "xmpsidecar.hpp"
#ifdef EXV_ENABLE_VIDEO
#include "asfvideo.hpp"
#include "matroskavideo.hpp"
#include "quicktimevideo.hpp"
#include "riffvideo.hpp"
#endif // EXV_ENABLE_VIDEO
// + standard includes
#include <array>
@ -100,13 +103,14 @@ constexpr auto registry = std::array{
Registry{ImageType::tga, newTgaInstance, isTgaType, amNone, amNone, amNone, amNone},
Registry{ImageType::bmp, newBmpInstance, isBmpType, amNone, amNone, amNone, amNone},
Registry{ImageType::jp2, newJp2Instance, isJp2Type, amReadWrite, amReadWrite, amReadWrite, amNone},
// needs to be before bmff because some ftyp files are handled as qt and
// the rest should fall through to bmff
// needs to be before bmff because some ftyp files are handled as qt and
// the rest should fall through to bmff
#ifdef EXV_ENABLE_VIDEO
Registry{ImageType::qtime, newQTimeInstance, isQTimeType, amRead, amNone, amRead, amNone},
Registry{ImageType::asf, newAsfInstance, isAsfType, amRead, amNone, amRead, amNone},
Registry{ImageType::riff, newRiffInstance, isRiffType, amRead, amNone, amRead, amNone},
Registry{ImageType::mkv, newMkvInstance, isMkvType, amRead, amNone, amRead, amNone},
#endif // EXV_ENABLE_VIDEO
#ifdef EXV_ENABLE_BMFF
Registry{ImageType::bmff, newBmffInstance, isBmffType, amRead, amRead, amRead, amNone},
#endif // EXV_ENABLE_BMFF

@ -21,7 +21,6 @@
// included header files
#include "config.h"
// #ifdef EXV_ENABLE_VIDEO
#include "basicio.hpp"
#include "error.hpp"
#include "futils.hpp"
@ -970,4 +969,4 @@ bool isMkvType(BasicIo& iIo, bool advance) {
return result;
}
} // namespace Exiv2
} // namespace Exiv2

@ -1613,4 +1613,4 @@ bool isQTimeType(BasicIo& iIo, bool advance) {
return matched;
}
} // namespace Exiv2
} // namespace Exiv2

@ -21,7 +21,6 @@
// included header files
#include "config.h"
// #ifdef EXV_ENABLE_VIDEO
#include "basicio.hpp"
#include "error.hpp"
#include "futils.hpp"
@ -1252,6 +1251,4 @@ bool isRiffType(BasicIo& iIo, bool advance) {
}
return matched;
}
} // namespace Exiv2
// #endif // EXV_ENABLE_VIDEO

@ -309,6 +309,7 @@ void Exiv2::dumpLibraryInfo(std::ostream& os, const std::vector<std::regex>& key
int enable_bmff = 0;
int enable_webready = 0;
int enable_nls = 0;
int enable_video = 0;
int use_curl = 0;
#ifdef EXV_HAVE_INTTYPES_H
@ -421,6 +422,10 @@ void Exiv2::dumpLibraryInfo(std::ostream& os, const std::vector<std::regex>& key
enable_nls = 1;
#endif
#ifdef EXV_ENABLE_VIDEO
enable_video = 1;
#endif
#ifdef EXV_USE_CURL
use_curl = 1;
#endif
@ -487,6 +492,7 @@ void Exiv2::dumpLibraryInfo(std::ostream& os, const std::vector<std::regex>& key
output(os, keys, "enable_bmff", enable_bmff);
output(os, keys, "enable_webready", enable_webready);
output(os, keys, "enable_nls", enable_nls);
output(os, keys, "enable_video", enable_video);
output(os, keys, "use_curl", use_curl);
output(os, keys, "config_path", Exiv2::Internal::getExiv2ConfigPath());

@ -1,8 +1,12 @@
find_package(GTest REQUIRED)
# video support.
if( EXV_ENABLE_VIDEO )
set(VIDEO_SUPPORT test_asfvideo.cpp test_matroskavideo.cpp test_riffVideo.cpp)
endif()
add_executable(unit_tests
mainTestRunner.cpp
test_asfvideo.cpp
test_basicio.cpp
test_bmpimage.cpp
test_cr2header_int.cpp
@ -19,7 +23,6 @@ add_executable(unit_tests
test_jp2image_int.cpp
test_IptcKey.cpp
test_LangAltValueRead.cpp
test_matroskavideo.cpp
test_Photoshop.cpp
test_pngimage.cpp
test_safe_op.cpp
@ -27,9 +30,9 @@ add_executable(unit_tests
test_tiffheader.cpp
test_types.cpp
test_TimeValue.cpp
test_riffVideo.cpp
test_utils.cpp
test_XmpKey.cpp
${VIDEO_SUPPORT}
$<TARGET_OBJECTS:exiv2lib_int>
)

Loading…
Cancel
Save