diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d40de22..39609c81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ # For details see the accompanying COPYING-CMAKE-SCRIPTS file. ## -# Running cmake in a tree in which we have run ./configure ; make +# Running cmake in a tree in which we have run ./configure ; make # creates include/exiv2/exv_conf.h which conflicts with cmake's own exv_conf.h # This causes incorrect compilation and linking errors. # @@ -43,6 +43,7 @@ SET( GENERIC_LIB_SOVERSION "13" ) OPTION( EXIV2_ENABLE_SHARED "Build exiv2 as a shared library (dll)" ON ) OPTION( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON ) OPTION( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" ON ) +OPTION( EXIV2_ENABLE_VIDEO "Build with video support" OFF ) OPTION( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON ) OPTION( EXIV2_ENABLE_NLS "Build native language support (requires gettext)" ON ) OPTION( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON ) @@ -50,11 +51,13 @@ OPTION( EXIV2_ENABLE_LENSDATA "Build including lens data" OPTION( EXIV2_ENABLE_COMMERCIAL "Build with the EXV_COMMERCIAL_VERSION symbol set" OFF ) OPTION( EXIV2_ENABLE_BUILD_SAMPLES "Build the unit tests" ON ) OPTION( EXIV2_ENABLE_BUILD_PO "Build translations files" OFF ) +OPTION( EXIV2_ENABLE_VIDEO "Build video support into library" OFF ) +OPTION( EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF ) OPTION( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo" ON ) OPTION( EXIV2_ENABLE_SSH "USE Libssh for SshIo" ON ) IF( MINGW OR UNIX ) - IF ( CMAKE_CXX_COMPILER STREQUAL "g++" OR CMAKE_C_COMPILER STREQUAL "gcc" ) + IF ( CMAKE_CXX_COMPILER STREQUAL "g++" OR CMAKE_C_COMPILER STREQUAL "gcc" ) ADD_DEFINITIONS(-Wall -Wcast-align -Wpointer-arith @@ -71,23 +74,23 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src/ ${CMAKE_SOURCE_DIR}/include/ ${CM if( MSVC ) # cmake_policy(SET CMP0008) - + include(CMake_msvc.txt) msvc_runtime_report() msvc_runtime_configure(${EXIV2_ENABLE_SHARED}) msvc_runtime_report() - - ADD_DEFINITIONS(-DPSAPI_VERSION=1) # to be compatible with <= WinVista (#905) - + + ADD_DEFINITIONS(-DPSAPI_VERSION=1) # to be compatible with <= WinVista (#905) + set(E expat-2.1.0) set(Z zlib-1.2.7) set(C curl-7.39.0) - set(C libssh-0.5.5) - + set(C libssh-0.5.5) + if( NOT IS_DIRECTORY ./../${E} ) set(OUT_OF_SOURCE 1) endif() - + # link dependent libraries FIND_PACKAGE(EXPAT QUIET) if ( NOT EXPAT_LIBRARY ) @@ -95,7 +98,7 @@ if( MSVC ) set(EXPAT_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../${E}/lib) include_directories( ${EXPAT_INCLUDE_DIR} msvc64\\include src\\include) endif() - + # FIND_PACKAGE(CURL) if ( NOT CURL_FOUND ) set(CURL_LIBRARY ${CMAKE_SOURCE_DIR}/../${C}/$(ConfigurationName)/curl) @@ -109,14 +112,14 @@ if( MSVC ) set(SSH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../${C}) include_directories( ${SSH_INCLUDE_DIR}) endif() - + FIND_PACKAGE(ZLIB QUIET) if ( NOT ZLIB_FOUND ) set(ZLIB_LIBRARY ${CMAKE_SOURCE_DIR}/../${Z}/$(ConfigurationName)/zlib) set(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../${Z}) endif() include_directories(${ZLIB_INCLUDE_DIR}) - + if ( EXIV2_ENABLE_SHARED ) add_library(${E} SHARED IMPORTED) add_library(${Z} SHARED IMPORTED) @@ -200,7 +203,7 @@ IF( NOT MSVC ) # Issue #722: out of source builds compiled against standard include files such as /usr/local/lib/include/exiv2 # do not use CREATE_SYMLINK or CMAKE_CAN_SYMLINK as they don't work on CYGWIN EXECUTE_PROCESS( WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/src exiv2) - + IF( EXIV2_ENABLE_BUILD_SAMPLES ) EXECUTE_PROCESS( WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/samples COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/src exiv2) ENDIF( EXIV2_ENABLE_BUILD_SAMPLES ) @@ -232,10 +235,10 @@ ADD_CUSTOM_TARGET(testx COMMAND make testx "EXIV2_BINDIR=${CMAKE_BINARY_DIR}/b ## # http://dev.exiv2.org/boards/3/topics/1364 # effectively does a make doc on the root directory -# has to run 'make config' and './configure' +# has to run 'make config' and './configure' # and copy bin/taglist to /bin/taglist for use by 'make doc' IF( MINGW OR UNIX OR APPLE) - ADD_CUSTOM_TARGET(doc + ADD_CUSTOM_TARGET(doc WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/doc" COMMAND chmod +x ./cmake_doc.sh COMMAND ./cmake_doc.sh "${CMAKE_BINARY_DIR}" diff --git a/config/CMakeChecks.txt b/config/CMakeChecks.txt index d7502d88..0e9ae4f1 100644 --- a/config/CMakeChecks.txt +++ b/config/CMakeChecks.txt @@ -55,41 +55,48 @@ IF( EXIV2_ENABLE_PNG ) SET (HAVE_LIBZ ${ZLIB_FOUND}) ENDIF( EXIV2_ENABLE_PNG ) -IF( EXIV2_ENABLE_CURL ) - FIND_PACKAGE( CURL ) - INCLUDE_DIRECTORIES( ${CURL_INCLUDE_DIR} ) - # FindCURL.cmake doesn't check for REQUIRED flags - so we need to check ourselves - IF( MINGW OR UNIX ) - IF (NOT CURL_FOUND) - MESSAGE(FATAL_ERROR "missing library curl required for HttpIo") - ELSE (NOT CURL_FOUND) - SET ( USE_CURL 1 ) - ENDIF( NOT CURL_FOUND ) - ENDIF( MINGW OR UNIX ) -ENDIF( EXIV2_ENABLE_CURL ) +IF( EXIV2_ENABLE_VIDEO ) + SET( ENABLE_VIDEO 1 ) +ENDIF( EXIV2_ENABLE_VIDEO ) -IF( EXIV2_ENABLE_SSH ) - FIND_PACKAGE( SSH ) - INCLUDE_DIRECTORIES( ${SSH_INCLUDE_DIR} ) - # FindSSH.cmake doesn't check for REQUIRED flags - so we need to check ourselves - IF( MINGW OR UNIX ) - IF (NOT SSH_FOUND) - MESSAGE(FATAL_ERROR "missing library libssh required for SshIo") - ELSE (NOT SSH_FOUND) - SET ( USE_SSH 1 ) - ENDIF( NOT SSH_FOUND ) - ENDIF( MINGW OR UNIX ) -ENDIF( EXIV2_ENABLE_SSH ) +IF( EXIV2_ENABLE_WEBREADY ) + SET( ENABLE_WEBREADY 1 ) + IF( EXIV2_ENABLE_CURL ) + FIND_PACKAGE( CURL ) + INCLUDE_DIRECTORIES( ${CURL_INCLUDE_DIR} ) + # FindCURL.cmake doesn't check for REQUIRED flags - so we need to check ourselves + IF( MINGW OR UNIX ) + IF (NOT CURL_FOUND) + MESSAGE(FATAL_ERROR "missing library curl required for HttpIo") + ELSE (NOT CURL_FOUND) + SET ( USE_CURL 1 ) + ENDIF( NOT CURL_FOUND ) + ENDIF( MINGW OR UNIX ) + ENDIF( EXIV2_ENABLE_CURL ) + + IF( EXIV2_ENABLE_SSH ) + FIND_PACKAGE( SSH ) + INCLUDE_DIRECTORIES( ${SSH_INCLUDE_DIR} ) + # FindSSH.cmake doesn't check for REQUIRED flags - so we need to check ourselves + IF( MINGW OR UNIX ) + IF (NOT SSH_FOUND) + MESSAGE(FATAL_ERROR "missing library libssh required for SshIo") + ELSE (NOT SSH_FOUND) + SET ( USE_SSH 1 ) + ENDIF( NOT SSH_FOUND ) + ENDIF( MINGW OR UNIX ) + ENDIF( EXIV2_ENABLE_SSH ) +ENDIF( EXIV2_ENABLE_WEBREADY ) IF (EXIV2_ENABLE_XMP) FIND_PACKAGE(EXPAT) INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR}) # FindEXPAT.cmake doesn't check for REQUIRED flags - so we need to check ourselves - IF( MINGW OR UNIX ) - IF (NOT EXPAT_FOUND) - MESSAGE(FATAL_ERROR "missing library expat required for XMP") - ENDIF( NOT EXPAT_FOUND ) - ENDIF( MINGW OR UNIX ) + IF( MINGW OR UNIX ) + IF (NOT EXPAT_FOUND) + MESSAGE(FATAL_ERROR "missing library expat required for XMP") + ENDIF( NOT EXPAT_FOUND ) + ENDIF( MINGW OR UNIX ) ENDIF (EXIV2_ENABLE_XMP) IF( EXIV2_ENABLE_SHARED ) @@ -216,6 +223,8 @@ IF( NOT MSVC ) ENDIF( NOT MSVC ) SET( EXV_SYMBOLS ENABLE_NLS + ENABLE_VIDEO + ENABLE_WEBREADY HAVE_ALARM HAVE_DECL_STRERROR_R HAVE_GMTIME_R @@ -310,6 +319,12 @@ OptionOutput( "Nikon lens database: " EXIV2_ENABLE_LENSDATA OptionOutput( "Commercial build: " EXIV2_ENABLE_COMMERCIAL ) OptionOutput( "Build the unit tests: " EXIV2_ENABLE_BUILD_SAMPLES ) OptionOutput( "Building translations files: " EXIV2_ENABLE_BUILD_PO ) +OptionOutput( "Building video support: " EXIV2_ENABLE_VIDEO ) +OptionOutput( "Building webready support: " EXIV2_ENABLE_WEBREADY ) + +if ( EXIV2_ENABLE_WEBREADY ) OptionOutput( "USE Libcurl for HttpIo: " EXIV2_ENABLE_CURL ) OptionOutput( "USE Libssh for SshIo: " EXIV2_ENABLE_SSH ) +endif ( EXIV2_ENABLE_WEBREADY ) + MESSAGE( STATUS "------------------------------------------------------------------" ) diff --git a/config/config.h.cmake b/config/config.h.cmake index 589d9ebe..97860091 100644 --- a/config/config.h.cmake +++ b/config/config.h.cmake @@ -23,6 +23,12 @@ /* Define to 1 if you have the header file. */ #cmakedefine EXV_HAVE_LIBINTL_H 1 +/* Define to 1 if you require video support. */ +#cmakedefine EXV_ENABLE_VIDEO 1 + +/* Define to 1 if you require webready support. */ +#cmakedefine EXV_ENABLE_WEBREADY 1 + #ifndef EXV_COMMERCIAL_VERSION /* Define to 1 to enable translation of Nikon lens names. */ @@ -207,7 +213,7 @@ typedef int pid_t; #define __CYGWIN__ __CYGWIN32__ #define EXV_HAVE_GXXCLASSVISIBILITY #endif - + /* File path separator */ #if defined(WIN32) && !defined(__CYGWIN__) #define EXV_SEPARATOR_STR "\\" diff --git a/config/config.h.in b/config/config.h.in index a0669e0b..c5a7a67d 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -5,8 +5,6 @@ # include "exv_msvc.h" #else -/* config.h.in. Generated from configure.ac by autoheader. */ - /* Define to 1 if you want to use libssh */ #undef USE_SSH @@ -40,6 +38,12 @@ #endif /* !EXV_COMMERCIAL_VERSION */ +/* Define to 1 to include video code in the library */ +#undef ENABLE_VIDEO + +/* Define to 1 to include webready code in the library */ +#undef ENABLE_WEBREADY + /* Define to 1 if you have the `iconv' function. */ #undef HAVE_ICONV diff --git a/config/configure.ac b/config/configure.ac index ff752bb5..82f8d5d4 100644 --- a/config/configure.ac +++ b/config/configure.ac @@ -151,85 +151,104 @@ AC_ARG_ENABLE(xmp, USE_XMP_TOOLKIT=$enableval, USE_XMP_TOOLKIT=yes) AC_MSG_RESULT($USE_XMP_TOOLKIT) -# libcurl option might change flags, so we save them initially -_cppflags="${CPPFLAGS}" -_ldflags="${LDFLAGS}" - -AC_ARG_WITH(curl, -[ --with-curl[[=DIR]] use libcurl in DIR],[ - if test "$withval" != "no" -a "$withval" != "yes"; then - CURL_DIR=$withval - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LDFLAGS="${LDFLAGS} -L$withval/lib" - fi -]) - -USE_CURL= -if test "$with_curl" != "no"; then - # Check for libcurl library - found_curl=yes - CURL_CPPFLAGS= - CURL_LDFLAGS= - CURL_LIBS= - AC_CHECK_HEADERS(curl/curl.h, - AC_CHECK_LIB(curl, curl_easy_init,[ - USE_CURL=yes - AC_DEFINE([USE_CURL], [1], [Use libcurl library]) - CURL_LIBS="-lcurl" - if test "x${CURL_DIR}" != "x"; then - CURL_CPPFLAGS="-I${CURL_DIR}/include" - CURL_LDFLAGS="-L${CURL_DIR}/lib" - fi],[found_curl=no]),[found_curl=no]) - if test "$found_curl" = "no"; then - AC_MSG_ERROR(either specify a valid curl installation with --with-curl=DIR or use --without-curl) - fi - AC_SUBST(CURL_CPPFLAGS) - AC_SUBST(CURL_LDFLAGS) - AC_SUBST(CURL_LIBS) +AC_MSG_CHECKING([whether to compile with video support]) +AC_ARG_ENABLE(video, + [ --enable-video compile with the ENABLE_VIDEO set ], + ENABLE_VIDEO=$enableval, ENABLE_VIDEO=no) +AC_MSG_RESULT($ENABLE_VIDEO) +AC_SUBST(ENABLE_VIDEO) +if test "$enable_video" = "yes"; then + AC_DEFINE(ENABLE_VIDEO) fi -CPPFLAGS=${_cppflags} -LDFLAGS=${_ldflags} - -# libssh option might change flags, so we save them initially -_cppflags="${CPPFLAGS}" -_ldflags="${LDFLAGS}" - -AC_ARG_WITH(ssh, -[ --with-ssh[[=DIR]] use libssh in DIR],[ - if test "$withval" != "no" -a "$withval" != "yes"; then - SSH_DIR=$withval - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LDFLAGS="${LDFLAGS} -L$withval/lib" - fi -]) - -USE_SSH= -if test "$with_ssh" != "no"; then - # Check for libssh library - found_ssh=yes - SSH_CPPFLAGS= - SSH_LDFLAGS= - SSH_LIBS= - AC_CHECK_HEADERS(libssh/libssh.h, - AC_CHECK_LIB(ssh, ssh_new,[ - USE_SSH=yes - AC_DEFINE([USE_SSH], [1], [Use libssh library]) - SSH_LIBS="-lssh" - if test "x${SSH_DIR}" != "x"; then - SSH_CPPFLAGS="-I${SSH_DIR}/include" - SSH_LDFLAGS="-L${SSH_DIR}/lib" - fi],[found_ssh=no]),[found_ssh=no]) - if test "$found_ssh" = "no"; then - AC_MSG_ERROR(either specify a valid libssh installation with --with-ssh=DIR or use --without-ssh) - fi - AC_SUBST(SSH_CPPFLAGS) - AC_SUBST(SSH_LDFLAGS) - AC_SUBST(SSH_LIBS) +AC_MSG_CHECKING([whether to compile with webready support]) +AC_ARG_ENABLE(webready, + [ --enable-webready compile Exiv2 library with webready support ], + ENABLE_WEBREADY=$enableval, ENABLE_WEBREADY=no) +AC_MSG_RESULT($ENABLE_WEBREADY) +if test "$enable_webready" = "yes"; then + AC_DEFINE(ENABLE_WEBREADY) fi -CPPFLAGS=${_cppflags} -LDFLAGS=${_ldflags} +if test "$enable_webready" = "yes"; then + # libcurl option might change flags, so we save them initially + _cppflags="${CPPFLAGS}" + _ldflags="${LDFLAGS}" + + AC_ARG_WITH(curl, + [ --with-curl[[=DIR]] use libcurl in DIR],[ + if test "$withval" != "no" -a "$withval" != "yes"; then + CURL_DIR=$withval + CPPFLAGS="${CPPFLAGS} -I$withval/include" + LDFLAGS="${LDFLAGS} -L$withval/lib" + fi + ]) + + USE_CURL= + if test "$with_curl" != "no"; then + # Check for libcurl library + found_curl=yes + CURL_CPPFLAGS= + CURL_LDFLAGS= + CURL_LIBS= + AC_CHECK_HEADERS(curl/curl.h, + AC_CHECK_LIB(curl, curl_easy_init,[ + USE_CURL=yes + AC_DEFINE([USE_CURL], [1], [Use libcurl library]) + CURL_LIBS="-lcurl" + if test "x${CURL_DIR}" != "x"; then + CURL_CPPFLAGS="-I${CURL_DIR}/include" + CURL_LDFLAGS="-L${CURL_DIR}/lib" + fi],[found_curl=no]),[found_curl=no]) + if test "$found_curl" = "no"; then + AC_MSG_ERROR(either specify a valid curl installation with --with-curl=DIR or use --without-curl) + fi + AC_SUBST(CURL_CPPFLAGS) + AC_SUBST(CURL_LDFLAGS) + AC_SUBST(CURL_LIBS) + fi + CPPFLAGS=${_cppflags} + LDFLAGS=${_ldflags} + + # libssh option might change flags, so we save them initially + _cppflags="${CPPFLAGS}" + _ldflags="${LDFLAGS}" + + AC_ARG_WITH(ssh, + [ --with-ssh[[=DIR]] use libssh in DIR],[ + if test "$withval" != "no" -a "$withval" != "yes"; then + SSH_DIR=$withval + CPPFLAGS="${CPPFLAGS} -I$withval/include" + LDFLAGS="${LDFLAGS} -L$withval/lib" + fi + ]) + + USE_SSH= + if test "$with_ssh" != "no"; then + # Check for libssh library + found_ssh=yes + SSH_CPPFLAGS= + SSH_LDFLAGS= + SSH_LIBS= + AC_CHECK_HEADERS(libssh/libssh.h, + AC_CHECK_LIB(ssh, ssh_new,[ + USE_SSH=yes + AC_DEFINE([USE_SSH], [1], [Use libssh library]) + SSH_LIBS="-lssh" + if test "x${SSH_DIR}" != "x"; then + SSH_CPPFLAGS="-I${SSH_DIR}/include" + SSH_LDFLAGS="-L${SSH_DIR}/lib" + fi],[found_ssh=no]),[found_ssh=no]) + if test "$found_ssh" = "no"; then + AC_MSG_ERROR(either specify a valid libssh installation with --with-ssh=DIR or use --without-ssh) + fi + AC_SUBST(SSH_CPPFLAGS) + AC_SUBST(SSH_LDFLAGS) + AC_SUBST(SSH_LIBS) + fi + CPPFLAGS=${_cppflags} + LDFLAGS=${_ldflags} +fi # expat option might change flags, so we save them initially _cppflags="${CPPFLAGS}" @@ -361,6 +380,18 @@ yes) echo "-- XMP metadata support........... YES" ;; echo "" ;; esac +case "$ENABLE_VIDEO" in +yes) echo "-- Video support.................. YES" ;; +*) echo "-- Video support.................. NO" +esac + +if test "$enable_webready" = "yes"; then + echo "-- Webready support............... YES" +else + echo "-- Webready support............... NO" +fi + +if test "$enable_webready" = "yes"; then case "$USE_CURL" in yes) echo "-- Using Lib Curl................. YES" ;; *) echo "-- Using Lib Curl................. NO" @@ -382,6 +413,7 @@ yes) echo "-- Using Lib SSH.................. YES" ;; echo "http://www.libssh.org/get-it/" echo "" ;; esac +fi echo "------------------------------------------------------------------" echo "" diff --git a/include/exiv2/exv_msvc-webready.h b/include/exiv2/exv_msvc-webready.h index e7f8236c..999be771 100644 --- a/include/exiv2/exv_msvc-webready.h +++ b/include/exiv2/exv_msvc-webready.h @@ -6,7 +6,6 @@ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 07-Feb-04, ahu: created - 26-Feb-05, ahu: renamed and moved to src directory */ #ifdef _MSC_VER @@ -93,6 +92,12 @@ typedef int pid_t; /* Define to 1 if you have the Adobe XMP Toolkit. */ #define EXV_HAVE_XMP_TOOLKIT 1 +/* Define to 1 to enable video/audio metadata support. */ +# undef EXV_ENABLE_VIDEO + +/* Define to 1 to enable webready support. */ +#define EXV_ENABLE_WEBREADY 1 + /* Define as 1 if you want to use curl to perform http I/O */ #ifndef EXV_USE_CURL #define EXV_USE_CURL 1 diff --git a/include/exiv2/exv_msvc.h b/include/exiv2/exv_msvc.h index a7419c56..a862bcac 100644 --- a/include/exiv2/exv_msvc.h +++ b/include/exiv2/exv_msvc.h @@ -6,7 +6,6 @@ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 07-Feb-04, ahu: created - 26-Feb-05, ahu: renamed and moved to src directory */ #ifdef _MSC_VER @@ -93,6 +92,12 @@ typedef int pid_t; /* Define to 1 if you have the Adobe XMP Toolkit. */ #define EXV_HAVE_XMP_TOOLKIT 1 +/* Define to 1 to build video support into the library */ +#undef EXV_ENABLE_VIDEO + +/* Define to 1 to build webready support into the library */ +#undef EXV_ENABLE_WEBREADY + /* Define as 1 if you want to use curl to perform http I/O */ #ifndef EXV_USE_CURL #define EXV_USE_CURL 0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 410c4215..706ab672 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -141,31 +141,33 @@ SET( LIBEXIV2_SRC asfvideo.cpp utilsvideo.cpp ) -## -# add curl support -IF( EXIV2_ENABLE_CURL ) - IF( CURL_FOUND ) - SET( LIBEXIV2_SRC ${LIBEXIV2_SRC} - easyaccess.cpp - ) - set( LIBEXIV2_HDR ${LIBEXIV2_HDR} - ${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/easyaccess.hpp - ) +IF( EXIV2_ENABLE_WEBREADY ) + ## + # add curl support + IF( EXIV2_ENABLE_CURL ) + IF( CURL_FOUND ) + SET( LIBEXIV2_SRC ${LIBEXIV2_SRC} + easyaccess.cpp + ) + set( LIBEXIV2_HDR ${LIBEXIV2_HDR} + ${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/easyaccess.hpp + ) + ENDIF() ENDIF() -ENDIF() -## -# add ssh support -IF( EXIV2_ENABLE_SSH ) - IF( SSH_FOUND ) - SET( LIBEXIV2_SRC ${LIBEXIV2_SRC} - ssh.cpp - ) - set( LIBEXIV2_HDR ${LIBEXIV2_HDR} - ${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/ssh.hpp - ) + ## + # add ssh support + IF( EXIV2_ENABLE_SSH ) + IF( SSH_FOUND ) + SET( LIBEXIV2_SRC ${LIBEXIV2_SRC} + ssh.cpp + ) + set( LIBEXIV2_HDR ${LIBEXIV2_HDR} + ${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/ssh.hpp + ) + ENDIF() ENDIF() -ENDIF() +ENDIF( EXIV2_ENABLE_WEBREADY ) ## # add png*.cpp files if PNG support requested @@ -240,7 +242,7 @@ SET_TARGET_PROPERTIES( exiv2lib PROPERTIES OUTPUT_NAME exiv2 ) -if ( MSVC ) +if ( MSVC ) source_group("Header Files" FILES ${LIBEXIV2_HDR} ) TARGET_LINK_LIBRARIES( exiv2lib ${EXPAT_LIBRARIES} ) source_group("Header Files" FILES ${LIBCURL_HDR} ) @@ -261,7 +263,7 @@ endif() if( EXIV2_ENABLE_LIBXMP ) ADD_DEPENDENCIES( exiv2lib xmp ) - if ( MSVC ) + if ( MSVC ) LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH}/$(ConfigurationName)) endif(MSVC) TARGET_LINK_LIBRARIES( exiv2lib xmp ) @@ -270,7 +272,7 @@ ENDIF() IF( EXIV2_ENABLE_PNG ) IF( ZLIB_FOUND ) IF( MSVC ) - if ( EXIV2_ENABLE_SHARED ) + if ( EXIV2_ENABLE_SHARED ) TARGET_LINK_LIBRARIES( exiv2lib optimized ${ZLIB_LIBRARIES} debug ${ZLIB_LIBRARIES}d ) else() TARGET_LINK_LIBRARIES( exiv2lib optimized zlibstatic.lib debug zlibstaticd.lib ) diff --git a/src/asfvideo.cpp b/src/asfvideo.cpp index e296a0be..26e9c0c9 100644 --- a/src/asfvideo.cpp +++ b/src/asfvideo.cpp @@ -31,6 +31,18 @@ EXIV2_RCSID("@(#) $Id$") // ***************************************************************************** // included header files +#ifdef _MSC_VER +# include "exv_msvc.h" +#else +# include "exv_conf.h" +#endif + +#ifndef EXV_ENABLE_VIDEO +namespace Exiv2 { +extern int asfvideo_extern; +int asfvideo_extern = 1; +} +#else #include "asfvideo.hpp" #include "futils.hpp" #include "basicio.hpp" @@ -281,9 +293,9 @@ namespace Exiv2 { uint64_t getUint64_t(Exiv2::DataBuf& buf) { uint64_t temp = 0; - for(int i = 0; i < 8; ++i){ - temp = temp + static_cast(buf.pData_[i]*(pow(static_cast(256), i))); - } + for(int i = 0; i < 8; ++i){ + temp = temp + static_cast(buf.pData_[i]*(pow(static_cast(256), i))); + } return temp; } @@ -349,7 +361,7 @@ namespace Exiv2 { return; } - char GUID[37] = ""; //the getGUID function write the GUID[36], + char GUID[37] = ""; //the getGUID function write the GUID[36], getGUID(guidBuf, GUID); tv = find( GUIDReferenceTags, GUID); @@ -772,18 +784,18 @@ namespace Exiv2 { aspectRatio = floor(aspectRatio*10) / 10; xmpData_["Xmp.video.AspectRatio"] = aspectRatio; - int aR = (int) ((aspectRatio*10.0)+0.1); + int aR = (int) ((aspectRatio*10.0)+0.1); - switch (aR) { - case 13 : xmpData_["Xmp.video.AspectRatio"] = "4:3" ; break; - case 17 : xmpData_["Xmp.video.AspectRatio"] = "16:9" ; break; - case 10 : xmpData_["Xmp.video.AspectRatio"] = "1:1" ; break; - case 16 : xmpData_["Xmp.video.AspectRatio"] = "16:10" ; break; - case 22 : xmpData_["Xmp.video.AspectRatio"] = "2.21:1" ; break; - case 23 : xmpData_["Xmp.video.AspectRatio"] = "2.35:1" ; break; - case 12 : xmpData_["Xmp.video.AspectRatio"] = "5:4" ; break; - default : xmpData_["Xmp.video.AspectRatio"] = aspectRatio;break; - } + switch (aR) { + case 13 : xmpData_["Xmp.video.AspectRatio"] = "4:3" ; break; + case 17 : xmpData_["Xmp.video.AspectRatio"] = "16:9" ; break; + case 10 : xmpData_["Xmp.video.AspectRatio"] = "1:1" ; break; + case 16 : xmpData_["Xmp.video.AspectRatio"] = "16:10" ; break; + case 22 : xmpData_["Xmp.video.AspectRatio"] = "2.21:1" ; break; + case 23 : xmpData_["Xmp.video.AspectRatio"] = "2.35:1" ; break; + case 12 : xmpData_["Xmp.video.AspectRatio"] = "5:4" ; break; + default : xmpData_["Xmp.video.AspectRatio"] = aspectRatio;break; + } } // AsfVideo::aspectRatio @@ -815,3 +827,4 @@ namespace Exiv2 { } } // namespace Exiv2 +#endif // EXV_ENABLE_VIDEO diff --git a/src/image.cpp b/src/image.cpp index f0fe320b..644573b4 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -55,10 +55,12 @@ EXIV2_RCSID("@(#) $Id$") #include "tgaimage.hpp" #include "bmpimage.hpp" #include "jp2image.hpp" +#ifdef EXV_ENABLE_VIDEO #include "matroskavideo.hpp" #include "quicktimevideo.hpp" #include "riffvideo.hpp" #include "asfvideo.hpp" +#endif // EXV_ENABLE_VIDEO #include "rw2image.hpp" #include "pgfimage.hpp" #include "xmpsidecar.hpp" @@ -129,10 +131,12 @@ namespace { { ImageType::tga, newTgaInstance, isTgaType, amNone, amNone, amNone, amNone }, { ImageType::bmp, newBmpInstance, isBmpType, amNone, amNone, amNone, amNone }, { ImageType::jp2, newJp2Instance, isJp2Type, amReadWrite, amReadWrite, amReadWrite, amNone }, +#ifdef EXV_ENABLE_VIDEO { ImageType::qtime,newQTimeInstance,isQTimeType,amRead, amNone, amRead, amNone }, { ImageType::riff, newRiffInstance, isRiffType, amRead, amNone, amRead, amNone }, { ImageType::asf, newAsfInstance, isAsfType, amNone, amNone, amRead, amNone }, { ImageType::mkv, newMkvInstance, isMkvType, amNone, amNone, amRead, amNone }, +#endif // EXV_ENABLE_VIDEO // End of list marker { ImageType::none, 0, 0, amNone, amNone, amNone, amNone } }; @@ -356,21 +360,21 @@ namespace Exiv2 { { std::string result; - int need = (int) std::strlen(format); // initial guess + int need = (int) std::strlen(format); // initial guess char* buffer = NULL; - int again = 4; - int rc = -1; + int again = 4; + int rc = -1; if (rc < 0 && again--) { if ( buffer ) delete[] buffer; - need *= 2 ; + need *= 2 ; buffer = new char[need]; - if ( buffer ) { - va_list args; // variable arg list - va_start(args, format); // args start after format - rc=vsnprintf(buffer,(unsigned int)need, format, args); - va_end(args); // free the args - } + if ( buffer ) { + va_list args; // variable arg list + va_start(args, format); // args start after format + rc=vsnprintf(buffer,(unsigned int)need, format, args); + va_end(args); // free the args + } } if ( rc > 0 ) result = std::string(buffer) ; diff --git a/src/matroskavideo.cpp b/src/matroskavideo.cpp index 4b3ab3a1..f56c500f 100644 --- a/src/matroskavideo.cpp +++ b/src/matroskavideo.cpp @@ -31,6 +31,18 @@ EXIV2_RCSID("@(#) $Id$") // ***************************************************************************** // included header files +#ifdef _MSC_VER +# include "exv_msvc.h" +#else +# include "exv_conf.h" +#endif + +#ifndef EXV_ENABLE_VIDEO +namespace Exiv2 { +extern int matroskavideo_extern; +int matroskavideo_extern=1; +} +#else #include "matroskavideo.hpp" #include "futils.hpp" #include "basicio.hpp" @@ -568,7 +580,7 @@ namespace Exiv2 { DataBuf buf2(bufMinSize+1); std::memset(buf2.pData_, 0x0, buf2.size_); - long s = static_cast(size) ; + long s = static_cast(size) ; io_->read(buf2.pData_,s); contentManagement(mt, buf2.pData_,s); } // MatroskaVideo::decodeBlock @@ -711,18 +723,18 @@ namespace Exiv2 { aspectRatio = floor(aspectRatio*10) / 10; xmpData_["Xmp.video.AspectRatio"] = aspectRatio; - int aR = (int) ((aspectRatio*10.0)+0.1); + int aR = (int) ((aspectRatio*10.0)+0.1); - switch (aR) { - case 13 : xmpData_["Xmp.video.AspectRatio"] = "4:3" ; break; - case 17 : xmpData_["Xmp.video.AspectRatio"] = "16:9" ; break; - case 10 : xmpData_["Xmp.video.AspectRatio"] = "1:1" ; break; - case 16 : xmpData_["Xmp.video.AspectRatio"] = "16:10" ; break; - case 22 : xmpData_["Xmp.video.AspectRatio"] = "2.21:1" ; break; - case 23 : xmpData_["Xmp.video.AspectRatio"] = "2.35:1" ; break; - case 12 : xmpData_["Xmp.video.AspectRatio"] = "5:4" ; break; - default : xmpData_["Xmp.video.AspectRatio"] = aspectRatio;break; - } + switch (aR) { + case 13 : xmpData_["Xmp.video.AspectRatio"] = "4:3" ; break; + case 17 : xmpData_["Xmp.video.AspectRatio"] = "16:9" ; break; + case 10 : xmpData_["Xmp.video.AspectRatio"] = "1:1" ; break; + case 16 : xmpData_["Xmp.video.AspectRatio"] = "16:10" ; break; + case 22 : xmpData_["Xmp.video.AspectRatio"] = "2.21:1" ; break; + case 23 : xmpData_["Xmp.video.AspectRatio"] = "2.35:1" ; break; + case 12 : xmpData_["Xmp.video.AspectRatio"] = "5:4" ; break; + default : xmpData_["Xmp.video.AspectRatio"] = aspectRatio;break; + } } // MatroskaVideo::aspectRatio uint32_t MatroskaVideo::findBlockSize(byte b) @@ -764,3 +776,4 @@ namespace Exiv2 { } } // namespace Exiv2 +#endif // EXV_ENABLE_VIDEO diff --git a/src/quicktimevideo.cpp b/src/quicktimevideo.cpp index be27da54..dad18637 100644 --- a/src/quicktimevideo.cpp +++ b/src/quicktimevideo.cpp @@ -31,6 +31,18 @@ EXIV2_RCSID("@(#) $Id$") // ***************************************************************************** // included header files +#ifdef _MSC_VER +# include "exv_msvc.h" +#else +# include "exv_conf.h" +#endif + +#ifndef EXV_ENABLE_VIDEO +namespace Exiv2 { +extern int quicktimevideo_extern ; +int quicktimevideo_extern = 1; +} +#else #include "quicktimevideo.hpp" #include "futils.hpp" #include "basicio.hpp" @@ -559,7 +571,7 @@ namespace Exiv2 { #ifdef _MSC_VER temp = temp + static_cast(buf.pData_[i]*(pow(static_cast(256), n-i-1))); #else - temp = temp + buf.pData_[i]*(pow((float)256,n-i-1)); + temp = temp + buf.pData_[i]*(pow((float)256,n-i-1)); #endif return temp; @@ -575,9 +587,9 @@ namespace Exiv2 { uint64_t temp = 0; for(int i = n-1; i >= 0; i--) #if _MSC_VER - temp = temp + static_cast(buf.pData_[i]*(pow(static_cast(256), n-i-1))); + temp = temp + static_cast(buf.pData_[i]*(pow(static_cast(256), n-i-1))); #else - temp = temp + buf.pData_[i]*(pow((float)256,n-i-1)); + temp = temp + buf.pData_[i]*(pow((float)256,n-i-1)); #endif return temp; @@ -1253,7 +1265,7 @@ namespace Exiv2 { break; } } - io_->read(buf.pData_, static_cast(size % 4)); //cause size is so small, this cast should be right. + io_->read(buf.pData_, static_cast(size % 4)); //cause size is so small, this cast should be right. } // QuickTimeVideo::audioDescDecoder void QuickTimeVideo::imageDescDecoder() @@ -1301,7 +1313,7 @@ namespace Exiv2 { break; } } - io_->read(buf.pData_, static_cast(size % 4)); + io_->read(buf.pData_, static_cast(size % 4)); xmpData_["Xmp.video.BitDepth"] = returnBufValue(buf, 1); } // QuickTimeVideo::imageDescDecoder @@ -1613,18 +1625,18 @@ namespace Exiv2 { aspectRatio = floor(aspectRatio*10) / 10; xmpData_["Xmp.video.AspectRatio"] = aspectRatio; - int aR = (int) ((aspectRatio*10.0)+0.1); + int aR = (int) ((aspectRatio*10.0)+0.1); - switch (aR) { - case 13 : xmpData_["Xmp.video.AspectRatio"] = "4:3" ; break; - case 17 : xmpData_["Xmp.video.AspectRatio"] = "16:9" ; break; - case 10 : xmpData_["Xmp.video.AspectRatio"] = "1:1" ; break; - case 16 : xmpData_["Xmp.video.AspectRatio"] = "16:10" ; break; - case 22 : xmpData_["Xmp.video.AspectRatio"] = "2.21:1" ; break; - case 23 : xmpData_["Xmp.video.AspectRatio"] = "2.35:1" ; break; - case 12 : xmpData_["Xmp.video.AspectRatio"] = "5:4" ; break; - default : xmpData_["Xmp.video.AspectRatio"] = aspectRatio;break; - } + switch (aR) { + case 13 : xmpData_["Xmp.video.AspectRatio"] = "4:3" ; break; + case 17 : xmpData_["Xmp.video.AspectRatio"] = "16:9" ; break; + case 10 : xmpData_["Xmp.video.AspectRatio"] = "1:1" ; break; + case 16 : xmpData_["Xmp.video.AspectRatio"] = "16:10" ; break; + case 22 : xmpData_["Xmp.video.AspectRatio"] = "2.21:1" ; break; + case 23 : xmpData_["Xmp.video.AspectRatio"] = "2.35:1" ; break; + case 12 : xmpData_["Xmp.video.AspectRatio"] = "5:4" ; break; + default : xmpData_["Xmp.video.AspectRatio"] = aspectRatio;break; + } } // QuickTimeVideo::aspectRatio @@ -1655,4 +1667,4 @@ namespace Exiv2 { } } // namespace Exiv2 - +#endif // EXV_ENABLE_VIDEO diff --git a/src/riffvideo.cpp b/src/riffvideo.cpp index 0dcd291c..183856ee 100644 --- a/src/riffvideo.cpp +++ b/src/riffvideo.cpp @@ -31,6 +31,18 @@ EXIV2_RCSID("@(#) $Id$") // ***************************************************************************** // included header files +#ifdef _MSC_VER +# include "exv_msvc.h" +#else +# include "exv_conf.h" +#endif + +#ifndef EXV_ENABLE_VIDEO +namespace Exiv2 { +extern int riffvideo_extern ; +int riffvideo_extern = 1; +} +#else #include "riffvideo.hpp" #include "futils.hpp" #include "basicio.hpp" @@ -111,7 +123,7 @@ namespace Exiv2 { { "ICOP", "Xmp.video.Copyright" }, { "ICRD", "Xmp.video.DateTimeDigitized" }, { "ICRP", "Xmp.video.Cropped" }, - { "IDIM", "Xmp.video.Dimensions " }, + { "IDIM", "Xmp.video.Dimensions" }, { "IDPI", "Xmp.video.DotsPerInch" }, { "IDST", "Xmp.video.DistributedBy" }, { "IEDT", "Xmp.video.EditedBy" }, @@ -1199,18 +1211,18 @@ namespace Exiv2 { aspectRatio = floor(aspectRatio*10) / 10; xmpData_["Xmp.video.AspectRatio"] = aspectRatio; - int aR = (int) ((aspectRatio*10.0)+0.1); + int aR = (int) ((aspectRatio*10.0)+0.1); - switch (aR) { - case 13 : xmpData_["Xmp.video.AspectRatio"] = "4:3" ; break; - case 17 : xmpData_["Xmp.video.AspectRatio"] = "16:9" ; break; - case 10 : xmpData_["Xmp.video.AspectRatio"] = "1:1" ; break; - case 16 : xmpData_["Xmp.video.AspectRatio"] = "16:10" ; break; - case 22 : xmpData_["Xmp.video.AspectRatio"] = "2.21:1" ; break; - case 23 : xmpData_["Xmp.video.AspectRatio"] = "2.35:1" ; break; - case 12 : xmpData_["Xmp.video.AspectRatio"] = "5:4" ; break; - default : xmpData_["Xmp.video.AspectRatio"] = aspectRatio;break; - } + switch (aR) { + case 13 : xmpData_["Xmp.video.AspectRatio"] = "4:3" ; break; + case 17 : xmpData_["Xmp.video.AspectRatio"] = "16:9" ; break; + case 10 : xmpData_["Xmp.video.AspectRatio"] = "1:1" ; break; + case 16 : xmpData_["Xmp.video.AspectRatio"] = "16:10" ; break; + case 22 : xmpData_["Xmp.video.AspectRatio"] = "2.21:1" ; break; + case 23 : xmpData_["Xmp.video.AspectRatio"] = "2.35:1" ; break; + case 12 : xmpData_["Xmp.video.AspectRatio"] = "5:4" ; break; + default : xmpData_["Xmp.video.AspectRatio"] = aspectRatio;break; + } } // RiffVideo::fillAspectRatio void RiffVideo::fillDuration(double frame_rate, long frame_count) @@ -1249,3 +1261,4 @@ namespace Exiv2 { } } // namespace Exiv2 +#endif // EXV_ENABLE_VIDEO diff --git a/src/ssh.cpp b/src/ssh.cpp index 27478e88..18653073 100644 --- a/src/ssh.cpp +++ b/src/ssh.cpp @@ -30,8 +30,12 @@ EXIV2_RCSID("@(#) $Id: rw2image.cpp 3201 2013-12-01 12:13:42Z ahuggel $") #include "ssh.hpp" -#if EXV_USE_SSH == 1 - +#if EXV_USE_SSH != 1 +namespace Exiv2 { +extern int ssh_extern; +int ssh_extern = 1; +} +#else // class member definitions namespace Exiv2 { diff --git a/src/version.cpp b/src/version.cpp index 59b0a582..bd4998c4 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -270,6 +270,9 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) int have_unistd =0; int have_unicode_path=0; + int enable_video =0; + int enable_webready =0; + #if EXV_HAVE_DECL_STRERROR_R have_strerror_r=1; #endif @@ -402,6 +405,14 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) have_unicode_path=1; #endif +#if EXV_ENABLE_VIDEO + enable_video=1; +#endif + +#if EXV_ENABLE_WEBREADY + enable_webready=1; +#endif + #if defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW__) // enumerate loaded libraries and determine path to executable HMODULE handles[200]; @@ -508,6 +519,8 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) output(os,keys,"have_sys_types" ,have_sys_types ); output(os,keys,"have_unistd" ,have_unistd ); output(os,keys,"have_unicode_path" ,have_unicode_path); + output(os,keys,"enable_video" ,enable_video ); + output(os,keys,"enable_webready" ,enable_webready ); #if defined(__linux__) dlclose(ph);