From 01d64764cd21c2adb2558d2605fb4dd0bc22591e Mon Sep 17 00:00:00 2001 From: Packit Date: Sep 09 2020 13:59:12 +0000 Subject: exiv2-0.27.2 base --- diff --git a/.clang-format.optional b/.clang-format.optional new file mode 100644 index 0000000..cac9cee --- /dev/null +++ b/.clang-format.optional @@ -0,0 +1,28 @@ +--- +BasedOnStyle: Google +Language: Cpp +Standard: Cpp03 +TabWidth: 4 +UseTab: Never +ColumnLimit: 120 +NamespaceIndentation: All + +AccessModifierOffset: -4 +ContinuationIndentWidth: 4 +IndentWidth: 4 + +BreakBeforeBraces: Custom +BraceWrapping: + AfterStruct: true + AfterClass: true + AfterFunction: true + AfterControlStatement: false + AfterEnum: true + AfterNamespace: true + +AllowShortFunctionsOnASingleLine: None +AllowShortBlocksOnASingleLine: false +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false + +... diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f76849 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +*~ +*.gmo +*.la +*.lo +*.o +*.swp +*.pyc +*.txt.user +.DS_Store +.idea/* +cmake-* +build* +po/POTFILES +po/remove-potcdate.sed +po/stamp-po +src/doxygen.hpp +test/tmp/* +doc/html + +contrib/vms/.vagrant diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..4b6ff25 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,99 @@ +# all builds use the same ccache folder in the project root that is cached +variables: + CCACHE_BASEDIR: '$CI_PROJECT_DIR' + CCACHE_DIR: '$CI_PROJECT_DIR/ccache' + +# default config for all distros: +# - install dependencies via script +# - create ccache dir & setup caching of it (for each job separately) +.build_config: &default_config + before_script: + - ci/install_dependencies.sh + - mkdir -p ccache + cache: + key: "$CI_JOB_NAME" + paths: + - ccache/ + +# default build job: +# - run build script +# - only create artifacts of the build directory when something fails +# (for cmake logs) +.build_template: &distro_build + script: + - python3 ci/test_build.py + artifacts: + when: on_failure + paths: + - build/ + +stages: + - test + - deploy + +Fedora: + image: fedora:28 + <<: *default_config + <<: *distro_build + +Fedora_MinGW: + image: fedora:29 + before_script: + - dnf -y upgrade + - dnf -y install mingw64-gcc-c++ mingw64-filesystem mingw64-expat mingw64-zlib cmake make + script: + - python3 ci/test_build.py --without-tests --cmake-executable "mingw64-cmake" --cmake-options "-DEXIV2_TEAM_EXTRA_WARNINGS=ON -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_WIN_UNICODE=ON " --compilers --shared-libs OFF + +Debian: + image: debian:9 + <<: *default_config + <<: *distro_build + +Archlinux: + image: archlinux/base + <<: *default_config + <<: *distro_build + +Ubuntu: + image: ubuntu:18.04 + <<: *default_config + <<: *distro_build + +CentOS: + image: centos:7 + <<: *default_config + <<: *distro_build + +OpenSUSE: + image: opensuse/tumbleweed + <<: *default_config + <<: *distro_build + +Install: + image: fedora:28 + stage: deploy + <<: *default_config + script: + - mkdir build && cd build + - cmake -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=/usr/ -DBUILD_WITH_CCACHE=ON .. + - make -j $(nproc) + - make install + - make clean + - EXIV2_BINDIR=/usr/bin/ make tests + +pages: + image: fedora:28 + stage: deploy + <<: *default_config + script: + - dnf -y install doxygen graphviz + - mkdir build && cd build + - cmake -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_DOC=ON .. + - make doc + - cd .. + - mv build/doc/html/ public/ + artifacts: + paths: + - public + only: + - master diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..42b8724 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,41 @@ +language: cpp + +git: + quiet: true + depth: 1 + +matrix: + include: + - os: linux + dist: xenial + sudo: required + compiler: gcc + env: COVERAGE=1 CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DBUILD_WITH_COVERAGE=ON -DEXIV2_ENABLE_CURL=ON" + + - os: linux + dist: xenial + sudo: required + compiler: gcc + env: + - WITH_VALGRIND=1 + - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_ENABLE_CURL=ON" + + - os: linux + dist: xenial + sudo: required + compiler: clang + env: CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_ENABLE_CURL=ON" + + - os: osx + osx_image: xcode10.2 + compiler: clang + env: CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_CURL=ON" + +install: ./ci/install.sh +script: ./ci/run.sh + +cache: + ccache: true + directories: + - conan # Conan installation folder + - $HOME/conanData # Conan storage location diff --git a/ABOUT-NLS b/ABOUT-NLS new file mode 100644 index 0000000..e3b649e --- /dev/null +++ b/ABOUT-NLS @@ -0,0 +1,1111 @@ +1 Notes on the Free Translation Project +*************************************** + +Free software is going international! The Free Translation Project is +a way to get maintainers of free software, translators, and users all +together, so that free software will gradually become able to speak many +languages. A few packages already provide translations for their +messages. + + If you found this `ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work on translations can contact the appropriate team. + + When reporting bugs in the `intl/' directory or bugs which may be +related to internationalization, you should tell about the version of +`gettext' which is used. The information can be found in the +`intl/VERSION' file, in internationalized packages. + +1.1 Quick configuration advice +============================== + +If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias, message inheritance, automatic +charset conversion or plural form handling) as the implementation here. +It is also not possible to offer this additional functionality on top +of a `catgets' implementation. Future versions of GNU `gettext' will +very likely convey even more functionality. So it might be a good idea +to change to GNU `gettext' as soon as possible. + + So you need _not_ provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +1.2 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU `gettext'. Other packages have their own ways to +internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU `gettext' functions. If not, the included GNU +`gettext' library will be used. This library is wholly contained +within this package, usually in the `intl/' subdirectory, so prior +installation of the GNU `gettext' package is _not_ required. +Installers may use special options at configuration time for changing +the default behaviour. The commands: + + ./configure --with-included-gettext + ./configure --disable-nls + +will, respectively, bypass any pre-existing `gettext' to use the +internationalizing routines provided within this package, or else, +_totally_ disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might not be desirable. You should use +the more recent version of the GNU `gettext' library. I.e. if the file +`intl/VERSION' shows that the library which comes with this package is +more recent, you should use + + ./configure --with-included-gettext + +to prevent auto-detection. + + The configuration process will not test for the `catgets' function +and therefore it will not be used. The reason is that even an +emulation of `gettext' on top of `catgets' could not provide all the +extensions of the GNU `gettext' library. + + Internationalized packages usually have many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +1.3 Using This Package +====================== + +As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, +and `CC' is an ISO 3166 two-letter country code. For example, let's +suppose that you speak German and live in Germany. At the shell +prompt, merely execute `setenv LANG de_DE' (in `csh'), +`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). +This can be done from your `.login' or `.profile' file, once and for +all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of `LL_CC', with `LL' denoting the +language and `CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are +used, such as `LL' or `LL_CC.ENCODING'. You can get the list of +locales supported by your system for your country by running the command +`locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' +for the purpose of message handling, but you still need to have `LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather +read translations in German than English for when Swedish is not +available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from `no' to `nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under `nb' and some older ones under `no', it's recommended +for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and +older translations are used. + + In the `LANGUAGE' environment variable, but not in the `LANG' +environment variable, `LL_CC' combinations can be abbreviated as `LL' +to denote the language's main dialect. For example, `de' is equivalent +to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' +(Portuguese as spoken in Portugal) in this context. + +1.4 Translating Teams +===================== + +For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams" +area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +`-request' appended. For example, speakers of Swedish can send a +message to `sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate +_actively_ in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `translation@iro.umontreal.ca' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skill are praised more than +programming skill, here. + +1.5 Available Packages +====================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of June +2006. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB eo + +----------------------------------------------------+ + GNUnet | [] | + a2ps | [] [] [] [] [] | + aegis | () | + ant-phone | () | + anubis | [] | + ap-utils | | + aspell | [] [] [] [] | + bash | [] [] [] | + batchelor | [] | + bfd | | + bibshelf | [] | + binutils | [] | + bison | [] [] | + bison-runtime | | + bluez-pin | [] [] [] [] [] | + cflow | [] | + clisp | [] [] | + console-tools | [] [] | + coreutils | [] [] [] [] | + cpio | | + cpplib | [] [] [] | + cryptonit | [] | + darkstat | [] () [] | + dialog | [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] | + doodle | [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + error | [] [] [] [] | + fetchmail | [] [] () [] | + fileutils | [] [] | + findutils | [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | | + gawk | [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] | + gettext-runtime | [] [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] [] [] | + gip | [] | + gliv | [] | + glunarclock | [] | + gmult | [] [] | + gnubiff | () | + gnucash | () () [] | + gnucash-glossary | [] () | + gnuedu | | + gnulib | [] [] [] [] [] [] | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | [] [] | + gpe-clock | [] [] | + gpe-conf | [] [] | + gpe-contacts | | + gpe-edit | [] | + gpe-filemanager | | + gpe-go | [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] | + gpe-package | | + gpe-sketchbook | [] [] | + gpe-su | [] [] | + gpe-taskmanager | [] [] | + gpe-timesheet | [] | + gpe-today | [] [] | + gpe-todo | | + gphoto2 | [] [] [] [] | + gprof | [] [] | + gpsdrive | () () | + gramadoir | [] [] | + grep | [] [] [] [] [] [] | + gretl | | + gsasl | | + gss | | + gst-plugins | [] [] [] [] | + gst-plugins-base | [] [] [] | + gst-plugins-good | [] [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] [] [] | + gtick | [] () | + gtkam | [] [] [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] | + id-utils | [] [] | + impost | | + indent | [] [] [] | + iso_3166 | [] [] | + iso_3166_1 | [] [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | [] | + iso_4217 | [] | + iso_639 | [] [] | + jpilot | [] | + jtag | | + jwhois | | + kbd | [] [] [] [] | + keytouch | | + keytouch-editor | | + keytouch-keyboa... | | + latrine | () | + ld | [] | + leafpad | [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] | + libgpewidget | [] [] [] | + libgpg-error | [] | + libgphoto2 | [] [] | + libgphoto2_port | [] [] | + libgsasl | | + libiconv | | + libidn | [] [] | + lifelines | [] () | + lilypond | [] | + lingoteach | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | [] | + make | [] [] | + man-db | [] () [] [] | + minicom | [] [] [] | + mysecretdiary | [] [] | + nano | [] [] () [] | + nano_1_0 | [] () [] [] | + opcodes | [] | + parted | | + pilot-qof | [] | + psmisc | [] | + pwdutils | | + python | | + qof | | + radius | [] | + recode | [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] [] | + sed | [] [] [] | + sh-utils | [] [] | + shared-mime-info | [] [] [] | + sharutils | [] [] [] [] [] [] | + shishi | | + silky | | + skencil | [] () | + sketch | [] () | + solfege | | + soundtracker | [] [] | + sp | [] | + stardict | [] | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | | + texinfo | [] [] [] | + textutils | [] [] [] | + tin | () () | + tp-robot | [] | + tuxpaint | [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + vorbis-tools | [] [] [] [] | + wastesedge | () | + wdiff | [] [] [] [] | + wget | [] [] | + xchat | [] [] [] [] [] | + xkeyboard-config | | + xpad | [] [] | + +----------------------------------------------------+ + af am ar az be bg bs ca cs cy da de el en en_GB eo + 11 0 1 2 8 20 1 42 43 2 62 97 18 1 16 13 + + es et eu fa fi fr ga gl gu he hi hr hu id is it + +--------------------------------------------------+ + GNUnet | | + a2ps | [] [] [] () | + aegis | | + ant-phone | [] | + anubis | [] | + ap-utils | [] [] | + aspell | [] [] [] | + bash | [] [] [] | + batchelor | [] [] | + bfd | [] | + bibshelf | [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] [] [] | + bison-runtime | [] [] [] [] [] | + bluez-pin | [] [] [] [] [] | + cflow | | + clisp | [] [] | + console-tools | | + coreutils | [] [] [] [] [] [] | + cpio | [] [] [] | + cpplib | [] [] | + cryptonit | [] | + darkstat | [] () [] [] [] | + dialog | [] [] [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] [] | + enscript | [] [] [] | + error | [] [] [] [] [] | + fetchmail | [] | + fileutils | [] [] [] [] [] [] | + findutils | [] [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | [] [] | + gawk | [] [] [] [] | + gbiff | [] | + gcal | [] [] | + gcc | [] | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] | + gettext-tools | [] [] [] | + gimp-print | [] [] | + gip | [] [] [] | + gliv | () | + glunarclock | [] [] [] | + gmult | [] [] [] | + gnubiff | () () | + gnucash | () () () | + gnucash-glossary | [] [] | + gnuedu | [] | + gnulib | [] [] [] [] [] [] [] [] | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | [] [] [] [] | + gpe-clock | [] [] [] [] | + gpe-conf | [] | + gpe-contacts | [] [] | + gpe-edit | [] [] [] [] | + gpe-filemanager | [] | + gpe-go | [] [] [] | + gpe-login | [] [] [] | + gpe-ownerinfo | [] [] [] [] [] | + gpe-package | [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] [] [] | + gpe-taskmanager | [] [] [] | + gpe-timesheet | [] [] [] [] | + gpe-today | [] [] [] [] | + gpe-todo | [] | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] [] | + gpsdrive | () () [] () | + gramadoir | [] [] | + grep | [] [] [] [] [] [] [] [] [] [] [] [] | + gretl | [] [] [] | + gsasl | [] | + gss | [] | + gst-plugins | [] [] [] | + gst-plugins-base | [] [] | + gst-plugins-good | [] [] [] | + gstreamer | [] [] [] | + gtick | [] [] [] [] [] | + gtkam | [] [] [] [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] [] | + impost | [] [] | + indent | [] [] [] [] [] [] [] [] [] [] | + iso_3166 | [] [] [] | + iso_3166_1 | [] [] [] [] [] [] [] | + iso_3166_2 | [] | + iso_3166_3 | [] | + iso_4217 | [] [] [] [] | + iso_639 | [] [] [] [] [] | + jpilot | [] [] | + jtag | [] | + jwhois | [] [] [] [] [] | + kbd | [] [] | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + latrine | [] [] [] | + ld | [] [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] | + libgpewidget | [] [] [] [] [] | + libgpg-error | | + libgphoto2 | [] [] | + libgphoto2_port | [] [] | + libgsasl | [] [] | + libiconv | | + libidn | [] [] | + lifelines | () | + lilypond | [] | + lingoteach | [] [] [] | + lynx | [] [] [] | + m4 | [] [] [] [] | + mailutils | [] [] | + make | [] [] [] [] [] [] [] [] | + man-db | () | + minicom | [] [] [] [] | + mysecretdiary | [] [] [] | + nano | [] () [] [] [] [] | + nano_1_0 | [] [] [] [] [] | + opcodes | [] [] [] [] | + parted | [] [] [] | + pilot-qof | | + psmisc | [] [] [] | + pwdutils | | + python | | + qof | | + radius | [] [] | + recode | [] [] [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] | + sed | [] [] [] [] [] | + sh-utils | [] [] [] [] [] [] [] | + shared-mime-info | [] [] [] [] [] [] | + sharutils | [] [] [] [] [] [] [] [] | + shishi | | + silky | [] | + skencil | [] [] | + sketch | [] [] | + solfege | [] | + soundtracker | [] [] [] | + sp | [] | + stardict | [] | + system-tools-ba... | [] [] [] [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] | + textutils | [] [] [] [] [] | + tin | [] () | + tp-robot | [] [] [] | + tuxpaint | [] [] | + unicode-han-tra... | | + unicode-transla... | [] [] | + util-linux | [] [] [] [] [] [] [] | + vorbis-tools | [] [] | + wastesedge | () | + wdiff | [] [] [] [] [] [] [] [] | + wget | [] [] [] [] [] [] [] [] | + xchat | [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] | + xpad | [] [] [] | + +--------------------------------------------------+ + es et eu fa fi fr ga gl gu he hi hr hu id is it + 89 21 16 2 41 118 59 14 1 8 1 6 60 30 0 52 + + ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no + +--------------------------------------------------+ + GNUnet | | + a2ps | () [] [] () | + aegis | () | + ant-phone | [] | + anubis | [] [] [] | + ap-utils | [] | + aspell | [] [] | + bash | [] | + batchelor | [] [] | + bfd | | + bibshelf | [] | + binutils | | + bison | [] [] [] | + bison-runtime | [] [] [] | + bluez-pin | [] [] [] | + cflow | | + clisp | [] | + console-tools | | + coreutils | [] | + cpio | | + cpplib | [] | + cryptonit | [] | + darkstat | [] [] | + dialog | [] [] | + diffutils | [] [] [] | + doodle | | + e2fsprogs | [] | + enscript | [] | + error | [] | + fetchmail | [] [] | + fileutils | [] [] | + findutils | [] | + flex | [] [] | + fslint | [] [] | + gas | | + gawk | [] [] | + gbiff | [] | + gcal | | + gcc | | + gettext-examples | [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] | + gip | [] [] | + gliv | [] | + glunarclock | [] [] | + gmult | [] [] | + gnubiff | | + gnucash | () () | + gnucash-glossary | [] | + gnuedu | | + gnulib | [] [] [] [] | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] | + gpe-beam | [] | + gpe-calendar | [] | + gpe-clock | [] [] | + gpe-conf | [] [] | + gpe-contacts | [] | + gpe-edit | [] [] | + gpe-filemanager | [] | + gpe-go | [] [] | + gpe-login | [] [] | + gpe-ownerinfo | [] | + gpe-package | [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] | + gpe-taskmanager | [] [] [] | + gpe-timesheet | [] | + gpe-today | [] | + gpe-todo | | + gphoto2 | [] [] | + gprof | | + gpsdrive | () () () | + gramadoir | () | + grep | [] [] [] | + gretl | | + gsasl | [] | + gss | | + gst-plugins | [] | + gst-plugins-base | | + gst-plugins-good | [] | + gstreamer | [] | + gtick | [] | + gtkam | [] | + gtkorphan | [] | + gtkspell | [] [] | + gutenprint | | + hello | [] [] [] [] [] [] [] [] | + id-utils | [] | + impost | | + indent | [] [] | + iso_3166 | [] | + iso_3166_1 | [] [] | + iso_3166_2 | [] | + iso_3166_3 | [] | + iso_4217 | [] [] [] | + iso_639 | [] [] [] | + jpilot | () () () | + jtag | | + jwhois | [] | + kbd | [] | + keytouch | [] | + keytouch-editor | | + keytouch-keyboa... | [] | + latrine | [] | + ld | | + leafpad | [] [] | + libc | [] [] [] [] [] | + libexif | | + libextractor | | + libgpewidget | [] | + libgpg-error | | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | [] | + libiconv | | + libidn | [] [] | + lifelines | [] | + lilypond | | + lingoteach | [] | + lynx | [] [] | + m4 | [] [] | + mailutils | | + make | [] [] [] | + man-db | () | + minicom | [] | + mysecretdiary | [] | + nano | [] [] [] | + nano_1_0 | [] [] [] | + opcodes | [] | + parted | [] [] | + pilot-qof | | + psmisc | [] [] [] | + pwdutils | | + python | | + qof | | + radius | | + recode | [] | + rpm | [] [] | + screem | [] | + scrollkeeper | [] [] [] [] | + sed | [] [] | + sh-utils | [] [] | + shared-mime-info | [] [] [] [] [] | + sharutils | [] [] | + shishi | | + silky | [] | + skencil | | + sketch | | + solfege | | + soundtracker | | + sp | () | + stardict | [] [] | + system-tools-ba... | [] [] [] [] | + tar | [] [] [] | + texinfo | [] [] [] | + textutils | [] [] [] | + tin | | + tp-robot | [] | + tuxpaint | [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] | + vorbis-tools | [] | + wastesedge | [] | + wdiff | [] [] | + wget | [] [] | + xchat | [] [] [] [] | + xkeyboard-config | [] | + xpad | [] [] [] | + +--------------------------------------------------+ + ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no + 40 24 2 1 1 3 1 2 3 21 0 15 1 102 6 3 + + nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + +------------------------------------------------------+ + GNUnet | | + a2ps | () [] [] [] [] [] [] | + aegis | () () | + ant-phone | [] [] | + anubis | [] [] [] | + ap-utils | () | + aspell | [] [] | + bash | [] [] [] | + batchelor | [] [] | + bfd | | + bibshelf | [] | + binutils | [] [] | + bison | [] [] [] [] [] | + bison-runtime | [] [] [] [] | + bluez-pin | [] [] [] [] [] [] [] [] [] | + cflow | [] | + clisp | [] | + console-tools | [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + cpplib | [] | + cryptonit | [] [] | + darkstat | [] [] [] [] [] [] | + dialog | [] [] [] [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] [] | + error | [] [] [] [] | + fetchmail | [] [] [] | + fileutils | [] [] [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] [] [] | + fslint | [] [] [] [] | + gas | | + gawk | [] [] [] [] | + gbiff | [] | + gcal | [] | + gcc | | + gettext-examples | [] [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] [] [] | + gimp-print | [] [] | + gip | [] [] [] [] | + gliv | [] [] [] [] | + glunarclock | [] [] [] [] [] [] | + gmult | [] [] [] [] | + gnubiff | () | + gnucash | () [] | + gnucash-glossary | [] [] [] | + gnuedu | | + gnulib | [] [] [] [] [] | + gnunet-gtk | [] | + gnutls | [] [] | + gpe-aerial | [] [] [] [] [] [] [] | + gpe-beam | [] [] [] [] [] [] [] | + gpe-calendar | [] [] [] [] [] [] [] [] | + gpe-clock | [] [] [] [] [] [] [] [] | + gpe-conf | [] [] [] [] [] [] [] | + gpe-contacts | [] [] [] [] [] | + gpe-edit | [] [] [] [] [] [] [] [] | + gpe-filemanager | [] [] | + gpe-go | [] [] [] [] [] [] | + gpe-login | [] [] [] [] [] [] [] [] | + gpe-ownerinfo | [] [] [] [] [] [] [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] [] [] [] [] [] [] | + gpe-su | [] [] [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] [] [] [] | + gpe-timesheet | [] [] [] [] [] [] [] [] | + gpe-today | [] [] [] [] [] [] [] [] | + gpe-todo | [] [] [] [] | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] | + gpsdrive | [] [] [] | + gramadoir | [] [] | + grep | [] [] [] [] [] [] [] [] | + gretl | [] | + gsasl | [] [] | + gss | [] [] [] | + gst-plugins | [] [] [] [] | + gst-plugins-base | [] | + gst-plugins-good | [] [] [] [] | + gstreamer | [] [] [] | + gtick | [] [] [] | + gtkam | [] [] [] [] | + gtkorphan | [] | + gtkspell | [] [] [] [] [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] | + impost | [] | + indent | [] [] [] [] [] [] | + iso_3166 | [] [] [] [] [] [] | + iso_3166_1 | [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | [] [] [] [] | + iso_4217 | [] [] [] [] | + iso_639 | [] [] [] [] | + jpilot | | + jtag | [] | + jwhois | [] [] [] [] | + kbd | [] [] [] | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + latrine | [] [] | + ld | [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] [] | + libgpewidget | [] [] [] [] [] [] [] | + libgpg-error | [] [] | + libgphoto2 | [] | + libgphoto2_port | [] [] | + libgsasl | [] [] [] [] | + libiconv | | + libidn | [] [] () | + lifelines | [] [] | + lilypond | | + lingoteach | [] | + lynx | [] [] [] | + m4 | [] [] [] [] [] | + mailutils | [] [] [] [] | + make | [] [] [] [] | + man-db | [] [] | + minicom | [] [] [] [] [] | + mysecretdiary | [] [] [] [] | + nano | [] [] | + nano_1_0 | [] [] [] [] | + opcodes | [] [] | + parted | [] | + pilot-qof | [] | + psmisc | [] [] | + pwdutils | [] [] | + python | | + qof | [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] | + rpm | [] [] [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] | + sed | [] [] [] [] [] [] [] [] [] | + sh-utils | [] [] [] | + shared-mime-info | [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] | + silky | [] | + skencil | [] [] [] | + sketch | [] [] [] | + solfege | [] | + soundtracker | [] [] | + sp | | + stardict | [] [] [] | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] [] | + tin | () | + tp-robot | [] | + tuxpaint | [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + vorbis-tools | [] [] | + wastesedge | | + wdiff | [] [] [] [] [] [] | + wget | [] [] [] [] | + xchat | [] [] [] [] [] [] [] | + xkeyboard-config | [] [] | + xpad | [] [] [] | + +------------------------------------------------------+ + nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + 0 2 3 58 31 53 5 76 72 5 42 48 12 51 128 2 + + tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu + +---------------------------------------------------+ + GNUnet | [] | 2 + a2ps | [] [] [] | 19 + aegis | | 0 + ant-phone | [] [] | 6 + anubis | [] [] [] | 11 + ap-utils | () [] | 4 + aspell | [] [] [] | 14 + bash | [] | 11 + batchelor | [] [] | 9 + bfd | | 1 + bibshelf | [] | 7 + binutils | [] [] [] | 9 + bison | [] [] [] | 19 + bison-runtime | [] [] [] | 15 + bluez-pin | [] [] [] [] [] [] | 28 + cflow | [] [] | 4 + clisp | | 6 + console-tools | [] [] | 5 + coreutils | [] [] | 17 + cpio | [] [] [] | 9 + cpplib | [] [] [] [] | 11 + cryptonit | | 5 + darkstat | [] () () | 15 + dialog | [] [] [] [] [] | 30 + diffutils | [] [] [] [] | 28 + doodle | [] | 6 + e2fsprogs | [] [] | 10 + enscript | [] [] [] | 16 + error | [] [] [] [] | 18 + fetchmail | [] [] | 12 + fileutils | [] [] [] | 18 + findutils | [] [] [] | 17 + flex | [] [] | 15 + fslint | [] | 9 + gas | [] | 3 + gawk | [] [] | 15 + gbiff | [] | 5 + gcal | [] | 5 + gcc | [] [] [] | 5 + gettext-examples | [] [] [] [] [] | 24 + gettext-runtime | [] [] [] [] [] | 26 + gettext-tools | [] [] [] [] [] | 19 + gimp-print | [] [] | 12 + gip | [] [] | 12 + gliv | [] [] | 8 + glunarclock | [] [] [] | 15 + gmult | [] [] [] [] | 15 + gnubiff | [] | 1 + gnucash | () | 2 + gnucash-glossary | [] [] | 9 + gnuedu | [] | 2 + gnulib | [] [] [] [] [] | 28 + gnunet-gtk | | 1 + gnutls | | 2 + gpe-aerial | [] [] | 14 + gpe-beam | [] [] | 14 + gpe-calendar | [] [] [] [] | 19 + gpe-clock | [] [] [] [] | 20 + gpe-conf | [] [] | 14 + gpe-contacts | [] [] | 10 + gpe-edit | [] [] [] [] | 19 + gpe-filemanager | [] | 5 + gpe-go | [] [] | 14 + gpe-login | [] [] [] [] [] | 20 + gpe-ownerinfo | [] [] [] [] | 20 + gpe-package | [] | 5 + gpe-sketchbook | [] [] | 16 + gpe-su | [] [] [] | 19 + gpe-taskmanager | [] [] [] | 19 + gpe-timesheet | [] [] [] [] | 18 + gpe-today | [] [] [] [] [] | 20 + gpe-todo | [] | 6 + gphoto2 | [] [] [] [] | 20 + gprof | [] [] | 11 + gpsdrive | | 4 + gramadoir | [] | 7 + grep | [] [] [] [] | 33 + gretl | | 4 + gsasl | [] [] | 6 + gss | [] | 5 + gst-plugins | [] [] [] | 15 + gst-plugins-base | [] [] [] | 9 + gst-plugins-good | [] [] [] | 18 + gstreamer | [] [] [] | 17 + gtick | [] | 11 + gtkam | [] | 13 + gtkorphan | [] | 7 + gtkspell | [] [] [] [] [] [] | 26 + gutenprint | | 3 + hello | [] [] [] [] [] | 39 + id-utils | [] [] | 14 + impost | [] | 4 + indent | [] [] [] [] | 25 + iso_3166 | [] [] [] | 15 + iso_3166_1 | [] [] | 20 + iso_3166_2 | | 2 + iso_3166_3 | [] [] | 9 + iso_4217 | [] [] | 14 + iso_639 | [] [] | 16 + jpilot | [] [] [] [] | 7 + jtag | [] | 3 + jwhois | [] [] [] | 13 + kbd | [] [] | 12 + keytouch | [] | 4 + keytouch-editor | | 2 + keytouch-keyboa... | [] | 4 + latrine | [] [] | 8 + ld | [] [] [] | 7 + leafpad | [] [] [] [] | 23 + libc | [] [] [] | 23 + libexif | [] | 4 + libextractor | [] | 5 + libgpewidget | [] [] [] | 19 + libgpg-error | [] | 4 + libgphoto2 | [] | 7 + libgphoto2_port | [] [] [] | 10 + libgsasl | [] | 8 + libiconv | | 0 + libidn | [] [] | 10 + lifelines | | 4 + lilypond | | 2 + lingoteach | [] | 6 + lynx | [] [] [] | 15 + m4 | [] [] [] | 18 + mailutils | [] | 8 + make | [] [] [] | 20 + man-db | [] | 6 + minicom | [] | 14 + mysecretdiary | [] [] | 12 + nano | [] [] | 15 + nano_1_0 | [] [] [] | 18 + opcodes | [] [] | 10 + parted | [] [] [] | 9 + pilot-qof | [] | 3 + psmisc | [] | 10 + pwdutils | [] | 3 + python | | 0 + qof | [] | 2 + radius | [] | 6 + recode | [] [] [] | 25 + rpm | [] [] [] | 13 + screem | [] | 2 + scrollkeeper | [] [] [] [] | 26 + sed | [] [] [] | 22 + sh-utils | [] | 15 + shared-mime-info | [] [] [] [] | 23 + sharutils | [] [] [] | 23 + shishi | | 1 + silky | [] | 4 + skencil | [] | 7 + sketch | | 6 + solfege | | 2 + soundtracker | [] [] | 9 + sp | [] | 3 + stardict | [] [] [] [] | 11 + system-tools-ba... | [] [] [] [] [] [] [] | 37 + tar | [] [] [] [] | 17 + texinfo | [] [] [] | 15 + textutils | [] [] [] | 17 + tin | | 1 + tp-robot | [] [] [] | 9 + tuxpaint | [] [] [] | 16 + unicode-han-tra... | | 0 + unicode-transla... | | 2 + util-linux | [] [] [] | 20 + vorbis-tools | [] [] | 11 + wastesedge | | 1 + wdiff | [] [] | 22 + wget | [] [] [] | 19 + xchat | [] [] [] [] | 28 + xkeyboard-config | [] [] [] [] | 11 + xpad | [] [] [] | 14 + +---------------------------------------------------+ + 77 teams tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu + 172 domains 0 1 1 78 39 0 135 14 1 50 1 52 0 2040 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and +distributed as such by its maintainer. There might be an observable +lag between the mere existence a PO file and its wide availability in a +distribution. + + If June 2006 seems to be old, you may fetch a more recent copy of +this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date +matrix with full percentage details can be found at +`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. + +1.6 Using `gettext' in new packages +=================================== + +If you are writing a freely available program and want to +internationalize it you are welcome to use GNU `gettext' in your +package. Of course you have to respect the GNU Library General Public +License which covers the use of the GNU `gettext' library. This means +in particular that even non-free programs can use `libintl' as a shared +library, whereas only free software can use `libintl' as a static +library or use modified versions of `libintl'. + + Once the sources are changed appropriately and the setup can handle +the use of `gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not +developed inside the GNU project. Therefore the information given above +applies also for every other Free Software Project. Contact +`translation@iro.umontreal.ca' to make the `.pot' files available to +the translation teams. + diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..9f06aef --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +See doc/ChangeLog. Authors and other contributors are mentioned there. diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..224cd64 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,111 @@ +cmake_minimum_required( VERSION 3.3.2 ) + +project(exiv2 + VERSION 0.27.2 + LANGUAGES CXX C +) + +include(cmake/mainSetup.cmake REQUIRED) + +# options and their default values +option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON ) +option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON ) +option( EXIV2_ENABLE_EXTERNAL_XMP "Use external version of XMP" OFF ) +option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON ) +option( EXIV2_ENABLE_NLS "Build native language support (requires gettext)" OFF ) +option( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON ) +option( EXIV2_ENABLE_LENSDATA "Build including lens data" ON ) +option( EXIV2_ENABLE_VIDEO "Build video support into library" OFF ) +option( EXIV2_ENABLE_DYNAMIC_RUNTIME "Use dynamic runtime (used for static libs)" ON ) +option( EXIV2_ENABLE_WIN_UNICODE "Use Unicode paths (wstring) on Windows" OFF ) +option( EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF ) +option( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo (WEBREADY)" OFF ) +option( EXIV2_ENABLE_SSH "USE Libssh for SshIo (WEBREADY)" OFF ) + +option( EXIV2_BUILD_SAMPLES "Build sample applications" ON ) +option( EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" ON ) +option( EXIV2_BUILD_UNIT_TESTS "Build unit tests" OFF ) +option( EXIV2_BUILD_DOC "Add 'doc' target to generate documentation" OFF ) + +# Only intended to be used by Exiv2 developers/contributors +option( EXIV2_TEAM_EXTRA_WARNINGS "Add more sanity checks using compiler flags" OFF ) +option( EXIV2_TEAM_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF ) +option( EXIV2_TEAM_USE_SANITIZERS "Enable ASAN and UBSAN when available" OFF ) +option( EXIV2_TEAM_PACKAGING "Additional stuff for generating packages" OFF ) +set(EXTRA_COMPILE_FLAGS " ") + +mark_as_advanced( + EXIV2_TEAM_EXTRA_WARNINGS + EXIV2_TEAM_WARNINGS_AS_ERRORS + EXIV2_ENABLE_EXTERNAL_XMP + EXTRA_COMPILE_FLAGS + EXIV2_TEAM_USE_SANITIZERS +) + +option( BUILD_WITH_CCACHE "Use ccache to speed up compilations" OFF ) +option( BUILD_WITH_COVERAGE "Add compiler flags to generate coverage stats" OFF ) + +set( PACKAGE_BUGREPORT "http://github.com/exiv2/exiv2" ) +set( PACKAGE_URL "http://exiv2.dyndns.org") +set( PROJECT_DESCRIPTION "Exif and IPTC metadata library and tools") + +if ( EXIV2_ENABLE_EXTERNAL_XMP ) + set(EXIV2_ENABLE_XMP OFF) +endif() + +if( EXIV2_BUILD_UNIT_TESTS ) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # Requires CMake 3.3.3 +endif() + +include(cmake/findDependencies.cmake REQUIRED) +include(cmake/compilerFlags.cmake REQUIRED) +include(cmake/generateConfigFile.cmake REQUIRED) + +if (EXIV2_BUILD_DOC) + include(cmake/generateDoc.cmake REQUIRED) + generate_documentation("${PROJECT_SOURCE_DIR}/cmake/Doxyfile.in") +endif() + + +include_directories(${CMAKE_BINARY_DIR}) # Make the exv_conf.h file visible for the full project + +if( EXIV2_ENABLE_XMP ) + add_subdirectory( xmpsdk ) +endif() + +include(cmake/compilerFlagsExiv2.cmake REQUIRED) + +add_subdirectory( include ) +add_subdirectory( src ) + +if( EXIV2_BUILD_UNIT_TESTS ) + add_subdirectory ( unitTests ) +endif() + +if( EXIV2_BUILD_SAMPLES ) + ## + # tests + add_custom_target(tests + COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make test + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/test" + ) + add_subdirectory( samples ) + get_directory_property(SAMPLES DIRECTORY samples DEFINITION APPLICATIONS) + add_dependencies(tests exiv2lib exiv2 ${SAMPLES}) +endif() + +if( EXIV2_ENABLE_NLS ) + add_subdirectory( po ) +endif() + +if (EXIV2_TEAM_PACKAGING) + include(cmake/packaging.cmake) +endif() + +configure_file(cmake/exiv2.pc.in exiv2.pc @ONLY) +install(FILES ${CMAKE_BINARY_DIR}/exiv2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + +include(cmake/printSummary.cmake) + +# That's all Folks! +## diff --git a/CODING_GUIDELINES.md b/CODING_GUIDELINES.md new file mode 100644 index 0000000..1f1ce3c --- /dev/null +++ b/CODING_GUIDELINES.md @@ -0,0 +1,59 @@ +Coding Guidelines +====================== + +# Contents # + +* [1. General Guidelines](#10-general-guidelines) +* [2. Integer and Array Overflows](#20-integer-and-array-overflows) +* [3. Code Formatting](#30-code-formatting) + * [3.1 Guidelines to Apply clang-format](#31-guidelines-to-apply-clang-format) + +# 1. General Guidelines # +- All new code must be properly tested: via unit tests (based on the Gtest framework; see `$REPO/unitTest`) or system tests (scripts exercising the main exiv2 application; see `$REPO/test`). +- Code should be simple to read and to understand. +- Do not invoke undefined behavior. [Optional] Ensure that with UBSAN, i.e. compile your code with `-fsanitize=undefined` and run the test suite. +- Ensure that your code has no memory errors. [Optional] Use ASAN for that, i.e. compile your code with `-fsanitize=address`. + +# 2. Integer and Array Overflows # +- All new code that is added must be resistant to integer overflows, thus if you multiply, add, subtract, divide or bitshift integers you must ensure that no overflow can occur. Please keep in mind that signed integer overflow is undefined behavior, thus you must check for overflows before performing the arithmetic operation, otherwise the compiler is free to optimize your check after the overflow away (this has happened already). +- All new code must be resistant to buffer overflows. Thus before you access arrays a range check must be performed. +- Distrust any data that you extract from images or from external sources. E.g. if the metadata of an image gives you an offset of another information inside that file, do not assume that this offset will not result in an out off bounds read. +- New code must not assume the endianes and the word size of the system it is being run on. I.e. don't assume that `sizeof(int) = 8` or that the following will work: +```cpp +const uint32_t some_var = get_var(); +const uint16_t lower_2_bytes = (const uint16_t*) &some_var; +``` +since this will give you the upper two bytes on big endian systems. +If in doubt, then use the fixed size integer types like `int32_t`, `uint64_t`, `size_t`, etc. + +# 3. Code Formatting # + +The project contains a `.clang-format.optional` file defining the code formatting of the project (more details about of this file was defined can be found in this [PR](https://github.com/Exiv2/exiv2/pull/152)). We do not provide it via the standard name (`.clang-format`), since we do not enforce code formatting and do not want editors to automatically format everything. + +Nevertheless, we suggest you to respect the code formatting by symlinking `.clang-format.optional` to `.clang-format` and applying `clang-format` to new or existing code. You can do it by using the `clang-format` command-line tool or by using one of the integration plugins provided by various editors or IDEs. Currently we know about these integrations: + +- [QtCreator](http://doc.qt.io/qtcreator/creator-beautifier.html) -> beautifier -> clang-format +- [vim-clang-format](https://github.com/rhysd/vim-clang-format) +- [Emacs](https://clang.llvm.org/docs/ClangFormat.html#emacs-integration) +- Visual Studio: [1](http://clang.llvm.org/docs/ClangFormat.html#visual-studio-integration), [2](https://marketplace.visualstudio.com/items?itemName=xaver.clang-format) + +Note that some times the formatting applied to complex code might result in some unexpected output. If you know how to improve the current `.clang-format` file to deal with such cases, then please contribute!. Otherwise, you have two options: +1. Apply `clang-format` to individual blocks of code (avoid to apply it over the complex piece of code). +2. Indicate which parts of the code that should not be `clang-format` formatted: + +```cpp +// clang-format off + void unformatted_code ; +// clang-format on +``` + +## 3.1 Guidelines to Apply clang-format ## + +- New files should follow the clang-format style. +- Old files will be completely re-formatted only if we need to touch several lines/functions/methods of that file. In that case, we suggest to first create a PR just re-formatting the files that will be touched. Later we create another PR with the code changes. +- If we only need to fix a small portion of a file then we do not apply clang-format at all, or we just do it in the code block that we touch. + +More information about clang: +- Link to [clang-format](https://clang.llvm.org/docs/ClangFormat.html) tool. +- Link to the [clang-format option](https://clang.llvm.org/docs/ClangFormatStyleOptions.html). + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a2341c3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,144 @@ +Contributing to the Exiv2 Project +====================== + +# Contents # + +* [1. Introduction](#1-introduction) +* [2. Recommended Workflow for Contributing Code](#2-recommended-workflow-for-contributing-code) +* [3. Contributing Lens Data](#3-contributing-lens-data) +* [4. Reporting Bugs](#5-reporting-bugs) + +# 1. Introduction # + +This file describes how users and developers can contribute to the Exiv2 project. We welcome any help, like for example, contributing lens data (images), code contributions, and bug reports. +In the past this was organized using Redmine at: [dev.exiv2.org](http://dev.exiv2.org). As of April 2017 the Exiv2 project has moved from svn and Redmine to GitHub and information, such +as, Wikis etc., will gradually be moved from Redmine to GitHub. User requests on the Redmine forums and the Redmine issue tracking system will be serviced until Exiv2 0.27 is released. +After 0.27 is released the Redmine site will be read-only and all feature requests, bug reports etc., must be performed on GitHub. It is, however, preferred to use GitHub for all new +feature requests and bug reports to Exiv2. + +# 2. Recommended Workflow for Contributing Code # + +Here we describe the recommended code contribution workflow after switching to GitHub. Code contributions is performed by using *pull requests* (PR) on GitHub. +For this to work one first needs to [create a user account on GitHub](https://help.github.com/articles/signing-up-for-a-new-github-account/) if one do not +already have one. A PR should preferable contain only one new feature/bug fix etc. Since it is not uncommon to work on several PRs at the same time +it is recommended to create a new _branch_ for each PR. In this way PRs can easily be separated and the review and merge process becomes cleaner. +As a rule-of-thumb: + +- PRs should be kept at a manageable size. Try to focus in just one goal per PR. If you find yourself doing several things in a PR that were not expected, +then try to split the different tasks in different PRs. +- Commits should always change a *single* logical unit so that cherry-picking & reverting is simple. +- Commit messages should be as informative and concise as possible. The first line of the commit message should be < 80 characters and + describe the commit briefly. If the 80 characters are too short for a summary, then consider splitting the commit. Alternatively, below the short summary + add one blank line and then a more detailed explanation if required. + +See the [GIT_GUIDELINES.md](GIT_GUIDELINES.md) file for a more detailed description on the git workflow. + +Also, there are two recommended ways to work on the code: 1) one can create a _fork_ of the main Exiv2 repository and work on that fork, or 2) one can create a branch +on the main repository and work in the branch. Using the "fork" method only you can push commits to your fork whereas on the latter method other Exiv2 team members +can commit changes to the branch. Working on a branch on the main repository is the recommended method for team members since one needs push rights to the main repo +and all other developers should use the fork method which we will now describe in more detail. + +Below we outline the recommended steps in the code contribution workflow. We use `your-username` to refer to your username on GitHub, `exiv2_upstream` is used when we +set the upstream remote repository for Exiv2 (we could have picked any name by try to avoid already used names like, in particular, `origin` and `master`), and +we use the name `my-new-feature` for the branch that we create (eg., the branch name should reflect the code change being made). + +**Important**: If your PR lives for a long time, then don't press the button _Update branch_ in the Pull Request view, instead follow the steps below, as +that avoids additional merge commits. + +Once you have a GitHub login: + +1. Fork the Exiv2 git repository to your GitHub account by pressing the _Fork_ button at: [https://github.com/Exiv2/exiv2](https://github.com/Exiv2/exiv2) +(more details [here](https://guides.github.com/activities/forking/)). + +2. Then start a terminal (or use your favorite git GUI app) and clone your fork of the Exiv2 repo: + + $ git clone https://github.com:your-username/exiv2.git + $ cd exiv2 + +3. Add a new remote pointing to upstream exiv2 repository: + + $ git remote add exiv2_upstream https://github.com/Exiv2/exiv2.git + + and verify that you have the two remotes configured correctly: + + $ git remote -v + exiv2_upstream https://github.com/Exiv2/exiv2.git (fetch) + exiv2_upstream https://github.com/Exiv2/exiv2.git (push) + origin https://github.com/your-username/exiv2.git (fetch) + origin https://github.com/your-username/exiv2.git (push) + +4. Next, create a branch for your PR from `exiv2_upstream/master` (which we also need to fetch first): + + $ git fetch exiv2_upstream master + $ git checkout exiv2_upstream/master + $ git checkout -b my-new-feature + + You will get a warning about a detached head which can be ignored here. NB: This is an important step to avoid draging in old commits! + +5. Configure the project and check that it builds (CMake is our the preferred configuration system, but not the only one [see [README.md](README.md)]): + + $ rm -rf build + $ mkdir build && cd build + $ cmake -DCMAKE_BUILD_TYPE=Release .. + $ make + +6. Now, make your change(s), add tests for your changes, and commit each change: + + ... + + $ git commit -m "Commit message 1" + + ... + + $ git commit -m "Commit message 2" + +7. Make sure the tests pass: + + $ make tests # Application tests + $./bin/unit_tests # Unit tests + + Exiv2's (new) test system is described in more detail in the [doc.md](tests/doc.md) and [writing_tests.md](tests/writing_tests.md) files, and a description of the old + test system can be found on the Redmine wiki: [How_do_I_run_the_test_suite_for_Exiv2](http://dev.exiv2.org/projects/exiv2/wiki/How_do_I_run_the_test_suite_for_Exiv2) + +8. Push the changes to your fork on GitHub: + + $ git push origin my-new-feature + +9. Create the PR by pressing the _New pull request_ button on: `https://github.com/your-username/exiv2` + +10. Now wait for an Exiv2 project member(s) to respond to your PR. Follow the discussion on your PR at [https://github.com/Exiv2/exiv2/pulls](GitHub). + You may have to do some updates to your PR until it gets accepted. + +11. After the PR has been reviewed you must _rebase_ your repo copy since there may have been several changes to the main upstream repo + (a PR can live for several days or even weeks). + + Switch to your branch again + + $ git checkout my-new-feature + + And rebase in top of master: + + $ git pull --rebase exiv2_upstream master + + When you do a rebase the commit history is rewritten and, therefore, the next time you try to push your branch to your fork repository you will need to use the `--force` option: + + $ git push --force + +Also, follow the coding guidelines in the [CODING_GUIDELINES.md](CODING_GUIDELINES.md) file! + +# 3. Contributing Lens Data # + +In order for the Exiv2 project to, in particular, support a new lens we need an example image containing the Exif metadata for that lens. This is a good way for +non-programmers to contribute to the project and example images can be submitted using the following procedure: + +1. Create a new Issue by pressing the _New issue_ button here: [https://github.com/Exiv2/exiv2/issues](https://github.com/Exiv2/exiv2/issues), +2. In the new Issue, enter/add the lens mount and full lens name for each lens, +3. Take a (small) .jpg image (with the lens cap on) with each lens and transfer the .jpg file(s) to disk __without processing it__ in a desktop or server software (this is important to preserve the exif metadata in the file), +4. Attach the .jpg image(s) to the Issue [one can just drag-and-drop the image(s) or paste it/them from the clipboard]. + +Note that we are not only interested in non-supported lenses since we also look for example images to expand and improve the Exiv2 code tests. + +# 4. Reporting Bugs # + +Bugs should be reported by creating Issues on GitHub. However, before reporting a bug first check the Issue list if the bug is already known, and only if you cannot find any previous bug report +then create a new Issue. When reporting a bug try describe the problem in as much detail as possible and if the bug is triggered by an input file then attach that file to the GitHub Issue. diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..c484a90 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/COPYING-CMAKE-SCRIPTS b/COPYING-CMAKE-SCRIPTS new file mode 100644 index 0000000..4b41776 --- /dev/null +++ b/COPYING-CMAKE-SCRIPTS @@ -0,0 +1,22 @@ +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 copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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/README-CONAN.md b/README-CONAN.md new file mode 100644 index 0000000..2bc7953 --- /dev/null +++ b/README-CONAN.md @@ -0,0 +1,603 @@ +![Exiv2](exiv2.png) + +# Building Exiv2 dependencies with conan + +Conan is a portable package manager for C/C++ libraries. It can be used to create all dependencies needed to build Exiv2, without needing to install system packages. + +This document provides a step-by-step guide to show you the basic usage of conan. For more details about the tool, +please visit the [Conan documentation website](http://docs.conan.io/en/latest/). + +Although we provide step-by-step instructions to enable you to build Exiv2 with conan, we recommend that you read conan's documentation to understand the main concepts: [Getting started with Conan](http://docs.conan.io/en/latest/getting_started.html) + +To build Exiv2 with conan, you will also need to install CMake. https://cmake.org/download/ + + +---- +### T A B L E _ OF _ C O N T E N T S + +1. [Step by Step Guide](#1) + 1. [Install conan](#1-1) + 2. [Test conan installation](#1-2) + 3. [Create a build directory](#1-3) + 4. [Build dependencies and install conan artefacts in your build directory](#1-4) + 5. [Execute cmake to generate build files for your environment:](#1-5) +2. [Platform Notes](#2) + 1. [Linux Notes](#2-1) + 2. [Visual Studio Notes](#2-2) + 3. [Cygwin Notes](#2-3) + 4. [MinGW Notes](#2-4) +3. [Conan Architecture](#3) + 1. [conanfile.py](#3-1) + 2. [Conan Recipes](#3-2) + 3. [Conan server search path](#3-3) + 4. [Configuring conan on your machine](#3-4) +4. [Building Exiv2 with Adobe XMPsdk 2016](#4) + 1. [Add a remote directory to conan's recipe search path](#4-1) + 2. [Build dependencies and install conan artefacts in your build directory](#4-2) + 3. [Execute cmake to generate build files for your environment](#4-3) + 4. [Build Exiv2 and link Adobe XMPsdk library](#4-4) +5. [Webready Support](#5) + + +---- +# 1 Step by Step Guide + + +##### 1.1) Install conan: + +```bash +$ pip install conan +``` +For other installation methods (brew, installers, from sources), visit this [link]([install +conan](http://docs.conan.io/en/latest/installation.html)). + +To upgrade the version of conan: + +```bash +$ pip install conan --upgrade +``` + + +##### 1.2) Test conan installation + +```bash +$ conan --version +Conan version 1.4.1 +``` + + +##### 1.3) Create a build directory + +Create a build directory and will run the conan commands: + +```bash +$ mkdir build +$ cd build +$ conan profile list +``` + +**IMPORTANT** _**Visual Studio Users**_ require the profile msvc2017Release64 in %HOMEPATH%\.conan\profiles\msvc2017Release64 + +```ini +[build_requires] +[settings] +arch=x86_64 +build_type=Release +compiler=Visual Studio +compiler.runtime=MD +compiler.version=15 +os=Windows +arch_build=x86_64 +os_build=Windows +[options] +[env] +``` + + +##### 1.4) Build dependencies and install conan artefacts in your build directory + +Execute `$ conan install` pointing to the directory containing `conanfile.py`. + +```bash +$ conan install .. --build missing # --profile msvc2017Release64 +``` + +_**Visual Studio Users**_ should use `--profile msvc2017Release64` + +The output from this command is quite long as conan downloads or builds zlib, expat, curl and other dependencies. + + +##### 1.5) Execute cmake to generate build files for your environment. + +```bash +$ cmake .. # -G "Visual Studio 15 2017 Win64" +``` + + +##### 1.6) Build Exiv2: + +```bash +$ cmake --build . --config Release +``` + +[TOC](#TOC) + +## 2) Platform Notes + + +### 2.1) Linux Notes + +##### Default Profile + +When you run conan install for the first time, it will detect and write the default profile ~/.conan/profile/default. On my Ubuntu system with GCC 4.9, this is: + +```ini +[settings] +os=Linux +os_build=Linux +arch=x86_64 +arch_build=x86_64 +compiler=gcc +compiler.version=4.9 +compiler.libcxx=libstdc++ +build_type=Release +[options] +[build_requires] +[env] +``` + +##### Changing profile settings + +One of the most important **profile** settings to be adjusted in your conan profile when working on Linux is the field + +```bash +compiler.libcxx=libstdc++11 # Possible values: libstdc++, libstdc++11, libc++ +``` +With the arrival of the c++11 standard, and the growing popularity of the *clang* compiler, it is increasingly important which version of the standard library to use (corresponds to the `-stdlib` compiler flag). + +Recommended **libcxx** +settings works with conan and different compilers: + +```bash +compiler.libcxx=libstdc++11 # will use -stdlib=libstdc++ and define _GLIBCXX_USE_CXX11_ABI=1 +compiler.libcxx=libstdc++ # will use -stdlib=libstdc++ and define _GLIBCXX_USE_CXX11_ABI=0 +compiler.libcxx=libc++ # will use -stdlib=libc++ +``` + +As a rule of thumb, set `compiler.libcxx=libstdc++11` when using a version of gcc >= 5.1. + +More information about the standard library and GCC [dual ABI in gcc](https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html) with GCC works. + +Please, be aware that normally when using gcc >= 5.1, \_GLIBCXX\_USE\_CXX11\_ABI is set to 1 by default. However some linux +distributions might set that definition to 0 by default. In case you get linking errors about standard c++ containers or +algorithms when bringing the Exiv2 dependencies with conan, this might indicate a mismatch between the value set in +**compiler.libcxx** and the default values used in your distribution. + +[TOC](#TOC) + +### 2.2) Visual Studio Notes + +I use the following batch file to start cmd.exe. I do this to reduce the complexity of the path which grows as various tools are installed on Windows. The purpose of this script is to ensure a "stripped down path". + +```bat +@echo off +setlocal +cd %HOMEPATH% +set "PATH=C:\Python34\;C:\Python27\;C:\Python27\Scripts;C:\Perl64\site\bin;C:\Perl64\bin;C:\WINDOWS\system32;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;c:\Program Files\cmake\bin;" +cmd +``` + +### Profiles for Visual Studio + +Exiv2 v0.27 can be built with VS 2008, 2010, 2012, 2013, 2015 and 2017. + +Exiv2 v0.27.1 (and later) can be built with VS 2015, 2017 and 2019. I believe Exiv2 will build with 2013 and earlier, however we don't actively support these version of Visual Studio. + +v0.28 is being "modernised" to C++11 and will not support C++98. We don't expect Exiv2 v0.28 to build with VS 2008, 2010, 2012 or 2013. + +You create profiles in %HOMEPATH%\.conan\profiles with a text editor. For your convenience, you'll find profiles in `\cmake/msvc\_conan\_profiles`. There are 26 in total: + +``` +Profile := msvc{Edition}{Type}{Bits} +Edition := { 2019 | 2017 | 2015 } +Type := { Release | Debug } +Bits := { 64 | 32 } # 32 bit build is not provided for 2019 +Examples: msvc2019Release msvc2017Release64 msvc2015Debug32 +``` + +The profile msvc2017Release64 is as follows: + +```ini +[build_requires] +[settings] +arch=x86_64 +build_type=Release +compiler=Visual Studio +compiler.runtime=MD +compiler.version=15 +os=Windows +arch_build=x86_64 +os_build=Windows +[options] +[env] +``` + +### Tools for Visual Studio 2019 + +You will need cmake version 3.14 (and up) and conan 1.14 (and up). Additionally, when I upgraded to conan 1.14.3, I had to manually update (For me: `%USERPROFILE% == C:\Users\rmills`): + +```bat +copy/y %USERPROFILE%\.conan\settings.yml.new %USERPROFILE%\.conan\settings.yml +``` + +### CMake Generators for Visual Studio + +In the step-by-step guide, the command `$ cmake ..` uses +the default CMake generator. Always use the generator for your version of Visual Studio. For example: + +```bat +c:\....\exiv2\build> conan install .. --profile msvc2017Release64 --build missing +c:\....\exiv2\build> cmake .. -G "Visual Studio 15 2017 Win64" +c:\....\exiv2\build> cmake --build . --config Release +``` + +CMake provides Generators for different editions of Visual Studio. The 64 and 32 bit Generators have different names: + +| Architecture | Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | +|:--------- |--------------------|--------------------|--------------------|--------------------| +| 64 bit | "Visual Studio 16 2019" | "Visual Studio 15 2017 Win64" | "Visual Studio 14 2015 Win64" | +| 32 bit | Not provided | "Visual Studio 15 2017" | "Visual Studio 14 2015" | + +### Recommended settings for Visual Studio + +##### 64 bit Release Build + +| | Visual Studio 2017 | Visual Studio 2017 | Visual Studio 2015| +|:---------|--------------------|--------------------|--------------| +| _**conan install .. --profile**_ | msvc2019Release | msvc2017Release64 | msvc2015Release64 | +| _**cmake -G**_ | "Visual Studio 16 2019" | "Visual Studio 15 2017 Win64" | "Visual Studio 14 2015 Win64" | +| _**profile**_






_ | arch=x86\_64
arch\_build=x86\_64
build\_type=Release
compiler.runtime=MD
compiler.version=16
compiler=Visual Studio
os=Windows
os\_build=Windows | arch=x86\_64
arch\_build=x86\_64
build\_type=Release
compiler.runtime=MD
compiler.version=15
compiler=Visual Studio
os=Windows
os\_build=Windows | arch=x86\_64
arch\_build=x86\_64
build\_type=Release
compiler.runtime=MD
compiler.version=14
compiler=Visual Studio
os=Windows
os\_build=Windows | + +##### Debug Builds + +|| Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | +|:-------|-------|------|--------------| +| _**conan install .. --profile**_ | msvc2019Debug | msvc2017Debug64 | msvc2015Debug64 | +| _**profile**_
_ | build\_type=Debug
compiler.runtime=MDd | build\_type=Debug
compiler.runtime=MDd | build_type=Debug
compiler.runtime=MDd | + +##### 32bit Builds + +|| Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | +|:-----------|--------------------|--------------------|--------------------| +| _**conan install .. --profile**_ | Not provided | msvc2017Release32 | msvc2015Release32 | +| _**cmake -G**_ | Not provided | "Visual Studio 15 2017" | "Visual Studio 14 2015" | +| _**profile**_
_ | Not provided | arch=x86
arch\_build=x86 | arch=x86
arch\_build=x86 | + +##### Static Builds + +The default builds of Exiv2 and sample applications build and use DLLs. + +To build static libraries, use the cmake option `-DBUILD_SHARED_LIBS=Off`. You will probably also want to use the static run-time. The default is to use the dynamic run-time library. + +```bash +$ cmake -DBUILD_SHARED_LIBS=Off -DEXIV2_ENABLE_DYNAMIC_RUNTIME=Off +``` + +If you wish to use the static C run-time library, use the following option in the conan profile. + +| | Static Release | Static Debug | +|:--- |:--------- |:-------------------| +| **profile setting** | compiler.runtime=MT | compiler.runtime=MTd | + +If you receive a linker warning concerning `LIBCMT`, it is because you are attempting to link libraries which have been built with different run-time libraries. +You should link everything with the dynamic or static run-time. You can link a static library with the dynamic run-time if you wish. + +### Changing profile settings with the conan command + +It is recommended that you use profiles provided in `/cmake/msvc\_conan\_profiles'. + +You can modify profile settings on the command line. +The following example demonstrates making substantial changes to profile settings by performing a 32 bit build using Visual Studio 2015 with a 2017 profile! This example is not considered good practice, it is an illustration to some conan flexibility which be useful when your build environment is automated. + +```bash +$ conan install .. --profile msvc2017Release64 -s arch_build=x86 -s arch=x86 -s compiler.version=14 +$ cmake .. -G "Visual Studio 2015" +$ cmake --build . --config Release +``` + +[TOC](#TOC) + +### 2.3) Cygwin Notes + +Do not use conan on the Cygwin Platform. To build Exiv2 for Cygwin use CMake without conan. We recommend installing dependences (expat, zlib) with platform tools or build/install from source. + +[TOC](#TOC) + +### 2.4) MinGW Notes + +Team Exiv2 supports MinGW msys/2. Team Exiv2 does not support MinGW msys/1.0. + +As with Cygwin, we do not recommend using conan to build on the MinGW/msys2 platform. We recommend installing dependences (expat, zlib) with platform tools or build/install from source. + +[TOC](#TOC) + +## 3 Conan Architecture + + +##### 3.1) conanfile.py + +In the root level of the **Exiv2** repository, the file `conanfile.py` defines C/C++ dependencies with the syntax: `Library/version@user/channel` + +For example, **zlib**: + +```python +self.requires('self.requires('zlib/1.2.11@conan/stable')') +``` + +[TOC](#TOC) + +##### 3.2) Conan _**Recipes**_ + +Conan searches remote servers for a _**recipe**_ to build a dependency. + +A _**recipe**_ is a python file which indicates how to build a library from sources. The recipe +understands configurations: Platform/Compiler/Settings. If the remote server has a pre-compiled package for +your configuration, it will be downloaded. Otherwise, conan will compile the libraries on your machine using instructions in the recipe. + +To illustrate, here is list of packages that returned by the command `$ conan search` + +```bash +$ conan search --remote conan-center zlib/1.2.11@conan/stable +``` + +The output should be: + +```bash +Existing packages for recipe zlib/1.2.11@conan/stable: + + Package_ID: 0000193ac313953e78a4f8e82528100030ca70ee + [options] + shared: False + [settings] + arch: x86_64 + build_type: Debug + compiler: gcc + compiler.version: 4.9 + os: Linux + Outdated from recipe: False + + Package_ID: 014be746b283391f79d11e4e8af3154344b58223 + [options] + shared: False + [settings] + arch: x86_64 + build_type: Debug + compiler: gcc + compiler.exception: seh + compiler.threads: posix + compiler.version: 5 + os: Windows + Outdated from recipe: False + +... deleted .... + +``` + +[TOC](#TOC) + +##### 3.3) Conan server search path + +Conan searches remote servers for a _**recipe**_ to build the dependency. You can list them with the command: + +```bash +$ conan remote list +``` + +You can add servers to the conan server search path: + +```bash +$ conan remote add conan-piponazo https://api.bintray.com/conan/piponazo/piponazo +``` + +[TOC](#TOC) + +##### 3.4) Configuring conan on your machine + +Conan stores its configuration and local builds in the directory ~/.conan (%HOMEPATH%\\.conan on Windows). + +Conan installs several files and two directories: + +```bash +$HOME/.conan/profiles Configuration files for compilers/platforms +$HOME/.conan/data Dependencies are built/stored in this directory +``` + +[TOC](#TOC) + +##### 3.5) Running `conan install` for the first time + +The first time you run `$ conan install`, it will auto-detect your configuration and store a default profile in the file +$HOME/.conan/profiles/default + +Normally you will want to define new profiles for choosing different compilers (msvc, gcc, clang), different +build_type (Release, Debug), runtimes (MD, MT, MDd, MTd) + +The expected output should be something like this, in case it's the first time you run conan: + +```bash +$ conan install .. --build missing +Expat/2.2.5@pix4d/stable: Retrieving from predefined remote 'conan-center' +Expat/2.2.5@pix4d/stable: Trying with 'conan-center'... +Downloading conanmanifest.txt +[==================================================] 220B/220B +Downloading conanfile.py +[==================================================] 1.7KB/1.7KB +zlib/1.2.11@conan/stable: Retrieving from predefined remote 'conan-center' +zlib/1.2.11@conan/stable: Trying with 'conan-center'... +Downloading conanmanifest.txt +[==================================================] 121B/121B +Downloading conanfile.py +[==================================================] 5.7KB/5.7KB +libcurl/7.56.1@bincrafters/stable: Retrieving from predefined remote 'bincrafters' +libcurl/7.56.1@bincrafters/stable: Trying with 'bincrafters'... +Downloading conanmanifest.txt +... +PROJECT: Installing D:\Dev\Windows\projects\exiv2\conanfile.py +Requirements + Expat/2.2.5@pix4d/stable from 'conan-center' + OpenSSL/1.0.2n@conan/stable from 'conan-center' + gtest/1.8.0@bincrafters/stable from 'conan-center' + libcurl/7.56.1@bincrafters/stable from 'bincrafters' + zlib/1.2.11@conan/stable from 'conan-center' +Packages + Expat/2.2.5@pix4d/stable:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 + OpenSSL/1.0.2n@conan/stable:606fdb601e335c2001bdf31d478826b644747077 + gtest/1.8.0@bincrafters/stable:a35f8fa327837a5f1466eaf165e1b6347f6e1e51 + libcurl/7.56.1@bincrafters/stable:e37838f02fd790447943465f1c9317fd1c59b95c + zlib/1.2.11@conan/stable:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 + +PROJECT: Retrieving package 6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 +Expat/2.2.5@pix4d/stable: Looking for package 6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 in remote 'conan-center' +Downloading conanmanifest.txt +[==================================================] 323B/323B +Downloading conaninfo.txt +[==================================================] 438B/438B +Downloading conan_package.tgz +[==================================================] 133.6KB/133.6KB +Expat/2.2.5@pix4d/stable: Package installed 6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 +PROJECT: Retrieving package a35f8fa327837a5f1466eaf165e1b6347f6e1e51 +gtest/1.8.0@bincrafters/stable: Looking for package a35f8fa327837a5f1466eaf165e1b6347f6e1e51 in remote 'conan-center' +Downloading conanmanifest.txt +[==================================================] 3.5KB/3.5KB +Downloading conaninfo.txt +[==================================================] 478B/478B +Downloading conan_package.tgz +[==================================================] 1001.1KB/1001.1KB +gtest/1.8.0@bincrafters/stable: Package installed a35f8fa327837a5f1466eaf165e1b6347f6e1e51 +PROJECT: Retrieving package 6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 +... +PROJECT: Generator cmake created conanbuildinfo.cmake +PROJECT: Generator txt created conanbuildinfo.txt +PROJECT: Generated conaninfo.txt +PROJECT imports(): Copied 5 '.dll' files +(conan) +``` + +Note that it first downloads the recipes, and then the binary packages. When everything goes well, conan found +the recipes in the remotes, and it also found packages for our configuration (msvc2017, Release, MD). + +However, if you use other configuration for which there are no packages in the remotes, you will get an error such as: + +```bash + PROJECT: WARN: Can't find a 'zlib/1.2.11@conan/stable' package for the specified options and settings: + - Settings: arch=x86_64, build_type=Release, compiler=clang, compiler.version=3.9, os=Macos + - Options: shared=False + + ERROR: Missing prebuilt package for 'zlib/1.2.11@conan/stable' + Try to build it from sources with "--build zlib" + Or read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package" +``` + +In that case, we can tell conan to build the library: + +```bash +$ conan install .. --profile MyEsotericProfile --build missing +``` + +Once the command succeeds, we will have the libraries in our system (you can find the recipes and packages in +`$HOME/.conan/data`). When you execute the command `conan install` with the same profile, the following output is typical: + +```bash +$ conan install .. +PROJECT: Installing D:\Dev\Windows\projects\exiv2\conanfile.py +Requirements + Expat/2.2.5@pix4d/stable from 'conan-center' + OpenSSL/1.0.2n@conan/stable from 'conan-center' + gtest/1.8.0@bincrafters/stable from 'conan-center' + libcurl/7.56.1@bincrafters/stable from 'bincrafters' + zlib/1.2.11@conan/stable from 'conan-center' +Packages + Expat/2.2.5@pix4d/stable:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 + OpenSSL/1.0.2n@conan/stable:606fdb601e335c2001bdf31d478826b644747077 + gtest/1.8.0@bincrafters/stable:a35f8fa327837a5f1466eaf165e1b6347f6e1e51 + libcurl/7.56.1@bincrafters/stable:e37838f02fd790447943465f1c9317fd1c59b95c + zlib/1.2.11@conan/stable:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 + +Expat/2.2.5@pix4d/stable: Already installed! +gtest/1.8.0@bincrafters/stable: Already installed! +zlib/1.2.11@conan/stable: Already installed! +OpenSSL/1.0.2n@conan/stable: Already installed! +libcurl/7.56.1@bincrafters/stable: Already installed! +PROJECT: Generator cmake created conanbuildinfo.cmake +PROJECT: Generator txt created conanbuildinfo.txt +PROJECT: Generated conaninfo.txt +PROJECT imports(): Copied 5 '.dll' files +``` + +Indicating that the packages were found in the local cache. + +[TOC](#TOC) + +## 4 Building Exiv2 with Adobe XMPsdk 2016 + +With Exiv2 v0.27, you can build Exiv2 with Adobe XMPsdk 2016 on Linux/GCC, Mac/clang and Visual Studio 2017. +Other platforms such as Cygwin are not supported by Adobe. Adobe/XMPsdk is built as a external library. +Applications which wish use the Adobe XMPsdk directly should build Exiv2 in this configuration and the +library can be used by the application and Exiv2. The Adobe XMPsdk can be built as a static or shared library (.DLL) + +To build Exiv2 with Adobe XMPsdk 2016, should perform steps 1.1, 1.2 and 1.3 described above, then perform the following: + + +##### 4.1) Add a remote directory to conan's recipe search path + +By default, conan knows about several public conan repositories. Exiv2 requires +the **piponazo** repository to find the XmpSdk dependency which is not available from **conan-center** repository. + +```bash +$ conan remote add conan-piponazo https://api.bintray.com/conan/piponazo/piponazo +``` + + +##### 4.2) Build dependencies and install conan artefacts in your build directory + +```bash +$ conan install .. --options xmp=True --build missing +``` + + +##### 4.3) Execute cmake to generate build files for your environment: + +You must tell CMake to link Adobe's library: + +```bash +$ cmake .. -DEXIV2_ENABLE_EXTERNAL_XMP=On # -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release +``` +**MacOS-X** users should use the cmake _**Xcode**_ Generator + +```bash +$ cmake .. -DEXIV2_ENABLE_EXTERNAL_XMP=On -G Xcode +``` + + +##### 4.4) Build Exiv2 and link Adobe XMPsdk library + +```bash +$ cmake --build . --config Release +``` + +[TOC](#TOC) + +## 5 Webready Support + +Exiv2 can perform I/O using internet protocols such as https, https, ftp and ssh. + +The feature is disabled by default. You will need to instruct conan to build/download necessary libraries (curl, openssl and libssh) and tell CMake to link to the libraries. + +```bash +$ conan install .. --options webready=True +$ cmake -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=ON -DEXIV2_ENABLE_SSH=ON .. +``` + +[TOC](#TOC) + +Written by Robin Mills
robin@clanmills.com
Updated: 2019-04-18 diff --git a/README-SAMPLES.md b/README-SAMPLES.md new file mode 100644 index 0000000..6e2015c --- /dev/null +++ b/README-SAMPLES.md @@ -0,0 +1,603 @@ +![Exiv2](exiv2.png) + +# Exiv2 Sample Applications + +Exiv2 is a C++ library and a command line utility to read, write, delete and modify Exif, IPTC, XMP and ICC image metadata. Exiv2 also features a collection of sample and test command-line programs. Please be aware that while the program _**exiv2**_ enjoys full support from Team Exiv2, the other programs have been written for test, documentation or development purposes. You are expected to read the code to discover the specification of programs other than _**exiv2**_. + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +### Sample Programs + +| Name | Purpose | More information | Code | +|:--- |:--- |:--- |:-- | +| _**addmoddel**_ | Demonstrates Exiv2 library APIs to add, modify or delete metadata | [addmoddel](#addmoddel) | [addmoddel.cpp](samples/addmoddel.cpp) | +| _**exifcomment**_ | Set Exif.Photo.UserComment in an image | [exifcomment](#exifcomment) | [exifcomment.cpp](samples/exifcomment.cpp) | +| _**exifdata**_ | Prints _**Exif**_ metadata in different formats in an image | [exifdata](#exifdata) | [exifdata.cpp](samples/exifdata.cpp) | +| _**exifprint**_ | Print _**Exif**_ metadata in images
Miscelleous other features | [exifprint](#exifprint)| [exifprint.cpp](samples/exifprint.cpp) | +| _**exifvalue**_ | Prints the value of a single _**Exif**_ tag in a file | [exifvalue](#exifvalue) | [exifvalue.cpp](samples/exifvalue.cpp) | +| _**exiv2**_ | Command line utility to read, write, delete and modify Exif, IPTC, XMP and ICC image metadata.
This is the primary test tool used by Team Exiv2 and can exercise almost all code in the library. Due to the extensive capability of this utility, the APIs used are usually less obvious for casual code inspection. | [https://exiv2.org/manpage.html](https://exiv2.org/manpage.html)
[https://exiv2.org/sample.html](https://exiv2.org/sample.html) | | +| _**exiv2json**_ | Extracts data from image in JSON format.
This program also contains a parser to recursively parse Xmp metadata into vectors and objects. | [exiv2json](#exiv2json) | [exiv2json.cpp](samples/exiv2json.cpp) | +| _**geotag**_ | Reads GPX data and updates images with GPS Tags | [geotag](#geotag) | [geotag.cpp](samples/geotag.cpp) | +| _**iptceasy**_ | Demonstrates read, set or modify IPTC metadata | [iptceasy](#iptceasy) | [iptceasy.cpp](samples/iptceasy.cpp) | +| _**iptcprint**_ | Demonstrates Exiv2 library APIs to print Iptc data | [iptceasy](#iptceasy) | [iptcprint.cpp](samples/iptcprint.cpp) | +| _**metacopy**_ | Demonstrates copying metadata from one image to another | [metacopy](#metacopy) | [metacopy.cpp](samples/metacopy.cpp) | +| _**mrwthumb**_ | Sample program to extract a Minolta thumbnail from the makernote | [mrwthumb](#mrwthumb) | [mrwthumb.cpp](samples/mrwthumb.cpp) | +| _**xmpparse**_ | Read an XMP packet from a file, parse it and print all (known) properties. | [xmpparse](#xmpparse) | [xmpparse.cpp](samples/xmpparse.cpp) | +| _**xmpprint**_ | Read an XMP from a file, parse it and print all (known) properties.. | [xmpprint](#xmpprint) | [xmpprint.cpp](samples/xmpprint.cpp) | +| _**xmpsample**_ | Demonstrates Exiv2 library high level XMP classes | [xmpsample](#xmpsample) | [xmpsample.cpp](samples/exmpsample.cpp) | + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +### Test Programs + +As Exiv2 is open source, we publish all our materials. Some of the following programs are actively used in our test harness. Some of the following programs were written during the development of features and their on-going use may be limited, or even obsolete. In general these programs are published as source and Team Exiv2 will not provide support to users. + +| Name | Kind | More information | +|:--- |:--- |:--- | +| _**conntest**_ | Test http/https/ftp/ssh/sftp connection | [conntest](#conntest) | +| _**convert-test**_ | Conversion test driver | [convert-test](#convert-test) | +| _**easyaccess-test**_ | Sample program using high-level metadata access functions | [easyaccess-test](#easyaccess-test) | +| _**getopt-test**_ | Sample program to test getopt() | [getopt-test](#getopt-test) | +| _**ini-test**_ | Shows simple usage of the INIReader class | [ini-test](#ini-test) | +| _**iotest**_ | Test programs for BasicIo functions. | [iotest](#iotest) | +| _**iptctest**_ | Sample program test Iptc reading and writing. | [iptctest](#iptctest) | +| _**key-test**_ | Key unit tests | [key-test](#key-test) | +| _**largeiptc-test**_ | Test for large (>65535 bytes) IPTC buffer | [largeiptc-test](#largeiptc-test) | +| _**mmap-test**_ | Simple mmap tests | [mmap-test](#mmap-test) | +| _**path-test**_ | Test path IO | [path-test](#path-test) | +| _**prevtest**_ | Test access to preview images | [prevtest](#prevtest) | +| _**remotetest**_ | Tester application for testing remote i/o. | [remotetest](#remotetest) | +| _**stringto-test**_ | Test conversions from string to long, float and Rational types. | [stringto-test](#stringto-test) | +| _**taglist**_ | Print a simple comma separated list of tags defined in Exiv2 | [taglist](#taglist) | +| _**tiff-test**_ | Simple TIFF write test | [tiff-test](#tiff-test) | +| _**werror-test**_ | Simple tests for the wide-string error class WError | [werror-test](#werror-test) | +| _**write-test**_ | ExifData write unit tests | [write-test](#write-test) | +| _**write2-test**_ | ExifData write unit tests for Exif data created from scratch | [write2-test](#write2-test) | +| _**xmpdump**_ | Sample program to dump the XMP packet of an image | [xmpdump](#xmpdump) | +| _**xmpparser-test**_ | Read an XMP packet from a file, parse and re-serialize it. | [xmpparser-test](#xmpparser-test) | + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +## 2 Sample Program Descriptions + +
+ +#### addmoddel + +``` +Usage: addmoddel file +``` + +Demonstrates Exiv2 library APIs to add, modify or delete metadata. _Code: [addmoddel.cpp](samples/addmoddel.cpp)_ + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### exifcomment + +``` +Usage: exifcomment file +``` + +This is a simple program that demonstrates how to set _**Exif.Photo.UserComment**_ in an image. _Code: [exifcomment.cpp](samples/exifcomment.cpp)_ + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +### exifdata + +``` +Usage: exifdata file format +formats: csv | json | wolf | xml +``` + +This is a simple program to demonstrate dumping _**Exif**_ metadata in common formats. _Code: [exifdata.cpp](samples/exifdata.cpp)_ + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### exifprint + +``` +Usage: exifprint [ file | --version | --version-test ] +``` + +| Arguments | Description | +|:-- |:--- | +| file | Path to image | +| --version | Print version information from build | +| --version-test | Tests Exiv2 VERSION API | + +This program demonstrates how to print _**Exif**_ metadata in an image. This program is also discussed in the platform ReadMe.txt file included in a build bundle. The option **--version** was added enable the user to build a test application which dumps the build information. The option **--version-test** was added to test the macro EXIV2\_TEST\_VERSION() in **include/exiv2/version.hpp**. + +There is one other unique feature of this program. It is the only test/sample program which can use the EXV\_UNICODE\_PATH build feature of Exiv2 on Windows. + +_Code: [exifprint.cpp](samples/exifprint.cpp)_ + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### exifvalue + +``` +Usage: exifvalue file tag +``` +Prints the value of a single _**Exif**_ tag in a file. _Code: [exifvalue.cpp](samples/exifvalue.cpp)_ + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### exiv2json + +``` +Usage: exiv2json [-option] file +Option: all | exif | iptc | xmp | filesystem +``` +| Arguments | Description | +|:-- |:--- | +| all | All metadata | +| filesystem | Filesystem metadata | +| exif | Exif metadata | +| iptc | Iptc metadata | +| xmp | Xmp metadata | +| file | path to image | + +This program dumps metadata from an image in JSON format. _Code: [exiv2json.cpp](samples/exiv2json.cpp)_ + +exiv2json has a recursive parser to encode XMP into Vectors and Objects. XMP data is XMP and can contain XMP `Bag` and `Seq` which are converted to JSON Objects and Arrays. Exiv2 presents data in the format: Family.Group.Tag. For XMP, results in "flat" output such such as: + +``` +$ exiv2 -px ~/Stonehenge.jpg +Xmp.xmp.Rating XmpText 1 0 +Xmp.xmp.ModifyDate XmpText 25 2015-07-16T20:25:28+01:00 +Xmp.dc.description LangAlt 1 lang="x-default" Classic View +``` + +exiv2json parses the Exiv2 'Family.Group.Tag' data and restores the structure of the original data in JSON. _Code: [exiv2json.cpp](samples/exiv2json.cpp)_ + +``` +$ exiv2json -xmp http://clanmills.com/Stonehenge.jpg +{ + "Xmp": { + "xmp": { + "Rating": "0", + "ModifyDate": "2015-07-16T20:25:28+01:00" + }, + "dc": { + "description": { + "lang": { + "x-default": "Classic View" + } + } + }, + "xmlns": { + "dc": "http:\/\/purl.org\/dc\/elements\/1.1\/", + "xmp": "http:\/\/ns.adobe.com\/xap\/1.0\/" + } + } +} +$ +``` + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### geotag + +``` +Usage: geotag {-help|-version|-dst|-dryrun|-ascii|-verbose|-adjust value|-tz value|-delta value}+ path+ +``` + +Geotag reads one or more GPX files and adds GPS Tages to images. _Code: [geotag.cpp](samples/geotag.cpp)_ + +If the path is a directory, geotag will read all the files in the directory. It constructs a time dictionary of position data, then updates every image with GPS Tags. + +| Arguments | Description | +|:-- |:--- | +| -ascii | Output in ascii (not UTF8). Prints `deg` instead of °. | +| -dst | Apply 1 hour adjustment for daylight saving time. | +| -dryrun | Read arguments and print report. Does not modify images. | +| -verbose | Report progress. | +| -adjust value | Add/subtract time from image data. | +| -tz value | Specify time zone. For example PST = -8:00 | +| -delta value | Correction between Image DataTime and GPS time. | + +I use this program frequently. I have a little Canon camera which I take when I run. My Samsung Galaxy Watch uploads my runs to Strava and I download the GPX. If I'm in another time-zone and have forgotten to change the time setting in the camera, I use `-adjust` to alter the images. The GPX time is always correct, however the camera is normally off by seconds or minutes. This option enables you to correct for inaccuracy in the setting of the camera time. + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### iptceasy + +``` +Usage: iptceasy file +Reads and writes raw metadata. Use -h option for help. +``` + +Demonstrates read, set or modify IPTC metadata. _Code: [iptceasy.cpp](samples/iptceasy.cpp)_ + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### iptcprint + +``` +Usage: iptcprint file +Reads and writes raw metadata. Use -h option for help. +``` + +Demonstrates Exiv2 library APIs to print Iptc data. _Code: [iptcprint.cpp](samples/iptcprint.cpp)_ + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### metacopy + +``` +Usage: metacopy [-iecaph] readfile writefile +Reads and writes raw metadata. Use -h option for help. +``` + +Metacopy is used to copy a complete metadata block from one file to another. _Code: [metacopy.cpp](samples/metacopy.cpp)_ + +Please note that some metadata such as Exif.Photo.PixelXDimension is considered to be part of the image and will not be copied. + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### mrwthumb + +``` +Usage: mrwthumb file +``` + +Sample program to extract a Minolta thumbnail from the makernote. _Code: [mrwthumb.cpp](samples/mrwthumb.cpp)_ + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### xmpparse + +``` +Usage: xmpparse file +``` + +Read an XMP packet from a file, parse it and print all (known) properties. _Code: [xmpparse.cpp](samples/xmpparse.cpp)_ + + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### xmpprint + +``` +Usage: xmpprint file +``` + +Read an XMP from a file, parse it and print all (known) properties. _Code: [xmpprint.cpp](samples/xmpprint.cpp)_ + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### xmpsample + +``` +Usage: xmpsample file +``` + +Demonstrates Exiv2 library high level XMP classes. _Code: [xmpsample.cpp](samples/xmpsample.cpp)_ + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +## 3 Test Program Descriptions + +
+ +#### conntest + +``` +Usage: conntest url {-http1_0} +``` + +Test http/https/ftp/ssh/sftp connection + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### convert-test + +``` +Usage: convert-test file +``` + +Conversion test driver + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### easyaccess-test + +``` +Usage: easyaccess-test file +``` + +Sample program using high-level metadata access functions + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### getopt-test + +``` +Usage: getopt-test +``` +This program is used to test the function **getopt()**. Prior to Exiv2 v0.27, the sample programs used the platform's C Runtime Library function **getopt()**. Visual Studio builds used code in src/getopt.cpp. Due to differences in the platform **getopt()**, the code in src/getopt.cpp was modified and adopted on every platforms. This test program was added for test and debug purpose. Please note that src/getopt.cpp is compiled and linked into the sample application and is not part of the Exiv2 library. + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### ini-test + +``` +Usage: ini-test +``` + +This program is used to test reading the file ini-test. This program was added in Exiv2 v0.26 when the ~/.exiv2 file was added to the Exiv2 architecture. + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### iotest + +``` +Usage: iotest filein fileout1 fileout2 +fileouts are overwritten and should match filein exactly +``` + +Test programs for BasicIo functions. + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### iptctest + +``` +Usage: iptctest image +Commands read from stdin. +``` + +Sample program test Iptc reading and writing. + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### key-test + +``` +Usage: key-test +``` + +Key unit tests + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### largeiptc-test + +``` +Usage: largeiptc-test image datafile +``` + +Test for large (>65535 bytes) IPTC buffer + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### mmap-test + +``` +Usage: mmap-test file +``` + +Simple mmap tests + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### path-test + +``` +Usage: path-test file +``` + +Test path IO + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### prevtest + +``` +Usage: prevtest file +``` + +Test access to preview images + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### remotetest + +``` +Usage: remotetest remotetest file {--nocurl | --curl} +``` + +Tester application for testing remote i/o. + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### stringto-test + +``` +Usage: stringto-test +``` + +Test conversions from string to long, float and Rational types. + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### taglist + +``` +Usage: taglist [--group name|Groups|Exif|Canon|CanonCs|CanonSi|CanonCf|Fujifilm|Minolta|Nikon1|Nikon2|Nikon3|Olympus|Panasonic|Pentax|Sigma|Sony|Iptc|dc|xmp|xmpRights|xmpMM|xmpBJ|xmpTPg|xmpDM|pdf|photoshop|crs|tiff|exif|aux|iptc] +Print Exif tags, MakerNote tags, or Iptc datasets +``` + +Print a simple comma separated list of tags defined in Exiv2 + +This program encodes the library's tag definitions in ascii. +The data from this program is formatted as HTML on the web-site. https://exiv2.org/metadata.html + +For example, to show the binary definition of Group `Nikon3`: + +``` +1516 rmills@rmillsmbp:~/gnu/github/exiv2/0.27-maintenance $ taglist Nikon3 +Version, 1, 0x0001, Nikon3, Exif.Nikon3.Version, Undefined, Nikon Makernote version +ISOSpeed, 2, 0x0002, Nikon3, Exif.Nikon3.ISOSpeed, Short, ISO speed setting +ColorMode, 3, 0x0003, Nikon3, Exif.Nikon3.ColorMode, Ascii, Color mode +Quality, 4, 0x0004, Nikon3, Exif.Nikon3.Quality, Ascii, Image quality setting +WhiteBalance, 5, 0x0005, Nikon3, Exif.Nikon3.WhiteBalance, Ascii, White balance +Sharpening, 6, 0x0006, Nikon3, Exif.Nikon3.Sharpening, Ascii, Image sharpening setting +Focus, 7, 0x0007, Nikon3, Exif.Nikon3.Focus, Ascii, Focus mode +FlashSetting, 8, 0x0008, Nikon3, Exif.Nikon3.FlashSetting, Ascii, Flash setting +FlashDevice, 9, 0x0009, Nikon3, Exif.Nikon3.FlashDevice, Ascii, Flash device +... +``` + +We can see those tags being used: + +``` +$ exiv2 -pa --grep Nikon3 http://clanmills.com/Stonehenge.jpg +1519 rmills@rmillsmbp:~/gnu/github/exiv2/0.27-maintenance $ exiv2 -pa --grep Nikon3 http://clanmills.com/Stonehenge.jpg +Exif.Nikon3.Version Undefined 4 2.11 +Exif.Nikon3.ISOSpeed Short 2 200 +1520 rmills@rmillsmbp:~/gnu/github/exiv2/0.27-maintenance $ +... +``` + +This information is formatted (search Nikon (format 3) MakerNote Tags): [https://exiv2.org/tags-nikon.html](https://exiv2.org/tags-nikon.html) + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### tiff-test + +``` +Usage: tiff-test file +``` + +Simple TIFF write test + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + + +
+ +#### werror-test + +``` +Usage: werror-test +``` + +Simple tests for the wide-string error class WError + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### write-test + +``` +Usage: write-test file case +where case is an integer between 1 and 11 +``` + +ExifData write unit tests + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### write2-test + +``` +Usage: write2-test file +``` + +ExifData write unit tests for Exif data created from scratch + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### xmpdump + +``` +Usage: xmpdump file +``` + +Sample program to dump the XMP packet of an image + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + +
+ +#### xmpparser-test + +``` +Usage: xmpparser-test file +``` + +Read an XMP packet from a file, parse and re-serialize it. + +[Sample](#TOC1) Programs [Test](#TOC2) Programs + + + +Robin Mills
+robin@clanmills.com
+Revised: 2019-06-20 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a3e1960 --- /dev/null +++ b/README.md @@ -0,0 +1,898 @@ +| Travis | AppVeyor | GitLab| Codecov| Repology| +|:-------------:|:-------------:|:-----:|:------:|:-------:| +| [![Build Status](https://travis-ci.org/Exiv2/exiv2.svg?branch=0.27-maintenance)](https://travis-ci.org/Exiv2/exiv2) | [![Build status](https://ci.appveyor.com/api/projects/status/d6vxf2n0cp3v88al/branch/0.27-maintenance?svg=true)](https://ci.appveyor.com/project/piponazo/exiv2-wutfp/branch/0.27-maintenance) | [![pipeline status](https://gitlab.com/D4N/exiv2/badges/0.27-maintenance/pipeline.svg)](https://gitlab.com/D4N/exiv2/commits/0.27-maintenance) | [![codecov](https://codecov.io/gh/Exiv2/exiv2/branch/0.27-maintenance/graph/badge.svg)](https://codecov.io/gh/Exiv2/exiv2) | [![Packaging status](https://repology.org/badge/tiny-repos/exiv2.svg)](https://repology.org/metapackage/exiv2/versions) | +
+ +### TABLE OF CONTENTS + +1. [Welcome to Exiv2](#1) +2. [Building, Installing, Using and Uninstalling Exiv2](#2) + 1. [Build, Install, Use and Uninstall Exiv2 on a UNIX-like system](#2-1) + 2. [Build and Install Exiv2 with Visual Studio](#2-2) + 3. [Build Options](#2-3) + 4. [Dependencies](#2-4) + 5. [Building and linking your code with Exiv2](#2-5) + 6. [Consuming Exiv2 with CMake](#2-6) + 7. [Using pkg-config to compile and link your code with Exiv2](#2-7) + 8. [Localisation](#2-8) + 9. [Building Exiv2 Documentation](#2-9) + 10. [Building Exiv2 Packages](#2-10) + 11. [Debugging Exiv2](#2-11) + 12. [Building Exiv2 with Clang and other build chains](#2-12) + 13. [Building Exiv2 with ccache](#2-13) +3. [License and Support](#3) + 1. [License](#3-1) + 2. [Support](#3-2) +4. [Test Suit](#4) + 1. [Running tests on a UNIX-like system](#4-1) + 2. [Running tests on Visual Studio builds](#4-2) + 3. [Unit tests](#4-3) +5. [Platform Notes](#5) + 1. [Linux](#5-1) + 2. [MacOS-X](#5-2) + 3. [MinGW](#5-3) + 4. [Cygwin](#5-4) + 5. [Microsoft Visual C++](#5-5) + 6. [Unix](#5-6) + +
+ +# Welcome to Exiv2 + +![Exiv2](exiv2.png) + +Exiv2 is a C++ library and a command line utility to read, +write, delete and modify Exif, IPTC, XMP and ICC image metadata. + +| Exiv2 Resource | Location | +|:------ |:---- | +| Releases and Documentation | [https://exiv2.org](https://exiv2.org) | +| Prereleases: | [https://pre-release.exiv2.org](https://pre-release.exiv2.org) | +| Project Resources | [https://github.com/Exiv2/exiv2](https://github.com/Exiv2/exiv2) | +| License (GPLv2) | [COPYING](COPYING) | +| CMake Downloads | [https://cmake.org/download/](https://cmake.org/download/) | + +The file ReadMe.txt in a Build bundle describes how to install the library on the platform. ReadMe.txt also documents how to compile and link code on the platform. + +[TOC](#TOC) +
+ +## 2 Building, Installing, Using and Uninstalling Exiv2 + +You need [CMake](https://cmake.org/download/) to configure the Exiv2 project and a C++11 compiler. + +
+ +### 2.1 Build, Install, Use Exiv2 on a UNIX-like system + +```bash +cd $EXIV_ROOT +mkdir build && cd build +cmake .. -DCMAKE_BUILD_TYPE=Release +cmake --build . +make test +sudo make install +``` + +This will install the library into the "standard locations". The library will be installed in `/usr/local/lib`, executables (including the exiv2 command-line program) in `/usr/local/bin/` and header files in `/usr/local/include/exiv2` + +#### Using the exiv2 command-line program + +To execute the exiv2 command line program, you should update your path to search /usr/local/bin/ + +```bash +$ export PATH="/usr/local/bin:$PATH" +``` + +You will also need to locate libexiv2 at run time: + +```bash +$ export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" # Linux, Cygwin, MinGW/msys2 +$ export DYLD_LIBRARY_PATH="/usr/local/lib:$DYLD_LIBRARY_PATH" # MacOS-X +``` + + + +[TOC](#TOC) +
+ +### 2.2 Build and Install Exiv2 with Visual Studio + +We recommend that you use conan to download the Exiv2 external dependencies on Windows (On Linux/OSX you can use or install system packages). +Apart from handling the dependencies, to configure and compile the project is pretty similar to the UNIX like systems. +See [README-CONAN](README-CONAN.md) for more information + +[TOC](#TOC) +
+ +### 2.3 Build options + +There are two groups of CMake options. There are many options defined by CMake. Here are some particularly useful options: + +| Options | Purpose (_default_) | +|:------------- |:------------- | +| CMAKE\_INSTALL\_PREFIX
CMAKE\_BUILD\_TYPE
BUILD\_SHARED\_LIBS | Where to install on your computer _**(/usr/local)**_
Type of build _**(Release)**_ See: [Debugging Exiv2](#2-11)
Build exiv2lib as shared or static _**(On)**_ | + +Options defined by /CMakeLists.txt include: + +```bash +576 rmills@rmillsmm:~/gnu/github/exiv2/exiv2 $ grep ^option CMakeLists.txt +option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON ) +option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON ) +option( EXIV2_ENABLE_EXTERNAL_XMP "Use external version of XMP" OFF ) +option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON ) +... +577 rmills@rmillsmm:~/gnu/github/exiv2/exiv2 $ +``` + +Options are defined on the CMake command line: +```bash +$ cmake -DBUILD_SHARED_LIBS=On -DEXIV2_ENABLE_NLS=OFF +``` + +[TOC](#TOC) +
+ +### 2.4 Dependencies + +The following Exiv2 features require external libraries: + +| Feature | Package | Default | To change default | Availability | +|:-------------------------- |:-------- |:--------:| :---------------------------- |:----------- | +| PNG image support | zlib | ON | -DEXIV2\_ENABLE\_PNG=Off | [http://zlib.net/](http://zlib.net/) | +| XMP support | expat | ON | -DEXIV2\_ENABLE\_XMP=Off | [http://expat.sourceforge.net](http://expat.sourceforge.net)/
Use _**Expat 2.2.6**_ and later | +| Natural language system | gettext | OFF | -DEXIV2\_ENABLE\_NLS=On | [http://www.gnu.org/software/gettext/](http://www.gnu.org/software/gettext/) | + +On UNIX systems, you may install the dependencies using the distribution's package management system. Install the +development package of a dependency to install the header files and libraries required to build Exiv2. In the file +`ci/install_dependencies.sh` you can check to the list of packages we install on different Linux distributions. This +file is used to setup some CI images in which we try out the Exiv2 compilation. + +Natural language system is discussed in more detail here: [Localisation](#2-8) + +Notes about different platforms are included here: [Platform Notes](#5) + +You may choose to install dependences with conan. This is supported on all platforms and is especially useful for users of Visual Studio. +See [README-CONAN](README-CONAN.md) for more information. + +[TOC](#TOC) + +
+ +### 2.5 Building and linking your code with Exiv2 + +There are detailed platform notes about compiling and linking in `releasenotes/{platform}/ReadMe.txt` + +where `platform: { CYGWIN | Darwin | Linux | MinGW | msvc }` + +In general you need to do the following: + +1) Application code should be written in C++98 and include exiv2 headers: + +```C++ +#include +``` + +2) Compile your C++ code with the directive: **`-I/usr/local/include`** + +3) Link your code with libexiv2 using the linker options: **`-lexiv2`** and **`-L/usr/local/lib`** + +The following is a typical command to build and link with libexiv2: + +```bash +$ g++ -std=c++98 myprog.cpp -o myprog -I/usr/local/include -L/usr/local/lib -lexiv2 +``` + +[TOC](#TOC) +
+ +### 2.6 Consuming Exiv2 with CMake + +When exiv2 is installed, the files required to consume Exiv2 are installed in `${CMAKE_INSTALL_PREFIX}/lib/cmake/exiv2` + +You can build samples/exifprint.cpp as follows: + +```bash +$ cd +$ mkdir exifprint +$ cd exifprint +$ *** EDIT CMakeLists.txt *** +$ cat CMakeLists.txt +cmake_minimum_required(VERSION 3.8) +project(exifprint VERSION 0.0.1 LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_EXTENSIONS OFF) + +find_package(exiv2 REQUIRED CONFIG NAMES exiv2) # search ${CMAKE_INSTALL_PREFIX}/lib/cmake/exiv2/ +add_executable(exifprint ../samples/exifprint.cpp) # compile this +target_link_libraries(exifprint exiv2lib) # link exiv2lib + +$ cmake . # generate the makefile +$ make # build the code +$ ./exifprint # test your executable +Usage: ./exifprint [ file | --version || --version-test ] +$ +``` + +This [repository](https://github.com/piponazo/exiv2Consumer) shows an example of how to consume Exiv2 with CMake. + +[TOC](#TOC) +
+ +### 2.7 Using pkg-config to compile and link your code with Exiv2 + +When exiv2 is installed, the file exiv2.pc used by pkg-config is installed in `${CMAKE_INSTALL_PREFIX}/lib/pkgconfig` You will need to set the following in your environment: + +```bash +$ export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" +``` + +To compile and link using exiv2.pc, you usually add the following to your Makefile. + +```bash +PKGCONFIG=pkg-config +CPPFLAGS := `pkg-config exiv2 --cflags` +LDFLAGS := `pkg-config exiv2 --libs` +``` + +If you are not using make, you can use pkg-config as follows: + +```bash +g++ -std=c++98 myprogram.cpp -o myprogram $(pkg-config exiv2 --libs --cflags) +``` + +[TOC](#TOC) +
+ +### 2.8 Localisation + +Localisation is supported on a UNIX-like platform: Linux, MacOS-X, Cygwin and MinGW/msys2. Localisation is not supported for Visual Studio builds. + +To build localisation support, use the CMake option `-DEXIV2_ENABLE_NLS=ON`. You must install the `gettext` package with your package manager or from source. The `gettext` package is available from [http://www.gnu.org/software/gettext/](http://www.gnu.org/software/gettext/) and includes the library `libintl` and utilities to build localisation files. If CMake produces error messages which mention libintl or gettext, you should verify that the package `gettext` has been correctly built and installed. + +You must install the build to test localisation. This ensures that the localisation message files can be found at run-time. You cannot test localisation in the directory `build\bin`. + +1) Running exiv2 in another language + +```bash +$ env LANG=fr_FR exiv2 # env LANGUAGE=fr_FR exiv2 on Linux! +exiv2: Une action doit être spécifié +exiv2: Au moins un fichier est nécessaire +Utilisation : exiv2 [ options ] [ action ] fichier ... + +Manipulation des métadonnées EXIF issues des images. +$ +``` + +2) Adding additional languages to exiv2 + +To support a new language which we'll designate 'xy' for this discussion: + +2.1) Generate a po file from the po template: + +```bash +$ cd +$ mkdir -p po/xy +$ msginit --input=po/exiv2.pot --locale=xy --output=po/xy.po +``` +2.2) Edit/Translate the strings in po/xy.po + +I edited the following: + +```bash +#: src/exiv2.cpp:237 +msgid "Manipulate the Exif metadata of images.\n" +msgstr "" +``` +to: + +```bash +#: src/exiv2.cpp:237 +msgid "Manipulate the Exif metadata of images.\n" +msgstr "Manipulate image metadata.\n" +``` + +2.3) Generate the messages file: + +```bash +$ mkdir -p po/xy/LC_MESSAGES +$ msgfmt --output-file=po/xy/LC_MESSAGES/exiv2.mo po/xy.po +``` + +2.4) Install and test your messages: + +You have to install your messages to test them. It's not possible to test a messages file by executing build/bin/exiv2. + +```bash +$ sudo mkdir -p /usr/local/share/locale/xy/LC_MESSAGES +$ sudo cp -R po/xy/LC_MESSAGES/exiv2.mo /usr/local/share/locale/xy/LC_MESSAGES +$ env LANG=xy exiv2 # env LANGUAGE=xy on Linux! +exiv2: An action must be specified +exiv2: At least one file is required +Usage: exiv2 [ options ] [ action ] file ... + +Manipulate image metadata. <--------- Edited message! +$ +``` + +2.5) Submitting your new language file for inclusion in future versions of Exiv2: + +You may submit a PR which contains po/xy.po AND a modification to po/CMakeLists.txt + +Or, open a new issue on https://github.com/exiv2/exiv2 and attach the file xy.po.zip which can be created as follows: + +``` +$ zip xy.po.zip po/xy.po + adding: po/xy.po (deflated 78%) +ls -l xy.po.zip +-rw-r--r--+ 1 rmills staff 130417 25 Jun 10:15 xy.po.zip +$ +``` + + +[TOC](#TOC) +
+ +### 2.9 Building Exiv2 Documentation + +Building documentation requires installing special tools. You will probably prefer to +read the documentation on-line from the project website: https://exiv2.org + + +To build documentation, use the CMake option **`-DEXIV2_BUILD_DOC=On`**. +Additionally, you will require an additional build step to actually build the documentation. + +```bash +$ cmake ..options.. -DEXIV2_BUILD_DOC=ON +$ make doc +``` + +To build the documentation, you must install the following products: + +| Product | Availability | +|:------------ |:------------ | +| doxygen
graphviz
python
xsltproc
md5sum | [http://www.doxygen.org/](http://www.doxygen.org/)
[http://www.graphviz.org/](http://www.graphviz.org/)
[http://www.python.org/](http://www.python.org/)
[http://xmlsoft.org/XSLT/](http://xmlsoft.org/XSLT/)
[http://www.microbrew.org/tools/md5sha1sum/](http://www.microbrew.org/tools/md5sha1sum/) | + +[TOC](#TOC) +
+ +### 2.10 Building Exiv2 Packages + +To enable the building of Exiv2 packages, use the CMake option `-DEXIV2_TEAM_PACKAGING=ON`. + +You should not build Exiv2 Packages. This feature is intended for use by Team Exiv2 to create Platform and Source Packages on the buildserver. + +There are two types of Exiv2 packages which are generated by cpack from the cmake command-line. + +1) Platform Package (header files, binary library and samples. Some documentation and release notes) + +Create and build exiv2 for your platform. + +```bash +$ git clone https://github.com/exiv2/exiv2 +$ mkdir -p exiv2/build +$ cd exiv2/build +$ cmake .. -G "Unix Makefiles" -DEXIV2_TEAM_PACKAGING=On +... +-- Build files have been written to: .../build +$ cmake --build . --config Release +... +[100%] Built target addmoddel +$ make package +... +CPack: - package: /path/to/exiv2/build/exiv2-0.27.1-Linux.tar.gz generated. +``` + +2) Source Package + +```bash +$ make package_source +Run CPack packaging tool for source... +... +CPack: - package: /path/to/exiv2/build/exiv2-0.27.1-Source.tar.gz generated. +``` + +You may prefer to run `$ cmake --build . --config Release --target package_source` + + +[TOC](#TOC) +
+ +### 2.11 Debugging Exiv2 + +1) Generating and installing a debug library + +In general to generate a debug library, you should use the option *cmake* option `-DCMAKE_RELEASE_TYPE=Debug` and build in the usual way. + +```bash +$ cd +$ mkdir build +$ cd build +$ cmake .. -G "Unix Makefiles" "-DCMAKE_BUILD_TYPE=Debug" +$ make + +``` + +You must install the library to ensure that your code is linked to the debug library. + +You can check that you have generated a debug build with the command: + +```bash +$ exiv2 -vVg debug +exiv2 0.27.1 +debug=1 +$ +``` + +[TOC](#TOC) + +2) About preprocessor symbols `NDEBUG` and `EXIV2_DEBUG_MESSAGES` + +Exiv2 respects the symbol `NDEBUG` which is set only for Release builds. There are sequences of code which are defined within: + +```C++ +#ifdef EXIV2_DEBUG_MESSAGES +.... +#endif +``` + +Those blocks of code are not compiled unless you define `EXIV2_DEBUG_MESSAGES` by yourself. They are provided for additional debugging information. For example, if you are interested in additional output from webpimage.cpp, you can update your build as follows: + +```bash +$ cd +$ touch src/webpimage.cpp +$ make CXXFLAGS=-DEXIV2_DEBUG_MESSAGESDEBUG +$ bin/exiv2 ... +-- or -- +$ sudo make install +$ exiv2 ... +``` + +If you are debugging library code, it is recommended that you use the exiv2 command-line as your test harness as Team Exiv2 is very familiar with this tool and able to give support. + +[TOC](#TOC) + +3) Starting the debugger + +This is platform specific. On Linux: + +```bash +$ gdb exiv2 +``` + +[TOC](#TOC) + +4) Using Debugger IDEs such as Xcode, CLion, Visual Studio, Eclipse or QtCreator + +I have used all those IDEs to debug the Exiv2 library and applications. All of them work. You may find it takes initial effort, however I assure you that they all work well. + +I personally use CLion which has excellent integration with CMake. It will automatically add **`-DCMAKE_BUILD_TYPE=Debug`** to the cmake command. It keeps build types in separate directories such as **`/cmake-build-debug`**. + +[TOC](#TOC) + +5) cmake --build . options **`--config Release|Debug`** and **`--target install`** + +Visual Studio and Xcode can build debug or release builds without using the option **`-DCMAKE_BUILD_TYPE`** because the generated project files can build multiple types. The option **`--config Debug`** can be specified on the command-line to specify the build type. Alternatively, if you prefer to build in the IDE, the UI provides options to select the configuration and target. + +With the Unix Makefile generator, the targets can be listed: + +```bash +$ make help +The following are some of the valid targets for this Makefile: +... all (the default if no target is provided) +... clean +... depend +... install/local +......... +``` + +[TOC](#TOC) +
+ +### 2.12 Building Exiv2 with **clang** and other build chains + +1) On Linux + + +```bash +$ cd +$ rm -rf build ; mkdir build ; cd build +$ cmake .. -DCMAKE_C_COMPILER=$(which clang) -DCMAKE_CXX_COMPILER=$(which clang++) +$ cmake --build . +``` + +**_OR_** + +```bash +$ export CC=$(which clang) +$ export CXX=$(which clang++) +$ cd +$ rm -rf build ; mkdir build ; cd build +$ cmake .. +$ cmake --build . +``` + +2) On MacOS-X + +Apple provide clang with Xcode. GCC has not been supported by Apple since 2013. The _"normal unix build"_ uses Clang. + +3) On Cygwin, MinGW/msys2, Windows (using clang-cl) and Visual Studio. + +I have been unable to get clang to work on any of those platforms. + +4) Cross Compiling + +I've never succeeded in getting this to work. I use different VMs for Linux 32 and 64 bit. I've documented how to set up Cygwin and MinGW/msys2 for 64 and 32 bit builds in [README-CONAN](README-CONAN.md) + +[TOC](#TOC) +
+ +### 2.13 Building Exiv2 with ccache + +To speed up compilation, the utility ccache can be installed to cache the output of the compiler. This greatly speeds up the build when you frequently built code that has not been modified. + +Installing and using ccache (and other similar utilities), is platform dependent. On Ubuntu: + +```bash +$ sudo apt install --yes ccache +``` + +To build with ccache, use the cmake option **-DBUILD\_WITH\_CCACHE=On** + +```bash +$ cd +$ mkdir build ; cd build ; cd build +$ cmake .. -G "Unix Makefiles" -DBUILD_WITH_CCACHE=On +$ make +# Build again to appreciate the performance gain +$ make clean +$ make +``` + +Due to the way in which ccache is installed in Fedora (and other Linux distros), ccache effectively replaces the compiler. A default build or **-DBUILD\_WITH\_CCACHE=Off** is not effective and the environment variable CCACHE_DISABLE is required to disable ccache. [https://github.com/Exiv2/exiv2/issues/361](https://github.com/Exiv2/exiv2/issues/361) + +[TOC](#TOC) +
+ +## 3 License and Support + +All project resources are accessible from the project website. + https://github.com/Exiv2/exiv2 + +
+ +### 3.1 License + +Copyright (C) 2004-2019 Exiv2 authors. +You should have received a copy of the file [COPYING](COPYING) which details the GPLv2 license. + +Exiv2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +Exiv2 program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +[TOC](#TOC) +
+ +### 3.2 Support +For new bug reports and feature requests, please open an issue in Github. + +[TOC](#TOC) +
+ +## 4 Running the test suite + +The test suite is a mix of bash and python scripts. The python scripts are new to v0.27 and the bash scripts are being replaced as time permits. + +
+ +### 4.1 Running tests on a UNIX-like system + +You can run the suite directly from the build: + +```bash +$ cmake .. -G "Unix Makefiles" +$ make +... +$ make tests +... lots of output ... +Summary report +``` + +You can run individual tests in the test directory using the environment variable EXIV2\_BINDIR to specify the location of the build artifacts. For Cygwin and MinGW/msys builds, also set EXIV2_EXT=.exe + +```bash +rmills@rmillsmbp-w7 ~/gnu/github/exiv2/exiv2/build $ cd ../test +rmills@rmillsmbp-w7 ~/gnu/github/exiv2/exiv2/test $ env EXIV2_BINDIR=${PWD}/../build/bin ./icc-test.sh +ICC jpg md5 webp md5 png md5 jpg md5 +all testcases passed. + +rmills@rmillsmbp-w7 ~/gnu/github/exiv2/exiv2/test $ env EXIV2_BINDIR=${PWD}/../build/bin make newtests +``` + +[TOC](#TOC) +
+ +### 4.2 Running tests on Visual Studio builds + +Use the bash interpreter for MinGW/msys2 to run the test suite. It's essential to have a DOS Python3 interpreter on your path called `python3.exe` The variables EXIV2\_BINDIR and EXIV2\_EXT enable the test suite to locate the MSVC build artifacts. + +```bash +$ cd /build +$ cd ../test +$ PATH="/c/Python37:$PATH" +$ export EXIV2_EXT=.exe +$ export EXIV2_BINDIR=${PWD}/../build/bin +``` + +**Caution: ** The python3 interpreter must be for DOS and called python3.exe. I copied `c:\Python37\python.exe c:\Python37\python3.exe` + +Once you have modified the PATH and and exported EXIV2\_BINDIR and EXIV2\_EXT, you can execute the test suite as described for UNIX-like systems: + +```bash +$ cd /test +$ make test +$ make newtests +$ ./icc-test.sh +``` + +[TOC](#TOC) +
+ +### 4.3 Unit tests + +The code for the unit tests is in `/unitTests` + +To build the unit tests, use the *cmake* option `-DEXIV2_BUILD_UNIT_TESTS=ON`. + +To execute the unit tests: + +```bash +$ cd /build +$ bin/unit_tests +``` + +There is a discussion on the web about installing GTest: [https://github.com/Exiv2/exiv2/issues/575](https://github.com/Exiv2/exiv2/issues/575) + +[TOC](#TOC) +
+ +## 5 Platform Notes + +There are many ways to set up and configure your platform. The following notes are provided as a guide. + +
+ +### 5.1 Linux + +Update your system and install the build tools and dependencies (zlib, expat, gtest and others) + +```bash +$ sudo apt --yes update +$ sudo apt install --yes build-essential git clang ccache python3 libxml2-utils cmake python3 libexpat1-dev libz-dev zlib1g-dev libssh-dev libcurl4-openssl-dev libgtest-dev google-mock +``` + +Get the code from GitHub and build + +```bash +$ mkdir -p ~/gnu/github/exiv2 +$ cd ~/gnu/github/exiv2 +$ git clone https://github.com/exiv2/exiv2 +$ cd exiv2 +$ mkdir build ; cd build ; +$ cmake .. -G "Unix Makefiles" +$ make +``` + +[TOC](#TOC) +
+ +### 5.2 MacOS-X + +You will need to install Xcode and the Xcode command-line tools to build on the Mac. + +You should build and install libexpat and zlib. You may use brew, macports, build from source, or use conan. + +I recommend that you build and install CMake from source. + +[TOC](#TOC) +
+ +### 5.3 MinGW + +We provide support for both 64bit and 32bit builds using MinGW/msys2. [https://www.msys2.org](https://www.msys2.org) + +Support for MinGW/msys1.0 32 bit build was provided for Exiv2 v0.26. MinGW/msys1.0 is not supported by Team Exiv2 for Exiv2 v0.27 and later. + +There is a discussion on the web about installing GTest: [https://github.com/Exiv2/exiv2/issues/575](https://github.com/Exiv2/exiv2/issues/575) + +#### MinGW/msys2 64 bit +Install: [http://repo.msys2.org/distrib/x86\_64/msys2-x86\_64-20180531.exe](http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20180531.exe) + +I use the following batch file to start the MinGW/msys2 64 bit bash shell from the Dos Command Prompt (cmd.exe) + +```bat +@echo off +setlocal +set "PS1=\! MSYS64:\u@\h:\w \$ " +set PATH="/usr/local/bin/:/usr/bin:/mingw64/bin:/bin:/usr/sbin:/sbin" +set "HOME=c:\msys64\home\%USERNAME%" +if NOT EXIST %HOME% mkdir %HOME% +cd %HOME% +c:\msys64\usr\bin\bash.exe -norc + +``` + +#### MinGW/msys2 32 bit +Install: [http://repo.msys2.org/distrib/i686/msys2-i686-20180531.exe](http://repo.msys2.org/distrib/i686/msys2-i686-20180531.exe) + +I use the following batch file to start the MinGW/msys2 32 bit bash shell from the Dos Command Prompt (cmd.exe) + +```bat +@echo off +setlocal +set "PS1=\! MSYS32:\u@\h:\w \$ " +set PATH="/usr/local/bin/:/usr/bin:/mingw32/bin:/bin:/usr/sbin:/sbin" +set "HOME=c:\msys32\home\%USERNAME%" +if NOT EXIST %HOME% mkdir %HOME% +cd %HOME% +c:\msys32\usr\bin\bash.exe -norc + +``` + +#### Install MinGW Dependencies + +Install tools and dependencies: + +```bash +$ for i in base-devel git cmake coreutils python3 man gcc gdb make dos2unix diffutils zlib-devel libexpat-devel libiconv-devel gettext-devel; do (echo y|pacman -S $i); done +``` + +You can upgrade all installed packages on your system with the following command. For me, this broke msys32 and I had to reinstall msys32 and all the dependencies. Your experience may be different. + +```bash +$ pacman -Syu +``` + +#### Download exiv2 from github and build + +```bash +$ mkdir -p ~/gnu/github/exiv2 +$ cd ~/gnu/github/exiv2 +$ git clone https://github.com/exiv2/exiv2 +$ cd exiv2 +$ mkdir build ; cd build ; +$ cmake .. -G "Unix Makefiles" +$ make +``` + +#### MinGW and Regex + +The exiv2 command line program provides an option **`--grep`** to filter output. The implementation requires the header file **``** and supporting library to be available during the build. When not available, the option **`--grep`** degrades to a substring match. Because there are several versions of **``** available on the MinGW platform, detection of regex is always disabled on this platform and uses substring match. The following command reveals if regex is included in your build: + +```bash +$ exiv2 -vVg regex +exiv2 0.27.1 +have_regex=1 +$ +``` + +[TOC](#TOC) +
+ +### 5.4 Cygwin + +Download: [https://cygwin.com/install.html](https://cygwin.com/install.html) and run setup-x86_64.exe for 64 Bit Cygwin, or setup-x86.exe for 32 bit Cygwin. I install into c:\\cygwin64 and c:\\cygwin32 + +You need: +make, cmake, gcc, gettext-devel pkg-config, dos2unix, zlib-devel, libexpat1-devel, git, python3-interpreter, libiconv, libxml2-utils, libncurses. + +Download and build libiconv-1.15: [https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz](https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz) + +There is a discussion on the web about installing GTest: [https://github.com/Exiv2/exiv2/issues/575](https://github.com/Exiv2/exiv2/issues/575) + +Download and build cmake from source because I can't get the cygwin installed cmake 3.6.2 to work. +To build cmake from source, you need libncurses. [https://cmake.org/download/](https://cmake.org/download/) + +I use the following batch file "cygwin64.bat" to start the Cygwin/64 bit bash shell from the Dos Command Prompt (cmd.exe). + +```bat +@echo off +setlocal +set "PATH=c:\cygwin64\usr\local\bin;c:\cygwin64\bin;c:\cygwin64\usr\bin;c:\cygwin64\usr\sbin;" +if NOT EXIST %HOME% mkdir %HOME% +set "HOME=c:\cygwin64\home\rmills" +cd %HOME% +set "PS1=\! CYGWIN64:\u@\h:\w \$ " +bash.exe -norc +``` + +[TOC](#TOC) +
+ +### 5.5 Microsoft Visual C++ + +We recommend that you use Conan to build Exiv2 using Microsoft Visual C++. Exiv2 v0.27 can be built with Visual Studio versions 2008 and later. We actively support and build with Visual Studio 2015, 2017 and 2019. + +As well as Microsoft Visual Studio, you will need to install CMake, Python3, and Conan. + +1) Binary installers for CMake on Windows are availably from [https://cmake.org/download/](https://cmake.org/download/).
+2) Binary installers for Python3 are available from [python.org](https://python.org)
+3) Conan can be installed using python/pip. Details in [README-CONAN.md](README-CONAN.md) + +I use the following batch file to start cmd.exe. I do this to reduce the complexity of the path which grows as various tools are installed on Windows. The purpose of this script is to ensure a "stripped down path". + +```bat +@echo off +setlocal +cd %HOMEPATH% +set "PATH=C:\Python37\;C:\Python27\;C:\Python27\Scripts;C:\Perl64\site\bin;C:\Perl64\bin;C:\WINDOWS\system32;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;c:\Program Files\cmake\bin;" +cmd +``` + +[TOC](#TOC) +
+ +### 5.6 Unix + +Exiv2 can be built on many Unix and Linux distros. With v0.27.2, we are starting to actively support the Unix Distributions NetBSD and FreeBSD. We hope to add CI support for these platforms in v0.27.3. + +I have provided notes here based on my experience with these platforms. Feedback is welcome. + +I am willing to support Exiv2 on other commercial Unix distributions such as AIX, HP-UX and OSF/1 provided you provide with an ssh account for your platform. I will require super-user privileges to install software. + +#### NetBSD + +You can build exiv2 from source using the methods described for linux. I built and installed exiv2 using "Pure CMake" and didn't require conan. +You will want to use the package manager `pkgsrc` to build/install: + +1. gcc (currently GCC 5.5.0) +2. python3 +3. cmake +4. bash +5. sudo +6. chksum +7. gettext + +I entered links into the file system `# ln -s /usr/pkg/bin/python37 /usr/local/bin/python3` and `# ln -s /usr/pkg/bin/bash /bin/bash` +It's important to ensure that `LD_LIBRARY_PATH` includes `/usr/local/lib` and `/usr/pkg/lib`. It's important to ensure that PATH includes `/usr/local/bin`, `/usr/pkg/bin` and `/usr/pkg/sbin`. + +#### FreeBSD + +Clang is pre-installed as ``/usr/bin/{cc|c++}` as well has libz and expat. FreeBSD uses pkg as the package manager which I used to install cmake and git. + +```bash +$ su root +Password: +# pkg install cmake +# pkg install git +``` + +To run the Exiv2 test suite, I installed bash and python. The test suite requires additional work as the platform `diff` command does not understand the option `--binary` and returns an error. In consequence, the test harness returns lots of errors. I hope to address this in v0.27.3. + + +```bash +# pkg install bash +# pkg install python +``` + +#### Solaris + +Work in progress: [https://github.com/Exiv2/exiv2/issues/902](https://github.com/Exiv2/exiv2/issues/902) + +[TOC](#TOC) + +Robin Mills + +Revised: 2019-07-29 diff --git a/WORK-IN-PROGRESS b/WORK-IN-PROGRESS new file mode 100644 index 0000000..0781e99 --- /dev/null +++ b/WORK-IN-PROGRESS @@ -0,0 +1,345 @@ +T A B L E o f C O N T E N T S +--------------------------------- + +1 Building Adobe XMPsdk and Samples in Terminal with the ./Generate_XXX_mac.sh scripts +1.1 Amazing Discovery 1 DumpFile is linked to libstdc++.6.dylib +1.2 Amazing Discovery 2 Millions of "weak symbol/visibility" messages + +4 Build design for v0.26.1 +4.8 Support for MinGW + +5 Refactoring the Tiff Code +5.1 Background +5.2 How does Exiv2 decode the ExifData in a JPEG? +5.3 How is metadata organized in Exiv2 +5.4 Where are the tags defined? +5.5 How do the MakerNotes get decoded? +5.6 How do the encoders work? + +6 Using external XMP SDK via Conan + +========================================================================== + +4 Build design for v0.26.1 + +Added : 2017-08-18 +Modified: 2017-08-23 + + The purpose of the v0.26.1 is to release bug fixes and + experimental new features which may become defaults with v0.27 + +4.8 Support for MinGW + MinGW msys/1.0 was deprecated when v0.26 was released. + No support for MinGW msys/1.0 will be provided. + It's very likely that the MinGW msys/1.0 will build. + I will not provide any user support for MinGW msys/1.0 in future. + + MinGW msys/2.0 might be supported as "experimental" in Exiv2 v0.26.2 + + +========================================================================== + +5 Refactoring the Tiff Code + +Added : 2017-09-24 +Modified: 2017-09-24 + +5.1 Background + Tiff parsing is the root code of a metadata engine. + + The Tiff parsing code in Exiv2 is very difficult to understand and has major architectural shortcomings: + + 1) It requires the Tiff file to be totally in memory + 2) It cannot handle BigTiff + 3) The parser doesn't know the source of the in memory tiff image + 4) It uses memory mapping on the tiff file + - if the network connection is lost, horrible things happen + - it requires a lot of VM to map the complete file + - BigTiff file can be 100GB+ + - The memory mapping causes problems with Virus Detection software on Windows + 5) The parser cannot deal with multi-page tiff files + 6) It requires the total file to be in contiguous memory and defeats 'webready'. + + The Tiff parsing code in Exiv2 is ingenious. It's also very robust. It works well. It can: + + 1) Handle 32-bit Tiff and Many Raw formats (which are derived from Tiff) + 2) It can read and write Manufacturer's MakerNotes which are (mostly) in Tiff format + 3) It probably has other great features that I haven't discovered + - because the code is so hard to understand, I can't simply browse and read it. + 4) It separates file navigation from data analysis. + + The code in image::printStructure was originally written to understand "what is a tiff?" + It has problems: + 1) It was intended to be a single threaded debugging function and has security issues. + 2) It doesn't handle BigTiff + 3) It's messy. It's reading and processing metadata simultaneously. + + The aim of this project is to + 1) Reconsider the Tiff Code. + 2) Keep everything good in the code and address known deficiencies + 3) Establish a Team Exiv2 "Tiff Expert" who knows the code intimately. + +5.2 How does Exiv2 decode the ExifData in a JPEG? + You can get my test file from http://clanmills.com/Stonehenge.jpg + + 808 rmills@rmillsmbp:~/gnu/github/exiv2/exiv2/build $ exiv2 -pS ~/Stonehenge.jpg + STRUCTURE OF JPEG FILE: /Users/rmills/Stonehenge.jpg + address | marker | length | data + 0 | 0xffd8 SOI + 2 | 0xffe1 APP1 | 15288 | Exif..II*...................... + 15292 | 0xffe1 APP1 | 2610 | http://ns.adobe.com/xap/1.0/.accept(reader); + + The class tree for the decoder is: + + class TiffDecoder : public TiffFinder { + class TiffReader , + class TiffFinder : public TiffVisitor { + class TiffVisitor { + public: + //! Events for the stop/go flag. See setGo(). + enum GoEvent { + geTraverse = 0, + geKnownMakernote = 1 + }; + + void setGo(GoEvent event, bool go); + virtual void visitEntry(TiffEntry* object) =0; + virtual void visitDataEntry(TiffDataEntry* object) =0; + virtual void visitImageEntry(TiffImageEntry* object) =0; + virtual void visitSizeEntry(TiffSizeEntry* object) =0; + virtual void visitDirectory(TiffDirectory* object) =0; + virtual void visitSubIfd(TiffSubIfd* object) =0; + virtual void visitMnEntry(TiffMnEntry* object) =0; + virtual void visitIfdMakernote(TiffIfdMakernote* object) =0; + virtual void visitIfdMakernoteEnd(TiffIfdMakernote* object); + virtual void visitBinaryArray(TiffBinaryArray* object) =0; + virtual void visitBinaryArrayEnd(TiffBinaryArray* object); + //! Operation to perform for an element of a binary array + virtual void visitBinaryElement(TiffBinaryElement* object) =0; + + //! Check if stop flag for \em event is clear, return true if it's clear. + bool go(GoEvent event) const; + } + } + } + + The reader works by stepping along the Tiff directory and calls the visitor's + "callbacks" as it reads. + + There are 2000 lines of code in tiffcomposite.cpp and, to be honest, + I don't know what most of it does! + + Set a breakpoint in src/exif.cpp#571. + That’s where he adds the key/value to the exifData vector. + Exactly how did he get here? That’s a puzzle. + + void ExifData::add(const ExifKey& key, const Value* pValue) + { + add(Exifdatum(key, pValue)); + } + +5.3 How is metadata organized in Exiv2 + section.group.tag + + section: Exif | IPTC | Xmp + group: Photo | Image | MakerNote | Nikon3 .... + tag: YResolution etc ... + + 820 rmills@rmillsmbp:~/gnu/github/exiv2/exiv2/src $ exiv2 -pa ~/Stonehenge.jpg | cut -d' ' -f 1 | cut -d. -f 1 | sort | uniq + Exif + Iptc + Xmp + + 821 rmills@rmillsmbp:~/gnu/github/exiv2/exiv2/src $ exiv2 -pa --grep Exif ~/Stonehenge.jpg | cut -d'.' -f 2 | sort | uniq + GPSInfo + Image + Iop + MakerNote + Nikon3 + NikonAf2 + NikonCb2b + NikonFi + NikonIi + NikonLd3 + NikonMe + NikonPc + NikonVr + NikonWt + Photo + Thumbnail + + 822 rmills@rmillsmbp:~/gnu/github/exiv2/exiv2/src $ 533 rmills@rmillsmbp:~/Downloads $ exiv2 -pa --grep Exif ~/Stonehenge.jpg | cut -d'.' -f 3 | cut -d' ' -f 1 | sort | uniq + AFAperture + AFAreaHeight + AFAreaMode + ... + XResolution + YCbCrPositioning + YResolution +534 rmills@rmillsmbp:~/Downloads $ + 823 rmills@rmillsmbp:~/gnu/github/exiv2/exiv2/src $ + + The data in IFD0 of is Exiv2.Image: + + 826 rmills@rmillsmbp:~/gnu/github/exiv2/exiv2/src $ exiv2 -pR ~/Stonehenge.jpg | head -20 + STRUCTURE OF JPEG FILE: /Users/rmills/Stonehenge.jpg + address | marker | length | data + 0 | 0xffd8 SOI + 2 | 0xffe1 APP1 | 15288 | Exif..II*...................... + STRUCTURE OF TIFF FILE (II): MemIo + address | tag | type | count | offset | value + 10 | 0x010f Make | ASCII | 18 | 146 | NIKON CORPORATION + 22 | 0x0110 Model | ASCII | 12 | 164 | NIKON D5300 + 34 | 0x0112 Orientation | SHORT | 1 | | 1 + 46 | 0x011a XResolution | RATIONAL | 1 | 176 | 300/1 + 58 | 0x011b YResolution | RATIONAL | 1 | 184 | 300/1 + 70 | 0x0128 ResolutionUnit | SHORT | 1 | | 2 + 82 | 0x0131 Software | ASCII | 10 | 192 | Ver.1.00 + 94 | 0x0132 DateTime | ASCII | 20 | 202 | 2015:07:16 20:25:28 + 106 | 0x0213 YCbCrPositioning | SHORT | 1 | | 1 + 118 | 0x8769 ExifTag | LONG | 1 | | 222 + STRUCTURE OF TIFF FILE (II): MemIo + address | tag | type | count | offset | value + 224 | 0x829a ExposureTime | RATIONAL | 1 | 732 | 10/4000 + 236 | 0x829d FNumber | RATIONAL | 1 | 740 | 100/10 + 827 rmills@rmillsmbp:~/gnu/github/exiv2/exiv2/src $ exiv2 -pa --grep Image ~/Stonehenge.jpg + Exif.Image.Make Ascii 18 NIKON CORPORATION + Exif.Image.Model Ascii 12 NIKON D5300 + Exif.Image.Orientation Short 1 top, left + Exif.Image.XResolution Rational 1 300 + Exif.Image.YResolution Rational 1 300 + Exif.Image.ResolutionUnit Short 1 inch + Exif.Image.Software Ascii 10 Ver.1.00 + Exif.Image.DateTime Ascii 20 2015:07:16 20:25:28 + Exif.Image.YCbCrPositioning Short 1 Centered + Exif.Image.ExifTag Long 1 222 + Exif.Nikon3.ImageBoundary Short 4 0 0 6000 4000 + Exif.Nikon3.ImageDataSize Long 1 6173648 + Exif.NikonAf2.AFImageWidth Short 1 0 + Exif.NikonAf2.AFImageHeight Short 1 0 + Exif.Photo.ImageUniqueID Ascii 33 090caaf2c085f3e102513b24750041aa + Exif.Image.GPSTag Long 1 4060 + 828 rmills@rmillsmbp:~/gnu/github/exiv2/exiv2/src $ + + The data in IFD1 is Exiv2.Photo + + The data in the MakerNote is another embedded TIFF (which more embedded tiffs) + + 829 rmills@rmillsmbp:~/gnu/github/exiv2/exiv2/src $ exiv2 -pa --grep MakerNote ~/Stonehenge.jpg + Exif.Photo.MakerNote Undefined 3152 (Binary value suppressed) + Exif.MakerNote.Offset Long 1 914 + Exif.MakerNote.ByteOrder Ascii 3 II + 830 rmills@rmillsmbp:~/gnu/github/exiv2/exiv2/src $ + + The MakerNote decodes them into: + + Exif.Nikon1, Exiv2.NikonAf2 and so on. I don't know exactly it achieves this. + However it means that tag-numbers can be reused in different IFDs. + Tag 0x0016 = Nikon GPSSpeed and can mean something different elsewhere. + +5.4 Where are the tags defined? + + There's an array of "TagInfo" data structures in each of the makernote decoders. + These define the tag (a number) and the tag name, the groupID (eg canonId) and the default type. + There's also a callback to print the value of the tag. This does the "interpretation" + that is performed by the -pt in the exiv2 command-line program. + + TagInfo(0x4001, "ColorData", N_("Color Data"), N_("Color data"), canonId, makerTags, unsignedShort, -1, printValue), + +5.5 How do the MakerNotes get decoded? + + I don't know. It has something to do with this code in tiffcomposite.cpp#936 + + TiffMnEntry::doAccept(TiffVisitor& visitor) { ... } + + Most makernotes are TiffStructures. So the TiffXXX classes are invoked recursively to decode the maker note. + +#0 0x000000010058b4b0 in Exiv2::Internal::TiffDirectory::doAccept(Exiv2::Internal::TiffVisitor&) at /Users/rmills/gnu/github/exiv2/exiv2/src/tiffcomposite.cpp:916 + This function iterated the array of entries + +#1 0x000000010058b3c6 in Exiv2::Internal::TiffComponent::accept(Exiv2::Internal::TiffVisitor&) at /Users/rmills/gnu/github/exiv2/exiv2/src/tiffcomposite.cpp:891 +#2 0x00000001005b5357 in Exiv2::Internal::TiffParserWorker::parse(unsigned char const*, unsigned int, unsigned int, Exiv2::Internal::TiffHeaderBase*) at /Users/rmills/gnu/github/exiv2/exiv2/src/tiffimage.cpp:2006 + This function creates an array of TiffEntries + +#3 0x00000001005a2a60 in Exiv2::Internal::TiffParserWorker::decode(Exiv2::ExifData&, Exiv2::IptcData&, Exiv2::XmpData&, unsigned char const*, unsigned int, unsigned int, void (Exiv2::Internal::TiffDecoder::* (*)(std::__1::basic_string, std::__1::allocator > const&, unsigned int, Exiv2::Internal::IfdId))(Exiv2::Internal::TiffEntryBase const*), Exiv2::Internal::TiffHeaderBase*) at /Users/rmills/gnu/github/exiv2/exiv2/src/tiffimage.cpp:1900 +#4 0x00000001005a1ae9 in Exiv2::TiffParser::decode(Exiv2::ExifData&, Exiv2::IptcData&, Exiv2::XmpData&, unsigned char const*, unsigned int) at /Users/rmills/gnu/github/exiv2/exiv2/src/tiffimage.cpp:260 +#5 0x000000010044d956 in Exiv2::ExifParser::decode(Exiv2::ExifData&, unsigned char const*, unsigned int) at /Users/rmills/gnu/github/exiv2/exiv2/src/exif.cpp:625 +#6 0x0000000100498fd7 in Exiv2::JpegBase::readMetadata() at /Users/rmills/gnu/github/exiv2/exiv2/src/jpgimage.cpp:386 +#7 0x000000010000bc59 in Action::Print::printList() at /Users/rmills/gnu/github/exiv2/exiv2/src/actions.cpp:530 +#8 0x0000000100005835 in Action::Print::run(std::__1::basic_string, std::__1::allocator > const&) at /Users/rmills/gnu/github/exiv2/exiv2/src/actions.cpp:245 + + +5.6 How do the encoders work? + + I understand writeMetadata() and will document that soon. + I still have to study how the TiffVisitor writes metadata. + + +6 Using external XMP SDK via Conan + +Section 1 describes how to compile the newer versions of XMP SDK with a bash script. This +approach had few limitations: + + 1) We had to include sources from other projects into the Exiv2 repository: Check the folder + xmpsdk/third-party. + 2) Different scripts for compiling XMP SDK on Linux, Mac OSX and Windows. + 3) Lot of configuration/compilation issues depending on the system configuration. + +Taking into account that during the last months we have done a big effort in migrating the +manipulation of 3rd party dependencies to Conan, we have decided to do the same here. A conan recipe +has been written for XmpSdk at: + +https://github.com/piponazo/conan-xmpsdk + +And the recipe and package binaries can be found in the piponazo's bintray repository: + +https://bintray.com/piponazo/piponazo + +This conan recipe provides a custom CMake finder that will be used by our CMake code to properly +find XMP SDK in the conan cache and then be able to use the CMake variables: ${XMPSDK_LIBRARY} and +${XMPSDK_INCLUDE_DIR}. + +These are the steps you will need to follow to configure the project with the external XMP support: + + # Add the conan-piponazo remote to your conan configuration (only once) + conan remote add conan-piponazo https://api.bintray.com/conan/piponazo/piponazo + + mkdir build && cd build + + # Run conan to bring the dependencies. Note that the XMPSDK is not enabled by default and you will + # need to enable the xmp option to bring it. + conan install .. --options xmp=True + + # Configure the project with support for the external XMP version. Disable the normal XMP version + cmake -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_XMP=OFF -DEXIV2_ENABLE_EXTERNAL_XMP=ON -DBUILD_SHARED_LIBS=ON .. + +Note that the usage of the newer versions of XMP is experimental and it was included in Exiv2 +because few users has requested it. diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..c5bec85 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,84 @@ +environment: + PYTHON: "C:\\Python37" + + matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 + CMAKE_GENERATOR: Visual Studio 10 2010 + INTEGRATION_TESTS: 0 + VS_COMPILER_VERSION: 10 + VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat + ARCHITECTURE: x86 + UNIT_TESTS: 0 + WARNINGS_AS_ERRORS: OFF + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 + CMAKE_GENERATOR: Visual Studio 11 2012 Win64 + INTEGRATION_TESTS: 0 + VS_COMPILER_VERSION: 11 + VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat + ARCHITECTURE: x86_64 + UNIT_TESTS: 1 + WARNINGS_AS_ERRORS: ON + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 + CMAKE_GENERATOR: Visual Studio 12 2013 Win64 + INTEGRATION_TESTS: 0 + VS_COMPILER_VERSION: 12 + VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat + ARCHITECTURE: x86_64 + UNIT_TESTS: 1 + WARNINGS_AS_ERRORS: ON + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + CMAKE_GENERATOR: Visual Studio 14 2015 Win64 + INTEGRATION_TESTS: 1 + VS_COMPILER_VERSION: 14 + VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat + ARCHITECTURE: x86_64 + UNIT_TESTS: 1 + WARNINGS_AS_ERRORS: ON + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + CMAKE_GENERATOR: Visual Studio 15 2017 Win64 + INTEGRATION_TESTS: 1 + VS_COMPILER_VERSION: 15 + VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat + ARCHITECTURE: x86_64 + UNIT_TESTS: 1 + WARNINGS_AS_ERRORS: ON + +shallow_clone: true + +install: + - set PATH=%PATH%;%PYTHON%/Scripts/ + - echo %APPVEYOR_BUILD_FOLDER% + - mkdir C:\projects\deps + - cd C:\projects\deps + - appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip -FileName ninja.zip + - 7z x ninja.zip -oC:\projects\deps\ninja > nul + - set PATH=C:\projects\deps\ninja;%PATH% + - ninja --version + - pip.exe install conan==1.17.2 + - cd %APPVEYOR_BUILD_FOLDER% + +before_build: + - cmd: conan remote list + - cmd: conan config set storage.path=c:\Users\appveyor\conanCache + - cmd: conan profile new --detect default + - cmd: conan profile update settings.compiler.version=%VS_COMPILER_VERSION% default + - cmd: conan profile update settings.arch=%ARCHITECTURE% default + - cmd: conan profile update settings.arch_build=%ARCHITECTURE% default + - cmd: cat c:\Users\appveyor\.conan\conan.conf + +build_script: + - cmd: md build + - cmd: cd build + - cmd: call "%VCVARS%" x86_amd64 + - cmd: conan --version + - cmd: conan remote list + - cmd: conan install .. -o webready=True --build missing + - cmd: echo %CMAKE_GENERATOR% + - cmd: cmake -G "%CMAKE_GENERATOR%" -DEXIV2_TEAM_WARNINGS_AS_ERRORS=%WARNINGS_AS_ERRORS% -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=%UNIT_TESTS% -DCMAKE_INSTALL_PREFIX=install .. + - cmd: cmake --build . --config Release + - cmd: cmake --build . --config Release --target install + - cmd: cd bin + - cmd: if %UNIT_TESTS% == 1 unit_tests.exe + - cmd: cd ../../tests/ + - cmd: set EXIV2_EXT=.exe + - cmd: if %INTEGRATION_TESTS% == 1 c:\Python36\python.exe runner.py -v diff --git a/ci/install.sh b/ci/install.sh new file mode 100755 index 0000000..266eeb3 --- /dev/null +++ b/ci/install.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -e # Enables cheking of return values from each command +set -x # Prints every command + +if [[ "$(uname -s)" == 'Linux' ]]; then + sudo apt-get update + sudo apt-get install cmake zlib1g-dev libssh-dev python-pip libxml2-utils + if [ -n "$WITH_VALGRIND" ]; then + sudo apt-get install valgrind + fi + sudo pip install virtualenv + virtualenv conan + source conan/bin/activate +else + brew update + brew install pyenv-virtualenv + export PATH="/Users/travis/.pyenv/shims:${PATH}" + eval "$(pyenv init -)" + eval "$(pyenv virtualenv-init -)" + pyenv virtualenv conan + pyenv activate conan +fi + +python --version +pip install conan==1.17.2 +pip install codecov +conan --version +conan config set storage.path=~/conanData +conan profile new default --detect + +if [[ "$(uname -s)" == 'Linux' ]]; then + conan profile update settings.compiler.libcxx=libstdc++11 default +fi + diff --git a/ci/install_dependencies.sh b/ci/install_dependencies.sh new file mode 100755 index 0000000..b87ab75 --- /dev/null +++ b/ci/install_dependencies.sh @@ -0,0 +1,72 @@ +#!/bin/sh -e + +# Debian & derivatives don't provide binary packages of googletest +# => have to build them ourselves +# +# This script builds a shared library of googletest (not googlemock!) inside +# gtest_build and copies it to /usr/lib/ +debian_build_gtest() { + [ -d gtest_build ] || mkdir gtest_build + cd gtest_build + cmake -DBUILD_SHARED_LIBS=1 /usr/src/googletest/googletest + make + cp libgtest* /usr/lib/ + cd .. +} + +# workaround for really bare-bones Archlinux containers: +if [ -x "$(command -v pacman)" ]; then + pacman --noconfirm -Sy + pacman --noconfirm -S grep gawk sed +fi + +distro_id=$(grep '^ID=' /etc/os-release|awk -F = '{print $2}'|sed 's/\"//g') + +case "$distro_id" in + 'fedora') + dnf -y --refresh install gcc-c++ clang cmake make ccache expat-devel zlib-devel libssh-devel libcurl-devel gtest-devel which dos2unix + ;; + + 'debian') + apt-get update + apt-get install -y cmake g++ clang make ccache python3 libexpat1-dev zlib1g-dev libssh-dev libcurl4-openssl-dev libgtest-dev libxml2-utils + debian_build_gtest + ;; + + 'arch') + pacman --noconfirm -Syu + pacman --noconfirm -S gcc clang cmake make ccache expat zlib libssh curl gtest python dos2unix which diffutils + ;; + + 'ubuntu') + apt-get update + apt-get install -y cmake g++ clang make ccache python3 libexpat1-dev zlib1g-dev libssh-dev libcurl4-openssl-dev libgtest-dev google-mock libxml2-utils + debian_build_gtest + ;; + + 'centos'|'rhel') + yum -y install epel-release + # enable copr for gtest + curl https://copr.fedorainfracloud.org/coprs/defolos/devel/repo/epel-7/defolos-devel-epel-7.repo > /etc/yum.repos.d/_copr_defolos-devel.repo + yum clean all + yum -y install gcc-c++ clang cmake3 make ccache expat-devel zlib-devel libssh-devel libcurl-devel gtest-devel which python36 dos2unix + # symlink up to date versions of python & cmake to 'default' names + if [ ! -e /usr/bin/python3 ]; then + ln -s /usr/bin/python36 /usr/bin/python3 + elif [ -L /usr/bin/python3 ]; then + rm /usr/bin/python3 + ln -s /usr/bin/python36 /usr/bin/python3 + fi + mv /bin/cmake /bin/.cmake.old + ln -s /bin/cmake3 /bin/cmake + ;; + + 'opensuse'|'opensuse-tumbleweed') + zypper --non-interactive refresh + zypper --non-interactive install gcc-c++ clang cmake make ccache libexpat-devel zlib-devel libssh-devel libcurl-devel gtest which dos2unix libxml2-tools + ;; + *) + echo "Sorry, no predefined dependencies for your distribution $distro_id exist yet" + exit 1 + ;; +esac diff --git a/ci/run.sh b/ci/run.sh new file mode 100755 index 0000000..74f772d --- /dev/null +++ b/ci/run.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +set -e +set -x + +if [[ "$(uname -s)" == 'Linux' ]]; then + source conan/bin/activate + + if [ "$CC" == "clang" ]; then + # clang + Ubuntu don't like to run with UBSAN, but ASAN works + export CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_CXX_FLAGS=\"-fsanitize=address\" -DCMAKE_C_FLAGS=\"-fsanitize=address\" -DCMAKE_EXE_LINKER_FLAGS=\"-fsanitize=address\" -DCMAKE_MODULE_LINKER_FLAGS=\"-fsanitize=address\"" + elif [ -n "$WITH_VALGRIND" ]; then + export EXIV2_VALGRIND="valgrind --quiet" + else + export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=ON" + fi +else + export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=ON" + export PATH="/Users/travis/.pyenv/shims:${PATH}" + eval "$(pyenv init -)" + eval "$(pyenv virtualenv-init -)" + pyenv activate conan +fi + + +mkdir build && cd build +conan install .. -o webready=True --build missing + +cmake ${CMAKE_OPTIONS} -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_INSTALL_PREFIX=install .. +make -j2 + +make tests +make install + +# Check for detecting issues with the installation of headers +if [ `ls install/include/exiv2/ | wc -l` > 10 ]; then + echo Headers installed correctly +else + echo There was some problem with the installation of the public headers + exit 1 +fi + +pushd . +cd bin +$EXIV2_VALGRIND ./unit_tests +popd + +if [ -n "$COVERAGE" ]; then + bash <(curl -s https://codecov.io/bash) +fi + diff --git a/ci/test_build.py b/ci/test_build.py new file mode 100644 index 0000000..84e68c5 --- /dev/null +++ b/ci/test_build.py @@ -0,0 +1,133 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +import itertools +import multiprocessing +import os +import shlex +import subprocess +import sys + + +def call_wrapper(*args, **kwargs): + """ + Wrapper around subprocess.call which terminates the program on non-zero + return value. + """ + return_code = subprocess.call(*args, **kwargs) + if return_code != 0: + sys.exit(return_code) + + +def matrix_build(shared_libs, ccs, build_types, cmake_bin, cmake_options, + tests=True): + + NCPUS = multiprocessing.cpu_count() + + os.mkdir("build") + + for params in itertools.product(shared_libs, ccs, build_types): + + lib_type, cc, build_type = params + + cwd = os.path.abspath( + os.path.join( + "build", + "_".join( + map(lambda p: str(p) if p is not None else "", params) + ) + ) + ) + os.mkdir(cwd) + + cmake = "{cmake_bin} {!s} -DCMAKE_BUILD_TYPE={build_type} " \ + "-DBUILD_SHARED_LIBS={lib_type} -DEXIV2_BUILD_UNIT_TESTS={tests} "\ + "../..".format( + cmake_options, cmake_bin=cmake_bin, build_type=build_type, + lib_type=lib_type, tests="ON" if tests else "OFF" + ) + make = "make -j " + str(NCPUS) + make_tests = "make tests" + unit_test_binary = os.path.join(cwd, "bin", "unit_tests") + + # set compiler via environment only when requested + env_copy = os.environ.copy() + if cc is not None: + cxx = {"gcc": "g++", "clang": "clang++"}[cc] + env_copy["CC"] = cc + env_copy["CXX"] = cxx + + # location of the binaries for the new test suite: + env_copy["EXIV2_BINDIR"] = os.path.join(cwd, "bin") + + kwargs = {"env": env_copy, "cwd": cwd} + + def run(cmd): + call_wrapper(shlex.split(cmd), **kwargs) + + run(cmake) + run(make) + if tests: + run(make_tests) + run(unit_test_binary) + + +if __name__ == '__main__': + import argparse + + parser = argparse.ArgumentParser( + description="Build and test exiv2 using a matrix of build switches") + parser.add_argument( + "--compilers", + help="Compilers to be used to build exiv2 (when none ore specified, " + "then the default compiler will be used)", + nargs='*', + default=["gcc", "clang"], + type=str + ) + parser.add_argument( + "--shared-libs", + help="Values for the -DBUILD_SHARED_LIBS option", + nargs='+', + default=["ON", "OFF"], + type=str + ) + parser.add_argument( + "--build-types", + help="Values for the -DCMAKE_BUILD_TYPE option", + nargs='+', + default=["Debug", "Release"], + type=str + ) + parser.add_argument( + "--cmake-executable", + help="alternative name or path for the cmake executable", + nargs=1, + default=['cmake'], + type=str + ) + parser.add_argument( + "--without-tests", + help="Skip building and running tests", + action='store_true' + ) + parser.add_argument( + "--cmake-options", + help="Additional flags for cmake", + type=str, + nargs='?', + default="-DEXIV2_TEAM_EXTRA_WARNINGS=ON -DEXIV2_ENABLE_VIDEO=ON " + "-DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON " + "-DBUILD_WITH_CCACHE=ON -DEXIV2_ENABLE_CURL=ON" + ) + + args = parser.parse_args() + + if len(args.compilers) == 0: + args.compilers = [None] + + matrix_build( + args.shared_libs, args.compilers, args.build_types, + args.cmake_executable[0], args.cmake_options, + not args.without_tests + ) diff --git a/cmake/Doxyfile.in b/cmake/Doxyfile.in new file mode 100644 index 0000000..230739f --- /dev/null +++ b/cmake/Doxyfile.in @@ -0,0 +1,2455 @@ +# Doxyfile 1.8.13 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = Exiv2 + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = @ROOTDIR@/exiv2.png + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = NO + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = YES + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = NO + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = @INCDIR@ \ + @SRCDIR@ \ + @BINDIR@/doxygen.hpp + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = @ROOTDIR@/samples/Jzon.h \ + @ROOTDIR@/samples/Jzon.cpp \ + @ROOTDIR@/src/actions.hpp \ + @ROOTDIR@/src/actions.cpp \ + @ROOTDIR@/src/getopt.cpp \ + @ROOTDIR@/src/getopt.hpp \ + @ROOTDIR@/src/localtime.c \ + @ROOTDIR@/src/fff.h \ + @ROOTDIR@/src/private.h \ + @ROOTDIR@/src/timegm.h \ + @ROOTDIR@/src/tzfile.h \ + @ROOTDIR@/src/unused.h \ + + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = */../src/*_int.h* + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = @ROOTDIR@/samples/ + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse-libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = YES + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = YES + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /
+ + + + diff --git a/doc/templates/tags-pentax.html.in b/doc/templates/tags-pentax.html.in new file mode 100644 index 0000000..d9712b5 --- /dev/null +++ b/doc/templates/tags-pentax.html.in @@ -0,0 +1,19 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ +

Pentax MakerNote Tags defined in Exiv2

+
+

Tags found in the MakerNote of images taken with Pentax cameras.

+

Click on a column header to sort the table.

+
+__Pentax__ +
+ + + + diff --git a/doc/templates/tags-samsung.html.in b/doc/templates/tags-samsung.html.in new file mode 100644 index 0000000..11a86f1 --- /dev/null +++ b/doc/templates/tags-samsung.html.in @@ -0,0 +1,26 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ +

Samsung MakerNote Tags defined in Exiv2

+
+

Tags found in the MakerNote of images taken with Samsung cameras.

+

Click on a column header to sort the table.

+
+__Samsung2__ +
+ +

Samsung Picture Wizard Tags

+

Click on a column header to sort the table.

+__SamsungPictureWizard__ +
+ +
+ + + + diff --git a/doc/templates/tags-sigma.html.in b/doc/templates/tags-sigma.html.in new file mode 100644 index 0000000..c252216 --- /dev/null +++ b/doc/templates/tags-sigma.html.in @@ -0,0 +1,19 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ +

Sigma/Foveon MakerNote Tags defined in Exiv2

+
+

Tags found in the MakerNote of images taken with Sigma/Foveon cameras. These tags are defined by Exiv2 in accordance with [7].

+

Click on a column header to sort the table.

+
+__Sigma__ +
+ + + + diff --git a/doc/templates/tags-sony.html.in b/doc/templates/tags-sony.html.in new file mode 100644 index 0000000..4af010f --- /dev/null +++ b/doc/templates/tags-sony.html.in @@ -0,0 +1,57 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ +

Sony MakerNote Tags defined in Exiv2

+
+

Tags found in the MakerNote of images taken with Sony cameras.

+

Click on a column header to sort the table.

+
+__Sony1__ +
+ +

Sony Minolta Tags

+

These are the same tags as found in the Minolta MakerNote. +In Sony images the group name is SonyMinolta.

+

Click on a column header to sort the table.

+__SonyMinolta__ +
+ +

Sony Camera Settings Tags

+

Click on a column header to sort the table.

+__Sony1Cs__ +
+ +

Sony Camera Settings 2 Tags

+

Click on a column header to sort the table.

+__Sony1Cs2__ +
+ +

Sony Minolta Camera Settings Tags

+

These are the same tags as the Minolta Camera Settings in the Minolta MakerNote. +In Sony images the group name is Sony1MltCsOld or Sony1MltCsNew.

+

Click on a column header to sort the table.

+__Sony1MltCsOld__ +
+ +

Sony Minolta Camera Settings 7D Tags

+

These are the same tags as the Minolta 7D Camera Settings in the Minolta MakerNote. +In Sony images the group name is Sony1MltCs7D.

+

Click on a column header to sort the table.

+__Sony1MltCs7D__ +
+ +

Sony Minolta Camera Settings A100 Tags

+

Click on a column header to sort the table.

+__Sony1MltCsA100__ +
+ +
+ + + + diff --git a/doc/templates/tags-xmp-GPano.html.in b/doc/templates/tags-xmp-GPano.html.in new file mode 100644 index 0000000..6ecc1a2 --- /dev/null +++ b/doc/templates/tags-xmp-GPano.html.in @@ -0,0 +1,42 @@ +__doctype__ + + + +__header2__ + + + +
+ +__index1__ + +__index2__ + +

Google Photo Sphere XMP schema

+ +

Panorama tags written by Google Photosphere. Specifies XMP properties that provide information regarding the creation and rendering of a panorama image. + +

    + +
  • Exiv2 keys are Xmp.GPano.<Property>
  • + +
  • The schema namespace URI is http://ns.google.com/photos/1.0/panorama/
  • + +
  • The preferred schema namespace prefix is GPano
  • + +
+ +Reference: Photo Sphere XMP Metadata

+ +

Click on a column header to sort the table.

+ +__xmp_GPano__ + +
+ + + + + + + diff --git a/doc/templates/tags-xmp-MP.html.in b/doc/templates/tags-xmp-MP.html.in new file mode 100644 index 0000000..76d45df --- /dev/null +++ b/doc/templates/tags-xmp-MP.html.in @@ -0,0 +1,46 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Microsoft Photo 1.2 Region schema

+

The Microsoft XMP schemas for people tagging define a set of properties to tag individuals in digital photos. +

    +
  • Exiv2 keys are nested Xmp.MP.RegionInfo/MPRI:Regions/MPReg:<Property>
  • +
+
    +
  • The MP schema namespace URI is http://ns.microsoft.com/photo/1.2/
  • +
  • This schema namespace prefix is MP
  • +
+
    +
  • The MPRI schema namespace URI is http://ns.microsoft.com/photo/1.2/t/RegionInfo#
  • +
  • This schema namespace prefix is MPRI
  • +
+
    +
  • The MPReg schema namespace URI is http://ns.microsoft.com/photo/1.2/t/Region#
  • +
  • This schema namespace prefix is MPReg
  • +
+ +Reference: People Tagging Overview

+ +

Click on a column header to sort the table.

+ +__xmp_MP__ + +

+ +__xmp_MPRI__ + +

+ +__xmp_MPReg__ + +
+ + + + diff --git a/doc/templates/tags-xmp-MPRI.html.in b/doc/templates/tags-xmp-MPRI.html.in new file mode 100644 index 0000000..1ff3746 --- /dev/null +++ b/doc/templates/tags-xmp-MPRI.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Microsoft Photo RegionInfo schema

+

The Microsoft Photo RegionInfo 1.2 schema provides a set of properties for region info. +

    +
  • Exiv2 keys are Xmp.MPRI.<Property>
  • +
  • The schema namespace URI is http://ns.microsoft.com/photo/1.2/t/RegionInfo#
  • +
  • The preferred schema namespace prefix is MPRI
  • +
+Reference: People Tagging Overview

+ +

Click on a column header to sort the table.

+ +__xmp_MPRI__ + +
+ + + + diff --git a/doc/templates/tags-xmp-MPReg.html.in b/doc/templates/tags-xmp-MPReg.html.in new file mode 100644 index 0000000..8cd9820 --- /dev/null +++ b/doc/templates/tags-xmp-MPReg.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Microsoft Photo Region schema

+

The Microsoft Photo Region 1.2 schema provides a set of properties for image regions. +

    +
  • Exiv2 keys are Xmp.MPReg.<Property>
  • +
  • The schema namespace URI is http://ns.microsoft.com/photo/1.2/t/Region#
  • +
  • The preferred schema namespace prefix is MPReg
  • +
+Reference: People Tagging Overview

+ +

Click on a column header to sort the table.

+ +__xmp_MPReg__ + +
+ + + + diff --git a/doc/templates/tags-xmp-MicrosoftPhoto.html.in b/doc/templates/tags-xmp-MicrosoftPhoto.html.in new file mode 100644 index 0000000..9c21e02 --- /dev/null +++ b/doc/templates/tags-xmp-MicrosoftPhoto.html.in @@ -0,0 +1,26 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Microsoft Photo Schema

+

This schema specifies XMP properties used by Microsoft. +

    +
  • Exiv2 keys are Xmp.MicrosoftPhoto.<Property> +
  • The schema namespace URI is http://ns.microsoft.com/photo/1.0/
  • +
  • The preferred schema namespace prefix is MicrosoftPhoto
  • +
+

+

Click on a column header to sort the table.

+ +__xmp_MicrosoftPhoto__ + +
+ + + + diff --git a/doc/templates/tags-xmp-acdsee.html.in b/doc/templates/tags-xmp-acdsee.html.in new file mode 100644 index 0000000..358acd2 --- /dev/null +++ b/doc/templates/tags-xmp-acdsee.html.in @@ -0,0 +1,42 @@ +__doctype__ + + + +__header2__ + + + +
+ +__index1__ + +__index2__ + +

ACDSee XMP schema

+ +

Custom XMP properties written by ACDSee applications. + +

    + +
  • Exiv2 keys are Xmp.acdsee.<Property>
  • + +
  • The schema namespace URI is http://ns.acdsee.com/iptc/1.0/
  • + +
  • The preferred schema namespace prefix is acdsee
  • + +
+ +Reference: ACDSee Properties pane

+ +

Click on a column header to sort the table.

+ +__xmp_acdsee__ + +
+ + + + + + + diff --git a/doc/templates/tags-xmp-aux.html.in b/doc/templates/tags-xmp-aux.html.in new file mode 100644 index 0000000..919d058 --- /dev/null +++ b/doc/templates/tags-xmp-aux.html.in @@ -0,0 +1,28 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Exif Schema for Additional Exif Properties

+

The following table lists additional XMP properties that describe the equipment used to produce +Exif data. +

    +
  • Exiv2 keys are Xmp.aux.<Property> +
  • The schema namespace URI is http://ns.adobe.com/exif/1.0/aux/
  • +
  • The preferred schema namespace prefix is aux
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_aux__ + +
+ + + + diff --git a/doc/templates/tags-xmp-crs.html.in b/doc/templates/tags-xmp-crs.html.in new file mode 100644 index 0000000..14836d8 --- /dev/null +++ b/doc/templates/tags-xmp-crs.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Camera Raw Schema

+

This schema specifies XMP properties associated with image files produced in camera raw mode. +

    +
  • Exiv2 keys are Xmp.crs.<Property> +
  • The schema namespace URI is http://ns.adobe.com/camera-raw-settings/1.0/
  • +
  • The preferred schema namespace prefix is crs
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_crs__ + +
+ + + + diff --git a/doc/templates/tags-xmp-crss.html.in b/doc/templates/tags-xmp-crss.html.in new file mode 100644 index 0000000..76f50c1 --- /dev/null +++ b/doc/templates/tags-xmp-crss.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Camera Raw Saved Settings

+

This schema specifies XMP properties used to store development settings for raw image files. +

    +
  • Exiv2 keys are nested in the form Xmp.crss.SavedSettings[#]/crss:<Property>/crs:<Property>
  • +
  • The schema namespace URI is http://ns.adobe.com/camera-raw-saved-settings/1.0/
  • +
  • The preferred schema namespace prefix is crss
  • +
+Reference: No official document on this schema was found. Properties derived from examples posted in Adobe forums. +

+

Click on a column header to sort the table.

+ +__xmp_crss__ + +
+ + + + diff --git a/doc/templates/tags-xmp-dc.html.in b/doc/templates/tags-xmp-dc.html.in new file mode 100644 index 0000000..14e0743 --- /dev/null +++ b/doc/templates/tags-xmp-dc.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Dublin Core Schema

+

The Dublin Core schema provides a set of commonly used XMP properties. +

    +
  • Exiv2 keys are Xmp.dc.<Property> +
  • The schema namespace URI is http://purl.org/dc/elements/1.1/
  • +
  • The preferred schema namespace prefix is dc
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_dc__ + +
+ + + + diff --git a/doc/templates/tags-xmp-dcterms.html.in b/doc/templates/tags-xmp-dcterms.html.in new file mode 100644 index 0000000..b4b3073 --- /dev/null +++ b/doc/templates/tags-xmp-dcterms.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Qualified Dublin Core Schema

+

Qualified Dublin Core XMP properties are used under Darwin Core. +

    +
  • Exiv2 keys are nested: Xmp.dwc.Record/dcterms:<Property>
  • +
  • The schema namespace URI is http://purl.org/dc/terms/
  • +
  • The schema namespace prefix dcterms is only used for DwC Location properties: Xmp.dcterms.Location/dwc:<Property>
  • +
+Reference: DCMI Metadata Terms +

+

Click on a column header to sort the table.

+ +__xmp_dcterms__ + +
+ + + + diff --git a/doc/templates/tags-xmp-digiKam.html.in b/doc/templates/tags-xmp-digiKam.html.in new file mode 100644 index 0000000..ff01ff9 --- /dev/null +++ b/doc/templates/tags-xmp-digiKam.html.in @@ -0,0 +1,26 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

digiKam Photo Management Schema

+

This schema specifies XMP properties used by digiKam. +

    +
  • Exiv2 keys are Xmp.digiKam.<Property> +
  • The schema namespace URI is http://www.digikam.org/ns/1.0/
  • +
  • The preferred schema namespace prefix is digiKam
  • +
+

+

Click on a column header to sort the table.

+ +__xmp_digiKam__ + +
+ + + + diff --git a/doc/templates/tags-xmp-dwc.html.in b/doc/templates/tags-xmp-dwc.html.in new file mode 100644 index 0000000..60a98ed --- /dev/null +++ b/doc/templates/tags-xmp-dwc.html.in @@ -0,0 +1,29 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Darwin Core Schema

+

The Darwin Core schema provides a set of XMP properties intended to facilitate the sharing of information about biological diversity. +

    +
  • Exiv2 keys are nested: Xmp.dwc.<Main Structure>/dwc:<Property>
  • +
  • The schema namespace URI is http://rs.tdwg.org/dwc/index.htm
  • +
  • Darwin Core uses some Qualified Dublin Core properties
  • +
  • The preferred schema namespace prefix is dwc except for Location properties which use dcterms
  • +
  • Some child properties under Record use the dcterms sub key prefix
  • +
+Reference: Darwin Core Terms +

+

Click on a column header to sort the table.

+ +__xmp_dwc__ + +
+ + + + diff --git a/doc/templates/tags-xmp-exif.html.in b/doc/templates/tags-xmp-exif.html.in new file mode 100644 index 0000000..fa5d022 --- /dev/null +++ b/doc/templates/tags-xmp-exif.html.in @@ -0,0 +1,35 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Exif Schema for Exif-specific Properties

+

The following table lists the XMP properties defined solely by Exif.

+

Note: A number of Exif 2.3 properties are not included in XMP. These are generally + properties that relate directly to the image stream, or that are of little use without access + to the image stream. A general XMP principle is that XMP metadata should have value + in and of itself, separate from the primary file content. The omitted properties include: + StripOffsets, RowsPerStrip, StripByteCounts, JPEGInterchangeFormat, and + JPEGInterchangeFormatLength.

+

Note: Properties beginning with "GPS" are GPS properties that are also used by DIG-35 and + are part of the JPEG-2000 standard. +

    +
  • Exiv2 keys are Xmp.exif.<Property> +
  • The schema namespace URI is http://ns.adobe.com/exif/1.0/
  • +
  • The preferred schema namespace prefix is exif
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_exif__ + +
+ + + + diff --git a/doc/templates/tags-xmp-exifEX.html.in b/doc/templates/tags-xmp-exifEX.html.in new file mode 100644 index 0000000..67764d4 --- /dev/null +++ b/doc/templates/tags-xmp-exifEX.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Exif 2.3 metadata for XMP Properties

+

The following table lists additional XMP properties defined solely by Exif.

+
    +
  • Exiv2 keys are Xmp.exifEX.<Property> +
  • The schema namespace URI is http://cipa.jp/exif/1.0/
  • +
  • The preferred schema namespace prefix is exifEX
  • +
+Reference: Exif 2.3 metadata for XMP +

+

Click on a column header to sort the table.

+ +__xmp_exifEX__ + +
+ + + + diff --git a/doc/templates/tags-xmp-expressionmedia.html.in b/doc/templates/tags-xmp-expressionmedia.html.in new file mode 100644 index 0000000..a214456 --- /dev/null +++ b/doc/templates/tags-xmp-expressionmedia.html.in @@ -0,0 +1,28 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Microsoft Expression Media schema

+

This is the Microsoft badged version of the + iView Media Pro schema. +

    +
  • Exiv2 keys are Xmp.expressionmedia.<Property>
  • +
  • The schema namespace URI is http://ns.microsoft.com/expressionmedia/1.0/
  • +
  • The preferred schema namespace prefix is expressionmedia
  • +
+Reference: ?

+ +

Click on a column header to sort the table.

+ +__xmp_expressionmedia__ + +
+ + + + diff --git a/doc/templates/tags-xmp-iptc.html.in b/doc/templates/tags-xmp-iptc.html.in new file mode 100644 index 0000000..1eda891 --- /dev/null +++ b/doc/templates/tags-xmp-iptc.html.in @@ -0,0 +1,29 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

IPTC Core schema

+

This schema specifies the IPTC Core XMP properties. +

    +
  • Exiv2 keys are Xmp.iptc.<Property>
  • +
  • Creator Contact Info sub-keys are nested: Xmp.Iptc4xmpCore.CreatorContactInfo/Iptc4xmpCore:<Property>
  • +
  • The schema namespace URI is http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/
  • +
  • The preferred schema namespace prefix is Iptc4xmpCore
  • +
+Reference: "IPTC Core" Specification Version 1.2

+

Note: Exiv2 uses iptc (rather than Iptc4xmpCore) as the group name for keys of IPTC Core schema properties.

+ +

Click on a column header to sort the table.

+ +__xmp_iptc__ + +
+ + + + diff --git a/doc/templates/tags-xmp-iptcExt.html.in b/doc/templates/tags-xmp-iptcExt.html.in new file mode 100644 index 0000000..2d8cfb6 --- /dev/null +++ b/doc/templates/tags-xmp-iptcExt.html.in @@ -0,0 +1,31 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

IPTC Extension schema

+

This schema specifies the IPTC Extension XMP properties. The IPTC + Extension schema extends and complements the IPTC Core schema by a set + of more granular properties and further specialized rights related + properties from the PLUS metadata schema. +

    +
  • Exiv2 keys are Xmp.iptcExt.<Property>
  • +
  • The schema namespace URI is http://iptc.org/std/Iptc4xmpExt/2008-02-29/
  • +
  • The preferred schema namespace prefix is Iptc4xmpExt
  • +
+Reference: IPTC Extension Specification Version 1.2 standard

+

Note: Exiv2 uses iptcExt (rather than Iptc4xmpExt) as the group name for keys of IPTC Extension schema properties.

+ +

Click on a column header to sort the table.

+ +__xmp_iptcExt__ + +
+ + + + diff --git a/doc/templates/tags-xmp-kipi.html.in b/doc/templates/tags-xmp-kipi.html.in new file mode 100644 index 0000000..5b12cfc --- /dev/null +++ b/doc/templates/tags-xmp-kipi.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

KDE Image Program Interface schema

+

KDE Image Program Interface schema tags, used by digiKam kipi-plugins. +

    +
  • Exiv2 keys are Xmp.kipi.<Property>
  • +
  • The schema namespace URI is http://www.digikam.org/ns/kipi/1.0/
  • +
  • The preferred schema namespace prefix is kipi
  • +
+Reference: ?

+ +

Click on a column header to sort the table.

+ +__xmp_kipi__ + +
+ + + + diff --git a/doc/templates/tags-xmp-lr.html.in b/doc/templates/tags-xmp-lr.html.in new file mode 100644 index 0000000..3010d78 --- /dev/null +++ b/doc/templates/tags-xmp-lr.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Lightroom Schema

+

This schema specifies hierarchical keyword XMP properties used by Adobe Lightroom. +

    +
  • Exiv2 keys are Xmp.lr.<Property>
  • +
  • The schema namespace URI is http://ns.adobe.com/lightroom/1.0/
  • +
  • The preferred schema namespace prefix is lr
  • +
+Reference: Adobe Lightroom Keywords +

+

Click on a column header to sort the table.

+ +__xmp_lr__ + +
+ + + + diff --git a/doc/templates/tags-xmp-mediapro.html.in b/doc/templates/tags-xmp-mediapro.html.in new file mode 100644 index 0000000..a035f07 --- /dev/null +++ b/doc/templates/tags-xmp-mediapro.html.in @@ -0,0 +1,31 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Photo One Media Pro schema

+

Photo One Media Pro XMP properties. Program was previously known as Microsoft Expression Media and iView Media Pro. +

    +
  • Exiv2 keys are Xmp.mediapro.<Property>
  • +
  • The schema namespace URI is http://ns.iview-multimedia.com/mediapro/1.0/
  • +
  • The preferred schema namespace prefix is mediapro
  • +
+Reference: ?

+ +

Click on a column header to sort the table.

+ +__xmp_mediapro__ + +

While owned by Microsoft the Microsoft Expression Media schema was used.

+ +__xmp_expressionmedia__ + +
+ + + + diff --git a/doc/templates/tags-xmp-mwg-kw.html.in b/doc/templates/tags-xmp-mwg-kw.html.in new file mode 100644 index 0000000..bf93f41 --- /dev/null +++ b/doc/templates/tags-xmp-mwg-kw.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Metadata Working Group Keywords schema

+

The Metadata Working Group's schema for hierarchical keywords metadata. +

    +
  • Exiv2 keys are nested in the form Xmp.mwg-kw.Keywords/mwg-kw:Hierarchy/mwg-kw:<Property>
  • +
  • The schema namespace URI is http://www.metadataworkinggroup.com/schemas/keywords/
  • +
  • The preferred schema namespace prefix is mwg-kw
  • +
+Reference: Guidelines for Handling Image Metadata

+ +

Click on a column header to sort the table.

+ +__xmp_mwg-kw__ + +
+ + + + diff --git a/doc/templates/tags-xmp-mwg-rs.html.in b/doc/templates/tags-xmp-mwg-rs.html.in new file mode 100644 index 0000000..d1f87a0 --- /dev/null +++ b/doc/templates/tags-xmp-mwg-rs.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Metadata Working Group Regions schema

+

The Metadata Working Group's schema for image region metadata. +

    +
  • Exiv2 keys are nested in the form Xmp.mwg-rs.Regions/mwg-rs:RegionList/mwg-rs:<Property>
  • +
  • The schema namespace URI is http://www.metadataworkinggroup.com/schemas/regions/
  • +
  • The preferred schema namespace prefix is mwg-rs
  • +
+Reference: Guidelines for Handling Image Metadata

+ +

Click on a column header to sort the table.

+ +__xmp_mwg-rs__ + +
+ + + + diff --git a/doc/templates/tags-xmp-pdf.html.in b/doc/templates/tags-xmp-pdf.html.in new file mode 100644 index 0000000..167192b --- /dev/null +++ b/doc/templates/tags-xmp-pdf.html.in @@ -0,0 +1,26 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ +

Adobe PDF schema

+

This schema specifies XMP properties used with Adobe PDF documents. +

    +
  • Exiv2 keys are Xmp.pdf.<Property> +
  • The schema namespace URI is http://ns.adobe.com/pdf/1.3/
  • +
  • The preferred schema namespace prefix is pdf
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_pdf__ + +
+ + + + diff --git a/doc/templates/tags-xmp-photoshop.html.in b/doc/templates/tags-xmp-photoshop.html.in new file mode 100644 index 0000000..286c573 --- /dev/null +++ b/doc/templates/tags-xmp-photoshop.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Photoshop Schema

+

This schema specifies XMP properties used by Adobe Photoshop. +

    +
  • Exiv2 keys are Xmp.photoshop.<Property> +
  • The schema namespace URI is http://ns.adobe.com/photoshop/1.0/
  • +
  • The preferred schema namespace prefix is photoshop
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_photoshop__ + +
+ + + + diff --git a/doc/templates/tags-xmp-plus.html.in b/doc/templates/tags-xmp-plus.html.in new file mode 100644 index 0000000..252fcbd --- /dev/null +++ b/doc/templates/tags-xmp-plus.html.in @@ -0,0 +1,29 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

PLUS License Data Format schema

+

The PLUS License Data Format ("LDF") is an ordered group of fields available + for optional use in embedding and reading image license metadata in digital + files and other documents. +

    +
  • Exiv2 keys are Xmp.plus.<Property>
  • +
  • The schema namespace URI is http://ns.useplus.org/ldf/xmp/1.0/
  • +
  • The preferred schema namespace prefix is plus
  • +
+Reference: PLUS Technical Specification

+ +

Click on a column header to sort the table.

+ +__xmp_plus__ + +
+ + + + diff --git a/doc/templates/tags-xmp-tiff.html.in b/doc/templates/tags-xmp-tiff.html.in new file mode 100644 index 0000000..f35f56c --- /dev/null +++ b/doc/templates/tags-xmp-tiff.html.in @@ -0,0 +1,28 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

Exif Schema for TIFF Properties

+

The following table lists the XMP properties for TIFF-derived data. Only those TIFF properties that +are mentioned in the EXIF 2.2 specification are included here. +

    +
  • Exiv2 keys are Xmp.tiff.<Property> +
  • The schema namespace URI is http://ns.adobe.com/tiff/1.0/
  • +
  • The preferred schema namespace prefix is tiff
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_tiff__ + +
+ + + + diff --git a/doc/templates/tags-xmp-xmp.html.in b/doc/templates/tags-xmp-xmp.html.in new file mode 100644 index 0000000..9a99781 --- /dev/null +++ b/doc/templates/tags-xmp-xmp.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

XMP Basic Schema

+

The XMP Basic Schema contains XMP properties that provide basic descriptive information. +

    +
  • Exiv2 keys are Xmp.xmp.<Property> +
  • The schema namespace URI is http://ns.adobe.com/xap/1.0/
  • +
  • The preferred schema namespace prefix is xmp
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_xmp__ + +
+ + + + diff --git a/doc/templates/tags-xmp-xmpBJ.html.in b/doc/templates/tags-xmp-xmpBJ.html.in new file mode 100644 index 0000000..5b15ede --- /dev/null +++ b/doc/templates/tags-xmp-xmpBJ.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

XMP Basic Job Ticket Schema

+

The following XMP schema describes very simple workflow or job information. +

    +
  • Exiv2 keys are Xmp.xmpBJ.<Property> +
  • The schema namespace URI is http://ns.adobe.com/xap/1.0/bj/
  • +
  • The preferred schema namespace prefix is xmpBJ
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_xmpBJ__ + +
+ + + + diff --git a/doc/templates/tags-xmp-xmpDM.html.in b/doc/templates/tags-xmp-xmpDM.html.in new file mode 100644 index 0000000..5e68678 --- /dev/null +++ b/doc/templates/tags-xmp-xmpDM.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

XMP Dynamic Media Schema

+

This schema specifies XMP properties used by the Adobe dynamic media group. +

    +
  • Exiv2 keys are Xmp.xmpDM.<Property> +
  • The schema namespace URI is http://ns.adobe.com/xmp/1.0/DynamicMedia/
  • +
  • The preferred schema namespace prefix is xmpDM
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_xmpDM__ + +
+ + + + diff --git a/doc/templates/tags-xmp-xmpMM.html.in b/doc/templates/tags-xmp-xmpMM.html.in new file mode 100644 index 0000000..6c7f197 --- /dev/null +++ b/doc/templates/tags-xmp-xmpMM.html.in @@ -0,0 +1,34 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

XMP Media Management Schema

+

The XMP Media Management Schema is primarily for use by digital asset management (DAM) systems.

+

The following XMP properties are "owned" by the DAM system and should be set by applications +under their direction; they should not be used by unmanaged files: xmpMM:ManagedFrom, +xmpMM:Manager, xmpMM:ManageTo, xmpMM:ManageUI, xmpMM:ManagerVariant.

+

The following properties are owned by the DAM system for managed files, but can also be +used by applications for unmanaged files: xmpMM:DerivedFrom, xmpMM:DocumentID, +xmpMM:RenditionClass, xmpMM:RenditionParams, xmpMM:VersionID, xmpMM:Versions.

+

The xmpMM:History property is always owned by the application. +

    +
  • Exiv2 keys are Xmp.xmpMM.<Property> +
  • The schema namespace URI is http://ns.adobe.com/xap/1.0/mm/
  • +
  • The preferred schema namespace prefix is xmpMM
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_xmpMM__ + +
+ + + + diff --git a/doc/templates/tags-xmp-xmpRights.html.in b/doc/templates/tags-xmp-xmpRights.html.in new file mode 100644 index 0000000..44c0dcb --- /dev/null +++ b/doc/templates/tags-xmp-xmpRights.html.in @@ -0,0 +1,29 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

XMP Rights Management Schema

+

This schema includes XMP properties related to rights management. These properties specify +information regarding the legal restrictions associated with a resource.
+Note: XMP is not a rights-enforcement mechanism. +

    +
  • Exiv2 keys are Xmp.xmpRights.<Property> +
  • The schema namespace URI is http://ns.adobe.com/xap/1.0/rights/
  • +
  • The preferred schema namespace prefix is xmpRights
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_xmpRights__ + +
+ + + + diff --git a/doc/templates/tags-xmp-xmpTPg.html.in b/doc/templates/tags-xmp-xmpTPg.html.in new file mode 100644 index 0000000..fa50a4a --- /dev/null +++ b/doc/templates/tags-xmp-xmpTPg.html.in @@ -0,0 +1,27 @@ +__doctype__ + +__header2__ + + +
+__index1__ +__index2__ + +

XMP Paged-Text Schema

+

The Paged-Text schema is used for XMP properties for text appearing on a page in a document. +

    +
  • Exiv2 keys are Xmp.xmpTPg.<Property> +
  • The schema namespace URI is http://ns.adobe.com/xap/1.0/t/pg/
  • +
  • The preferred schema namespace prefix is xmpTPg
  • +
+Reference: XMP Specification and Documentation +

+

Click on a column header to sort the table.

+ +__xmp_xmpTPg__ + +
+ + + + diff --git a/doc/templates/tags.awk b/doc/templates/tags.awk new file mode 100644 index 0000000..04010fe --- /dev/null +++ b/doc/templates/tags.awk @@ -0,0 +1,43 @@ +################################################################################ +# File : tags.awk +# Author(s): Andreas Huggel (ahu) +# History : 07-Feb-04, ahu: created +# +# Description: +# Awk script to convert a taglist to XML format used in the documentation. +# $ taglist [itemName] | awk -f tags.awk > tags.xml +################################################################################ + +BEGIN { + FS = ", " # ,\t + print ""; + print ""; + + print "" + print "
" + print "XYZ MakerNote Tags defined in Exiv2" + print "" + print "

Tags found in the MakerNote of images taken with XYZ cameras. These tags " + print "are defined by Exiv2 in accordance with [X].

" + print "

Click on a column header to sort the table.

" + print "
" + print "
" + print "" +} + +{ + print " "; + print " " $1 "" + print " " $2 "" + print " " $3 "" + print " " $4 "" + print " " $5 "" + print " " $6 "" + print " " $7 "" + print " "; +} + +END { + print "" + print "
" +} diff --git a/doc/templates/tags.xsl b/doc/templates/tags.xsl new file mode 100644 index 0000000..e93f1c2 --- /dev/null +++ b/doc/templates/tags.xsl @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + +

+ +
+ + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + Tag (hex) + Tag (dec) + IFD + Key + Type + Tag description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/doc/templates/xmp.awk b/doc/templates/xmp.awk new file mode 100644 index 0000000..d3114c6 --- /dev/null +++ b/doc/templates/xmp.awk @@ -0,0 +1,42 @@ +################################################################################ +# File : xmp.awk +# Author(s): Andreas Huggel (ahu) +# History : 23-Nov-07, ahu: created +# +# Description: +# Awk script to convert an XMP property list to XML format used in the +# documentation. +# $ taglist [xmpList] | awk -f xmp.awk > [xmpList].xml +################################################################################ + +BEGIN { + FS = ", " # ,\t + print ""; + print ""; + + print "" + print "
" + print "XMP tags defined in Exiv2" + print "" + print "

Some description

" + print "

Click on a column header to sort the table.

" + print "
" + print "
" + print "" +} + +{ + print " "; + print " " $1 "" + print " " $2 "" + print " " $3 "" + print " " $4 "" + print " " $5 "" + print " " $6 "" + print " "; +} + +END { + print "" + print "
" +} diff --git a/doc/templates/xmp.xsl b/doc/templates/xmp.xsl new file mode 100644 index 0000000..24c0f5e --- /dev/null +++ b/doc/templates/xmp.xsl @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + +

+ +
+ + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + Property + Label + Value type + Exiv2 type + Category + Description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/exiv2.png b/exiv2.png new file mode 100644 index 0000000..8708a5e Binary files /dev/null and b/exiv2.png differ diff --git a/git_guidelines.md b/git_guidelines.md new file mode 100644 index 0000000..020a365 --- /dev/null +++ b/git_guidelines.md @@ -0,0 +1,274 @@ +# Guidelines for using git + +## Commit messages + +The first line of a commit message should be < 80 characters long and briefly +describe the whole commit. Optionally, you can prefix the summary with a +tag/module in square brackets (e.g. travis if your commit changed something for +Travis, or testsuite for the testsuite, or tiff-parser, etc.). If the commit +requires additional explanation, a blank line can be put below the summary +followed by a more thorough explanation. + +A commit message can look like this: +``` +[travis] Fix mac osx jobs + +- Specify concrete ubuntu and mac versions +- Use latest conan version +- Fix the profiles for linux and mac +- Use new version of expat (avilable in conan-center) +- Install urllib3 as suggested in python guidelines +- Use virtualenv with python3 +``` + +The advantage of this approach is that we always see the brief summary via `git +log --oneline` and on GitHub. The 80 characters limit ensures that the message +does not wrap. + +Please avoid overly generic commit messages like "fixed a bug", instead write +e.g. "fixed an overflow in the TIFF parser". If your commit fixes a specific +issue on GitHub then provide its number in the commit message. A message of the +form "fixes #aNumber" result in GitHub automatically closing issue #aNumber once +the issue got merged (please write that in the detailed description below the +summary). If the commit fixes an issue that got a CVE assigned, then you must +mention the CVE number in the commit message. Please also mention it in commit +messages for accompanying commits (like adding regression tests), so that +downstream package maintainers can cherry-pick the respective commits easily. + +If you have trouble finding a brief summary that fits into 80 characters, then +you should probably split your commit. + + +## When to commit + +Commits should be atomic, i.e. they should make one self-contained +change. Consider the following example: you want to fix an issue, which requires +you to perform two changes in two separate files to fix the issue. Then you also +want to reformat both files using clang-format and add a regression test or a +unit test. + +This would result in the following commits: +1. the fix for the issue in the two source files +2. addition of a unit test or regression test (provided that it does not require + additional changes to other logical units) +3. Application of clang format to the first source file +4. Application of clang format to the second source file + +We can summarize this in the following guidelines: +- Large formatting changes should be separate commits for each source file (that + way changes can be reviewed easily, as formatting changes result in very noisy + diffs) + +- Changes made in different source which do not make sense without each other + should be committed together + +- Changes made in the same file which do not belong together should not be + committed together + +- If changes are requested during the code review, then they should be either + included in the previous already created commits, if that is applicable. + For example if a variable's name should be changed, then that should be + included into the already created commit. A bigger change, like a new function + or class will probably require a separate commit. + +- Please keep in mind that your commits might be cherry-picked into an older + branch. Therefore split your commits accordingly, so that changes into + separate modules go into separate commits. + +- Every commit should keep the code base in a buildable state. The test suite + needn't pass on every commit, but must pass before being merged into + `master`. + +These are however not strict rules and it always depends on the case. If in +doubt: ask. + + +## Keeping the history linear + +We prefer to keep the git log nearly linear with the individual pull requests +still visible, since they usually form one logical unit. It should look roughly +like this: +``` +* 9f74f247 Merge pull request #227 from frli8848/master +|\ +| * 73ac02d7 Added test for Sigma lenses +| * fc8b45dd Added the Sigma 120-300mm F2.8 DG OS HSM | S for Nikon mount. +| * 34a3be02 Added Sigma 50mm F1.4 DG HSM | A mount/UPC code (for Nikon mount). +| * 21522702 Added Sigma 20mm F1.4 DG HSM | A mount/UPC code (for Nikon mount). +|/ +* f9d421b1 Merge pull request #109 from D4N/error_codes_enum +|\ +| * 3965a44d Replace error variable names in test suite with enum error codes +| * a15f090f Modified test suite so that case sensitive keys are possible +| * efe2ccdc Replaced all hardcoded error codes with ker... constants +| * d897997b Force error code usage to construct a Exiv2::BasicError +| * d3c3c036 Incorporated error codes into errList +| * b80fa1b4 Added error codes from src/error.cpp into an enumeration +|/ +* efee9a2b Merge pull request #205 from D4N/CVE-2017-1000127_reproducer +``` +As can be seen, the two pull requests are still distinguishable but the history +is still nearly linear. This ensures that cherry-picking and bisecting works +without issues. + +To ensure such a linear history, do **not** use GitHub's `Update Branch` button! +This creates a merge commit in your pull request's branch and can results in +rather complicated logs, like this: +``` +* | +|\ \ +| * | +* | | +|\ \ \ +| |/ / +|/| | +| * | +| * | +| * | +| * | +| * | +|/ / +* | +|\ \ +| |/ +|/| +| * +| * +| * +|/ +* +``` + +Instead of using the `Update Branch` button use `git pull --rebase`. For the +following example, we'll assume that we are working in a branch called +`feature_xyz` that should be merged into the branch `master`. Furthermore the +remote `origin` is a fork of exiv2 and the remote `upstream` is the "official" +exiv2 repository. + +Before we start working, the `master` branch looks like this: +``` +$ git log master --oneline --graph +* efee9a2b (master) Merge pull request #something +|\ +| * ead7f309 A commit on master +|/ +* 55001c8d Merge pull request #something else +``` + +We create a new branch `feature_xyz` based on `master`, create two new commits +`My commit 1` and `My commit 2` and submit a pull request into master. The log +of the branch `feature_xyz` now looks like this: +``` +$ git log feature_xyz --oneline --graph +* 893fffa5 (HEAD -> feature_xyz) My commit 2 +* a2a22fb9 My commit 1 +* efee9a2b (master) Merge pull request #something +|\ +| * ead7f309 A commit on master +|/ +* 55001c8d Merge pull request #something else +``` + +If now new commits are pushed to `master`, resulting in this log: +``` +$ git log master --oneline --graph +* 0d636cc9 (HEAD -> master) Hotfix for issue #something completely different +* efee9a2b Merge pull request #something +|\ +| * ead7f309 A commit on master +|/ +* 55001c8d Merge pull request #something else +``` +then the branch `feature_xyz` is out of date with `master`, because it lacks the +commit `0d636cc9`. We could now merge both branches (via the cli or GitHub's +`Update Branch` button), but that will result in a messy history. Thus **don't** +do it! If you do it, you'll have to remove the merge commits manually. + +Instead run: `git pull --rebase upstream master` in the `feature_xyz` +branch. Git will pull the new commit `0d636cc9` from master into your branch +`feature_xyz` and apply the two commits `My commit 1` and `My commit 2` on top +of it: +``` +$ git log feature_xyz --oneline --graph +* 22a7a8c2 (HEAD -> feature_xyz) My commit 2 +* efe2ccdc My commit 1 +* 0d636cc9 (master) Hotfix for issue #something completely different +* efee9a2b Merge pull request #something +|\ +| * ead7f309 A commit on master +|/ +* 55001c8d Merge pull request #something else +``` +Please note, that the hash of `My commit 1` and `My commit 2` changed! That +happened because their parent changed. Therefore you have to force push your +changes via `git push --force` next time you push your changes upstream. + + +## Merging pull requests + +Most pull requests should be merged by creating a merge commit (the default on +GitHub). Small pull requests (= only one can commit) can be rebased on top of +master. + + +## Branches and tags + +- The `master` branch is the current "main" development branch. It is protected + so that changes can be only included via reviewed pull requests. New releases + are made by tagging a specific commit on `master`. + +- Releases are tagged with a tag of the form `v$major.$minor`. The tag is not + changed when changes are backported. + +- For each release a branch of the form `$major.$minor` should be created to + store backported changes. It should be branched of from `master` at the commit + which was tagged with `v$major.$minor`. + +- All other branches are development branches for pull requests, experiments, + etc. They should be deleted once the pull request got merged or the branch is + no longer useful. + +- Exiv2 team members can create branches for pull requests in the main + repository if they want to collaborate with others (e.g. for big changes that + require a lot of work). No one should not `push --force` in these branches + without coordinating with others and should only `push --force-with-lease`. + + When only one person will work on a pull request, then the branch can be + created in their personal fork or in the main repository (note that branches + in the main repository provide an automatic continuous integration). + + +## Backporting changes + +We try to backport critical bugfixes to the latest released version on a best +effort basis. We lack the man power to support older releases, but accept +patches for these. + +Bugfixes for crashes, memory corruptions, overflows and other potentially +dangerous bugs **must** be backported. The same applies to bugfixes for issues +that got a CVE assigned. + + +## Final remarks + +Since git is a fully distributed version control system, all changes stay on +your machine until you push them. Thus, if you are in doubt whether a trickier +step with git might screw up your repository, you can simply create a backup of +your whole exiv2 folder. In case the tricky step went downhill, you can restore +your working copy of exiv2 and no one will ever know (unless you did a `git +push`)! + + +## Additional material + +- [The git book](https://git-scm.com/book/en/v2/) + +- `man git` and `man git $command` + +- [amending and interactive + rebase](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History) + +- [interactive + staging](https://git-scm.com/book/en/v2/Git-Tools-Interactive-Staging) (for + Emacs users: consider using [magit](https://magit.vc/) for interactive + staging) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 0000000..01b43a6 --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(exiv2) diff --git a/include/exiv2/CMakeLists.txt b/include/exiv2/CMakeLists.txt new file mode 100644 index 0000000..60080f1 --- /dev/null +++ b/include/exiv2/CMakeLists.txt @@ -0,0 +1,51 @@ +install(FILES + asfvideo.hpp + basicio.hpp + bigtiffimage.hpp + bmpimage.hpp + config.h + convert.hpp + cr2image.hpp + crwimage.hpp + datasets.hpp + easyaccess.hpp + epsimage.hpp + error.hpp + exif.hpp + exiv2.hpp + futils.hpp + gifimage.hpp + http.hpp + image.hpp + ini.hpp + iptc.hpp + jp2image.hpp + jpgimage.hpp + matroskavideo.hpp + metadatum.hpp + mrwimage.hpp + orfimage.hpp + pgfimage.hpp + pngimage.hpp + preview.hpp + properties.hpp + psdimage.hpp + quicktimevideo.hpp + rafimage.hpp + riffvideo.hpp + rw2image.hpp + rwlock.hpp + slice.hpp + ssh.hpp + tags.hpp + tgaimage.hpp + tiffimage.hpp + types.hpp + utilsvideo.hpp + value.hpp + version.hpp + webpimage.hpp + xmp_exiv2.hpp + xmpsidecar.hpp + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/exiv2) diff --git a/include/exiv2/asfvideo.hpp b/include/exiv2/asfvideo.hpp new file mode 100644 index 0000000..b103c4d --- /dev/null +++ b/include/exiv2/asfvideo.hpp @@ -0,0 +1,179 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file asfvideo.hpp + @brief An Image subclass to support ASF video files + @author Abhinav Badola for GSoC 2012 + mail.abu.to@gmail.com + @date 08-Aug-12, AB: created + */ +#ifndef ASFVIDEO_HPP +#define ASFVIDEO_HPP + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Add ASF to the supported image formats + namespace ImageType { + const int asf = 24; //!< Treating asf as an image type> + } + + /*! + @brief Class to access ASF video files. + */ + class EXIV2LIB_DEPRECATED_EXPORT AsfVideo:public Image + { + public: + //! @name Creators + //@{ + /*! + @brief Constructor for a ASF video. Since the constructor + can not return a result, callers should check the good() method + after object construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + */ + AsfVideo(BasicIo::AutoPtr io); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + void writeMetadata(); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + //@} + + protected: + /*! + @brief Check for a valid tag and decode the block at the current IO + position. Calls tagDecoder() or skips to next tag, if required. + */ + void decodeBlock(); + /*! + @brief Interpret tag information, and call the respective function + to save it in the respective XMP container. Decodes a Tag + Information and saves it in the respective XMP container, if + the block size is small. + @param tv Pointer to current tag, + @param size Size of the data block used to store Tag Information. + */ + void tagDecoder(const Internal::TagVocabulary* tv, uint64_t size); + /*! + @brief Interpret File_Properties tag information, and save it in + the respective XMP container. + */ + void fileProperties(); + /*! + @brief Interpret Stream_Properties tag information, and save it + in the respective XMP container. + */ + void streamProperties(); + /*! + @brief Interpret Codec_List tag information, and save it in + the respective XMP container. + */ + void codecList(); + /*! + @brief Interpret Content_Description tag information, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Data. + */ + void contentDescription(uint64_t size); + /*! + @brief Interpret Extended_Stream_Properties tag information, and + save it in the respective XMP container. + @param size Size of the data block used to store Tag Data. + */ + void extendedStreamProperties(uint64_t size); + /*! + @brief Interpret Header_Extension tag information, and save it in + the respective XMP container. + @param size Size of the data block used to store Tag Data. + */ + void headerExtension(uint64_t size); + /*! + @brief Interpret Metadata, Extended_Content_Description, + Metadata_Library tag information, and save it in the respective + XMP container. + @param meta A default integer which helps to overload the function + for various Tags that have a similar method of decoding. + */ + void metadataHandler(int meta = 1); + /*! + @brief Calculates Aspect Ratio of a video, and stores it in the + respective XMP container. + */ + void aspectRatio(); + + private: + //! @name NOT Implemented + //@{ + //! Copy constructor + AsfVideo(const AsfVideo& rhs); + //! Assignment operator + AsfVideo& operator=(const AsfVideo& rhs); + //@} + + private: + //! Variable to check the end of metadata traversing. + bool continueTraversing_; + //! Variable which stores current position of the read pointer. + uint64_t localPosition_; + //! Variable which stores current stream being processsed. + int streamNumber_; + //! Variable to store height and width of a video frame. + uint64_t height_, width_; + + }; //Class AsfVideo + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new AsfVideo instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newAsfInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a Windows Asf Video. + EXIV2LIB_DEPRECATED_EXPORT bool isAsfType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef ASFVIDEO_HPP_ diff --git a/include/exiv2/basicio.hpp b/include/exiv2/basicio.hpp new file mode 100644 index 0000000..1cd9879 --- /dev/null +++ b/include/exiv2/basicio.hpp @@ -0,0 +1,1206 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/* + File: basicio.hpp + */ +#ifndef BASICIO_HPP_ +#define BASICIO_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "types.hpp" + +// + standard includes +#include // for std::auto_ptr + +// The way to handle data from stdin or data uri path. If EXV_XPATH_MEMIO = 1, +// it uses MemIo. Otherwises, it uses FileIo. +#ifndef EXV_XPATH_MEMIO +#define EXV_XPATH_MEMIO 0 +#endif + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + /*! + @brief An interface for simple binary IO. + + Designed to have semantics and names similar to those of C style FILE* + operations. Subclasses should all behave the same so that they can be + interchanged. + */ + class EXIV2API BasicIo { + public: + //! BasicIo auto_ptr type + typedef std::auto_ptr AutoPtr; + + //! Seek starting positions + enum Position { beg, cur, end }; + + //! @name Creators + //@{ + //! Destructor + virtual ~BasicIo(); + //@} + + //! @name Manipulators + //@{ + /*! + @brief Open the IO source using the default access mode. The + default mode should allow for reading and writing. + + This method can also be used to "reopen" an IO source which will + flush any unwritten data and reset the IO position to the start. + Subclasses may provide custom methods to allow for + opening IO sources differently. + + @return 0 if successful;
+ Nonzero if failure. + */ + virtual int open() = 0; + + /*! + @brief Close the IO source. After closing a BasicIo instance can not + be read or written. Closing flushes any unwritten data. It is + safe to call close on a closed instance. + @return 0 if successful;
+ Nonzero if failure. + */ + virtual int close() = 0; + /*! + @brief Write data to the IO source. Current IO position is advanced + by the number of bytes written. + @param data Pointer to data. Data must be at least \em wcount + bytes long + @param wcount Number of bytes to be written. + @return Number of bytes written to IO source successfully;
+ 0 if failure; + */ + virtual long write(const byte* data, long wcount) = 0; + /*! + @brief Write data that is read from another BasicIo instance to + the IO source. Current IO position is advanced by the number + of bytes written. + @param src Reference to another BasicIo instance. Reading start + at the source's current IO position + @return Number of bytes written to IO source successfully;
+ 0 if failure; + */ + virtual long write(BasicIo& src) = 0; + /*! + @brief Write one byte to the IO source. Current IO position is + advanced by one byte. + @param data The single byte to be written. + @return The value of the byte written if successful;
+ EOF if failure; + */ + virtual int putb(byte data) = 0; + /*! + @brief Read data from the IO source. Reading starts at the current + IO position and the position is advanced by the number of bytes + read. + @param rcount Maximum number of bytes to read. Fewer bytes may be + read if \em rcount bytes are not available. + @return DataBuf instance containing the bytes read. Use the + DataBuf::size_ member to find the number of bytes read. + DataBuf::size_ will be 0 on failure. + */ + virtual DataBuf read(long rcount) = 0; + /*! + @brief Read data from the IO source. Reading starts at the current + IO position and the position is advanced by the number of bytes + read. + @param buf Pointer to a block of memory into which the read data + is stored. The memory block must be at least \em rcount bytes + long. + @param rcount Maximum number of bytes to read. Fewer bytes may be + read if \em rcount bytes are not available. + @return Number of bytes read from IO source successfully;
+ 0 if failure; + */ + virtual long read(byte* buf, long rcount) = 0; + /*! + @brief Read one byte from the IO source. Current IO position is + advanced by one byte. + @return The byte read from the IO source if successful;
+ EOF if failure; + */ + virtual int getb() = 0; + /*! + @brief Remove all data from this object's IO source and then transfer + data from the \em src BasicIo object into this object. + + The source object is invalidated by this operation and should not be + used after this method returns. This method exists primarily to + be used with the BasicIo::temporary() method. + + @param src Reference to another BasicIo instance. The entire contents + of src are transferred to this object. The \em src object is + invalidated by the method. + @throw Error In case of failure + */ + virtual void transfer(BasicIo& src) = 0; + /*! + @brief Move the current IO position. + @param offset Number of bytes to move the position relative + to the starting position specified by \em pos + @param pos Position from which the seek should start + @return 0 if successful;
+ Nonzero if failure; + */ +#if defined(_MSC_VER) + virtual int seek(int64_t offset, Position pos) = 0; +#else + virtual int seek(long offset, Position pos) = 0; +#endif + + /*! + @brief Direct access to the IO data. For files, this is done by + mapping the file into the process's address space; for memory + blocks, this allows direct access to the memory block. + @param isWriteable Set to true if the mapped area should be writeable + (default is false). + @return A pointer to the mapped area. + @throw Error In case of failure. + */ + virtual byte* mmap(bool isWriteable =false) =0; + /*! + @brief Remove a mapping established with mmap(). If the mapped area + is writeable, this ensures that changes are written back. + @return 0 if successful;
+ Nonzero if failure; + */ + virtual int munmap() =0; + + //@} + + //! @name Accessors + //@{ + /*! + @brief Get the current IO position. + @return Offset from the start of IO if successful;
+ -1 if failure; + */ + virtual long tell() const = 0; + /*! + @brief Get the current size of the IO source in bytes. + @return Size of the IO source in bytes;
+ -1 if failure; + */ + virtual size_t size() const = 0; + //!Returns true if the IO source is open, otherwise false. + virtual bool isopen() const = 0; + //!Returns 0 if the IO source is in a valid state, otherwise nonzero. + virtual int error() const = 0; + //!Returns true if the IO position has reached the end, otherwise false. + virtual bool eof() const = 0; + /*! + @brief Return the path to the IO resource. Often used to form + comprehensive error messages where only a BasicIo instance is + available. + */ + virtual std::string path() const =0; +#ifdef EXV_UNICODE_PATH + /*! + @brief Like path() but returns a unicode path in an std::wstring. + @note This function is only available on Windows. + */ + virtual std::wstring wpath() const =0; +#endif + + /*! + @brief Mark all the bNone blocks to bKnow. This avoids allocating memory + for parts of the file that contain image-date (non-metadata/pixel data) + + @note This method should be only called after the concerned data (metadata) + are all downloaded from the remote file to memory. + */ + virtual void populateFakeData() {} + + /*! + @brief this is allocated and populated by mmap() + */ + byte* bigBlock_; + + //@} + + protected: + //! @name Creators + //@{ + //! Default Constructor + BasicIo() : bigBlock_(NULL) {}; + //@} + }; // class BasicIo + + /*! + @brief Utility class that closes a BasicIo instance upon destruction. + Meant to be used as a stack variable in functions that need to + ensure BasicIo instances get closed. Useful when functions return + errors from many locations. + */ + class EXIV2API IoCloser { + public: + //! @name Creators + //@{ + //! Constructor, takes a BasicIo reference + explicit IoCloser(BasicIo& bio) : bio_(bio) {} + //! Destructor, closes the BasicIo reference + virtual ~IoCloser() { close(); } + //@} + + //! @name Manipulators + //@{ + //! Close the BasicIo if it is open + void close() { if (bio_.isopen()) bio_.close(); } + //@} + + // DATA + //! The BasicIo reference + BasicIo& bio_; + + private: + // Not implemented + //! Copy constructor + IoCloser(const IoCloser&); + //! Assignment operator + IoCloser& operator=(const IoCloser&); + }; // class IoCloser + + /*! + @brief Provides binary file IO by implementing the BasicIo + interface. + */ + class EXIV2API FileIo : public BasicIo { + public: + //! @name Creators + //@{ + /*! + @brief Constructor that accepts the file path on which IO will be + performed. The constructor does not open the file, and + therefore never failes. + @param path The full path of a file + */ + explicit FileIo(const std::string& path); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like FileIo(const std::string& path) but accepts a + unicode path in an std::wstring. + @note This constructor is only available on Windows. + */ + FileIo(const std::wstring& wpath); +#endif + //! Destructor. Flushes and closes an open file. + virtual ~FileIo(); + //@} + + //! @name Manipulators + //@{ + /*! + @brief Open the file using using the specified mode. + + This method can also be used to "reopen" a file which will flush any + unwritten data and reset the IO position to the start. Although + files can be opened in binary or text mode, this class has + only been tested carefully in binary mode. + + @param mode Specified that type of access allowed on the file. + Valid values match those of the C fopen command exactly. + @return 0 if successful;
+ Nonzero if failure. + */ + int open(const std::string& mode); + /*! + @brief Open the file using using the default access mode of "rb". + This method can also be used to "reopen" a file which will flush + any unwritten data and reset the IO position to the start. + @return 0 if successful;
+ Nonzero if failure. + */ + virtual int open(); + /*! + @brief Flush and unwritten data and close the file . It is + safe to call close on an already closed instance. + @return 0 if successful;
+ Nonzero if failure; + */ + virtual int close(); + /*! + @brief Write data to the file. The file position is advanced + by the number of bytes written. + @param data Pointer to data. Data must be at least \em wcount + bytes long + @param wcount Number of bytes to be written. + @return Number of bytes written to the file successfully;
+ 0 if failure; + */ + virtual long write(const byte* data, long wcount); + /*! + @brief Write data that is read from another BasicIo instance to + the file. The file position is advanced by the number + of bytes written. + @param src Reference to another BasicIo instance. Reading start + at the source's current IO position + @return Number of bytes written to the file successfully;
+ 0 if failure; + */ + virtual long write(BasicIo& src); + /*! + @brief Write one byte to the file. The file position is + advanced by one byte. + @param data The single byte to be written. + @return The value of the byte written if successful;
+ EOF if failure; + */ + virtual int putb(byte data); + /*! + @brief Read data from the file. Reading starts at the current + file position and the position is advanced by the number of + bytes read. + @param rcount Maximum number of bytes to read. Fewer bytes may be + read if \em rcount bytes are not available. + @return DataBuf instance containing the bytes read. Use the + DataBuf::size_ member to find the number of bytes read. + DataBuf::size_ will be 0 on failure. + */ + virtual DataBuf read(long rcount); + /*! + @brief Read data from the file. Reading starts at the current + file position and the position is advanced by the number of + bytes read. + @param buf Pointer to a block of memory into which the read data + is stored. The memory block must be at least \em rcount bytes + long. + @param rcount Maximum number of bytes to read. Fewer bytes may be + read if \em rcount bytes are not available. + @return Number of bytes read from the file successfully;
+ 0 if failure; + */ + virtual long read(byte* buf, long rcount); + /*! + @brief Read one byte from the file. The file position is + advanced by one byte. + @return The byte read from the file if successful;
+ EOF if failure; + */ + virtual int getb(); + /*! + @brief Remove the contents of the file and then transfer data from + the \em src BasicIo object into the empty file. + + This method is optimized to simply rename the source file if the + source object is another FileIo instance. The source BasicIo object + is invalidated by this operation and should not be used after this + method returns. This method exists primarily to be used with + the BasicIo::temporary() method. + + @note If the caller doesn't have permissions to write to the file, + an exception is raised and \em src is deleted. + + @param src Reference to another BasicIo instance. The entire contents + of src are transferred to this object. The \em src object is + invalidated by the method. + @throw Error In case of failure + */ + virtual void transfer(BasicIo& src); + /*! + @brief Move the current file position. + @param offset Number of bytes to move the file position + relative to the starting position specified by \em pos + @param pos Position from which the seek should start + @return 0 if successful;
+ Nonzero if failure; + */ +#if defined(_MSC_VER) + virtual int seek(int64_t offset, Position pos); +#else + virtual int seek(long offset, Position pos); +#endif + /*! + @brief Map the file into the process's address space. The file must be + open before mmap() is called. If the mapped area is writeable, + changes may not be written back to the underlying file until + munmap() is called. The pointer is valid only as long as the + FileIo object exists. + @param isWriteable Set to true if the mapped area should be writeable + (default is false). + @return A pointer to the mapped area. + @throw Error In case of failure. + */ + virtual byte* mmap(bool isWriteable =false); + /*! + @brief Remove a mapping established with mmap(). If the mapped area is + writeable, this ensures that changes are written back to the + underlying file. + @return 0 if successful;
+ Nonzero if failure; + */ + virtual int munmap(); + /*! + @brief close the file source and set a new path. + */ + virtual void setPath(const std::string& path); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like setPath(const std::string& path) but accepts a + unicode path in an std::wstring. + @note This method is only available on Windows. + */ + virtual void setPath(const std::wstring& wpath); +#endif + //@} + //! @name Accessors + //@{ + /*! + @brief Get the current file position. + @return Offset from the start of the file if successful;
+ -1 if failure; + */ + virtual long tell() const; + /*! + @brief Flush any buffered writes and get the current file size + in bytes. + @return Size of the file in bytes;
+ -1 if failure; + */ + virtual size_t size() const; + //! Returns true if the file is open, otherwise false. + virtual bool isopen() const; + //! Returns 0 if the file is in a valid state, otherwise nonzero. + virtual int error() const; + //! Returns true if the file position has reached the end, otherwise false. + virtual bool eof() const; + //! Returns the path of the file + virtual std::string path() const; +#ifdef EXV_UNICODE_PATH + /* + @brief Like path() but returns the unicode path of the file in an std::wstring. + @note This function is only available on Windows. + */ + virtual std::wstring wpath() const; +#endif + + /*! + @brief Mark all the bNone blocks to bKnow. This avoids allocating memory + for parts of the file that contain image-date (non-metadata/pixel data) + + @note This method should be only called after the concerned data (metadata) + are all downloaded from the remote file to memory. + */ + virtual void populateFakeData(); + //@} + + private: + // NOT IMPLEMENTED + //! Copy constructor + FileIo(FileIo& rhs); + //! Assignment operator + FileIo& operator=(const FileIo& rhs); + + // Pimpl idiom + class Impl; + std::auto_ptr p_; + + }; // class FileIo + + /*! + @brief Provides binary IO on blocks of memory by implementing the BasicIo + interface. A copy-on-write implementation ensures that the data passed + in is only copied when necessary, i.e., as soon as data is written to + the MemIo. The original data is only used for reading. If writes are + performed, the changed data can be retrieved using the read methods + (since the data used in construction is never modified). + + @note If read only usage of this class is common, it might be worth + creating a specialized readonly class or changing this one to + have a readonly mode. + */ + class EXIV2API MemIo : public BasicIo { + public: + //! @name Creators + //@{ + //! Default constructor that results in an empty object + MemIo(); + /*! + @brief Constructor that accepts a block of memory. A copy-on-write + algorithm allows read operations directly from the original data + and will create a copy of the buffer on the first write operation. + @param data Pointer to data. Data must be at least \em size + bytes long + @param size Number of bytes to copy. + */ + MemIo(const byte* data, long size); + //! Destructor. Releases all managed memory + virtual ~MemIo(); + //@} + + //! @name Manipulators + //@{ + /*! + @brief Memory IO is always open for reading and writing. This method + therefore only resets the IO position to the start. + + @return 0 + */ + virtual int open(); + /*! + @brief Does nothing on MemIo objects. + @return 0 + */ + virtual int close(); + /*! + @brief Write data to the memory block. If needed, the size of the + internal memory block is expanded. The IO position is advanced + by the number of bytes written. + @param data Pointer to data. Data must be at least \em wcount + bytes long + @param wcount Number of bytes to be written. + @return Number of bytes written to the memory block successfully;
+ 0 if failure; + */ + virtual long write(const byte* data, long wcount); + /*! + @brief Write data that is read from another BasicIo instance to + the memory block. If needed, the size of the internal memory + block is expanded. The IO position is advanced by the number + of bytes written. + @param src Reference to another BasicIo instance. Reading start + at the source's current IO position + @return Number of bytes written to the memory block successfully;
+ 0 if failure; + */ + virtual long write(BasicIo& src); + /*! + @brief Write one byte to the memory block. The IO position is + advanced by one byte. + @param data The single byte to be written. + @return The value of the byte written if successful;
+ EOF if failure; + */ + virtual int putb(byte data); + /*! + @brief Read data from the memory block. Reading starts at the current + IO position and the position is advanced by the number of + bytes read. + @param rcount Maximum number of bytes to read. Fewer bytes may be + read if \em rcount bytes are not available. + @return DataBuf instance containing the bytes read. Use the + DataBuf::size_ member to find the number of bytes read. + DataBuf::size_ will be 0 on failure. + */ + virtual DataBuf read(long rcount); + /*! + @brief Read data from the memory block. Reading starts at the current + IO position and the position is advanced by the number of + bytes read. + @param buf Pointer to a block of memory into which the read data + is stored. The memory block must be at least \em rcount bytes + long. + @param rcount Maximum number of bytes to read. Fewer bytes may be + read if \em rcount bytes are not available. + @return Number of bytes read from the memory block successfully;
+ 0 if failure; + */ + virtual long read(byte* buf, long rcount); + /*! + @brief Read one byte from the memory block. The IO position is + advanced by one byte. + @return The byte read from the memory block if successful;
+ EOF if failure; + */ + virtual int getb(); + /*! + @brief Clear the memory block and then transfer data from + the \em src BasicIo object into a new block of memory. + + This method is optimized to simply swap memory block if the source + object is another MemIo instance. The source BasicIo instance + is invalidated by this operation and should not be used after this + method returns. This method exists primarily to be used with + the BasicIo::temporary() method. + + @param src Reference to another BasicIo instance. The entire contents + of src are transferred to this object. The \em src object is + invalidated by the method. + @throw Error In case of failure + */ + virtual void transfer(BasicIo& src); + /*! + @brief Move the current IO position. + @param offset Number of bytes to move the IO position + relative to the starting position specified by \em pos + @param pos Position from which the seek should start + @return 0 if successful;
+ Nonzero if failure; + */ +#if defined(_MSC_VER) + virtual int seek(int64_t offset, Position pos); +#else + virtual int seek(long offset, Position pos); +#endif + /*! + @brief Allow direct access to the underlying data buffer. The buffer + is not protected against write access in any way, the argument + is ignored. + @note The application must ensure that the memory pointed to by the + returned pointer remains valid and allocated as long as the + MemIo object exists. + */ + virtual byte* mmap(bool /*isWriteable*/ =false); + virtual int munmap(); + //@} + + //! @name Accessors + //@{ + /*! + @brief Get the current IO position. + @return Offset from the start of the memory block + */ + virtual long tell() const; + /*! + @brief Get the current memory buffer size in bytes. + @return Size of the in memory data in bytes;
+ -1 if failure; + */ + virtual size_t size() const; + //!Always returns true + virtual bool isopen() const; + //!Always returns 0 + virtual int error() const; + //!Returns true if the IO position has reached the end, otherwise false. + virtual bool eof() const; + //! Returns a dummy path, indicating that memory access is used + virtual std::string path() const; +#ifdef EXV_UNICODE_PATH + /* + @brief Like path() but returns a unicode dummy path in an std::wstring. + @note This function is only available on Windows. + */ + virtual std::wstring wpath() const; +#endif + + /*! + @brief Mark all the bNone blocks to bKnow. This avoids allocating memory + for parts of the file that contain image-date (non-metadata/pixel data) + + @note This method should be only called after the concerned data (metadata) + are all downloaded from the remote file to memory. + */ + virtual void populateFakeData(); + + //@} + + private: + // NOT IMPLEMENTED + //! Copy constructor + MemIo(MemIo& rhs); + //! Assignment operator + MemIo& operator=(const MemIo& rhs); + + // Pimpl idiom + class Impl; + std::auto_ptr p_; + + }; // class MemIo + + /*! + @brief Provides binary IO for the data from stdin and data uri path. + */ +#if EXV_XPATH_MEMIO + class EXIV2API XPathIo : public MemIo { + public: + //! @name Creators + //@{ + //! Default constructor + XPathIo(const std::string& path); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like XPathIo(const std::string& path) but accepts a + unicode url in an std::wstring. + @note This constructor is only available on Windows. + */ + XPathIo(const std::wstring& wpath); +#endif + //@} + private: + /*! + @brief Read data from stdin and write the data to memory. + @throw Error if it can't convert stdin to binary. + */ + void ReadStdin(); + /*! + @brief Read the data from data uri path and write the data to memory. + @param path The data uri. + @throw Error if no base64 data in path. + */ + void ReadDataUri(const std::string& path); + }; // class XPathIo +#else + class EXIV2API XPathIo : public FileIo { + public: + /*! + @brief The extension of the temporary file which is created when getting input data + to read metadata. This file will be deleted in destructor. + */ + static const std::string TEMP_FILE_EXT; + /*! + @brief The extension of the generated file which is created when getting input data + to add or modify the metadata. + */ + static const std::string GEN_FILE_EXT; + + //! @name Creators + //@{ + //! Default constructor that reads data from stdin/data uri path and writes them to the temp file. + explicit XPathIo(const std::string& orgPath); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like XPathIo(const std::string& orgPath) but accepts a + unicode url in an std::wstring. + @note This constructor is only available on Windows. + */ + XPathIo(const std::wstring& wOrgPathpath); +#endif + //! Destructor. Releases all managed memory and removes the temp file. + virtual ~XPathIo(); + //@} + + //! @name Manipulators + //@{ + /*! + @brief Change the name of the temp file and make it untemporary before + calling the method of superclass FileIo::transfer. + */ + virtual void transfer(BasicIo& src); + + //@} + + //! @name Static methods + //@{ + /*! + @brief Read the data from stdin/data uri path and write them to the file. + @param orgPath It equals "-" if the input data's from stdin. Otherwise, it's data uri path. + @return the name of the new file. + @throw Error if it fails. + */ + static std::string writeDataToFile(const std::string& orgPath); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like writeDataToFile(const std::string& orgPath) but accepts a + unicode url in an std::wstring. + @note This constructor is only available on Windows. + */ + static std::string writeDataToFile(const std::wstring& wOrgPath); +#endif + //@} + + private: + // True if the file is a temporary file and it should be deleted in destructor. + bool isTemp_; + std::string tempFilePath_; + }; // class XPathIo +#endif + + + /*! + @brief Provides remote binary file IO by implementing the BasicIo interface. This is an + abstract class. The logics for remote access are implemented in HttpIo, CurlIo, SshIo which + are the derived classes of RemoteIo. + */ + class EXIV2API RemoteIo : public BasicIo { + public: + //! Destructor. Releases all managed memory. + virtual ~RemoteIo(); + //@} + + //! @name Manipulators + //@{ + /*! + @brief Connect to the remote server, get the size of the remote file and + allocate the array of blocksMap. + + If the blocksMap is already allocated (this method has been called before), + it just reset IO position to the start and does not flush the old data. + @return 0 if successful;
+ Nonzero if failure. + */ + virtual int open(); + + /*! + @brief Reset the IO position to the start. It does not release the data. + @return 0 if successful;
+ Nonzero if failure. + */ + virtual int close(); + /*! + @brief Not support this method. + @return 0 means failure + */ + virtual long write(const byte* data, long wcount); + /*! + @brief Write data that is read from another BasicIo instance to the remote file. + + The write access is done in an efficient way. It only sends the range of different + bytes between the current data and BasicIo instance to the remote machine. + + @param src Reference to another BasicIo instance. Reading start + at the source's current IO position + @return The size of BasicIo instance;
+ 0 if failure; + @throw Error In case of failure + + @note The write access is only supported by http, https, ssh. + */ + virtual long write(BasicIo& src); + + /*! + @brief Not support + @return 0 means failure + */ + virtual int putb(byte data); + /*! + @brief Read data from the memory blocks. Reading starts at the current + IO position and the position is advanced by the number of + bytes read. + If the memory blocks are not populated (False), it will connect to server + and populate the data to memory blocks. + @param rcount Maximum number of bytes to read. Fewer bytes may be + read if \em rcount bytes are not available. + @return DataBuf instance containing the bytes read. Use the + DataBuf::size_ member to find the number of bytes read. + DataBuf::size_ will be 0 on failure. + */ + virtual DataBuf read(long rcount); + /*! + @brief Read data from the the memory blocks. Reading starts at the current + IO position and the position is advanced by the number of + bytes read. + If the memory blocks are not populated (!= bMemory), it will connect to server + and populate the data to memory blocks. + @param buf Pointer to a block of memory into which the read data + is stored. The memory block must be at least \em rcount bytes + long. + @param rcount Maximum number of bytes to read. Fewer bytes may be + read if \em rcount bytes are not available. + @return Number of bytes read from the memory block successfully;
+ 0 if failure; + */ + virtual long read(byte* buf, long rcount); + /*! + @brief Read one byte from the memory blocks. The IO position is + advanced by one byte. + If the memory block is not populated (!= bMemory), it will connect to server + and populate the data to the memory block. + @return The byte read from the memory block if successful;
+ EOF if failure; + */ + virtual int getb(); + /*! + @brief Remove the contents of the file and then transfer data from + the \em src BasicIo object into the empty file. + + The write access is done in an efficient way. It only sends the range of different + bytes between the current data and BasicIo instance to the remote machine. + + @param src Reference to another BasicIo instance. The entire contents + of src are transferred to this object. The \em src object is + invalidated by the method. + @throw Error In case of failure + + @note The write access is only supported by http, https, ssh. + */ + virtual void transfer(BasicIo& src); + /*! + @brief Move the current IO position. + @param offset Number of bytes to move the IO position + relative to the starting position specified by \em pos + @param pos Position from which the seek should start + @return 0 if successful;
+ Nonzero if failure; + */ +#if defined(_MSC_VER) + virtual int seek(int64_t offset, Position pos); +#else + virtual int seek(long offset, Position pos); +#endif + /*! + @brief Not support + @return NULL + */ + virtual byte* mmap(bool /*isWriteable*/ =false); + /*! + @brief Not support + @return 0 + */ + virtual int munmap(); + //@} + //! @name Accessors + //@{ + /*! + @brief Get the current IO position. + @return Offset from the start of the memory block + */ + virtual long tell() const; + /*! + @brief Get the current memory buffer size in bytes. + @return Size of the in memory data in bytes;
+ -1 if failure; + */ + virtual size_t size() const; + //!Returns true if the memory area is allocated. + virtual bool isopen() const; + //!Always returns 0 + virtual int error() const; + //!Returns true if the IO position has reached the end, otherwise false. + virtual bool eof() const; + //!Returns the URL of the file. + virtual std::string path() const; +#ifdef EXV_UNICODE_PATH + /* + @brief Like path() but returns a unicode URL path in an std::wstring. + @note This function is only available on Windows. + */ + virtual std::wstring wpath() const; +#endif + + /*! + @brief Mark all the bNone blocks to bKnow. This avoids allocating memory + for parts of the file that contain image-date (non-metadata/pixel data) + + @note This method should be only called after the concerned data (metadata) + are all downloaded from the remote file to memory. + */ + virtual void populateFakeData(); + + //@} + + protected: + //! @name Creators + //@{ + //! Default Constructor + RemoteIo() {p_=NULL;} + //@} + + // Pimpl idiom + class Impl; + //! Pointer to implementation + Impl* p_; + }; // class RemoteIo + + /*! + @brief Provides the http read/write access for the RemoteIo. + */ + class EXIV2API HttpIo : public RemoteIo { + public: + //! @name Creators + //@{ + /*! + @brief Constructor that accepts the http URL on which IO will be + performed. The constructor does not open the file, and + therefore never failes. + @param url The full path of url + @param blockSize the size of the memory block. The file content is + divided into the memory blocks. These blocks are populated + on demand from the server, so it avoids copying the complete file. + */ + HttpIo(const std::string& url, size_t blockSize = 1024); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like HttpIo(const std::string& url, size_t blockSize = 1024) but accepts a + unicode url in an std::wstring. + @note This constructor is only available on Windows. + */ + HttpIo(const std::wstring& wurl, size_t blockSize = 1024); +#endif + //@} + protected: + // NOT IMPLEMENTED + //! Copy constructor + HttpIo(HttpIo& rhs); + //! Assignment operator + HttpIo& operator=(const HttpIo& rhs); + // Pimpl idiom + class HttpImpl; + + //! @name Creators + //@{ + //! Default Destructor + virtual ~HttpIo(){} + //@} + }; + +#ifdef EXV_USE_CURL + /*! + @brief Provides the http, https read/write access and ftp read access for the RemoteIo. + This class is based on libcurl. + */ + class EXIV2API CurlIo : public RemoteIo { + public: + //! @name Creators + //@{ + /*! + @brief Constructor that accepts the URL on which IO will be + performed. + @param url The full path of url + @param blockSize the size of the memory block. The file content is + divided into the memory blocks. These blocks are populated + on demand from the server, so it avoids copying the complete file. + @throw Error if it is unable to init curl pointer. + */ + CurlIo(const std::string& url, size_t blockSize = 0); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like CurlIo(const std::string& url, size_t blockSize = 0) but accepts a + unicode url in an std::wstring. + @note This constructor is only available on Windows. + */ + CurlIo(const std::wstring& wurl, size_t blockSize = 0); +#endif + /*! + @brief Write access is only available for some protocols. This method + will call RemoteIo::write(const byte* data, long wcount) if the write + access is available for the protocol. Otherwise, it throws the Error. + */ + long write(const byte* data, long wcount); + /*! + @brief Write access is only available for some protocols. This method + will call RemoteIo::write(BasicIo& src) if the write access is available + for the protocol. Otherwise, it throws the Error. + */ + long write(BasicIo& src); + protected: + // NOT IMPLEMENTED + //! Copy constructor + CurlIo(CurlIo& rhs); + //! Assignment operator + CurlIo& operator=(const CurlIo& rhs); + // Pimpl idiom + class CurlImpl; + + //! @name Creators + //@{ + //! Default Destructor + virtual ~CurlIo(){} + //@} + }; +#endif + +#ifdef EXV_USE_SSH + /*! + @brief Provides the ssh read/write access and sftp read access for the RemoteIo. + This class is based on libssh. + */ + class EXIV2LIB_DEPRECATED_EXPORT SshIo : public RemoteIo { + public: + //! @name Creators + //@{ + /*! + @brief Constructor that accepts the URL on which IO will be + performed. + @param url The full path of url + @param blockSize the size of the memory block. The file content is + divided into the memory blocks. These blocks are populated + on demand from the server, so it avoids copying the complete file. + @throw Error if it is unable to init ssh session. + */ + SshIo(const std::string& url, size_t blockSize = 1024); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like SshIo(const std::string& url, size_t blockSize = 1024) but accepts a + unicode url in an std::wstring. + @note This constructor is only available on Windows. + */ + SshIo(const std::wstring& wurl, size_t blockSize = 1024); +#endif + //@} + protected: + // NOT IMPLEMENTED + //! Copy constructor + SshIo(SshIo& rhs); + //! Assignment operator + SshIo& operator=(const SshIo& rhs); + // Pimpl idiom + class SshImpl; + + //! @name Creators + //@{ + //! Default Destructor + virtual ~SshIo(){} + //@} + }; +#endif + +// ***************************************************************************** +// template, inline and free functions + + /*! + @brief Read file \em path into a DataBuf, which is returned. + @return Buffer containing the file. + @throw Error In case of failure. + */ + EXIV2API DataBuf readFile(const std::string& path); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like readFile() but accepts a unicode path in an std::wstring. + @note This function is only available on Windows. + */ + EXIV2API DataBuf readFile(const std::wstring& wpath); +#endif + /*! + @brief Write DataBuf \em buf to file \em path. + @return Return the number of bytes written. + @throw Error In case of failure. + */ + EXIV2API long writeFile(const DataBuf& buf, const std::string& path); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like writeFile() but accepts a unicode path in an std::wstring. + @note This function is only available on Windows. + */ + EXIV2API long writeFile(const DataBuf& buf, const std::wstring& wpath); +#endif + /*! + @brief replace each substring of the subject that matches the given search string with the given replacement. + @return the subject after replacing. + */ + EXIV2API std::string ReplaceStringInPlace(std::string subject, const std::string& search, + const std::string& replace); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like ReplaceStringInPlace() but accepts a unicode path in an std::wstring. + @return the subject after replacing. + @note This function is only available on Windows. + */ + EXIV2API std::wstring ReplaceStringInPlace(std::wstring subject, const std::wstring& search, + const std::wstring& replace); +#endif +#ifdef EXV_USE_CURL + /*! + @brief The callback function is called by libcurl to write the data + */ + EXIV2API size_t curlWriter(char* data, size_t size, size_t nmemb, std::string* writerData); +#endif +} // namespace Exiv2 +#endif // #ifndef BASICIO_HPP_ diff --git a/include/exiv2/bigtiffimage.hpp b/include/exiv2/bigtiffimage.hpp new file mode 100644 index 0000000..9e53ee8 --- /dev/null +++ b/include/exiv2/bigtiffimage.hpp @@ -0,0 +1,16 @@ + +#include "basicio.hpp" +#include "image.hpp" + +namespace Exiv2 +{ + +namespace ImageType +{ + const int bigtiff = 25; +} + +Image::AutoPtr newBigTiffInstance(BasicIo::AutoPtr, bool); +bool isBigTiffType(BasicIo &, bool); + +} diff --git a/include/exiv2/bmpimage.hpp b/include/exiv2/bmpimage.hpp new file mode 100644 index 0000000..d5f8b8c --- /dev/null +++ b/include/exiv2/bmpimage.hpp @@ -0,0 +1,128 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file bmpimage.hpp + @brief Windows Bitmap (BMP) image + @author Marco Piovanelli, Ovolab (marco) + marco.piovanelli@pobox.com + @date 05-Mar-2007, marco: created + */ +#ifndef BMPIMAGE_HPP_ +#define BMPIMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Add Windows Bitmap (BMP) to the supported image formats + namespace ImageType { + const int bmp = 14; //!< Windows bitmap (bmp) image type (see class BmpImage) + } + + /*! + @brief Class to access Windows bitmaps. This is just a stub - we only + read width and height. + */ + class EXIV2API BmpImage : public Image { + //! @name NOT Implemented + //@{ + //! Copy constructor + BmpImage(const BmpImage& rhs); + //! Assignment operator + BmpImage& operator=(const BmpImage& rhs); + //@} + + public: + //! @name Creators + //@{ + /*! + @brief Constructor to open a Windows bitmap image. Since the + constructor can not return a result, callers should check the + good() method after object construction to determine success + or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + */ + explicit BmpImage(BasicIo::AutoPtr io); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + /*! + @brief Todo: Write metadata back to the image. This method is not + yet(?) implemented. Calling it will throw an Error(kerWritingImageFormatUnsupported). + */ + void writeMetadata(); + /*! + @brief Todo: Not supported yet(?). Calling this function will throw + an instance of Error(kerInvalidSettingForImage). + */ + void setExifData(const ExifData& exifData); + /*! + @brief Todo: Not supported yet(?). Calling this function will throw + an instance of Error(kerInvalidSettingForImage). + */ + void setIptcData(const IptcData& iptcData); + /*! + @brief Not supported. Calling this function will throw an instance + of Error(kerInvalidSettingForImage). + */ + void setComment(const std::string& comment); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + //@} + + }; // class BmpImage + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new BmpImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newBmpInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a Windows Bitmap image. + EXIV2API bool isBmpType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef BMPIMAGE_HPP_ diff --git a/include/exiv2/config.h b/include/exiv2/config.h new file mode 100644 index 0000000..b31ceb1 --- /dev/null +++ b/include/exiv2/config.h @@ -0,0 +1,97 @@ +// config.h + +#ifndef _CONFIG_H_ +#define _CONFIG_H_ + +///// Start of Visual Studio Support ///// +#ifdef _MSC_VER + +#define _MSC_VER_2010 1600 +#define _MSC_VER_2008 1500 + +// Constants required by Microsoft SDKs to define SHGetFolderPathA and others + +#ifndef _WIN32_WINNT +// Visual Studio 2012 and earlier +# if _MSC_VER < 1800 +# define _WIN32_WINNT 0x0501 +# else +# define _WIN32_WINNT 0x0600 +# endif +#endif + +#if _MSC_VER >= _MSC_VER_2008 +#pragma warning(disable : 4996) // Disable warnings about 'deprecated' standard functions +#pragma warning(disable : 4251) // Disable warnings from std templates about exporting interfaces +#endif + +/* On Microsoft compilers pid_t has to be set to int. */ +#ifndef HAVE_PID_T +typedef int pid_t; +#endif + +#endif // _MSC_VER +///// End of Visual Studio Support ///// + +#include "exv_conf.h" +//////////////////////////////////////// + +///// Start of platform marcos ///////// +#if defined(__MINGW32__) || defined(__MINGW64__) +# ifndef __MING__ +# define __MING__ 1 +# endif +# ifndef __MINGW__ +# define __MINGW__ 1 +# endif +#endif + +#ifndef __CYGWIN__ +# if defined(__CYGWIN32__) || defined(__CYGWIN64__) +# define __CYGWIN__ 1 +# endif +#endif + +#ifndef __LITTLE_ENDIAN__ +# if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define __LITTLE_ENDIAN__ 1 +# endif +# endif +#endif + +#ifndef __LITTLE_ENDIAN__ +# if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW__) +# define __LITTLE_ENDIAN__ 1 +# endif +#endif + +/* + If you're using Solaris and the Solaris Studio compiler + you must -library=stdcxx4 along with these inclusions below +*/ +#if defined(OS_SOLARIS) +# include +# include +# include +# if defined(__cplusplus) +# include +# include +# endif +#endif +///// End of platform marcos ///////// + +///// Path separator marcos ///// +#ifndef EXV_SEPARATOR_STR +# if defined(WIN32) && !defined(__CYGWIN__) +# define EXV_SEPARATOR_STR "\\" +# define EXV_SEPARATOR_CHR '\\' +# else +# define EXV_SEPARATOR_STR "/" +# define EXV_SEPARATOR_CHR '/' +# endif +#endif +////////////////////////////////////// + + +#endif // _CONFIG_H_ diff --git a/include/exiv2/convert.hpp b/include/exiv2/convert.hpp new file mode 100644 index 0000000..ce43594 --- /dev/null +++ b/include/exiv2/convert.hpp @@ -0,0 +1,115 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file convert.hpp + @brief Exif and IPTC conversions to and from XMP + @author Andreas Huggel (ahu) + ahuggel@gmx.net
+ Vladimir Nadvornik (vn) + nadvornik@suse.cz + @date 17-Mar-08, ahu: created basic converter framework
+ 20-May-08, vn: added actual conversion logic + */ +#ifndef CONVERT_HPP_ +#define CONVERT_HPP_ + +#include "exiv2lib_export.h" + +// included header files +#include "config.h" + +// + standard includes +#include + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class declarations + class ExifData; + class IptcData; + class XmpData; + +// ***************************************************************************** +// free functions, template and inline definitions + + //! Convert (copy) Exif tags to XMP properties. + EXIV2API void copyExifToXmp(const ExifData& exifData, XmpData& xmpData); + //! Convert (move) Exif tags to XMP properties, remove converted Exif tags. + EXIV2API void moveExifToXmp(ExifData& exifData, XmpData& xmpData); + + //! Convert (copy) XMP properties to Exif tags. + EXIV2API void copyXmpToExif(const XmpData& xmpData, ExifData& exifData); + //! Convert (move) XMP properties to Exif tags, remove converted XMP properties. + EXIV2API void moveXmpToExif(XmpData& xmpData, ExifData& exifData); + + //! Detect which metadata are newer and perform a copy in appropriate direction. + EXIV2API void syncExifWithXmp(ExifData& exifData, XmpData& xmpData); + + //! Convert (copy) IPTC datasets to XMP properties. + EXIV2API void copyIptcToXmp(const IptcData& iptcData, XmpData& xmpData, const char *iptcCharset = 0); + //! Convert (move) IPTC datasets to XMP properties, remove converted IPTC datasets. + EXIV2API void moveIptcToXmp(IptcData& iptcData, XmpData& xmpData, const char *iptcCharset = 0); + + //! Convert (copy) XMP properties to IPTC datasets. + EXIV2API void copyXmpToIptc(const XmpData& xmpData, IptcData& iptcData); + //! Convert (move) XMP properties to IPTC tags, remove converted XMP properties. + EXIV2API void moveXmpToIptc(XmpData& xmpData, IptcData& iptcData); + + /*! + @brief Convert character encoding of \em str from \em from to \em to. + If the function succeeds, \em str contains the result string. + + This function uses the iconv library, if the %Exiv2 library was compiled + with iconv support. Otherwise, on Windows, it uses Windows functions to + support a limited number of conversions and fails with a warning if an + unsupported conversion is attempted. If the function is called but %Exiv2 + was not compiled with iconv support and can't use Windows functions, it + fails with a warning. + + The conversions supported on Windows without iconv are: + + + + + + + + + + + +
fromto
UTF-8 UCS-2BE
UTF-8 UCS-2LE
UCS-2BE UTF-8
UCS-2BE UCS-2LE
UCS-2LE UTF-8
UCS-2LE UCS-2BE
ISO-8859-1UTF-8
ASCII UTF-8
+ + @param str The string to convert. It is updated to the converted string, + which may have a different size. If the function call fails, + the string is not modified. + @param from Charset in which the input string is encoded as a name + understood by \c iconv_open(3). + @param to Charset to convert the string to as a name + understood by \c iconv_open(3). + @return Return \c true if the conversion was successful, else \c false. + */ + EXIV2API bool convertStringCharset(std::string& str, const char* from, const char* to); + +} // namespace Exiv2 + +#endif // #ifndef CONVERT_HPP_ diff --git a/include/exiv2/cr2image.hpp b/include/exiv2/cr2image.hpp new file mode 100644 index 0000000..42ab550 --- /dev/null +++ b/include/exiv2/cr2image.hpp @@ -0,0 +1,162 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file cr2image.hpp + @brief Class Cr2Image + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @date 22-Apr-06, ahu: created + */ +#ifndef CR2IMAGE_HPP_ +#define CR2IMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Add CR2 to the supported image formats + namespace ImageType { + const int cr2 = 7; //!< CR2 image type (see class Cr2Image) + } + + /*! + @brief Class to access raw Canon CR2 images. Exif metadata + is supported directly, IPTC is read from the Exif data, if present. + */ + class EXIV2API Cr2Image : public Image { + public: + //! @name Creators + //@{ + /*! + @brief Constructor that can either open an existing CR2 image or create + a new image from scratch. If a new image is to be created, any + existing data is overwritten. Since the constructor can not return + a result, callers should check the good() method after object + construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + @param create Specifies if an existing image should be read (false) + or if a new file should be created (true). + */ + Cr2Image(BasicIo::AutoPtr io, bool create); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + void writeMetadata(); + /*! + @brief Print out the structure of image file. + @throw Error if reading of the file fails or the image data is + not valid (does not look like data of the specific image type). + @warning This function is not thread safe and intended for exiv2 -pS for debugging. + */ + void printStructure(std::ostream& out, PrintStructureOption option,int depth); + /*! + @brief Not supported. CR2 format does not contain a comment. + Calling this function will throw an Error(kerInvalidSettingForImage). + */ + void setComment(const std::string& comment); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + int pixelWidth() const; + int pixelHeight() const; + //@} + + private: + //! @name NOT implemented + //@{ + //! Copy constructor + Cr2Image(const Cr2Image& rhs); + //! Assignment operator + Cr2Image& operator=(const Cr2Image& rhs); + //@} + + }; // class Cr2Image + + /*! + @brief Stateless parser class for data in CR2 format. Images use this + class to decode and encode CR2 data. + See class TiffParser for details. + */ + class EXIV2API Cr2Parser { + public: + /*! + @brief Decode metadata from a buffer \em pData of length \em size + with data in CR2 format to the provided metadata containers. + See TiffParser::decode(). + */ + static ByteOrder decode( + ExifData& exifData, + IptcData& iptcData, + XmpData& xmpData, + const byte* pData, + uint32_t size + ); + /*! + @brief Encode metadata from the provided metadata to CR2 format. + See TiffParser::encode(). + */ + static WriteMethod encode( + BasicIo& io, + const byte* pData, + uint32_t size, + ByteOrder byteOrder, + const ExifData& exifData, + const IptcData& iptcData, + const XmpData& xmpData + ); + + }; // class Cr2Parser + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new Cr2Image instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newCr2Instance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a CR2 image. + EXIV2API bool isCr2Type(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef CR2IMAGE_HPP_ diff --git a/include/exiv2/crwimage.hpp b/include/exiv2/crwimage.hpp new file mode 100644 index 0000000..6b14260 --- /dev/null +++ b/include/exiv2/crwimage.hpp @@ -0,0 +1,171 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file crwimage.hpp + @brief Class CrwImage to access Canon CRW images.
+ References:
+ The Canon RAW (CRW) File Format by Phil Harvey + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @date 28-Aug-05, ahu: created + */ +#ifndef CRWIMAGE_HPP_ +#define CRWIMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class declarations + class ExifData; + class IptcData; + +// ***************************************************************************** +// class definitions + + // Add CRW to the supported image formats + namespace ImageType { + const int crw = 3; //!< CRW image type (see class CrwImage) + } + + /*! + @brief Class to access raw Canon CRW images. Only Exif metadata and a + comment are supported. CRW format does not contain IPTC metadata. + */ + class EXIV2API CrwImage : public Image { + public: + //! @name Creators + //@{ + /*! + @brief Constructor that can either open an existing CRW image or create + a new image from scratch. If a new image is to be created, any + existing data is overwritten. Since the constructor can not return + a result, callers should check the good() method after object + construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + @param create Specifies if an existing image should be read (false) + or if a new file should be created (true). + */ + CrwImage(BasicIo::AutoPtr io, bool create); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + void writeMetadata(); + /*! + @brief Not supported. CRW format does not contain IPTC metadata. + Calling this function will throw an Error(kerInvalidSettingForImage). + */ + void setIptcData(const IptcData& iptcData); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + int pixelWidth() const; + int pixelHeight() const; + //@} + + private: + //! @name NOT Implemented + //@{ + //! Copy constructor + CrwImage(const CrwImage& rhs); + //! Assignment operator + CrwImage& operator=(const CrwImage& rhs); + //@} + + }; // class CrwImage + + /*! + Stateless parser class for Canon CRW images (Ciff format). + */ + class EXIV2API CrwParser { + public: + /*! + @brief Decode metadata from a Canon CRW image in data buffer \em pData + of length \em size into \em crwImage. + + This is the entry point to access image data in Ciff format. The + parser uses classes CiffHeader, CiffEntry, CiffDirectory. + + @param pCrwImage Pointer to the %Exiv2 CRW image to hold the metadata + read from the buffer. + @param pData Pointer to the data buffer. Must point to the data of + a CRW image; no checks are performed. + @param size Length of the data buffer. + + @throw Error If the data buffer cannot be parsed. + */ + static void decode(CrwImage* pCrwImage, const byte* pData, uint32_t size); + /*! + @brief Encode metadata from the CRW image into a data buffer (the + binary CRW image). + + @param blob Data buffer for the binary image (target). + @param pData Pointer to the binary image data buffer. Must + point to data in CRW format; no checks are + performed. + @param size Length of the data buffer. + @param pCrwImage Pointer to the %Exiv2 CRW image with the metadata to + encode. + + @throw Error If the metadata from the CRW image cannot be encoded. + */ + static void encode( + Blob& blob, + const byte* pData, + uint32_t size, + const CrwImage* pCrwImage + ); + + }; // class CrwParser + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new CrwImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newCrwInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a CRW image. + EXIV2API bool isCrwType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef CRWIMAGE_HPP_ diff --git a/include/exiv2/datasets.hpp b/include/exiv2/datasets.hpp new file mode 100644 index 0000000..2ac98c3 --- /dev/null +++ b/include/exiv2/datasets.hpp @@ -0,0 +1,422 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file datasets.hpp + @brief IPTC dataset and type information + @author Brad Schick (brad) + @date 24-Jul-04, brad: created + */ +#ifndef DATASETS_HPP_ +#define DATASETS_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "metadatum.hpp" + +// + standard includes +#include +#include +#include + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + //! Details of an IPTC record. + struct EXIV2API RecordInfo { + //! Constructor + RecordInfo(uint16_t recordId, const char* name, const char* desc); + uint16_t recordId_; //!< Record id + const char* name_; //!< Record name (one word) + const char* desc_; //!< Record description + }; + + //! Details of an IPTC dataset. + struct EXIV2API DataSet { + //! Constructor + DataSet( + uint16_t number, + const char* name, + const char* title, + const char* desc, + bool mandatory, + bool repeatable, + uint32_t minbytes, + uint32_t maxbytes, + TypeId type, + uint16_t recordId, + const char* photoshop + ); + uint16_t number_; //!< Dataset number + const char* name_; //!< Dataset name + const char* title_; //!< Dataset title or label + const char* desc_; //!< Dataset description + bool mandatory_; //!< True if dataset is mandatory + bool repeatable_; //!< True if dataset is repeatable + uint32_t minbytes_; //!< Minimum number of bytes + uint32_t maxbytes_; //!< Maximum number of bytes + TypeId type_; //!< Exiv2 default type + uint16_t recordId_; //!< Record id + const char* photoshop_; //!< Photoshop string + }; // struct DataSet + + //! IPTC dataset reference, implemented as a static class. + class EXIV2API IptcDataSets { + public: + /*! + @name Record identifiers + @brief Record identifiers to logically group dataSets. There are other + possible record types, but they are not standardized by the IPTC + IIM4 standard (and not commonly used in images). + */ + //@{ + static const uint16_t invalidRecord = 0; + static const uint16_t envelope = 1; + static const uint16_t application2 = 2; + //@} + + //! @name Dataset identifiers + //@{ + static const uint16_t ModelVersion = 0; + static const uint16_t Destination = 5; + static const uint16_t FileFormat = 20; + static const uint16_t FileVersion = 22; + static const uint16_t ServiceId = 30; + static const uint16_t EnvelopeNumber = 40; + static const uint16_t ProductId = 50; + static const uint16_t EnvelopePriority = 60; + static const uint16_t DateSent = 70; + static const uint16_t TimeSent = 80; + static const uint16_t CharacterSet = 90; + static const uint16_t UNO = 100; + static const uint16_t ARMId = 120; + static const uint16_t ARMVersion = 122; + static const uint16_t RecordVersion = 0; + static const uint16_t ObjectType = 3; + static const uint16_t ObjectAttribute = 4; + static const uint16_t ObjectName = 5; + static const uint16_t EditStatus = 7; + static const uint16_t EditorialUpdate = 8; + static const uint16_t Urgency = 10; + static const uint16_t Subject = 12; + static const uint16_t Category = 15; + static const uint16_t SuppCategory = 20; + static const uint16_t FixtureId = 22; + static const uint16_t Keywords = 25; + static const uint16_t LocationCode = 26; + static const uint16_t LocationName = 27; + static const uint16_t ReleaseDate = 30; + static const uint16_t ReleaseTime = 35; + static const uint16_t ExpirationDate = 37; + static const uint16_t ExpirationTime = 38; + static const uint16_t SpecialInstructions = 40; + static const uint16_t ActionAdvised = 42; + static const uint16_t ReferenceService = 45; + static const uint16_t ReferenceDate = 47; + static const uint16_t ReferenceNumber = 50; + static const uint16_t DateCreated = 55; + static const uint16_t TimeCreated = 60; + static const uint16_t DigitizationDate = 62; + static const uint16_t DigitizationTime = 63; + static const uint16_t Program = 65; + static const uint16_t ProgramVersion = 70; + static const uint16_t ObjectCycle = 75; + static const uint16_t Byline = 80; + static const uint16_t BylineTitle = 85; + static const uint16_t City = 90; + static const uint16_t SubLocation = 92; + static const uint16_t ProvinceState = 95; + static const uint16_t CountryCode = 100; + static const uint16_t CountryName = 101; + static const uint16_t TransmissionReference = 103; + static const uint16_t Headline = 105; + static const uint16_t Credit = 110; + static const uint16_t Source = 115; + static const uint16_t Copyright = 116; + static const uint16_t Contact = 118; + static const uint16_t Caption = 120; + static const uint16_t Writer = 122; + static const uint16_t RasterizedCaption = 125; + static const uint16_t ImageType = 130; + static const uint16_t ImageOrientation = 131; + static const uint16_t Language = 135; + static const uint16_t AudioType = 150; + static const uint16_t AudioRate = 151; + static const uint16_t AudioResolution = 152; + static const uint16_t AudioDuration = 153; + static const uint16_t AudioOutcue = 154; + static const uint16_t PreviewFormat = 200; + static const uint16_t PreviewVersion = 201; + static const uint16_t Preview = 202; + //@} + + private: + //! Prevent construction: not implemented. + IptcDataSets() {} + //! Prevent copy-construction: not implemented. + IptcDataSets(const IptcDataSets& rhs); + //! Prevent assignment: not implemented. + IptcDataSets& operator=(const IptcDataSets& rhs); + + public: + /*! + @brief Return the name of the dataset. + @param number The dataset number + @param recordId The IPTC record Id + @return The name of the dataset or a string containing the hexadecimal + value of the dataset in the form "0x01ff", if this is an unknown + dataset. + */ + static std::string dataSetName(uint16_t number, uint16_t recordId); + /*! + @brief Return the title (label) of the dataset. + @param number The dataset number + @param recordId The IPTC record Id + @return The title (label) of the dataset + */ + static const char* dataSetTitle(uint16_t number, uint16_t recordId); + /*! + @brief Return the description of the dataset. + @param number The dataset number + @param recordId The IPTC record Id + @return The description of the dataset + */ + static const char* dataSetDesc(uint16_t number, uint16_t recordId); + /*! + @brief Return the photohsop name of a given dataset. + @param number The dataset number + @param recordId The IPTC record Id + @return The name used by photoshop for a dataset or an empty + string if photoshop does not use the dataset. + */ + static const char* dataSetPsName(uint16_t number, uint16_t recordId); + /*! + @brief Check if a given dataset is repeatable + @param number The dataset number + @param recordId The IPTC record Id + @return true if the given dataset is repeatable otherwise false + */ + static bool dataSetRepeatable(uint16_t number, uint16_t recordId); + /*! + @brief Return the dataSet number for dataset name and record id + + @param dataSetName dataSet name + @param recordId recordId + + @return dataSet number + + @throw Error if the \em dataSetName or \em recordId are invalid + */ + static uint16_t dataSet(const std::string& dataSetName, uint16_t recordId); + //! Return the type for dataSet number and Record id + static TypeId dataSetType(uint16_t number, uint16_t recordId); + /*! + @brief Return the name of the Record + @param recordId The record id + @return The name of the record or a string containing the hexadecimal + value of the record in the form "0x01ff", if this is an + unknown record. + */ + static std::string recordName(uint16_t recordId); + /*! + @brief Return the description of a record + @param recordId Record Id number + @return the description of the Record + */ + static const char* recordDesc(uint16_t recordId); + /*! + @brief Return the Id number of a record + @param recordName Name of a record type + @return the Id number of a Record + @throw Error if the record is not known; + */ + static uint16_t recordId(const std::string& recordName); + //! Return read-only list of built-in Envelope Record datasets + static const DataSet* envelopeRecordList(); + //! Return read-only list of built-in Application2 Record datasets + static const DataSet* application2RecordList(); + //! Print a list of all dataSets to output stream + static void dataSetList(std::ostream& os); + + private: + static int dataSetIdx(uint16_t number, uint16_t recordId); + static int dataSetIdx(const std::string& dataSetName, uint16_t recordId); + + static const DataSet* records_[]; + static const RecordInfo recordInfo_[]; + + }; // class IptcDataSets + + /*! + @brief Concrete keys for IPTC metadata. + */ + class EXIV2API IptcKey : public Key { + public: + //! Shortcut for an %IptcKey auto pointer. + typedef std::auto_ptr AutoPtr; + + //! @name Creators + //@{ + /*! + @brief Constructor to create an IPTC key from a key string. + + @param key The key string. + @throw Error if the first part of the key is not 'Iptc' or + the remaining parts of the key cannot be parsed and + converted to a record name and a dataset name. + */ + explicit IptcKey(const std::string& key); + /*! + @brief Constructor to create an IPTC key from dataset and record ids. + @param tag Dataset id + @param record Record id + */ + IptcKey(uint16_t tag, uint16_t record); + //! Copy constructor + IptcKey(const IptcKey& rhs); + //! Destructor + virtual ~IptcKey(); + //@} + + //! @name Manipulators + //@{ + /*! + @brief Assignment operator. + */ + IptcKey& operator=(const IptcKey& rhs); + //@} + + //! @name Accessors + //@{ + virtual std::string key() const; + virtual const char* familyName() const; + /*! + @brief Return the name of the group (the second part of the key). + For IPTC keys, the group name is the record name. + */ + virtual std::string groupName() const; + virtual std::string tagName() const; + virtual std::string tagLabel() const; + virtual uint16_t tag() const; + AutoPtr clone() const; + //! Return the name of the record + std::string recordName() const; + //! Return the record id + uint16_t record() const; + //@} + + protected: + //! @name Manipulators + //@{ + /*! + @brief Set the key corresponding to the dataset and record id. + The key is of the form 'Iptc.recordName.dataSetName'. + */ + void makeKey(); + /*! + @brief Parse and convert the key string into dataset and record id. + Updates data members if the string can be decomposed, or throws + \em Error. + + @throw Error if the key cannot be decomposed. + */ + void decomposeKey(); + //@} + + private: + //! Internal virtual copy constructor. + virtual IptcKey* clone_() const; + + // DATA + static const char* familyName_; + + uint16_t tag_; //!< Tag value + uint16_t record_; //!< Record value + std::string key_; //!< Key + + }; // class IptcKey + + /*! + @brief typedef for string:string map + */ + typedef std::map Dictionary; + /*! + @brief typedef for Dictionary* + */ + typedef Dictionary* Dictionary_p; + /*! + @brief typedef for Dictionary iterator + */ + typedef Dictionary::const_iterator Dictionary_i; + + /*! + @brief typedef for string set (unique strings) + */ + typedef std::set StringSet; + /*! + @brief typedef for StringSet* + */ + typedef StringSet* StringSet_p; + /*! + @brief Class to provide a StringSet iterator + */ + typedef std::set::const_iterator StringSet_i; + + /*! + @brief typedef for string vector + */ + typedef std::vector StringVector; + /*! + @brief typedef for StringVector pointer + */ + typedef StringVector* StringVector_p; + /*! + @brief Class to provide a StringVector iterator + */ + typedef StringVector::const_iterator StringVector_i; + + /*! + @brief typedef for uint32_t vector + */ + typedef std::vector Uint32Vector ; + /*! + @brief typedef for Uint32Vector pointer + */ + typedef Uint32Vector* Uint32Vector_p; + /*! + @brief typedef for Uint32Vector iterator + */ + typedef Uint32Vector::const_iterator Uint32Vector_i; + + +// ***************************************************************************** +// free functions + + //! Output operator for dataSet + EXIV2API std::ostream& operator<<(std::ostream& os, const DataSet& dataSet); + +} // namespace Exiv2 + +#endif // #ifndef DATASETS_HPP_ diff --git a/include/exiv2/easyaccess.hpp b/include/exiv2/easyaccess.hpp new file mode 100644 index 0000000..a77809b --- /dev/null +++ b/include/exiv2/easyaccess.hpp @@ -0,0 +1,88 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file easyaccess.hpp + @brief Provides easy (high-level) access to some Exif meta data. + @author Carsten Pfeiffer + @date 28-Feb-09, gis: created + */ +#ifndef EASYACCESS_HPP_ +#define EASYACCESS_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "exif.hpp" + +namespace Exiv2 { + +// ***************************************************************************** +// class declarations + class ExifData; + + //! Return the orientation of the image + EXIV2API ExifData::const_iterator orientation(const ExifData& ed); + //! Return the ISO speed used to shoot the image + EXIV2API ExifData::const_iterator isoSpeed(const ExifData& ed); + //! Return the flash bias value + EXIV2API ExifData::const_iterator flashBias(const ExifData& ed); + //! Return the exposure mode setting + EXIV2API ExifData::const_iterator exposureMode(const ExifData& ed); + //! Return the scene mode setting + EXIV2API ExifData::const_iterator sceneMode(const ExifData& ed); + //! Return the macro mode setting + EXIV2API ExifData::const_iterator macroMode(const ExifData& ed); + //! Return the image quality setting + EXIV2API ExifData::const_iterator imageQuality(const ExifData& ed); + //! Return the white balance setting + EXIV2API ExifData::const_iterator whiteBalance(const ExifData& ed); + //! Return the name of the lens used + EXIV2API ExifData::const_iterator lensName(const ExifData& ed); + //! Return the saturation level + EXIV2API ExifData::const_iterator saturation(const ExifData& ed); + //! Return the sharpness level + EXIV2API ExifData::const_iterator sharpness(const ExifData& ed); + //! Return the contrast level + EXIV2API ExifData::const_iterator contrast(const ExifData& ed); + //! Return the scene capture type + EXIV2API ExifData::const_iterator sceneCaptureType(const ExifData& ed); + //! Return the metering mode setting + EXIV2API ExifData::const_iterator meteringMode(const ExifData& ed); + //! Return the camera make + EXIV2API ExifData::const_iterator make(const ExifData& ed); + //! Return the camera model + EXIV2API ExifData::const_iterator model(const ExifData& ed); + //! Return the exposure time + EXIV2API ExifData::const_iterator exposureTime(const ExifData& ed); + //! Return the F number + EXIV2API ExifData::const_iterator fNumber(const ExifData& ed); + //! Return the subject distance + EXIV2API ExifData::const_iterator subjectDistance(const ExifData& ed); + //! Return the camera serial number + EXIV2API ExifData::const_iterator serialNumber(const ExifData& ed); + //! Return the focal length setting + EXIV2API ExifData::const_iterator focalLength(const ExifData& ed); + //! Return the AF point + EXIV2API ExifData::const_iterator afPoint(const ExifData& ed); + +} // namespace Exiv2 + +#endif // EASYACCESS_HPP_ diff --git a/include/exiv2/epsimage.hpp b/include/exiv2/epsimage.hpp new file mode 100644 index 0000000..9338f57 --- /dev/null +++ b/include/exiv2/epsimage.hpp @@ -0,0 +1,124 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file epsimage.hpp + @brief EPS image. +
References: +
[1] Adobe PostScript Language Document Structuring Conventions Specification, Version 3.0, September 1992 +
[2] Adobe Encapsulated PostScript File Format Specification, Version 3.0, May 1992 +
[3] Adobe XMP Specification Part 3: Storage in Files, July 2010 +
[4] Re: Thumbnail data format in ai file, Dec 2003 + @author Michael Ulbrich (mul) + mul@rentapacs.de + @author Volker Grabsch (vog) + vog@notjusthosting.com + @date 7-Mar-2011, vog: created + */ +#ifndef EPSIMAGE_HPP_ +#define EPSIMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 +{ + +// ***************************************************************************** +// class definitions + + // Add EPS to the supported image formats + namespace ImageType { + const int eps = 18; //!< EPS image type + } + + /*! + @brief Class to access EPS images. + */ + class EXIV2LIB_DEPRECATED_EXPORT EpsImage : public Image { + public: + //! @name Creators + //@{ + /*! + @brief Constructor to open a EPS image. Since the + constructor can't return a result, callers should check the + good() method after object construction to determine success + or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + @param create Specifies if an existing image should be read (false) + or if a new file should be created (true). + */ + EpsImage(BasicIo::AutoPtr io, bool create); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + void writeMetadata(); + /*! + @brief Not supported. + Calling this function will throw an instance of Error(kerInvalidSettingForImage). + */ + void setComment(const std::string& comment); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + //@} + + private: + //! @name NOT Implemented + //@{ + //! Copy constructor + EpsImage(const EpsImage& rhs); + //! Assignment operator + EpsImage& operator=(const EpsImage& rhs); + //@} + + }; // class EpsImage + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new EpsImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newEpsInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a EPS image. + EXIV2LIB_DEPRECATED_EXPORT bool isEpsType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef EPSIMAGE_HPP_ diff --git a/include/exiv2/error.hpp b/include/exiv2/error.hpp new file mode 100644 index 0000000..1787f10 --- /dev/null +++ b/include/exiv2/error.hpp @@ -0,0 +1,398 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file error.hpp + @brief Error class for exceptions, log message class + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @date 15-Jan-04, ahu: created
+ 11-Feb-04, ahu: isolated as a component + */ +#ifndef ERROR_HPP_ +#define ERROR_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "types.hpp" + +// + standard includes +#include +#include + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + /*! + @brief Class for a log message, used by the library. Applications can set + the log level and provide a customer log message handler (callback + function). + + This class is meant to be used as a temporary object with the + related macro-magic like this: + + + EXV_WARNING << "Warning! Something looks fishy.\n"; + + + which translates to + + + if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) + LogMsg(LogMsg::warn).os() << "Warning! Something looks fishy.\n"; + + + The macros EXV_DEBUG, EXV_INFO, EXV_WARNING and EXV_ERROR are + shorthands and ensure efficient use of the logging facility: If a + log message doesn't need to be generated because of the log level + setting, the temp object is not even created. + + Caveat: The entire log message is not processed in this case. So don't + make that call any logic that always needs to be executed. + */ + class EXIV2API LogMsg { + //! Prevent copy-construction: not implemented. + LogMsg(const LogMsg&); + //! Prevent assignment: not implemented. + LogMsg& operator=(const LogMsg&); + public: + /*! + @brief Defined log levels. To suppress all log messages, either set the + log level to \c mute or set the log message handler to 0. + */ + enum Level { debug = 0, info = 1, warn = 2, error = 3, mute = 4 }; + /*! + @brief Type for a log message handler function. The function receives + the log level and message and can process it in an application + specific way. The default handler sends the log message to + standard error. + */ + typedef void (*Handler)(int, const char*); + + //! @name Creators + //@{ + //! Constructor, takes the log message type as an argument + explicit LogMsg(Level msgType); + + //! Destructor, passes the log message to the message handler depending on the log level + ~LogMsg(); + //@} + + //! @name Manipulators + //@{ + //! Return a reference to the ostringstream which holds the log message + std::ostringstream& os(); + //@} + + /*! + @brief Set the log level. Only log messages with a level greater or + equal \em level are sent to the log message handler. Default + log level is \c warn. To suppress all log messages, set the log + level to \c mute (or set the log message handler to 0). + */ + static void setLevel(Level level); + /*! + @brief Set the log message handler. The default handler writes log + messages to standard error. To suppress all log messages, set + the log message handler to 0 (or set the log level to \c mute). + */ + static void setHandler(Handler handler); + //! Return the current log level + static Level level(); + //! Return the current log message handler + static Handler handler(); + //! The default log handler. Sends the log message to standard error. + static void defaultHandler(int level, const char* s); + + private: + // DATA + // The output level. Only messages with type >= level_ will be written + static Level level_; + // The log handler in use + static Handler handler_; + // The type of this log message + const Level msgType_; + // Holds the log message until it is passed to the message handler + std::ostringstream os_; + + }; // class LogMsg + +// Macros for simple access +//! Shorthand to create a temp debug log message object and return its ostringstream +#define EXV_DEBUG if (LogMsg::debug >= LogMsg::level() && LogMsg::handler()) LogMsg(LogMsg::debug).os() +//! Shorthand for a temp info log message object and return its ostringstream +#define EXV_INFO if (LogMsg::info >= LogMsg::level() && LogMsg::handler()) LogMsg(LogMsg::info).os() +//! Shorthand for a temp warning log message object and return its ostringstream +#define EXV_WARNING if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) LogMsg(LogMsg::warn).os() +//! Shorthand for a temp error log message object and return its ostringstream +#define EXV_ERROR if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) LogMsg(LogMsg::error).os() + +#ifdef _MSC_VER +// Disable MSVC warnings "non - DLL-interface classkey 'identifier' used as base +// for DLL-interface classkey 'identifier'" +# pragma warning( disable : 4275 ) +#endif + + //! Generalised toString function + template + std::basic_string toBasicString(const T& arg) + { + std::basic_ostringstream os; + os << arg; + return os.str(); + } + + /*! + @brief Error class interface. Allows the definition and use of a hierarchy + of error classes which can all be handled in one catch block. + Inherits from the standard exception base-class, to make life + easier for library users (they have the option of catching most + things via std::exception). + */ + class EXIV2API AnyError : public std::exception { + public: + AnyError(); + AnyError(const AnyError& o); + + virtual ~AnyError() throw(); + ///@brief Return the error code. + virtual int code() const throw() =0; + }; + + //! %AnyError output operator + inline std::ostream& operator<<(std::ostream& os, const AnyError& error) + { + return os << error.what(); + } + + //! Complete list of all Exiv2 error codes + enum ErrorCode { + kerGeneralError = -1, + kerSuccess = 0, + kerErrorMessage, + kerCallFailed, + kerNotAnImage, + kerInvalidDataset, + kerInvalidRecord, + kerInvalidKey, + kerInvalidTag, + kerValueNotSet, + kerDataSourceOpenFailed, + kerFileOpenFailed, + kerFileContainsUnknownImageType, + kerMemoryContainsUnknownImageType, + kerUnsupportedImageType, + kerFailedToReadImageData, + kerNotAJpeg, + kerFailedToMapFileForReadWrite, + kerFileRenameFailed, + kerTransferFailed, + kerMemoryTransferFailed, + kerInputDataReadFailed, + kerImageWriteFailed, + kerNoImageInInputData, + kerInvalidIfdId, + //! Entry::setValue: Value too large + kerValueTooLarge, + //! Entry::setDataArea: Value too large + kerDataAreaValueTooLarge, + kerOffsetOutOfRange, + kerUnsupportedDataAreaOffsetType, + kerInvalidCharset, + kerUnsupportedDateFormat, + kerUnsupportedTimeFormat, + kerWritingImageFormatUnsupported, + kerInvalidSettingForImage, + kerNotACrwImage, + kerFunctionNotSupported, + kerNoNamespaceInfoForXmpPrefix, + kerNoPrefixForNamespace, + kerTooLargeJpegSegment, + kerUnhandledXmpdatum, + kerUnhandledXmpNode, + kerXMPToolkitError, + kerDecodeLangAltPropertyFailed, + kerDecodeLangAltQualifierFailed, + kerEncodeLangAltPropertyFailed, + kerPropertyNameIdentificationFailed, + kerSchemaNamespaceNotRegistered, + kerNoNamespaceForPrefix, + kerAliasesNotSupported, + kerInvalidXmpText, + kerTooManyTiffDirectoryEntries, + kerMultipleTiffArrayElementTagsInDirectory, + kerWrongTiffArrayElementTagType, + kerInvalidKeyXmpValue, + kerInvalidIccProfile, + kerInvalidXMP, + kerTiffDirectoryTooLarge, + kerInvalidTypeValue, + kerInvalidMalloc, + kerCorruptedMetadata, + kerArithmeticOverflow, + kerMallocFailed, + }; + + /*! + @brief Simple error class used for exceptions. An output operator is + provided to print errors to a stream. + */ + template + class EXIV2API BasicError : public AnyError { + public: + //! @name Creators + //@{ + //! Constructor taking only an error code + explicit inline BasicError(ErrorCode code); + + //! Constructor taking an error code and one argument + template + inline BasicError(ErrorCode code, const A& arg1); + + //! Constructor taking an error code and two arguments + template + inline BasicError(ErrorCode code, const A& arg1, const B& arg2); + + //! Constructor taking an error code and three arguments + template + inline BasicError(ErrorCode code, const A& arg1, const B& arg2, const C& arg3); + + //! Virtual destructor. (Needed because of throw()) + virtual inline ~BasicError() throw(); + //@} + + //! @name Accessors + //@{ + virtual inline int code() const throw(); + /*! + @brief Return the error message as a C-string. The pointer returned by what() + is valid only as long as the BasicError object exists. + */ + virtual inline const char* what() const throw(); +#ifdef EXV_UNICODE_PATH + /*! + @brief Return the error message as a wchar_t-string. The pointer returned by + wwhat() is valid only as long as the BasicError object exists. + */ + virtual inline const wchar_t* wwhat() const throw(); +#endif + //@} + + private: + //! @name Manipulators + //@{ + //! Assemble the error message from the arguments + void setMsg(); + //@} + + // DATA + ErrorCode code_; //!< Error code + int count_; //!< Number of arguments + std::basic_string arg1_; //!< First argument + std::basic_string arg2_; //!< Second argument + std::basic_string arg3_; //!< Third argument + std::string msg_; //!< Complete error message +#ifdef EXV_UNICODE_PATH + std::wstring wmsg_; //!< Complete error message as a wide string +#endif + }; // class BasicError + + //! Error class used for exceptions (std::string based) + typedef BasicError Error; +#ifdef EXV_UNICODE_PATH + //! Error class used for exceptions (std::wstring based) + typedef BasicError WError; +#endif + +// ***************************************************************************** +// free functions, template and inline definitions + + //! Return the error message for the error with code \em code. + const char* errMsg(int code); + + template + BasicError::BasicError(ErrorCode code) + : code_(code), count_(0) + { + setMsg(); + } + + template template + BasicError::BasicError(ErrorCode code, const A& arg1) + : code_(code), count_(1), arg1_(toBasicString(arg1)) + { + setMsg(); + } + + template template + BasicError::BasicError(ErrorCode code, const A& arg1, const B& arg2) + : code_(code), count_(2), + arg1_(toBasicString(arg1)), + arg2_(toBasicString(arg2)) + { + setMsg(); + } + + template template + BasicError::BasicError(ErrorCode code, const A& arg1, const B& arg2, const C& arg3) + : code_(code), count_(3), + arg1_(toBasicString(arg1)), + arg2_(toBasicString(arg2)), + arg3_(toBasicString(arg3)) + { + setMsg(); + } + + template + BasicError::~BasicError() throw() + { + } + + template + int BasicError::code() const throw() + { + return code_; + } + + template + const char* BasicError::what() const throw() + { + return msg_.c_str(); + } + +#ifdef EXV_UNICODE_PATH + template + const wchar_t* BasicError::wwhat() const throw() + { + return wmsg_.c_str(); + } +#endif + +#ifdef _MSC_VER +# pragma warning( default : 4275 ) +#endif + +} // namespace Exiv2 +#endif // #ifndef ERROR_HPP_ diff --git a/include/exiv2/exif.hpp b/include/exiv2/exif.hpp new file mode 100644 index 0000000..8f5eb7c --- /dev/null +++ b/include/exiv2/exif.hpp @@ -0,0 +1,627 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file exif.hpp + @brief Encoding and decoding of Exif data + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @date 09-Jan-04, ahu: created + */ +#ifndef EXIF_HPP_ +#define EXIF_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "metadatum.hpp" +#include "tags.hpp" + +// + standard includes +#include + +// ***************************************************************************** +// namespace extensions +/*! + @brief Provides classes and functions to encode and decode Exif and Iptc data. + The libexiv2 API consists of the objects of this namespace. + */ +namespace Exiv2 { + +// ***************************************************************************** +// class declarations + class ExifData; + +// ***************************************************************************** +// class definitions + + /*! + @brief An Exif metadatum, consisting of an ExifKey and a Value and + methods to manipulate these. + */ + class EXIV2API Exifdatum : public Metadatum { + template friend Exifdatum& setValue(Exifdatum&, const T&); + public: + //! @name Creators + //@{ + /*! + @brief Constructor for new tags created by an application. The + %Exifdatum is created from a \em key / value pair. %Exifdatum copies + (clones) the \em key and value if one is provided. Alternatively, + a program can create an 'empty' %Exifdatum with only a key + and set the value using setValue(). + + @param key %ExifKey. + @param pValue Pointer to an %Exifdatum value. + @throw Error if the key cannot be parsed and converted. + */ + explicit Exifdatum(const ExifKey& key, const Value* pValue =0); + //! Copy constructor + Exifdatum(const Exifdatum& rhs); + //! Destructor + virtual ~Exifdatum(); + //@} + + //! @name Manipulators + //@{ + //! Assignment operator + Exifdatum& operator=(const Exifdatum& rhs); + /*! + @brief Assign \em value to the %Exifdatum. The type of the new Value + is set to UShortValue. + */ + Exifdatum& operator=(const uint16_t& value); + /*! + @brief Assign \em value to the %Exifdatum. The type of the new Value + is set to ULongValue. + */ + Exifdatum& operator=(const uint32_t& value); + /*! + @brief Assign \em value to the %Exifdatum. The type of the new Value + is set to URationalValue. + */ + Exifdatum& operator=(const URational& value); + /*! + @brief Assign \em value to the %Exifdatum. The type of the new Value + is set to ShortValue. + */ + Exifdatum& operator=(const int16_t& value); + /*! + @brief Assign \em value to the %Exifdatum. The type of the new Value + is set to LongValue. + */ + Exifdatum& operator=(const int32_t& value); + /*! + @brief Assign \em value to the %Exifdatum. The type of the new Value + is set to RationalValue. + */ + Exifdatum& operator=(const Rational& value); + /*! + @brief Assign \em value to the %Exifdatum. + Calls setValue(const std::string&). + */ + Exifdatum& operator=(const std::string& value); + /*! + @brief Assign \em value to the %Exifdatum. + Calls setValue(const Value*). + */ + Exifdatum& operator=(const Value& value); + void setValue(const Value* pValue); + /*! + @brief Set the value to the string \em value. Uses Value::read(const + std::string&). If the %Exifdatum does not have a Value yet, + then a %Value of the correct type for this %Exifdatum is + created. An AsciiValue is created for unknown tags. Return + 0 if the value was read successfully. + */ + int setValue(const std::string& value); + /*! + @brief Set the data area by copying (cloning) the buffer pointed to + by \em buf. + + Values may have a data area, which can contain additional + information besides the actual value. This method is used to set such + a data area. + + @param buf Pointer to the source data area + @param len Size of the data area + @return Return -1 if the %Exifdatum does not have a value yet or the + value has no data area, else 0. + */ + int setDataArea(const byte* buf, long len); + //@} + + //! @name Accessors + //@{ + //! Return the key of the %Exifdatum. + std::string key() const; + const char* familyName() const; + std::string groupName() const; + std::string tagName() const; + std::string tagLabel() const; + uint16_t tag() const; + //! Return the IFD id as an integer. (Do not use, this is meant for library internal use.) + int ifdId() const; + //! Return the name of the IFD + const char* ifdName() const; + //! Return the index (unique id of this key within the original IFD) + int idx() const; + /*! + @brief Write value to a data buffer and return the number + of bytes written. + + The user must ensure that the buffer has enough memory. Otherwise + the call results in undefined behaviour. + + @param buf Data buffer to write to. + @param byteOrder Applicable byte order (little or big endian). + @return Number of characters written. + */ + long copy(byte* buf, ByteOrder byteOrder) const; + std::ostream& write(std::ostream& os, const ExifData* pMetadata =0) const; + //! Return the type id of the value + TypeId typeId() const; + //! Return the name of the type + const char* typeName() const; + //! Return the size in bytes of one component of this type + long typeSize() const; + //! Return the number of components in the value + long count() const; + //! Return the size of the value in bytes + long size() const; + //! Return the value as a string. + std::string toString() const; + std::string toString(long n) const; + long toLong(long n =0) const; + float toFloat(long n =0) const; + Rational toRational(long n =0) const; + Value::AutoPtr getValue() const; + const Value& value() const; + //! Return the size of the data area. + long sizeDataArea() const; + /*! + @brief Return a copy of the data area of the value. The caller owns + this copy and %DataBuf ensures that it will be deleted. + + Values may have a data area, which can contain additional + information besides the actual value. This method is used to access + such a data area. + + @return A %DataBuf containing a copy of the data area or an empty + %DataBuf if the value does not have a data area assigned or the + value is not set. + */ + DataBuf dataArea() const; + //@} + + private: + // DATA + ExifKey::AutoPtr key_; //!< Key + Value::AutoPtr value_; //!< Value + + }; // class Exifdatum + + /*! + @brief Access to a Exif %thumbnail image. This class provides higher level + accessors to the thumbnail image that is optionally embedded in IFD1 + of the Exif data. These methods do not write to the Exif metadata. + Manipulators are provided in subclass ExifThumb. + + @note Various other preview and thumbnail images may be contained in an + image, depending on its format and the camera make and model. This + class only provides access to the Exif thumbnail as specified in the + Exif standard. + */ + class EXIV2API ExifThumbC { + public: + //! @name Creators + //@{ + //! Constructor. + explicit ExifThumbC(const ExifData& exifData); + //@} + + //! @name Accessors + //@{ + /*! + @brief Return the thumbnail image in a %DataBuf. The caller owns the + data buffer and %DataBuf ensures that it will be deleted. + */ + DataBuf copy() const; + /*! + @brief Write the thumbnail image to a file. + + A filename extension is appended to \em path according to the image + type of the thumbnail, so \em path should not include an extension. + The function will overwrite an existing file of the same name. + + @param path File name of the thumbnail without extension. + @return The number of bytes written. + */ + long writeFile(const std::string& path) const; +#ifdef EXV_UNICODE_PATH + /*! + @brief Like writeFile() but accepts a unicode path in an std::wstring. + @note This function is only available on Windows. + */ + long writeFile(const std::wstring& wpath) const; +#endif + /*! + @brief Return the MIME type of the thumbnail, either \c "image/tiff" + or \c "image/jpeg". + */ + const char* mimeType() const; + /*! + @brief Return the file extension for the format of the thumbnail + (".tif" or ".jpg"). + */ + const char* extension() const; +#ifdef EXV_UNICODE_PATH + /*! + @brief Like extension() but returns the extension in a wchar_t. + @note This function is only available on Windows. + */ + const wchar_t* wextension() const; +#endif + //@} + + private: + // DATA + const ExifData& exifData_; //!< Const reference to the Exif metadata. + + }; // class ExifThumb + + /*! + @brief Access and modify an Exif %thumbnail image. This class implements + manipulators to set and erase the thumbnail image that is optionally + embedded in IFD1 of the Exif data. Accessors are provided by the + base class, ExifThumbC. + + @note Various other preview and thumbnail images may be contained in an + image, depending on its format and the camera make and model. This + class only provides access to the Exif thumbnail as specified in the + Exif standard. + */ + class EXIV2API ExifThumb : public ExifThumbC { + public: + //! @name Creators + //@{ + //! Constructor. + explicit ExifThumb(ExifData& exifData); + //@} + + //! @name Manipulators + //@{ + /*! + @brief Set the Exif thumbnail to the JPEG image \em path. Set + XResolution, YResolution and ResolutionUnit to \em xres, + \em yres and \em unit, respectively. + + This results in the minimal thumbnail tags being set for a JPEG + thumbnail, as mandated by the Exif standard. + + @throw Error if reading the file fails. + + @note No checks on the file format or size are performed. + @note Additional existing Exif thumbnail tags are not modified. + @note The JPEG image inserted as thumbnail image should not + itself contain Exif data (or other metadata), as existing + applications may have problems with that. (The preview + application that comes with OS X for one.) - David Harvey. + */ + void setJpegThumbnail( + const std::string& path, + URational xres, + URational yres, + uint16_t unit + ); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like setJpegThumbnail() but accepts a unicode path in an + std::wstring. + @note This function is only available on Windows. + */ + void setJpegThumbnail( + const std::wstring& wpath, + URational xres, + URational yres, + uint16_t unit + ); +#endif + /*! + @brief Set the Exif thumbnail to the JPEG image pointed to by \em buf, + and size \em size. Set XResolution, YResolution and + ResolutionUnit to \em xres, \em yres and \em unit, respectively. + + This results in the minimal thumbnail tags being set for a JPEG + thumbnail, as mandated by the Exif standard. + + @throw Error if reading the file fails. + + @note No checks on the image format or size are performed. + @note Additional existing Exif thumbnail tags are not modified. + @note The JPEG image inserted as thumbnail image should not + itself contain Exif data (or other metadata), as existing + applications may have problems with that. (The preview + application that comes with OS X for one.) - David Harvey. + */ + void setJpegThumbnail( + const byte* buf, + long size, + URational xres, + URational yres, + uint16_t unit + ); + /*! + @brief Set the Exif thumbnail to the JPEG image \em path. + + This sets only the Compression, JPEGInterchangeFormat and + JPEGInterchangeFormatLength tags, which is not all the thumbnail + Exif information mandatory according to the Exif standard. (But it's + enough to work with the thumbnail.) + + @throw Error if reading the file fails. + + @note No checks on the file format or size are performed. + @note Additional existing Exif thumbnail tags are not modified. + */ + void setJpegThumbnail(const std::string& path); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like setJpegThumbnail(const std::string& path) but accepts a + unicode path in an std::wstring. + @note This function is only available on Windows. + */ + void setJpegThumbnail(const std::wstring& wpath); +#endif + /*! + @brief Set the Exif thumbnail to the JPEG image pointed to by \em buf, + and size \em size. + + This sets only the Compression, JPEGInterchangeFormat and + JPEGInterchangeFormatLength tags, which is not all the thumbnail + Exif information mandatory according to the Exif standard. (But it's + enough to work with the thumbnail.) + + @note No checks on the image format or size are performed. + @note Additional existing Exif thumbnail tags are not modified. + */ + void setJpegThumbnail(const byte* buf, long size); + /*! + @brief Delete the thumbnail from the Exif data. Removes all + Exif.%Thumbnail.*, i.e., Exif IFD1 tags. + */ + void erase(); + //@} + + private: + // DATA + ExifData& exifData_; //!< Reference to the related Exif metadata. + + }; // class ExifThumb + + //! Container type to hold all metadata + typedef std::list ExifMetadata; + + /*! + @brief A container for Exif data. This is a top-level class of the %Exiv2 + library. The container holds Exifdatum objects. + + Provide high-level access to the Exif data of an image: + - read Exif information from JPEG files + - access metadata through keys and standard C++ iterators + - add, modify and delete metadata + - write Exif data to JPEG files + - extract Exif metadata to files, insert from these files + - extract and delete Exif thumbnail (JPEG and TIFF thumbnails) + */ + class EXIV2API ExifData { + public: + //! ExifMetadata iterator type + typedef ExifMetadata::iterator iterator; + //! ExifMetadata const iterator type + typedef ExifMetadata::const_iterator const_iterator; + + //! @name Manipulators + //@{ + /*! + @brief Returns a reference to the %Exifdatum that is associated with a + particular \em key. If %ExifData does not already contain such + an %Exifdatum, operator[] adds object \em Exifdatum(key). + + @note Since operator[] might insert a new element, it can't be a const + member function. + */ + Exifdatum& operator[](const std::string& key); + /*! + @brief Add an Exifdatum from the supplied key and value pair. This + method copies (clones) key and value. No duplicate checks are + performed, i.e., it is possible to add multiple metadata with + the same key. + */ + void add(const ExifKey& key, const Value* pValue); + /*! + @brief Add a copy of the \em exifdatum to the Exif metadata. No + duplicate checks are performed, i.e., it is possible to add + multiple metadata with the same key. + + @throw Error if the makernote cannot be created + */ + void add(const Exifdatum& exifdatum); + /*! + @brief Delete the Exifdatum at iterator position \em pos, return the + position of the next exifdatum. Note that iterators into + the metadata, including \em pos, are potentially invalidated + by this call. + */ + iterator erase(iterator pos); + /*! + @brief Remove all elements of the range \em beg, \em end, return the + position of the next element. Note that iterators into + the metadata are potentially invalidated by this call. + */ + iterator erase(iterator beg, iterator end); + /*! + @brief Delete all Exifdatum instances resulting in an empty container. + Note that this also removes thumbnails. + */ + void clear(); + //! Sort metadata by key + void sortByKey(); + //! Sort metadata by tag + void sortByTag(); + //! Begin of the metadata + iterator begin() { return exifMetadata_.begin(); } + //! End of the metadata + iterator end() { return exifMetadata_.end(); } + /*! + @brief Find the first Exifdatum with the given \em key, return an + iterator to it. + */ + iterator findKey(const ExifKey& key); + //@} + + //! @name Accessors + //@{ + //! Begin of the metadata + const_iterator begin() const { return exifMetadata_.begin(); } + //! End of the metadata + const_iterator end() const { return exifMetadata_.end(); } + /*! + @brief Find the first Exifdatum with the given \em key, return a const + iterator to it. + */ + const_iterator findKey(const ExifKey& key) const; + //! Return true if there is no Exif metadata + bool empty() const { return count() == 0; } + //! Get the number of metadata entries + long count() const { return static_cast(exifMetadata_.size()); } + //@} + + private: + // DATA + ExifMetadata exifMetadata_; + + }; // class ExifData + + /*! + @brief Stateless parser class for Exif data. Images use this class to + decode and encode binary Exif data. + + @note Encode is lossy and is not the inverse of decode. + */ + class EXIV2API ExifParser { + public: + /*! + @brief Decode metadata from a buffer \em pData of length \em size + with binary Exif data to the provided metadata container. + + The buffer must start with a TIFF header. Return byte order + in which the data is encoded. + + @param exifData Exif metadata container. + @param pData Pointer to the data buffer. Must point to data in + binary Exif format; no checks are performed. + @param size Length of the data buffer + @return Byte order in which the data is encoded. + */ + static ByteOrder decode( + ExifData& exifData, + const byte* pData, + uint32_t size + ); + /*! + @brief Encode Exif metadata from the provided metadata to binary Exif + format. + + The original binary Exif data in the memory block \em pData, \em size + is parsed and updated in-place if possible ("non-intrusive" + writing). If that is not possible (e.g., if new tags were added), the + entire Exif structure is re-written to the \em blob ("intrusive" + writing). The return value indicates which write method was used. If + it is \c wmNonIntrusive, the original memory \em pData, \em size + contains the result and \em blob is empty. If the return value is + \c wmIntrusive, a new Exif structure was created and returned in + \em blob. The memory block \em pData, \em size may be partly updated in + this case and should not be used anymore. + + Encode is a lossy operation. It attempts to fit the Exif data into a + binary block suitable as the payload of a JPEG APP1 Exif segment, + which can be at most 65527 bytes large. Encode omits IFD0 tags that + are "not recorded" in compressed images according to the Exif 2.2 + specification. It also doesn't write tags in groups which do not occur + in JPEG images. If the resulting binary block is larger than allowed, + it further deletes specific large preview tags, unknown tags larger + than 4kB and known tags larger than 40kB. The operation succeeds even + if the end result is still larger than the allowed size. Application + should therefore always check the size of the \em blob. + + @param blob Container for the binary Exif data if "intrusive" + writing is necessary. Empty otherwise. + @param pData Pointer to the binary Exif data buffer. Must + point to data in Exif format; no checks are + performed. Will be modified if "non-intrusive" + writing is possible. + @param size Length of the data buffer. + @param byteOrder Byte order to use. + @param exifData Exif metadata container. + + @return Write method used. + */ + static WriteMethod encode( + Blob& blob, + const byte* pData, + uint32_t size, + ByteOrder byteOrder, + const ExifData& exifData + ); + /*! + @brief Encode metadata from the provided metadata to Exif format. + + Encode Exif metadata from the \em ExifData container to binary Exif + format in the \em blob, encoded in \em byteOrder. + + This simpler encode method uses "intrusive" writing, i.e., it builds + the binary representation of the metadata from scratch. It does not + attempt "non-intrusive", i.e., in-place updating. It's better to use + the other encode() method, if the metadata is already available in + binary format, in order to allow for "non-intrusive" updating of the + existing binary representation. + + This is just an inline wrapper for + ExifParser::encode(blob, 0, 0, byteOrder, exifData). + + @param blob Container for the binary Exif data. + @param byteOrder Byte order to use. + @param exifData Exif metadata container. + */ + static void encode( + Blob& blob, + ByteOrder byteOrder, + const ExifData& exifData + ) + { + encode(blob, 0, 0, byteOrder, exifData); + } + + }; // class ExifParser + +} // namespace Exiv2 + +#endif // #ifndef EXIF_HPP_ diff --git a/include/exiv2/exiv2.hpp b/include/exiv2/exiv2.hpp new file mode 100644 index 0000000..e25733c --- /dev/null +++ b/include/exiv2/exiv2.hpp @@ -0,0 +1,79 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file exiv2.hpp + @brief Include all Exiv2 header files. + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @date 21-Jun-10, ahu: created + */ +#ifndef EXIV2_HPP_ +#define EXIV2_HPP_ + +// ***************************************************************************** +// included header files +#include "exiv2/config.h" +#include "exiv2/datasets.hpp" +#include "exiv2/basicio.hpp" +#include "exiv2/bmpimage.hpp" +#include "exiv2/convert.hpp" +#include "exiv2/cr2image.hpp" +#include "exiv2/crwimage.hpp" +#include "exiv2/easyaccess.hpp" +#include "exiv2/epsimage.hpp" +#include "exiv2/error.hpp" +#include "exiv2/exif.hpp" +#include "exiv2/futils.hpp" +#include "exiv2/gifimage.hpp" +#include "exiv2/http.hpp" +#include "exiv2/image.hpp" +#include "exiv2/ini.hpp" +#include "exiv2/iptc.hpp" +#include "exiv2/jp2image.hpp" +#include "exiv2/jpgimage.hpp" +#include "exiv2/metadatum.hpp" +#include "exiv2/mrwimage.hpp" +#include "exiv2/orfimage.hpp" +#include "exiv2/pgfimage.hpp" + +#ifdef EXV_HAVE_LIBZ +#include "exiv2/pngimage.hpp" +#endif + +#include "exiv2/preview.hpp" +#include "exiv2/properties.hpp" +#include "exiv2/psdimage.hpp" +#include "exiv2/rafimage.hpp" +#include "exiv2/rw2image.hpp" + +#ifdef EXV_USE_SSH +#include "exiv2/ssh.hpp" +#endif + +#include "exiv2/tags.hpp" +#include "exiv2/tgaimage.hpp" +#include "exiv2/tiffimage.hpp" +#include "exiv2/types.hpp" +#include "exiv2/value.hpp" +#include "exiv2/version.hpp" +#include "exiv2/xmp_exiv2.hpp" +#include "exiv2/xmpsidecar.hpp" + +#endif // #ifndef EXIV2_HPP_ diff --git a/include/exiv2/futils.hpp b/include/exiv2/futils.hpp new file mode 100644 index 0000000..9e45028 --- /dev/null +++ b/include/exiv2/futils.hpp @@ -0,0 +1,210 @@ +// ********************************************************* -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file futils.hpp + @brief Basic file utility functions required by Exiv2 + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @date 12-Dec-03, ahu: created
+ 02-Apr-05, ahu: moved to Exiv2 namespace + */ +#ifndef FUTILS_HPP_ +#define FUTILS_HPP_ + +#include "exiv2lib_export.h" +#include "config.h" + +#include + +// namespace extensions +namespace Exiv2 +{ + //! the name of environmental variables. + enum EnVar + { + envHTTPPOST = 0, + envTIMEOUT = 1 + }; + //! the collection of protocols. + enum Protocol + { + pFile = 0, + pHttp, + pFtp, + pHttps, + pSftp, + pSsh, + pFileUri, + pDataUri, + pStdin + }; + // ********************************************************************* + // free functions + /*! + @brief Return the value of environmental variable. + @param[in] var The name of environmental variable. Must be a member of the enumeration @ref EnVar. + @return the value of environmental variable. If it's empty, the default value is returned. + @throws std::out_of_range when an unexpected EnVar is given as input. + */ + EXIV2API std::string getEnv(int env_var); + + /*! + @brief Encode the input url. + @param str The url needs encoding. + @return the url-encoded version of str. + @note Source: http://www.geekhideout.com/urlcode.shtml + @todo This function can probably be hidden into the implementation details + */ + EXIV2API std::string urlencode(const char* str); + + /*! + @brief Decode the input url. + @param str The url needs decoding. + @return the url-decoded version of str. + + @note Be sure to 'free' the returned string after use with 'delete []'. + Source: http://www.geekhideout.com/urlcode.shtml + @todo This function can probably be hidden into the implementation details + */ + EXIV2API char* urldecode(const char* str); + + /*! + @brief Like urlencode(char* str) but accept the input url in the std::string and modify it. + @todo This function can probably be hidden into the implementation details + */ + EXIV2API void urldecode(std::string& str); + + /*! + @brief Encode in base64 the data in data_buf and put the resulting string in result. + @param data_buf The data need to encode + @param dataLength Size in bytes of the in buffer + @param result The container for the result, NULL if it fails + @param resultSize Size in bytes of the out string, it should be at least + ((dataLength + 2) / 3) * 4 + 1 + @return 1 indicate success + + @note Source: http://en.wikibooks.org/wiki/Algorithm_Implementation/Miscellaneous/Base64 + */ + EXIV2API int base64encode(const void* data_buf, size_t dataLength, char* result, size_t resultSize); + + /*! + @brief Decode base64 data and put the resulting string in out. + @param in The data need to decode. + @param out The container for the result, it should be large enough to contain the result. + @param out_size The size of out in bytes. + @return the size of the resulting string. If it fails, return -1. + + @note Source: https://github.com/davidgaleano/libwebsockets/blob/master/lib/base64-decode.c + */ + EXIV2API long base64decode(const char* in, char* out, size_t out_size); + + /*! + @brief Return the protocol of the path. + @param path The path of file to extract the protocol. + @return the protocol of the path. + */ + EXIV2API Protocol fileProtocol(const std::string& path); + +#ifdef EXV_UNICODE_PATH + /*! + @brief Like fileProtocol() but accept a unicode path in an std::wstring. + @note This function is only available on Windows. + */ + EXIV2API Protocol fileProtocol(const std::wstring& wpath); +#endif + + /*! + @brief Test if a file exists. + + @param path Name of file to verify. + @param ct Flag to check if path is a regular file. + @return true if path exists and, if ct is set, + is a regular file, else false. + + @note The function calls stat() test for path + and its type, see stat(2). errno is left unchanged + in case of an error. + */ + EXIV2API bool fileExists(const std::string& path, bool ct = false); + +#ifdef EXV_UNICODE_PATH + /*! + @brief Like fileExists(const std::string& path, bool ct =false) but + accepts a unicode path in an std::wstring. + @note This function is only available on Windows. + */ + EXIV2API bool fileExists(const std::wstring& wpath, bool ct = false); +#endif + + /*! + @brief Get the path of file URL. + + @param url The file URL in the format file:///path or file://host/path + @return the path of file URL. + */ + EXIV2API std::string pathOfFileUrl(const std::string& url); + +#ifdef EXV_UNICODE_PATH + /*! + @brief Like pathOfFileUrl(const std::string& url) but accepts a unicode path in an std::wstring. + @note This function is only available on Windows. + */ + EXIV2API std::wstring pathOfFileUrl(const std::wstring& wurl); +#endif + + /*! + @brief Return a system error message and the error code (errno). + See %strerror(3). + */ + EXIV2API std::string strError(); + + //! @brief Return the path of the current process. + EXIV2API std::string getProcessPath(); + + /*! + @brief A container for URL components. It also provides the method to parse a + URL to get the protocol, host, path, port, querystring, username, password. + + Source: http://stackoverflow.com/questions/2616011/easy-way-to-parse-a-url-in-c-cross-platform + + @todo This class can probably be hidden from the API + */ + class Uri + { + public: + // DATA + std::string QueryString; //!< URL query string + std::string Path; //!< URL file path + std::string Protocol; //!< URL protocol + std::string Host; //!< URL host + std::string Port; //!< URL port + std::string Username; //!< URL username + std::string Password; //!< URL password + + /// @brief Parse the input URL to the protocol, host, path, username, password + static Uri EXIV2API Parse(const std::string& uri); + + /// @brief Decode the url components. + static void EXIV2API Decode(Uri& uri); + }; + +} // namespace Exiv2 + +#endif // #ifndef FUTILS_HPP_ diff --git a/include/exiv2/gifimage.hpp b/include/exiv2/gifimage.hpp new file mode 100644 index 0000000..bec7b1a --- /dev/null +++ b/include/exiv2/gifimage.hpp @@ -0,0 +1,129 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file gifimage.hpp + @brief GIF image, implemented using the following references: + GIF89 specification by W3C
+ @author Marco Piovanelli, Ovolab (marco) + marco.piovanelli@pobox.com + @date 26-Feb-2007, marco: created + */ +#ifndef GIFIMAGE_HPP_ +#define GIFIMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Add GIF to the supported image formats + namespace ImageType { + const int gif = 11; //!< GIF image type (see class GifImage) + } + + /*! + @brief Class to access raw GIF images. Exif/IPTC metadata are supported + directly. + */ + class EXIV2API GifImage : public Image { + //! @name NOT Implemented + //@{ + //! Copy constructor + GifImage(const GifImage& rhs); + //! Assignment operator + GifImage& operator=(const GifImage& rhs); + //@} + + public: + //! @name Creators + //@{ + /*! + @brief Constructor to open a GIF image. Since the + constructor can not return a result, callers should check the + good() method after object construction to determine success + or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + */ + explicit GifImage(BasicIo::AutoPtr io); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + /*! + @brief Todo: Write metadata back to the image. This method is not + yet(?) implemented. Calling it will throw an Error(kerWritingImageFormatUnsupported). + */ + void writeMetadata(); + /*! + @brief Todo: Not supported yet(?). Calling this function will throw + an instance of Error(kerInvalidSettingForImage). + */ + void setExifData(const ExifData& exifData); + /*! + @brief Todo: Not supported yet(?). Calling this function will throw + an instance of Error(kerInvalidSettingForImage). + */ + void setIptcData(const IptcData& iptcData); + /*! + @brief Not supported. Calling this function will throw an instance + of Error(kerInvalidSettingForImage). + */ + void setComment(const std::string& comment); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + //@} + + }; // class GifImage + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new GifImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newGifInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a GIF image. + EXIV2API bool isGifType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef GIFIMAGE_HPP_ diff --git a/include/exiv2/http.hpp b/include/exiv2/http.hpp new file mode 100644 index 0000000..e0c08c7 --- /dev/null +++ b/include/exiv2/http.hpp @@ -0,0 +1,22 @@ +#ifndef HTTP_HPP_ +#define HTTP_HPP_ + +#include "exiv2lib_export.h" + +#include "datasets.hpp" + +#include + + +namespace Exiv2 { + /*! + @brief execute an HTTP request + @param request - a Dictionary of headers to send to server + @param response - a Dictionary of response headers (dictionary is filled by the response) + @param errors - a String with an error + @return Server response 200 = OK, 404 = Not Found etc... + */ + EXIV2API int http(Exiv2::Dictionary& request,Exiv2::Dictionary& response,std::string& errors); +} + +#endif diff --git a/include/exiv2/image.hpp b/include/exiv2/image.hpp new file mode 100644 index 0000000..7b0ac55 --- /dev/null +++ b/include/exiv2/image.hpp @@ -0,0 +1,731 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file image.hpp + */ +#ifndef IMAGE_HPP_ +#define IMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "basicio.hpp" +#include "exif.hpp" +#include "iptc.hpp" +#include "xmp_exiv2.hpp" + +// + standard includes +#include +#include + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + //! Supported image formats + namespace ImageType { + const int none = 0; //!< Not an image + } + + //! Native preview information. This is meant to be used only by the PreviewManager. + struct NativePreview { + long position_; //!< Position + uint32_t size_; //!< Size + uint32_t width_; //!< Width + uint32_t height_; //!< Height + std::string filter_; //!< Filter + std::string mimeType_; //!< MIME type + }; + + //! List of native previews. This is meant to be used only by the PreviewManager. + typedef std::vector NativePreviewList; + + /*! + @brief Options for printStructure + */ + typedef enum { kpsNone, kpsBasic, kpsXMP, kpsRecursive + , kpsIccProfile , kpsIptcErase + } PrintStructureOption; + + /*! + @brief Abstract base class defining the interface for an image. This is + the top-level interface to the Exiv2 library. + + Image has containers to store image metadata and subclasses implement + read and save metadata from and to specific image formats.
+ Most client apps will obtain an Image instance by calling a static + ImageFactory method. The Image class can then be used to to read, write, + and save metadata. + */ + class EXIV2API Image { + public: + //! Image auto_ptr type + typedef std::auto_ptr AutoPtr; + + //! @name Creators + //@{ + /*! + @brief Constructor taking the image type, a bitmap of the supported + metadata types and an auto-pointer that owns an IO instance. + See subclass constructor doc. + */ + Image(int imageType, + uint16_t supportedMetadata, + BasicIo::AutoPtr io); + //! Virtual Destructor + virtual ~Image(); + //@} + + //! @name Manipulators + //@{ + /*! + @brief Print out the structure of image file. + @throw Error if reading of the file fails or the image data is + not valid (does not look like data of the specific image type). + @warning This function is not thread safe and intended for exiv2 -pS for debugging. + @warning You may need to put the stream into binary mode (see src/actions.cpp) + */ + virtual void printStructure(std::ostream& out, PrintStructureOption option =kpsNone, int depth=0); + /*! + @brief Read all metadata supported by a specific image format from the + image. Before this method is called, the image metadata will be + cleared. + + This method returns success even if no metadata is found in the + image. Callers must therefore check the size of individual metadata + types before accessing the data. + + @throw Error if opening or reading of the file fails or the image + data is not valid (does not look like data of the specific image + type). + */ + virtual void readMetadata() =0; + /*! + @brief Write metadata back to the image. + + All existing metadata sections in the image are either created, + replaced, or erased. If values for a given metadata type have been + assigned, a section for that metadata type will either be created or + replaced. If no values have been assigned to a given metadata type, + any exists section for that metadata type will be removed from the + image. + + @throw Error if the operation fails + */ + virtual void writeMetadata() =0; + /*! + @brief Assign new Exif data. The new Exif data is not written + to the image until the writeMetadata() method is called. + @param exifData An ExifData instance holding Exif data to be copied + */ + virtual void setExifData(const ExifData& exifData); + /*! + @brief Erase any buffered Exif data. Exif data is not removed from + the actual image until the writeMetadata() method is called. + */ + virtual void clearExifData(); + /*! + @brief Assign new IPTC data. The new IPTC data is not written + to the image until the writeMetadata() method is called. + @param iptcData An IptcData instance holding IPTC data to be copied + */ + virtual void setIptcData(const IptcData& iptcData); + /*! + @brief Erase any buffered IPTC data. IPTC data is not removed from + the actual image until the writeMetadata() method is called. + */ + virtual void clearIptcData(); + /*! + @brief Assign a raw XMP packet. The new XMP packet is not written + to the image until the writeMetadata() method is called. + + Subsequent calls to writeMetadata() write the XMP packet from + the buffered raw XMP packet rather than from buffered parsed XMP + data. In order to write from parsed XMP data again, use + either writeXmpFromPacket(false) or setXmpData(). + + @param xmpPacket A string containing the raw XMP packet. + */ + virtual void setXmpPacket(const std::string& xmpPacket); + /*! + @brief Erase the buffered XMP packet. XMP data is not removed from + the actual image until the writeMetadata() method is called. + + This has the same effect as clearXmpData() but operates on the + buffered raw XMP packet only, not the parsed XMP data. + + Subsequent calls to writeMetadata() write the XMP packet from + the buffered raw XMP packet rather than from buffered parsed XMP + data. In order to write from parsed XMP data again, use + either writeXmpFromPacket(false) or setXmpData(). + */ + virtual void clearXmpPacket(); + /*! + @brief Assign new XMP data. The new XMP data is not written + to the image until the writeMetadata() method is called. + + Subsequent calls to writeMetadata() encode the XMP data to + a raw XMP packet and write the newly encoded packet to the image. + In the process, the buffered raw XMP packet is updated. + In order to write directly from the raw XMP packet, use + writeXmpFromPacket(true) or setXmpPacket(). + + @param xmpData An XmpData instance holding XMP data to be copied + */ + virtual void setXmpData(const XmpData& xmpData); + /*! + @brief Erase any buffered XMP data. XMP data is not removed from + the actual image until the writeMetadata() method is called. + + This has the same effect as clearXmpPacket() but operates on the + buffered parsed XMP data. + + Subsequent calls to writeMetadata() encode the XMP data to + a raw XMP packet and write the newly encoded packet to the image. + In the process, the buffered raw XMP packet is updated. + In order to write directly from the raw XMP packet, use + writeXmpFromPacket(true) or setXmpPacket(). + */ + virtual void clearXmpData(); + /*! + @brief Set the image comment. The new comment is not written + to the image until the writeMetadata() method is called. + @param comment String containing comment. + */ + virtual void setComment(const std::string& comment); + /*! + @brief Erase any buffered comment. Comment is not removed + from the actual image until the writeMetadata() method is called. + */ + virtual void clearComment(); + /*! + @brief Set the image iccProfile. The new profile is not written + to the image until the writeMetadata() method is called. + @param iccProfile DataBuf containing profile (binary) + @param bTestValid - tests that iccProfile contains credible data + */ + virtual void setIccProfile(DataBuf& iccProfile,bool bTestValid=true); + /*! + @brief Erase iccProfile. the profile is not removed from + the actual image until the writeMetadata() method is called. + */ + virtual void clearIccProfile(); + /*! + @brief Erase iccProfile. the profile is not removed from + the actual image until the writeMetadata() method is called. + */ + virtual bool iccProfileDefined() { return iccProfile_.size_?true:false;} + + /*! + @brief return iccProfile + */ + virtual DataBuf* iccProfile() { return &iccProfile_; } + /*! + @brief Copy all existing metadata from source Image. The data is + copied into internal buffers and is not written to the image + until the writeMetadata() method is called. + @param image Metadata source. All metadata types are copied. + */ + virtual void setMetadata(const Image& image); + /*! + @brief Erase all buffered metadata. Metadata is not removed + from the actual image until the writeMetadata() method is called. + */ + virtual void clearMetadata(); + /*! + @brief Returns an ExifData instance containing currently buffered + Exif data. + + The contained Exif data may have been read from the image by + a previous call to readMetadata() or added directly. The Exif + data in the returned instance will be written to the image when + writeMetadata() is called. + + @return modifiable ExifData instance containing Exif values + */ + virtual ExifData& exifData(); + /*! + @brief Returns an IptcData instance containing currently buffered + IPTC data. + + The contained IPTC data may have been read from the image by + a previous call to readMetadata() or added directly. The IPTC + data in the returned instance will be written to the image when + writeMetadata() is called. + + @return modifiable IptcData instance containing IPTC values + */ + virtual IptcData& iptcData(); + /*! + @brief Returns an XmpData instance containing currently buffered + XMP data. + + The contained XMP data may have been read from the image by + a previous call to readMetadata() or added directly. The XMP + data in the returned instance will be written to the image when + writeMetadata() is called. + + @return modifiable XmpData instance containing XMP values + */ + virtual XmpData& xmpData(); + /*! + @brief Return a modifiable reference to the raw XMP packet. + */ + virtual std::string& xmpPacket(); + /*! + @brief Determine the source when writing XMP. + + Depending on the setting of this flag, writeMetadata() writes + XMP from the buffered raw XMP packet or from parsed XMP data. + The default is to write from parsed XMP data. The switch is also + set by all functions to set and clear the buffered raw XMP packet + and parsed XMP data, so using this function should usually not be + necessary. + + If %Exiv2 was compiled without XMP support, the default for this + flag is true and it will never be changed in order to preserve + access to the raw XMP packet. + */ + void writeXmpFromPacket(bool flag); + /*! + @brief Set the byte order to encode the Exif metadata in. + + The setting is only used when new Exif metadata is created and may + not be applicable at all for some image formats. If the target image + already contains Exif metadata, the byte order of the existing data + is used. If byte order is not set when writeMetadata() is called, + little-endian byte order (II) is used by default. + */ + void setByteOrder(ByteOrder byteOrder); + + /*! + @brief Print out the structure of image file. + @throw Error if reading of the file fails or the image data is + not valid (does not look like data of the specific image type). + */ + void printTiffStructure(BasicIo& io,std::ostream& out, PrintStructureOption option,int depth,size_t offset=0); + + /*! + @brief Print out the structure of a TIFF IFD + */ + void printIFDStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option,uint32_t start,bool bSwap,char c,int depth); + + /*! + @brief is the host platform bigEndian + */ + bool isBigEndianPlatform(); + + /*! + @brief is the host platform littleEndian + */ + bool isLittleEndianPlatform(); + + bool isStringType(uint16_t type); + bool isShortType(uint16_t type); + bool isLongType(uint16_t type); + bool isLongLongType(uint16_t type); + bool isRationalType(uint16_t type); + bool is2ByteType(uint16_t type); + bool is4ByteType(uint16_t type); + bool is8ByteType(uint16_t type); + bool isPrintXMP(uint16_t type, Exiv2::PrintStructureOption option); + bool isPrintICC(uint16_t type, Exiv2::PrintStructureOption option); + + uint64_t byteSwap(uint64_t value,bool bSwap) const; + uint32_t byteSwap(uint32_t value,bool bSwap) const; + uint16_t byteSwap(uint16_t value,bool bSwap) const; + uint16_t byteSwap2(const DataBuf& buf,size_t offset,bool bSwap) const; + uint32_t byteSwap4(const DataBuf& buf,size_t offset,bool bSwap) const; + uint64_t byteSwap8(const DataBuf& buf,size_t offset,bool bSwap) const; + + //@} + + //! @name Accessors + //@{ + /*! + @brief Return the byte order in which the Exif metadata of the image is + encoded. Initially, it is not set (\em invalidByteOrder). + */ + ByteOrder byteOrder() const; + /*! + @brief Check if the Image instance is valid. Use after object + construction. + @return true if the Image is in a valid state. + */ + bool good() const; + /*! + @brief Return the MIME type of the image. + + @note For each supported image format, the library knows only one MIME + type. This may not be the most specific MIME type for that format. In + particular, several RAW formats are variants of the TIFF format with + the same magic as TIFF itself. Class TiffImage handles most of them + and thus they all have MIME type "image/tiff", although a more + specific MIME type may exist (e.g., "image/x-nikon-nef"). + */ + virtual std::string mimeType() const =0; + /*! + @brief Return the pixel width of the image. + */ + virtual int pixelWidth() const; + /*! + @brief Return the pixel height of the image. + */ + virtual int pixelHeight() const; + /*! + @brief Returns an ExifData instance containing currently buffered + Exif data. + + The Exif data may have been read from the image by + a previous call to readMetadata() or added directly. The Exif + data in the returned instance will be written to the image when + writeMetadata() is called. + + @return read only ExifData instance containing Exif values + */ + virtual const ExifData& exifData() const; + /*! + @brief Returns an IptcData instance containing currently buffered + IPTC data. + + The contained IPTC data may have been read from the image by + a previous call to readMetadata() or added directly. The IPTC + data in the returned instance will be written to the image when + writeMetadata() is called. + + @return modifiable IptcData instance containing IPTC values + */ + virtual const IptcData& iptcData() const; + /*! + @brief Returns an XmpData instance containing currently buffered + XMP data. + + The contained XMP data may have been read from the image by + a previous call to readMetadata() or added directly. The XMP + data in the returned instance will be written to the image when + writeMetadata() is called. + + @return modifiable XmpData instance containing XMP values + */ + virtual const XmpData& xmpData() const; + /*! + @brief Return a copy of the image comment. May be an empty string. + */ + virtual std::string comment() const; + /*! + @brief Return the raw XMP packet as a string. + */ + virtual const std::string& xmpPacket() const; + /*! + @brief Return a reference to the BasicIo instance being used for Io. + + This refence is particularly useful to reading the results of + operations on a MemIo instance. For example after metadata has + been modified and the writeMetadata() method has been called, + this method can be used to get access to the modified image. + + @return BasicIo instance that can be used to read or write image + data directly. + @note If the returned BasicIo is used to write to the image, the + Image class will not see those changes until the readMetadata() + method is called. + */ + virtual BasicIo& io() const; + /*! + @brief Returns the access mode, i.e., the metadata functions, which + this image supports for the metadata type \em metadataId. + @param metadataId The metadata identifier. + @return Access mode for the requested image type and metadata identifier. + */ + AccessMode checkMode(MetadataId metadataId) const; + /*! + @brief Check if image supports a particular type of metadata. + This method is deprecated. Use checkMode() instead. + */ + bool supportsMetadata(MetadataId metadataId) const; + //! Return the flag indicating the source when writing XMP metadata. + bool writeXmpFromPacket() const; + //! Return list of native previews. This is meant to be used only by the PreviewManager. + const NativePreviewList& nativePreviews() const; + //@} + + //! set type support for this image format + void setTypeSupported( + int imageType, + uint16_t supportedMetadata + ) { + imageType_ = imageType; + supportedMetadata_ = supportedMetadata; + } + + //! set type support for this image format + int imageType() const { return imageType_; } + + protected: + // DATA + BasicIo::AutoPtr io_; //!< Image data IO pointer + ExifData exifData_; //!< Exif data container + IptcData iptcData_; //!< IPTC data container + XmpData xmpData_; //!< XMP data container + DataBuf iccProfile_; //!< ICC buffer (binary data) + std::string comment_; //!< User comment + std::string xmpPacket_; //!< XMP packet + int pixelWidth_; //!< image pixel width + int pixelHeight_; //!< image pixel height + NativePreviewList nativePreviews_; //!< list of native previews + + //! Return tag name for given tag id. + const std::string& tagName(uint16_t tag); + + //! Return tag type for given tag id. + const char* typeName(uint16_t tag) const; + + private: + //! @name NOT implemented + //@{ + //! Copy constructor + Image(const Image& rhs); + //! Assignment operator + Image& operator=(const Image& rhs); + //@} + + // DATA + int imageType_; //!< Image type + uint16_t supportedMetadata_; //!< Bitmap with all supported metadata types + bool writeXmpFromPacket_;//!< Determines the source when writing XMP + ByteOrder byteOrder_; //!< Byte order + + std::map tags_; //!< Map of tags + bool init_; //!< Flag marking if map of tags needs to be initialized + + }; // class Image + + //! Type for function pointer that creates new Image instances + typedef Image::AutoPtr (*NewInstanceFct)(BasicIo::AutoPtr io, bool create); + //! Type for function pointer that checks image types + typedef bool (*IsThisTypeFct)(BasicIo& iIo, bool advance); + + /*! + @brief Returns an Image instance of the specified type. + + The factory is implemented as a static class. + */ + class EXIV2API ImageFactory { + friend bool Image::good() const; + public: + /*! + @brief Create the appropriate class type implemented BasicIo based on the protocol of the input. + + "-" path implies the data from stdin and it is handled by StdinIo. + Http path can be handled by either HttpIo or CurlIo. Https, ftp paths + are handled by CurlIo. Ssh, sftp paths are handled by SshIo. Others are handled by FileIo. + + @param path %Image file. + @param useCurl Indicate whether the libcurl is used or not. + If it's true, http is handled by CurlIo. Otherwise it is handled by HttpIo. + @return An auto-pointer that owns an BasicIo instance. + @throw Error If the file is not found or it is unable to connect to the server to + read the remote file. + */ + static BasicIo::AutoPtr createIo(const std::string& path, bool useCurl = true); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like createIo() but accepts a unicode path in an std::wstring. + @note This function is only available on Windows. + */ + static BasicIo::AutoPtr createIo(const std::wstring& wpath, bool useCurl = true); +#endif + /*! + @brief Create an Image subclass of the appropriate type by reading + the specified file. %Image type is derived from the file + contents. + @param path %Image file. The contents of the file are tested to + determine the image type. File extension is ignored. + @param useCurl Indicate whether the libcurl is used or not. + If it's true, http is handled by CurlIo. Otherwise it is handled by HttpIo. + @return An auto-pointer that owns an Image instance whose type + matches that of the file. + @throw Error If opening the file fails or it contains data of an + unknown image type. + */ + static Image::AutoPtr open(const std::string& path, bool useCurl = true); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like open() but accepts a unicode path in an std::wstring. + @note This function is only available on Windows. + */ + static Image::AutoPtr open(const std::wstring& wpath, bool useCurl = true); +#endif + /*! + @brief Create an Image subclass of the appropriate type by reading + the provided memory. %Image type is derived from the memory + contents. + @param data Pointer to a data buffer containing an image. The contents + of the memory are tested to determine the image type. + @param size Number of bytes pointed to by \em data. + @return An auto-pointer that owns an Image instance whose type + matches that of the data buffer. + @throw Error If the memory contains data of an unknown image type. + */ + static Image::AutoPtr open(const byte* data, long size); + /*! + @brief Create an Image subclass of the appropriate type by reading + the provided BasicIo instance. %Image type is derived from the + data provided by \em io. The passed in \em io instance is + (re)opened by this method. + @param io An auto-pointer that owns a BasicIo instance that provides + image data. The contents of the image data are tested to determine + the type. + @note This method takes ownership of the passed + in BasicIo instance through the auto-pointer. Callers should not + continue to use the BasicIo instance after it is passed to this method. + Use the Image::io() method to get a temporary reference. + @return An auto-pointer that owns an Image instance whose type + matches that of the \em io data. If no image type could be + determined, the pointer is 0. + @throw Error If opening the BasicIo fails + */ + static Image::AutoPtr open(BasicIo::AutoPtr io); + /*! + @brief Create an Image subclass of the requested type by creating a + new image file. If the file already exists, it will be overwritten. + @param type Type of the image to be created. + @param path %Image file to create. File extension is ignored. + @return An auto-pointer that owns an Image instance of the requested + type. + @throw Error If the image type is not supported. + */ + static Image::AutoPtr create(int type, const std::string& path); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like create() but accepts a unicode path in an std::wstring. + @note This function is only available on Windows. + */ + static Image::AutoPtr create(int type, const std::wstring& wpath); +#endif + /*! + @brief Create an Image subclass of the requested type by creating a + new image in memory. + @param type Type of the image to be created. + @return An auto-pointer that owns an Image instance of the requested + type. + @throw Error If the image type is not supported + */ + static Image::AutoPtr create(int type); + /*! + @brief Create an Image subclass of the requested type by writing a + new image to a BasicIo instance. If the BasicIo instance already + contains data, it will be overwritten. + @param type Type of the image to be created. + @param io An auto-pointer that owns a BasicIo instance that will + be written to when creating a new image. + @note This method takes ownership of the passed in BasicIo instance + through the auto-pointer. Callers should not continue to use the + BasicIo instance after it is passed to this method. Use the + Image::io() method to get a temporary reference. + @return An auto-pointer that owns an Image instance of the requested + type. If the image type is not supported, the pointer is 0. + */ + static Image::AutoPtr create(int type, BasicIo::AutoPtr io); + /*! + @brief Returns the image type of the provided file. + @param path %Image file. The contents of the file are tested to + determine the image type. File extension is ignored. + @return %Image type or Image::none if the type is not recognized. + */ + static int getType(const std::string& path); +#ifdef EXV_UNICODE_PATH + /*! + @brief Like getType() but accepts a unicode path in an std::wstring. + @note This function is only available on Windows. + */ + static int getType(const std::wstring& wpath); +#endif + /*! + @brief Returns the image type of the provided data buffer. + @param data Pointer to a data buffer containing an image. The contents + of the memory are tested to determine the image type. + @param size Number of bytes pointed to by \em data. + @return %Image type or Image::none if the type is not recognized. + */ + static int getType(const byte* data, long size); + /*! + @brief Returns the image type of data provided by a BasicIo instance. + The passed in \em io instance is (re)opened by this method. + @param io A BasicIo instance that provides image data. The contents + of the image data are tested to determine the type. + @return %Image type or Image::none if the type is not recognized. + */ + static int getType(BasicIo& io); + /*! + @brief Returns the access mode or supported metadata functions for an + image type and a metadata type. + @param type The image type. + @param metadataId The metadata identifier. + @return Access mode for the requested image type and metadata identifier. + @throw Error(kerUnsupportedImageType) if the image type is not supported. + */ + static AccessMode checkMode(int type, MetadataId metadataId); + /*! + @brief Determine if the content of \em io is an image of \em type. + + The \em advance flag determines if the read position in the + stream is moved (see below). This applies only if the type + matches and the function returns true. If the type does not + match, the stream position is not changed. However, if + reading from the stream fails, the stream position is + undefined. Consult the stream state to obtain more + information in this case. + + @param type Type of the image. + @param io BasicIo instance to read from. + @param advance Flag indicating whether the position of the io + should be advanced by the number of characters read to + analyse the data (true) or left at its original + position (false). This applies only if the type matches. + @return true if the data matches the type of this class;
+ false if the data does not match + */ + static bool checkType(int type, BasicIo& io, bool advance); + + private: + //! @name Creators + //@{ + //! Prevent construction: not implemented. + ImageFactory(); + //! Prevent copy construction: not implemented. + ImageFactory(const ImageFactory& rhs); + //@} + + }; // class ImageFactory + +// ***************************************************************************** +// template, inline and free functions + + //! Append \em len bytes pointed to by \em buf to \em blob. + EXIV2API void append(Exiv2::Blob& blob, const byte* buf, uint32_t len); + +} // namespace Exiv2 + +#endif // #ifndef IMAGE_HPP_ diff --git a/include/exiv2/ini.hpp b/include/exiv2/ini.hpp new file mode 100755 index 0000000..17d544b --- /dev/null +++ b/include/exiv2/ini.hpp @@ -0,0 +1,205 @@ +// Read an INI file into easy-to-access name/value pairs. + +// inih and INIReader are released under the New BSD license (see LICENSE.txt). +// Go to the project home page for more info: +// +// https://github.com/benhoyt/inih + +#ifndef __INIREADER_H__ +#define __INIREADER_H__ + +#include "exiv2lib_export.h" + +#include +#include +#include + +namespace Exiv2 { + +/* inih -- simple .INI file parser + +inih is released under the New BSD license (see LICENSE.txt). Go to the project +home page for more info: + +https://github.com/benhoyt/inih + +*/ + +#ifndef __INI_H__ +#define __INI_H__ + +/* Make this header file easier to include in C++ code */ +#ifdef __cplusplus +extern "C" { +#endif + +//! @brief typedef for prototype of handler function. +typedef int (*ini_handler)(void* user, const char* section, + const char* name, const char* value); + +//! Typedef for prototype of fgets-style reader function. +typedef char* (*ini_reader)(char* str, int num, void* stream); + +/*! + @brief Parse given INI-style file. May have [section]s, name=value pairs + (whitespace stripped), and comments starting with ';' (semicolon). Section + is "" if name=value pair parsed before any section heading. name:value + pairs are also supported as a concession to Python's configparser. + + For each name=value pair parsed, call handler function with given user + pointer as well as section, name, and value (data only valid for duration + of handler call). Handler should return nonzero on success, zero on error. + + @param filename path to file + @param handler user defined handler + @param user void pointer passed to user handler + + @return 0 on success, line number of first error on parse error (doesn't + stop on first error), -1 on file open error, or -2 on memory allocation + error (only when INI_USE_STACK is zero). + + @return 0 on success +*/ +int ini_parse(const char* filename, ini_handler handler, void* user); + +/*! @brief Same as ini_parse(), but takes a FILE* instead of filename. This doesn't + close the file when it's finished -- the caller must do that. + + @param file open "C" file + @param handler user defined handler + @param user void pointer passed to user handler + */ +int ini_parse_file(FILE* file, ini_handler handler, void* user); + +/*! @brief Same as ini_parse(), but takes an ini_reader function pointer instead of + filename. Used for implementing custom or string-based I/O. + @param reader magic + @param stream more magic + @param handler user defined handler + @param user void pointer passed to user handler + + @return 0 on success +*/ +int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler, + void* user); + +/*! @brief Nonzero to allow multi-line value parsing, in the style of Python's + configparser. If allowed, ini_parse() will call the handler with the same + name for each subsequent line parsed. +*/ +#ifndef INI_ALLOW_MULTILINE +#define INI_ALLOW_MULTILINE 1 +#endif + +/*! @brief Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of + the file. See http://code.google.com/p/inih/issues/detail?id=21 +*/ +#ifndef INI_ALLOW_BOM +#define INI_ALLOW_BOM 1 +#endif + +/*! @brief Nonzero to allow inline comments (with valid inline comment characters + specified by INI_INLINE_COMMENT_PREFIXES). Set to 0 to turn off and match + Python 3.2+ configparser behaviour. +*/ +#ifndef INI_ALLOW_INLINE_COMMENTS +#define INI_ALLOW_INLINE_COMMENTS 1 +#endif +#ifndef INI_INLINE_COMMENT_PREFIXES +#define INI_INLINE_COMMENT_PREFIXES ";" +#endif + +//! @brief Nonzero to use stack, zero to use heap (malloc/free). +#ifndef INI_USE_STACK +#define INI_USE_STACK 1 +#endif + +//! @brief Stop parsing on first error (default is to keep parsing). +#ifndef INI_STOP_ON_FIRST_ERROR +#define INI_STOP_ON_FIRST_ERROR 0 +#endif + +//! @brief Maximum line length for any line in INI file. +#ifndef INI_MAX_LINE +#define INI_MAX_LINE 200 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INI_H__ */ + + +/*! @brief Read an INI file into easy-to-access name/value pairs. (Note that I've gone + for simplicity here rather than speed, but it should be pretty decent.) + */ +class EXIV2API INIReader +{ +public: + /*! @brief Construct INIReader and parse given filename. See ini.h for more info + about the parsing. + */ + explicit INIReader(const std::string& filename); + + /*! @brief Return the result of ini_parse(), i.e., 0 on success, line number of + first error on parse error, or -1 on file open error. + */ + int ParseError(); + + /*! @brief Get a string value from INI file, returning default_value if not found. + + @param section name of section + @param name name of key + @param default_value default if not found + + @return value + */ + std::string Get(std::string section, std::string name, + std::string default_value); + + /*! @brief Get an integer (long) value from INI file, returning default_value if + not found or not a valid integer (decimal "1234", "-1234", or hex "0x4d2"). + + @param section name of section + @param name name of key + @param default_value default if not found + + @return value + */ + long GetInteger(std::string section, std::string name, long default_value); + + /*! @brief Get a real (floating point double) value from INI file, returning + default_value if not found or not a valid floating point value + according to strtod(). + + @param section name of section + @param name name of key + @param default_value default if not found + + @return value + */ + double GetReal(std::string section, std::string name, double default_value); + + /*! @brief Get a boolean value from INI file, returning default_value if not found or if + not a valid true/false value. Valid true values are "true", "yes", "on", "1", + and valid false values are "false", "no", "off", "0" (not case sensitive). + + @param section name of section + @param name name of key + @param default_value default if not found + + @return value + */ + bool GetBoolean(std::string section, std::string name, bool default_value); + +private: + int _error; //!< status + std::map _values; //!< values from file + static std::string MakeKey(std::string section, std::string name); //!< return key encoded from section/name + static int ValueHandler(void* user, const char* section, const char* name, + const char* value); //!< value handler +}; +} // namespace Exiv2 + +#endif // __INIREADER_H__ diff --git a/include/exiv2/iptc.hpp b/include/exiv2/iptc.hpp new file mode 100644 index 0000000..add7413 --- /dev/null +++ b/include/exiv2/iptc.hpp @@ -0,0 +1,323 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file iptc.hpp + @brief Encoding and decoding of IPTC data + @author Brad Schick (brad) + brad@robotbattle.com + @date 31-Jul-04, brad: created + */ +#ifndef IPTC_HPP_ +#define IPTC_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "metadatum.hpp" +#include "datasets.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class declarations + class ExifData; + +// ***************************************************************************** +// class definitions + + /*! + @brief An IPTC metadatum ("dataset"), consisting of an IptcKey and a + Value and methods to manipulate these. + */ + class EXIV2API Iptcdatum : public Metadatum { + public: + //! @name Creators + //@{ + /*! + @brief Constructor for new tags created by an application. The + %Iptcdatum is created from a key / value pair. %Iptcdatum + copies (clones) the value if one is provided. Alternatively, a + program can create an 'empty' %Iptcdatum with only a key and + set the value using setValue(). + + @param key The key of the %Iptcdatum. + @param pValue Pointer to a %Iptcdatum value. + @throw Error if the key cannot be parsed and converted + to a tag number and record id. + */ + explicit Iptcdatum(const IptcKey& key, + const Value* pValue =0); + //! Copy constructor + Iptcdatum(const Iptcdatum& rhs); + //! Destructor + virtual ~Iptcdatum(); + //@} + + //! @name Manipulators + //@{ + //! Assignment operator + Iptcdatum& operator=(const Iptcdatum& rhs); + /*! + @brief Assign \em value to the %Iptcdatum. The type of the new Value + is set to UShortValue. + */ + Iptcdatum& operator=(const uint16_t& value); + /*! + @brief Assign \em value to the %Iptcdatum. + Calls setValue(const std::string&). + */ + Iptcdatum& operator=(const std::string& value); + /*! + @brief Assign \em value to the %Iptcdatum. + Calls setValue(const Value*). + */ + Iptcdatum& operator=(const Value& value); + void setValue(const Value* pValue); + /*! + @brief Set the value to the string \em value, using + Value::read(const std::string&). + If the %Iptcdatum does not have a Value yet, then a %Value of + the correct type for this %Iptcdatum is created. If that + fails (because of an unknown dataset), a StringValue is + created. Return 0 if the value was read successfully. + */ + int setValue(const std::string& value); + //@} + + //! @name Accessors + //@{ + long copy(byte* buf, ByteOrder byteOrder) const; + std::ostream& write(std::ostream& os, const ExifData* pMetadata =0) const; + /*! + @brief Return the key of the Iptcdatum. The key is of the form + 'Iptc.recordName.datasetName'. Note however that the key + is not necessarily unique, i.e., an IptcData object may contain + multiple metadata with the same key. + */ + std::string key() const; + /*! + @brief Return the name of the record (deprecated) + @return record name + */ + std::string recordName() const; + /*! + @brief Return the record id + @return record id + */ + uint16_t record() const; + const char* familyName() const; + std::string groupName() const; + /*! + @brief Return the name of the tag (aka dataset) + @return tag name + */ + std::string tagName() const; + std::string tagLabel() const; + //! Return the tag (aka dataset) number + uint16_t tag() const; + TypeId typeId() const; + const char* typeName() const; + long typeSize() const; + long count() const; + long size() const; + std::string toString() const; + std::string toString(long n) const; + long toLong(long n =0) const; + float toFloat(long n =0) const; + Rational toRational(long n =0) const; + Value::AutoPtr getValue() const; + const Value& value() const; + //@} + + private: + // DATA + IptcKey::AutoPtr key_; //!< Key + Value::AutoPtr value_; //!< Value + + }; // class Iptcdatum + + //! Container type to hold all metadata + typedef std::vector IptcMetadata; + + /*! + @brief A container for IPTC data. This is a top-level class of + the %Exiv2 library. + + Provide high-level access to the IPTC data of an image: + - read IPTC information from JPEG files + - access metadata through keys and standard C++ iterators + - add, modify and delete metadata + - write IPTC data to JPEG files + - extract IPTC metadata to files, insert from these files + */ + class EXIV2API IptcData { + public: + //! IptcMetadata iterator type + typedef IptcMetadata::iterator iterator; + //! IptcMetadata const iterator type + typedef IptcMetadata::const_iterator const_iterator; + + // Use the compiler generated constructors and assignment operator + + //! @name Manipulators + //@{ + /*! + @brief Returns a reference to the %Iptcdatum that is associated with a + particular \em key. If %IptcData does not already contain such + an %Iptcdatum, operator[] adds object \em Iptcdatum(key). + + @note Since operator[] might insert a new element, it can't be a const + member function. + */ + Iptcdatum& operator[](const std::string& key); + /*! + @brief Add an %Iptcdatum from the supplied key and value pair. This + method copies (clones) the value. A check for non-repeatable + datasets is performed. + @return 0 if successful;
+ 6 if the dataset already exists and is not repeatable + */ + int add(const IptcKey& key, Value* value); + /*! + @brief Add a copy of the Iptcdatum to the IPTC metadata. A check + for non-repeatable datasets is performed. + @return 0 if successful;
+ 6 if the dataset already exists and is not repeatable;
+ */ + int add(const Iptcdatum& iptcdatum); + /*! + @brief Delete the Iptcdatum at iterator position pos, return the + position of the next Iptcdatum. Note that iterators into + the metadata, including pos, are potentially invalidated + by this call. + */ + iterator erase(iterator pos); + /*! + @brief Delete all Iptcdatum instances resulting in an empty container. + */ + void clear() { iptcMetadata_.clear(); } + //! Sort metadata by key + void sortByKey(); + //! Sort metadata by tag (aka dataset) + void sortByTag(); + //! Begin of the metadata + iterator begin() { return iptcMetadata_.begin(); } + //! End of the metadata + iterator end() { return iptcMetadata_.end(); } + /*! + @brief Find the first Iptcdatum with the given key, return an iterator + to it. + */ + iterator findKey(const IptcKey& key); + /*! + @brief Find the first Iptcdatum with the given record and dataset it, + return a const iterator to it. + */ + iterator findId(uint16_t dataset, + uint16_t record = IptcDataSets::application2); + //@} + + //! @name Accessors + //@{ + //! Begin of the metadata + const_iterator begin() const { return iptcMetadata_.begin(); } + //! End of the metadata + const_iterator end() const { return iptcMetadata_.end(); } + /*! + @brief Find the first Iptcdatum with the given key, return a const + iterator to it. + */ + const_iterator findKey(const IptcKey& key) const; + /*! + @brief Find the first Iptcdatum with the given record and dataset + number, return a const iterator to it. + */ + const_iterator findId(uint16_t dataset, + uint16_t record = IptcDataSets::application2) const; + //! Return true if there is no IPTC metadata + bool empty() const { return count() == 0; } + //! Get the number of metadata entries + long count() const { return static_cast(iptcMetadata_.size()); } + /*! + @brief Return the exact size of all contained IPTC metadata + */ + long size() const; + /*! + @brief Return the metadata charset name or 0 + */ + const char *detectCharset() const; + /*! + @brief dump iptc formatted binary data (used by printStructure kpsRecursive) + */ + static void printStructure(std::ostream& out, const Slice& bytes,uint32_t depth); + //@} + + private: + // DATA + IptcMetadata iptcMetadata_; + }; // class IptcData + + /*! + @brief Stateless parser class for IPTC data. Images use this class to + decode and encode binary IPTC data. + */ + class EXIV2API IptcParser { + public: + /*! + @brief Decode binary IPTC data in IPTC IIM4 format from a buffer \em pData + of length \em size to the provided metadata container. + + @param iptcData Metadata container to add the decoded IPTC datasets to. + @param pData Pointer to the data buffer to read from. + @param size Number of bytes in the data buffer. + + @return 0 if successful;
+ 5 if the binary IPTC data is invalid or corrupt + */ + static int decode( + IptcData& iptcData, + const byte* pData, + uint32_t size + ); + /*! + @brief Encode the IPTC datasets from \em iptcData to a binary + representation in IPTC IIM4 format. + + Convert the IPTC datasets to binary format and return it. Caller owns + the returned buffer. The copied data follows the IPTC IIM4 standard. + + @return Data buffer containing the binary IPTC data in IPTC IIM4 format. + */ + static DataBuf encode( + const IptcData& iptcData + ); + + private: + // Constant data + static const byte marker_; // Dataset marker + + }; // class IptcParser + +} // namespace Exiv2 + +#endif // #ifndef IPTC_HPP_ diff --git a/include/exiv2/jp2image.hpp b/include/exiv2/jp2image.hpp new file mode 100644 index 0000000..308c76b --- /dev/null +++ b/include/exiv2/jp2image.hpp @@ -0,0 +1,140 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ + +/* + File: jp2image.cpp +*/ + +#ifndef JP2IMAGE_HPP_ +#define JP2IMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 +{ + +// ***************************************************************************** +// class definitions + + // Add JPEG-2000 to the supported image formats + namespace ImageType + { + const int jp2 = 15; //!< JPEG-2000 image type + } + + /*! + @brief Class to access JPEG-2000 images. + */ + class EXIV2API Jp2Image : public Image { + public: + //! @name Creators + //@{ + /*! + @brief Constructor to open a JPEG-2000 image. Since the + constructor can not return a result, callers should check the + good() method after object construction to determine success + or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + @param create Specifies if an existing image should be read (false) + or if a new file should be created (true). + */ + Jp2Image(BasicIo::AutoPtr io, bool create); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + void writeMetadata(); + + /*! + @brief Print out the structure of image file. + @throw Error if reading of the file fails or the image data is + not valid (does not look like data of the specific image type). + @warning This function is not thread safe and intended for exiv2 -pS for debugging. + */ + void printStructure(std::ostream& out, PrintStructureOption option,int depth); + + /*! + @brief Todo: Not supported yet(?). Calling this function will throw + an instance of Error(kerInvalidSettingForImage). + */ + void setComment(const std::string& comment); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + //@} + + private: + //! @name NOT Implemented + //@{ + //! Copy constructor + Jp2Image(const Jp2Image& rhs); + //! Assignment operator + Jp2Image& operator=(const Jp2Image& rhs); + /*! + @brief Provides the main implementation of writeMetadata() by + writing all buffered metadata to the provided BasicIo. + @param oIo BasicIo instance to write to (a temporary location). + + @return 4 if opening or writing to the associated BasicIo fails + */ + void doWriteMetadata(BasicIo& oIo); + + /*! + @brief reformats the Jp2Header to store iccProfile + @param oldData DataBufRef to data in the file. + @param newData DataBufRef with updated data + */ + void encodeJp2Header(const DataBuf& oldData,DataBuf& newData); + //@} + + }; // class Jp2Image + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new Jp2Image instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newJp2Instance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a JPEG-2000 image. + EXIV2API bool isJp2Type(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef JP2IMAGE_HPP_ diff --git a/include/exiv2/jpgimage.hpp b/include/exiv2/jpgimage.hpp new file mode 100644 index 0000000..27dd53b --- /dev/null +++ b/include/exiv2/jpgimage.hpp @@ -0,0 +1,438 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file jpgimage.hpp + @brief Class JpegImage to access JPEG images + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @author Brad Schick (brad) + brad@robotbattle.com + @author Volker Grabsch (vog) + vog@notjusthosting.com + @author Michael Ulbrich (mul) + mul@rentapacs.de + @date 15-Jan-05, brad: split out from image.cpp + */ +#ifndef JPGIMAGE_HPP_ +#define JPGIMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Supported JPEG image formats + namespace ImageType { + const int jpeg = 1; //!< JPEG image type (see class JpegImage) + const int exv = 2; //!< EXV image type (see class ExvImage) + } + + /*! + @brief Helper class, has methods to deal with %Photoshop "Information + Resource Blocks" (IRBs). + */ + struct EXIV2API Photoshop { + // Todo: Public for now + static const char ps3Id_[]; //!< %Photoshop marker + static const char* irbId_[]; //!< %Photoshop IRB markers + static const char bimId_[]; //!< %Photoshop IRB marker (deprecated) + static const uint16_t iptc_; //!< %Photoshop IPTC marker + static const uint16_t preview_; //!< %Photoshop preview marker + + /*! + @brief Checks an IRB + + @param pPsData Existing IRB buffer + @param sizePsData Size of the IRB buffer + @return true if the IRB marker is known and the buffer is big enough to check this;
+ false otherwise + */ + static bool isIrb(const byte* pPsData, + long sizePsData); + /*! + @brief Validates all IRBs + + @param pPsData Existing IRB buffer + @param sizePsData Size of the IRB buffer, may be 0 + @return true if all IRBs are valid;
+ false otherwise + */ + static bool valid(const byte* pPsData, + long sizePsData); + /*! + @brief Locates the data for a %Photoshop tag in a %Photoshop formated memory + buffer. Operates on raw data to simplify reuse. + @param pPsData Pointer to buffer containing entire payload of + %Photoshop formated data, e.g., from APP13 Jpeg segment. + @param sizePsData Size in bytes of pPsData. + @param psTag %Tag number of the block to look for. + @param record Output value that is set to the start of the + data block within pPsData (may not be null). + @param sizeHdr Output value that is set to the size of the header + within the data block pointed to by record (may not be null). + @param sizeData Output value that is set to the size of the actual + data within the data block pointed to by record (may not be null). + @return 0 if successful;
+ 3 if no data for psTag was found in pPsData;
+ -2 if the pPsData buffer does not contain valid data. + */ + static int locateIrb(const byte *pPsData, + long sizePsData, + uint16_t psTag, + const byte **record, + uint32_t *const sizeHdr, + uint32_t *const sizeData); + /*! + @brief Forwards to locateIrb() with \em psTag = \em iptc_ + */ + static int locateIptcIrb(const byte *pPsData, + long sizePsData, + const byte **record, + uint32_t *const sizeHdr, + uint32_t *const sizeData); + /*! + @brief Forwards to locatePreviewIrb() with \em psTag = \em preview_ + */ + static int locatePreviewIrb(const byte *pPsData, + long sizePsData, + const byte **record, + uint32_t *const sizeHdr, + uint32_t *const sizeData); + /*! + @brief Set the new IPTC IRB, keeps existing IRBs but removes the + IPTC block if there is no new IPTC data to write. + + @param pPsData Existing IRB buffer + @param sizePsData Size of the IRB buffer, may be 0 + @param iptcData Iptc data to embed, may be empty + @return A data buffer containing the new IRB buffer, may have 0 size + */ + static DataBuf setIptcIrb(const byte* pPsData, + long sizePsData, + const IptcData& iptcData); + + }; // class Photoshop + + /*! + @brief Abstract helper base class to access JPEG images. + */ + class EXIV2API JpegBase : public Image { + public: + //! @name Manipulators + //@{ + void readMetadata(); + void writeMetadata(); + + /*! + @brief Print out the structure of image file. + @throw Error if reading of the file fails or the image data is + not valid (does not look like data of the specific image type). + @warning This function is not thread safe and intended for exiv2 -pS for debugging. + */ + void printStructure(std::ostream& out, PrintStructureOption option,int depth); + //@} + + protected: + //! @name Creators + //@{ + /*! + @brief Constructor that can either open an existing image or create + a new image from scratch. If a new image is to be created, any + existing data is overwritten. + @param type Image type. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + @param create Specifies if an existing image should be read (false) + or if a new image should be created (true). + @param initData Data to initialize newly created images. Only used + when \em create is true. Should contain data for the smallest + valid image of the calling subclass. + @param dataSize Size of initData in bytes. + */ + JpegBase(int type, + BasicIo::AutoPtr io, + bool create, + const byte initData[], + long dataSize); + //@} + + //! @name Accessors + //@{ + /*! + @brief Determine if the content of the BasicIo instance is of the + type supported by this class. + + The advance flag determines if the read position in the stream is + moved (see below). This applies only if the type matches and the + function returns true. If the type does not match, the stream + position is not changed. However, if reading from the stream fails, + the stream position is undefined. Consult the stream state to obtain + more information in this case. + + @param iIo BasicIo instance to read from. + @param advance Flag indicating whether the position of the io + should be advanced by the number of characters read to + analyse the data (true) or left at its original + position (false). This applies only if the type matches. + @return true if the data matches the type of this class;
+ false if the data does not match + */ + virtual bool isThisType(BasicIo& iIo, bool advance) const =0; + //@} + + //! @name Manipulators + //@{ + /*! + @brief Writes the image header (aka signature) to the BasicIo instance. + @param oIo BasicIo instance that the header is written to. + @return 0 if successful;
+ 4 if the output file can not be written to + */ + virtual int writeHeader(BasicIo& oIo) const =0; + //@} + + // Constant Data + static const byte dht_; //!< JPEG DHT marker + static const byte dqt_; //!< JPEG DQT marker + static const byte dri_; //!< JPEG DRI marker + static const byte sos_; //!< JPEG SOS marker + static const byte eoi_; //!< JPEG EOI marker + static const byte app0_; //!< JPEG APP0 marker + static const byte app1_; //!< JPEG APP1 marker + static const byte app2_; //!< JPEG APP2 marker + static const byte app13_; //!< JPEG APP13 marker + static const byte com_; //!< JPEG Comment marker + static const byte sof0_; //!< JPEG Start-Of-Frame marker + static const byte sof1_; //!< JPEG Start-Of-Frame marker + static const byte sof2_; //!< JPEG Start-Of-Frame marker + static const byte sof3_; //!< JPEG Start-Of-Frame marker + static const byte sof5_; //!< JPEG Start-Of-Frame marker + static const byte sof6_; //!< JPEG Start-Of-Frame marker + static const byte sof7_; //!< JPEG Start-Of-Frame marker + static const byte sof9_; //!< JPEG Start-Of-Frame marker + static const byte sof10_; //!< JPEG Start-Of-Frame marker + static const byte sof11_; //!< JPEG Start-Of-Frame marker + static const byte sof13_; //!< JPEG Start-Of-Frame marker + static const byte sof14_; //!< JPEG Start-Of-Frame marker + static const byte sof15_; //!< JPEG Start-Of-Frame marker + static const char exifId_[]; //!< Exif identifier + static const char jfifId_[]; //!< JFIF identifier + static const char xmpId_[]; //!< XMP packet identifier + static const char iccId_[]; //!< ICC profile identifier + + private: + //! @name NOT implemented + //@{ + //! Default constructor. + JpegBase(); + //! Copy constructor + JpegBase(const JpegBase& rhs); + //! Assignment operator + JpegBase& operator=(const JpegBase& rhs); + //@} + + //! @name Manipulators + //@{ + /*! + @brief Initialize the image with the provided data. + @param initData Data to be written to the associated BasicIo + @param dataSize Size in bytes of data to be written + @return 0 if successful;
+ 4 if the image can not be written to. + */ + int initImage(const byte initData[], long dataSize); + /*! + @brief Provides the main implementation of writeMetadata() by + writing all buffered metadata to the provided BasicIo. + @param oIo BasicIo instance to write to (a temporary location). + + @return 4 if opening or writing to the associated BasicIo fails + */ + void doWriteMetadata(BasicIo& oIo); + //@} + + //! @name Accessors + //@{ + /*! + @brief Advances associated io instance to one byte past the next + Jpeg marker and returns the marker. This method should be called + when the BasicIo instance is positioned one byte past the end of a + Jpeg segment. + @return the next Jpeg segment marker if successful;
+ -1 if a maker was not found before EOF + */ + int advanceToMarker() const; + //@} + + }; // class JpegBase + + /*! + @brief Class to access JPEG images + */ + class EXIV2API JpegImage : public JpegBase { + friend EXIV2API bool isJpegType(BasicIo& iIo, bool advance); + public: + //! @name Creators + //@{ + /*! + @brief Constructor that can either open an existing Jpeg image or create + a new image from scratch. If a new image is to be created, any + existing data is overwritten. Since the constructor can not return + a result, callers should check the good() method after object + construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + @param create Specifies if an existing image should be read (false) + or if a new file should be created (true). + */ + JpegImage(BasicIo::AutoPtr io, bool create); + //@} + //! @name Accessors + //@{ + std::string mimeType() const; + //@} + + protected: + //! @name Accessors + //@{ + bool isThisType(BasicIo& iIo, bool advance) const; + //@} + //! @name Manipulators + //@{ + /*! + @brief Writes a Jpeg header (aka signature) to the BasicIo instance. + @param oIo BasicIo instance that the header is written to. + @return 0 if successful;
+ 2 if the input image is invalid or can not be read;
+ 4 if the temporary image can not be written to;
+ -3 other temporary errors + */ + int writeHeader(BasicIo& oIo) const; + //@} + + private: + // Constant data + static const byte soi_; // SOI marker + static const byte blank_[]; // Minimal Jpeg image + + // NOT Implemented + //! Default constructor + JpegImage(); + //! Copy constructor + JpegImage(const JpegImage& rhs); + //! Assignment operator + JpegImage& operator=(const JpegImage& rhs); + + }; // class JpegImage + + //! Helper class to access %Exiv2 files + class EXIV2API ExvImage : public JpegBase { + friend EXIV2API bool isExvType(BasicIo& iIo, bool advance); + public: + //! @name Creators + //@{ + /*! + @brief Constructor that can either open an existing EXV image or create + a new image from scratch. If a new image is to be created, any + existing data is overwritten. Since the constructor can not return + a result, callers should check the good() method after object + construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + @param create Specifies if an existing image should be read (false) + or if a new file should be created (true). + */ + ExvImage(BasicIo::AutoPtr io, bool create); + //@} + //! @name Accessors + //@{ + std::string mimeType() const; + //@} + + protected: + //! @name Accessors + //@{ + bool isThisType(BasicIo& iIo, bool advance) const; + //@} + //! @name Manipulators + //@{ + int writeHeader(BasicIo& oIo) const; + //@} + + private: + // Constant data + static const char exiv2Id_[]; // EXV identifier + static const byte blank_[]; // Minimal exiv2 file + + // NOT Implemented + //! Default constructor + ExvImage(); + //! Copy constructor + ExvImage(const ExvImage& rhs); + //! Assignment operator + ExvImage& operator=(const ExvImage& rhs); + + }; // class ExvImage + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new JpegImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newJpegInstance(BasicIo::AutoPtr io, bool create); + //! Check if the file iIo is a JPEG image. + EXIV2API bool isJpegType(BasicIo& iIo, bool advance); + /*! + @brief Create a new ExvImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newExvInstance(BasicIo::AutoPtr io, bool create); + //! Check if the file iIo is an EXV file + EXIV2API bool isExvType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef JPGIMAGE_HPP_ diff --git a/include/exiv2/matroskavideo.hpp b/include/exiv2/matroskavideo.hpp new file mode 100644 index 0000000..fa6981d --- /dev/null +++ b/include/exiv2/matroskavideo.hpp @@ -0,0 +1,155 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file matroskavideo.hpp + @brief An Image subclass to support Matroska video files + @author Abhinav Badola for GSoC 2012 + mail.abu.to@gmail.com + @date 18-Jun-12, AB: created + */ +#ifndef MATROSKAVIDEO_HPP_ +#define MATROSKAVIDEO_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Add MKV to the supported image formats + namespace ImageType { + const int mkv = 21; //!< Treating mkv as an image type> + } + + // Todo: Should be hidden + /*! + @brief Helper structure for the Matroska tags lookup table. + */ + struct EXIV2LIB_DEPRECATED MatroskaTags { + uint64_t val_; //!< Tag value + const char* label_; //!< Translation of the tag value + + //! Comparison operator for use with the find template + bool operator==(uint64_t key) const { return val_ == key; } + }; // struct TagDetails + + /*! + @brief Class to access Matroska video files. + */ + class EXIV2LIB_DEPRECATED_EXPORT MatroskaVideo : public Image { + public: + //! @name Creators + //@{ + /*! + @brief Constructor for a Matroska video. Since the constructor + can not return a result, callers should check the good() method + after object construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + */ + MatroskaVideo(BasicIo::AutoPtr io); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + void writeMetadata(); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + //@} + + protected: + /*! + @brief Function used to calulate the size of a block. + This information is only stored in one byte. + The size of the block is calculated by counting + the number of leading zeros in the binary code of the byte. + Size = (No. of leading zeros + 1) bytes + @param b The byte, which stores the information to calculate the size + @return Return the size of the block. + */ + uint32_t findBlockSize(byte b); + /*! + @brief Check for a valid tag and decode the block at the current IO position. + Calls contentManagement() or skips to next tag, if required. + */ + void decodeBlock(); + /*! + @brief Interpret tag information, and save it in the respective XMP container. + @param mt Pointer to current tag, + @param buf Pointer to the memory area with the tag information. + @param size Size of \em buf. + */ + void contentManagement(const MatroskaTags* mt, const byte* buf, long size); + /*! + @brief Calculates Aspect Ratio of a video, and stores it in the + respective XMP container. + */ + void aspectRatio(); + + private: + //! @name NOT Implemented + //@{ + //! Copy constructor + MatroskaVideo(const MatroskaVideo& rhs); + //! Assignment operator + MatroskaVideo& operator=(const MatroskaVideo& rhs); + //@} + + private: + //! Variable to check the end of metadata traversing. + bool continueTraversing_; + //! Variable to store height and width of a video frame. + uint64_t height_, width_; + + }; // class MatroskaVideo + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new MatroskaVideo instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newMkvInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a Matroska Video. + EXIV2LIB_DEPRECATED_EXPORT bool isMkvType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef MATROSKAVIDEO_HPP_ diff --git a/include/exiv2/metadatum.hpp b/include/exiv2/metadatum.hpp new file mode 100644 index 0000000..41640e2 --- /dev/null +++ b/include/exiv2/metadatum.hpp @@ -0,0 +1,316 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file metadatum.hpp + @brief Provides abstract base classes Metadatum and Key + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @author Brad Schick (brad) + brad@robotbattle.com + @date 09-Jan-04, ahu: created
+ 31-Jul-04, brad: isolated as a component
+ 23-Aug-04, ahu: added Key + */ +#ifndef METADATUM_HPP_ +#define METADATUM_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "value.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class declarations + class ExifData; + +// ***************************************************************************** +// class definitions + + /*! + @brief Abstract base class defining the %Key of a metadatum. + Keys are used to identify and group metadata. + */ + class EXIV2API Key { + public: + //! Shortcut for a %Key auto pointer. + typedef std::auto_ptr AutoPtr; + + //! @name Creators + //@{ + //! Destructor + virtual ~Key(); + //@} + + //! @name Accessors + //@{ + /*! + @brief Return the key of the metadatum as a string. The key is of the + form 'familyName.groupName.tagName'. Note however that the + key is not necessarily unique, e.g., an ExifData may contain + multiple metadata with the same key. + */ + virtual std::string key() const =0; + //! Return an identifier for the type of metadata (the first part of the key) + virtual const char* familyName() const =0; + //! Return the name of the group (the second part of the key) + virtual std::string groupName() const =0; + //! Return the name of the tag (which is also the third part of the key) + virtual std::string tagName() const =0; + //! Return a label for the tag + virtual std::string tagLabel() const =0; + //! Return the tag number + virtual uint16_t tag() const =0; + /*! + @brief Return an auto-pointer to a copy of itself (deep copy). + The caller owns this copy and the auto-pointer ensures that it + will be deleted. + */ + AutoPtr clone() const; + /*! + @brief Write the key to an output stream. You do not usually have + to use this function; it is used for the implementation of + the output operator for %Key, + operator<<(std::ostream &os, const Key &key). + */ + std::ostream& write(std::ostream& os) const { return os << key(); } + //@} + + protected: + //! @name Manipulators + //@{ + /*! + @brief Assignment operator. Protected so that it can only be used + by subclasses but not directly. + */ + Key& operator=(const Key& rhs); + //@} + + private: + //! Internal virtual copy constructor. + virtual Key* clone_() const =0; + + }; // class Key + + //! Output operator for Key types + inline std::ostream& operator<<(std::ostream& os, const Key& key) + { + return key.write(os); + } + + /*! + @brief Abstract base class defining the interface to access information + related to one metadata tag. + */ + class EXIV2API Metadatum { + public: + //! @name Creators + //@{ + //! Default Constructor + Metadatum(); + //! Copy constructor + Metadatum(const Metadatum& rhs); + //! Destructor + virtual ~Metadatum(); + //@} + + //! @name Manipulators + //@{ + /*! + @brief Set the value. This method copies (clones) the value pointed + to by pValue. + */ + virtual void setValue(const Value* pValue) =0; + /*! + @brief Set the value to the string buf. + Uses Value::read(const std::string& buf). If the metadatum does + not have a value yet, then one is created. See subclasses for + more details. Return 0 if the value was read successfully. + */ + virtual int setValue(const std::string& buf) =0; + //@} + + //! @name Accessors + //@{ + /*! + @brief Write the interpreted value to a string. + + Implemented in terms of write(), see there. + */ + std::string print(const ExifData* pMetadata =0) const; + /*! + @brief Write value to a data buffer and return the number + of bytes written. + + The user must ensure that the buffer has enough memory. Otherwise + the call results in undefined behaviour. + + @param buf Data buffer to write to. + @param byteOrder Applicable byte order (little or big endian). + @return Number of characters written. + */ + virtual long copy(byte* buf, ByteOrder byteOrder) const =0; + /*! + @brief Write the interpreted value to an output stream, return + the stream. + + The method takes an optional pointer to a metadata container. + Pretty-print functions may use that to refer to other metadata as it + is sometimes not sufficient to know only the value of the metadatum + that should be interpreted. Thus, it is advisable to always call this + method with a pointer to the metadata container if possible. + + This functionality is currently only implemented for Exif tags. + The pointer is ignored when used to write IPTC datasets or XMP + properties. + + Without the optional metadata pointer, you do not usually have to use + this function; it is used for the implementation of the output + operator for %Metadatum, + operator<<(std::ostream &os, const Metadatum &md). + + See also print(), which prints the interpreted value to a string. + */ + virtual std::ostream& write( + std::ostream& os, + const ExifData* pMetadata =0 + ) const =0; + /*! + @brief Return the key of the metadatum. The key is of the form + 'familyName.groupName.tagName'. Note however that the key + is not necessarily unique, e.g., an ExifData object may + contain multiple metadata with the same key. + */ + virtual std::string key() const =0; + //! Return the name of the metadata family (which is also the first part of the key) + virtual const char* familyName() const =0; + //! Return the name of the metadata group (which is also the second part of the key) + virtual std::string groupName() const =0; + //! Return the name of the tag (which is also the third part of the key) + virtual std::string tagName() const =0; + //! Return a label for the tag + virtual std::string tagLabel() const =0; + //! Return the tag + virtual uint16_t tag() const =0; + //! Return the type id of the value + virtual TypeId typeId() const =0; + //! Return the name of the type + virtual const char* typeName() const =0; + //! Return the size in bytes of one component of this type + virtual long typeSize() const =0; + //! Return the number of components in the value + virtual long count() const =0; + //! Return the size of the value in bytes + virtual long size() const =0; + //! Return the value as a string. + virtual std::string toString() const =0; + /*! + @brief Return the n-th component of the value converted to + a string. The behaviour of the method is undefined if there + is no n-th component. + */ + virtual std::string toString(long n) const =0; + /*! + @brief Return the n-th component of the value converted to long. + The return value is -1 if the value is not set and the behaviour + of the method is undefined if there is no n-th component. + */ + virtual long toLong(long n =0) const =0; + /*! + @brief Return the n-th component of the value converted to float. + The return value is -1 if the value is not set and the behaviour + of the method is undefined if there is no n-th component. + */ + virtual float toFloat(long n =0) const =0; + /*! + @brief Return the n-th component of the value converted to Rational. + The return value is -1/1 if the value is not set and the behaviour + of the method is undefined if there is no n-th component. + */ + virtual Rational toRational(long n =0) const =0; + /*! + @brief Return an auto-pointer to a copy (clone) of the value. The + caller owns this copy and the auto-poiner ensures that it will + be deleted. + + This method is provided for users who need full control over the + value. A caller may, e.g., downcast the pointer to the appropriate + subclass of Value to make use of the interface of the subclass to set + or modify its contents. + + @return An auto-pointer containing a pointer to a copy (clone) of the + value, 0 if the value is not set. + */ + virtual Value::AutoPtr getValue() const =0; + /*! + @brief Return a constant reference to the value. + + This method is provided mostly for convenient and versatile output of + the value which can (to some extent) be formatted through standard + stream manipulators. Do not attempt to write to the value through + this reference. An Error is thrown if the value is not set; as an + alternative to catching it, one can use count() to check if there + is any data before calling this method. + + @return A constant reference to the value. + @throw Error if the value is not set. + */ + virtual const Value& value() const =0; + //@} + + protected: + //! @name Manipulators + //@{ + /*! + @brief Assignment operator. Protected so that it can only be used + by subclasses but not directly. + */ + Metadatum& operator=(const Metadatum& rhs); + //@} + + }; // class Metadatum + + /*! + @brief Output operator for Metadatum types, writing the interpreted + tag value. + */ + inline std::ostream& operator<<(std::ostream& os, const Metadatum& md) + { + return md.write(os); + } + + /*! + @brief Compare two metadata by tag. Return true if the tag of metadatum + lhs is less than that of rhs. + */ + EXIV2API bool cmpMetadataByTag(const Metadatum& lhs, const Metadatum& rhs); + /*! + @brief Compare two metadata by key. Return true if the key of metadatum + lhs is less than that of rhs. + */ + EXIV2API bool cmpMetadataByKey(const Metadatum& lhs, const Metadatum& rhs); + +} // namespace Exiv2 + +#endif // #ifndef METADATUM_HPP_ diff --git a/include/exiv2/mrwimage.hpp b/include/exiv2/mrwimage.hpp new file mode 100644 index 0000000..7e5af65 --- /dev/null +++ b/include/exiv2/mrwimage.hpp @@ -0,0 +1,135 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file mrwimage.hpp + @brief Minolta RAW image, implemented using the following references: + Minolta Raw file format by Dalibor Jelinek + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @date 13-May-06, ahu: created + */ +#ifndef MRWIMAGE_HPP_ +#define MRWIMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Add MRW to the supported image formats + namespace ImageType { + const int mrw = 5; //!< MRW image type (see class MrwImage) + } + + /*! + @brief Class to access raw Minolta MRW images. Exif metadata is supported + directly, IPTC is read from the Exif data, if present. + */ + class EXIV2API MrwImage : public Image { + public: + //! @name Creators + //@{ + /*! + @brief Constructor that can either open an existing MRW image or create + a new image from scratch. If a new image is to be created, any + existing data is overwritten. Since the constructor can not return + a result, callers should check the good() method after object + construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + @param create Specifies if an existing image should be read (false) + or if a new file should be created (true). + */ + MrwImage(BasicIo::AutoPtr io, bool create); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + /*! + @brief Todo: Write metadata back to the image. This method is not + yet implemented. Calling it will throw an Error(kerWritingImageFormatUnsupported). + */ + void writeMetadata(); + /*! + @brief Todo: Not supported yet, requires writeMetadata(). Calling + this function will throw an Error(kerInvalidSettingForImage). + */ + void setExifData(const ExifData& exifData); + /*! + @brief Todo: Not supported yet, requires writeMetadata(). Calling + this function will throw an Error(kerInvalidSettingForImage). + */ + void setIptcData(const IptcData& iptcData); + /*! + @brief Not supported. MRW format does not contain a comment. + Calling this function will throw an Error(kerInvalidSettingForImage). + */ + void setComment(const std::string& comment); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + int pixelWidth() const; + int pixelHeight() const; + //@} + + private: + //! @name NOT Implemented + //@{ + //! Copy constructor + MrwImage(const MrwImage& rhs); + //! Assignment operator + MrwImage& operator=(const MrwImage& rhs); + //@} + + }; // class MrwImage + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new MrwImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newMrwInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a MRW image. + EXIV2API bool isMrwType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef MRWIMAGE_HPP_ diff --git a/include/exiv2/orfimage.hpp b/include/exiv2/orfimage.hpp new file mode 100644 index 0000000..2cbf2d6 --- /dev/null +++ b/include/exiv2/orfimage.hpp @@ -0,0 +1,155 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file orfimage.hpp + @brief Olympus RAW image + @author Jeff Costlow + costlow@gmail.com + @date 31-Jul-07, costlow: created + */ +#ifndef ORFIMAGE_HPP_ +#define ORFIMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "tiffimage.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Add ORF to the supported image formats + namespace ImageType { + const int orf = 9; //!< ORF image type (see class OrfImage) + } + + /*! + @brief Class to access raw Olympus ORF images. Exif metadata is supported + directly, IPTC is read from the Exif data, if present. + */ + class EXIV2API OrfImage : public TiffImage { + public: + //! @name Creators + //@{ + /*! + @brief Constructor that can either open an existing ORF image or create + a new image from scratch. If a new image is to be created, any + existing data is overwritten. Since the constructor can not return + a result, callers should check the good() method after object + construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + @param create Specifies if an existing image should be read (false) + or if a new file should be created (true). + */ + OrfImage(BasicIo::AutoPtr io, bool create); + //@} + + //! @name Manipulators + //@{ + void printStructure(std::ostream& out, PrintStructureOption option,int depth); + void readMetadata(); + void writeMetadata(); + /*! + @brief Not supported. ORF format does not contain a comment. + Calling this function will throw an Error(kerInvalidSettingForImage). + */ + void setComment(const std::string& comment); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + int pixelWidth() const; + int pixelHeight() const; + //@} + + private: + //! @name NOT Implemented + //@{ + //! Copy constructor + OrfImage(const OrfImage& rhs); + //! Assignment operator + OrfImage& operator=(const OrfImage& rhs); + //@} + + }; // class OrfImage + + /*! + @brief Stateless parser class for data in ORF format. Images use this + class to decode and encode ORF data. + See class TiffParser for details. + */ + class EXIV2API OrfParser { + public: + /*! + @brief Decode metadata from a buffer \em pData of length \em size + with data in ORF format to the provided metadata containers. + See TiffParser::decode(). + */ + static ByteOrder decode( + ExifData& exifData, + IptcData& iptcData, + XmpData& xmpData, + const byte* pData, + uint32_t size + ); + /*! + @brief Encode metadata from the provided metadata to ORF format. + See TiffParser::encode(). + */ + static WriteMethod encode( + BasicIo& io, + const byte* pData, + uint32_t size, + ByteOrder byteOrder, + const ExifData& exifData, + const IptcData& iptcData, + const XmpData& xmpData + ); + }; // class OrfParser + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new OrfImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newOrfInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is an ORF image. + EXIV2API bool isOrfType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef ORFIMAGE_HPP_ diff --git a/include/exiv2/pgfimage.hpp b/include/exiv2/pgfimage.hpp new file mode 100644 index 0000000..9612780 --- /dev/null +++ b/include/exiv2/pgfimage.hpp @@ -0,0 +1,133 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file pgfimage.hpp + @brief PGF image, implemented using the following references: + PGF specification from libpgf web site
+ @author Andreas Huggel (ahu) + ahuggel@gmx.net + @author Gilles Caulier (cgilles) + caulier dot gilles at gmail dot com + @date 16-Jun-09, gc: submitted + */ +#ifndef PGFIMAGE_HPP_ +#define PGFIMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 +{ + +// ***************************************************************************** +// class definitions + + // Add PGF to the supported image formats + namespace ImageType + { + const int pgf = 17; //!< PGF image type (see class PgfImage) + } + + /*! + @brief Class to access PGF images. Exif and IPTC metadata are supported + directly. + */ + class EXIV2API PgfImage : public Image { + public: + //! @name Creators + //@{ + /*! + @brief Constructor that can either open an existing PGF image or create + a new image from scratch. If a new image is to be created, any + existing data is overwritten. Since the constructor can not return + a result, callers should check the good() method after object + construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + @param create Specifies if an existing image should be read (false) + or if a new file should be created (true). + */ + PgfImage(BasicIo::AutoPtr io, bool create); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + void writeMetadata(); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const { return "image/pgf"; } + //@} + + private: + bool bSwap_; // true for bigEndian hardware, else false + //! @name NOT implemented + //@{ + //! Copy constructor + PgfImage(const PgfImage& rhs); + //! Assignment operator + PgfImage& operator=(const PgfImage& rhs); + /*! + @brief Provides the main implementation of writeMetadata() by + writing all buffered metadata to the provided BasicIo. + @param oIo BasicIo instance to write to (a temporary location). + + @return 4 if opening or writing to the associated BasicIo fails + */ + void doWriteMetadata(BasicIo& oIo); + //! Read Magick number. Only version >= 6 is supported. + byte readPgfMagicNumber(BasicIo& iIo); + //! Read PGF Header size encoded in 32 bits integer. + uint32_t readPgfHeaderSize(BasicIo& iIo); + //! Read header structure. + DataBuf readPgfHeaderStructure(BasicIo& iIo, int& width,int & height); + //@} + + }; // class PgfImage + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new PgfImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newPgfInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a PGF image. + EXIV2API bool isPgfType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef PGFIMAGE_HPP_ diff --git a/include/exiv2/pngimage.hpp b/include/exiv2/pngimage.hpp new file mode 100644 index 0000000..cfa83da --- /dev/null +++ b/include/exiv2/pngimage.hpp @@ -0,0 +1,137 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file pngimage.hpp + @brief PNG image, implemented using the following references: + PNG specification by W3C
+ PNG tags list by Phil Harvey
+ @author Andreas Huggel (ahu) + ahuggel@gmx.net + @author Gilles Caulier (cgilles) + caulier dot gilles at gmail dot com + @date 12-Jun-06, gc: submitted + */ +#ifndef PNGIMAGE_HPP_ +#define PNGIMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 +{ + +// ***************************************************************************** +// class definitions + + // Add PNG to the supported image formats + namespace ImageType + { + const int png = 6; //!< PNG image type (see class PngImage) + } + + /*! + @brief Class to access PNG images. Exif and IPTC metadata are supported + directly. + */ + class EXIV2API PngImage : public Image { + public: + //! @name Creators + //@{ + /*! + @brief Constructor that can either open an existing PNG image or create + a new image from scratch. If a new image is to be created, any + existing data is overwritten. Since the constructor can not return + a result, callers should check the good() method after object + construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + @param create Specifies if an existing image should be read (false) + or if a new file should be created (true). + */ + PngImage(BasicIo::AutoPtr io, bool create); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + void writeMetadata(); + + /*! + @brief Print out the structure of image file. + @throw Error if reading of the file fails or the image data is + not valid (does not look like data of the specific image type). + @warning This function is not thread safe and intended for exiv2 -pS for debugging. + */ + void printStructure(std::ostream& out, PrintStructureOption option,int depth); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + //@} + + private: + //! @name NOT implemented + //@{ + //! Copy constructor + PngImage(const PngImage& rhs); + //! Assignment operator + PngImage& operator=(const PngImage& rhs); + /*! + @brief Provides the main implementation of writeMetadata() by + writing all buffered metadata to the provided BasicIo. + @throw Error on input-output errors or when the image data is not valid. + @param oIo BasicIo instance to write to (a temporary location). + + */ + void doWriteMetadata(BasicIo& oIo); + //@} + + std::string profileName_; + + }; // class PngImage + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new PngImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newPngInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a PNG image. + EXIV2API bool isPngType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef PNGIMAGE_HPP_ diff --git a/include/exiv2/preview.hpp b/include/exiv2/preview.hpp new file mode 100644 index 0000000..b139185 --- /dev/null +++ b/include/exiv2/preview.hpp @@ -0,0 +1,196 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file preview.hpp + @brief Classes to access all preview images embedded in an image. + @author Vladimir Nadvornik (vn) + nadvornik@suse.cz + @date 18-Sep-08, vn: created + */ +#ifndef PREVIEW_HPP_ +#define PREVIEW_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + //! Type of preview image. + typedef int PreviewId; + + /*! + @brief Preview image properties. + */ + struct EXIV2API PreviewProperties { + //! Preview image mime type. + std::string mimeType_; + //! Preview image extension. + std::string extension_; +#ifdef EXV_UNICODE_PATH + //! Unicode preview image extension in an std::wstring + std::wstring wextension_; +#endif + //! Preview image size in bytes. + uint32_t size_; + //! Preview image width in pixels or 0 for unknown width. + uint32_t width_; + //! Preview image height in pixels or 0 for unknown height. + uint32_t height_; + //! Identifies type of preview image. + PreviewId id_; + }; + + //! Container type to hold all preview images metadata. + typedef std::vector PreviewPropertiesList; + + /*! + @brief Class that holds preview image properties and data buffer. + */ + class EXIV2API PreviewImage { + friend class PreviewManager; + public: + //! @name Constructors + //@{ + //! Copy constructor + PreviewImage(const PreviewImage& rhs); + //! Destructor. + ~PreviewImage(); + //@} + + //! @name Manipulators + //@{ + //! Assignment operator + PreviewImage& operator=(const PreviewImage& rhs); + //@} + + //! @name Accessors + //@{ + /*! + @brief Return a copy of the preview image data. The caller owns + this copy and %DataBuf ensures that it will be deleted. + */ + DataBuf copy() const; + /*! + @brief Return a pointer to the image data for read-only access. + */ + const byte* pData() const; + /*! + @brief Return the size of the preview image in bytes. + */ + uint32_t size() const; + /*! + @brief Write the thumbnail image to a file. + + A filename extension is appended to \em path according to the image + type of the preview image, so \em path should not include an extension. + The function will overwrite an existing file of the same name. + + @param path File name of the preview image without extension. + @return The number of bytes written. + */ + long writeFile(const std::string& path) const; +#ifdef EXV_UNICODE_PATH + /*! + @brief Like writeFile() but accepts a unicode path in an std::wstring. + @note This function is only available on Windows. + */ + long writeFile(const std::wstring& wpath) const; +#endif + /*! + @brief Return the MIME type of the preview image, usually either + \c "image/tiff" or \c "image/jpeg". + */ + std::string mimeType() const; + /*! + @brief Return the file extension for the format of the preview image + (".tif" or ".jpg"). + */ + std::string extension() const; +#ifdef EXV_UNICODE_PATH + /*! + @brief Like extension() but returns the unicode encoded extension in + an std::wstring. + @note This function is only available on Windows. + */ + std::wstring wextension() const; +#endif + /*! + @brief Return the width of the preview image in pixels. + */ + uint32_t width() const; + /*! + @brief Return the height of the preview image in pixels. + */ + uint32_t height() const; + /*! + @brief Return the preview image type identifier. + */ + PreviewId id() const; + //@} + + private: + //! Private constructor + PreviewImage(const PreviewProperties& properties, DataBuf data); + + PreviewProperties properties_; //!< Preview image properties + byte* pData_; //!< Pointer to the preview image data + uint32_t size_; //!< Size of the preview image data + + }; // class PreviewImage + + /*! + @brief Class for extracting preview images from image metadata. + */ + class EXIV2API PreviewManager { + public: + //! @name Constructors + //@{ + //! Constructor. + explicit PreviewManager(const Image& image); + //@} + + //! @name Accessors + //@{ + /*! + @brief Return the properties of all preview images in a list + sorted by preview width * height, starting with the smallest + preview image. + */ + PreviewPropertiesList getPreviewProperties() const; + /*! + @brief Return the preview image for the given preview properties. + */ + PreviewImage getPreviewImage(const PreviewProperties& properties) const; + //@} + + private: + const Image& image_; + + }; // class PreviewManager +} // namespace Exiv2 + +#endif // #ifndef PREVIEW_HPP_ diff --git a/include/exiv2/properties.hpp b/include/exiv2/properties.hpp new file mode 100644 index 0000000..09db134 --- /dev/null +++ b/include/exiv2/properties.hpp @@ -0,0 +1,320 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file properties.hpp + @brief XMP property and type information.
References:
+ XMP Specification from Adobe + (Property descriptions copied from the XMP specification with the permission of Adobe) + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @author Gilles Caulier (cgilles) + caulier dot gilles at gmail dot com + @date 13-Jul-07, ahu: created + */ +#ifndef PROPERTIES_HPP_ +#define PROPERTIES_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "datasets.hpp" +#include "rwlock.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class declarations + class XmpKey; + +// ***************************************************************************** +// class definitions + + //! Category of an XMP property + enum XmpCategory { xmpInternal, xmpExternal }; + + //! Information about one XMP property. + struct EXIV2API XmpPropertyInfo { + //! Comparison operator for name + bool operator==(const std::string& name) const; + + const char* name_; //!< Property name + const char* title_; //!< Property title or label + const char* xmpValueType_; //!< XMP value type (for info only) + TypeId typeId_; //!< Exiv2 default type for the property + XmpCategory xmpCategory_; //!< Category (internal or external) + const char* desc_; //!< Property description + }; + + //! Structure mapping XMP namespaces and (preferred) prefixes. + struct EXIV2API XmpNsInfo { + //! For comparison with prefix + struct Prefix { + //! Constructor. + explicit Prefix(const std::string& prefix); + //! The prefix string. + std::string prefix_; + }; + //! For comparison with namespace + struct Ns { + //! Constructor. + explicit Ns(const std::string& ns); + //! The namespace string + std::string ns_; + }; + //! Comparison operator for namespace + bool operator==(const Ns& ns) const; + //! Comparison operator for prefix + bool operator==(const Prefix& prefix) const; + + const char* ns_; //!< Namespace + const char* prefix_; //!< (Preferred) prefix + const XmpPropertyInfo* xmpPropertyInfo_; //!< List of known properties + const char* desc_; //!< Brief description of the namespace + }; + + //! XMP property reference, implemented as a static class. + class EXIV2API XmpProperties { + //! Prevent construction: not implemented. + XmpProperties(); + //! Prevent copy-construction: not implemented. + XmpProperties(const XmpProperties& rhs); + //! Prevent assignment: not implemented. + XmpProperties& operator=(const XmpProperties& rhs); + + private: + static const XmpNsInfo* nsInfoUnsafe(const std::string& prefix); + static void unregisterNsUnsafe(const std::string& ns); + static const XmpNsInfo* lookupNsRegistryUnsafe(const XmpNsInfo::Prefix& prefix); + + public: + /*! + @brief Return the title (label) of the property. + @param key The property key + @return The title (label) of the property, 0 if the + key is of an unknown property. + */ + static const char* propertyTitle(const XmpKey& key); + /*! + @brief Return the description of the property. + @param key The property key + @return The description of the property, 0 if the + key is of an unknown property. + */ + static const char* propertyDesc(const XmpKey& key); + /*! + @brief Return the type for property \em key. The default + for unknown keys is xmpText. + @param key The property key + @return The type of the property + */ + static TypeId propertyType(const XmpKey& key); + /*! + @brief Return information for the property for key. + + If the key is a path to a nested property (one which contains a slash, + like \c Xmp.MP.RegionInfo/MPRI:Regions), determines the innermost element + (\c Xmp.MPRI.Regions) and returns its property information. + + @param key The property key + @return A pointer to the property information, 0 if the + key is of an unknown property. + */ + static const XmpPropertyInfo* propertyInfo(const XmpKey& key); + /*! + @brief Return the namespace name for the schema associated + with \em prefix. + @param prefix Prefix + @return The namespace name + @throw Error if no namespace is registered with \em prefix. + */ + static std::string ns(const std::string& prefix); + /*! + @brief Return the namespace description for the schema associated + with \em prefix. + @param prefix Prefix + @return The namespace description + @throw Error if no namespace is registered with \em prefix. + */ + static const char* nsDesc(const std::string& prefix); + /*! + @brief Return read-only list of built-in properties for \em prefix. + @param prefix Prefix + @return Pointer to the built-in properties for prefix, may be 0 if + none is configured in the namespace info. + @throw Error if no namespace is registered with \em prefix. + */ + static const XmpPropertyInfo* propertyList(const std::string& prefix); + /*! + @brief Return information about a schema namespace for \em prefix. + Always returns a valid pointer. + @param prefix The prefix + @return A pointer to the related information + @throw Error if no namespace is registered with \em prefix. + */ + static const XmpNsInfo* nsInfo(const std::string& prefix); + + /*! + @brief Return the (preferred) prefix for schema namespace \em ns. + @param ns Schema namespace + @return The prefix or an empty string if namespace \em ns is not + registered. + */ + static std::string prefix(const std::string& ns); + //! Print a list of properties of a schema namespace to output stream \em os. + static void printProperties(std::ostream& os, const std::string& prefix); + + //! Interpret and print the value of an XMP property + static std::ostream& printProperty(std::ostream& os, + const std::string& key, + const Value& value); + /*! + @brief Register namespace \em ns with preferred prefix \em prefix. + + If the prefix is a known or previously registered prefix, the + corresponding namespace URI is overwritten. + + @note This invalidates XMP keys generated with the previous prefix. + */ + static void registerNs(const std::string& ns, const std::string& prefix); + /*! + @brief Unregister a custom namespace \em ns. + + The function only has an effect if there is a namespace \em ns + registered earlier, it does not unregister built-in namespaces. + + @note This invalidates XMP keys generated in this namespace. + */ + static void unregisterNs(const std::string& ns); + + //! lock to be used while modifying properties + static Exiv2::RWLock rwLock_; + + /*! + @brief Unregister all custom namespaces. + + The function only unregisters namespaces registered earlier, it does not + unregister built-in namespaces. + + @note This invalidates XMP keys generated in any custom namespace. + */ + static void unregisterNs(); + //! Type for the namespace registry + typedef std::map NsRegistry; + /*! + @brief Get the registered namespace for a specific \em prefix from the registry. + */ + static const XmpNsInfo* lookupNsRegistry(const XmpNsInfo::Prefix& prefix); + + // DATA + static NsRegistry nsRegistry_; //!< Namespace registry + + /*! + @brief Get all registered namespaces (for both Exiv2 and XMPsdk) + */ + static void registeredNamespaces(Exiv2::Dictionary& nsDict); + + }; // class XmpProperties + + /*! + @brief Concrete keys for XMP metadata. + */ + class EXIV2API XmpKey : public Key + { + public: + //! Shortcut for an %XmpKey auto pointer. + typedef std::auto_ptr AutoPtr; + + //! @name Creators + //@{ + /*! + @brief Constructor to create an XMP key from a key string. + + @param key The key string. + @throw Error if the first part of the key is not 'Xmp' or + the second part of the key cannot be parsed and converted + to a known (i.e., built-in or registered) schema prefix. + */ + explicit XmpKey(const std::string& key); + /*! + @brief Constructor to create an XMP key from a schema prefix + and a property name. + + @param prefix Schema prefix name + @param property Property name + + @throw Error if the schema prefix is not known. + */ + XmpKey(const std::string& prefix, const std::string& property); + //! Copy constructor. + XmpKey(const XmpKey& rhs); + //! Virtual destructor. + virtual ~XmpKey(); + //@} + + //! @name Manipulators + //@{ + //! Assignment operator. + XmpKey& operator=(const XmpKey& rhs); + //@} + + //! @name Accessors + //@{ + virtual std::string key() const; + virtual const char* familyName() const; + /*! + @brief Return the name of the group (the second part of the key). + For XMP keys, the group name is the schema prefix name. + */ + virtual std::string groupName() const; + virtual std::string tagName() const; + virtual std::string tagLabel() const; + //! Properties don't have a tag number. Return 0. + virtual uint16_t tag() const; + + AutoPtr clone() const; + + // Todo: Should this be removed? What about tagLabel then? + //! Return the schema namespace for the prefix of the key + std::string ns() const; + //@} + + private: + //! Internal virtual copy constructor. + virtual XmpKey* clone_() const; + + private: + // Pimpl idiom + struct Impl; + std::auto_ptr p_; + + }; // class XmpKey + + // ***************************************************************************** + // free functions + + //! Output operator for property info + EXIV2API std::ostream& operator<<(std::ostream& os, const XmpPropertyInfo& propertyInfo); + +} // namespace Exiv2 + +#endif // #ifndef PROPERTIES_HPP_ diff --git a/include/exiv2/psdimage.hpp b/include/exiv2/psdimage.hpp new file mode 100644 index 0000000..a087f87 --- /dev/null +++ b/include/exiv2/psdimage.hpp @@ -0,0 +1,147 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file psdimage.hpp + @brief Photoshop image, implemented using the following references: + Adobe Photoshop 6.0 File Format Specification by Adobe
+ @author Marco Piovanelli, Ovolab (marco) + marco.piovanelli@pobox.com + @author Michael Ulbrich + mul@rentapacs.de + @date 05-Mar-2007, marco: created + */ +#ifndef PSDIMAGE_HPP_ +#define PSDIMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Add PSD to the supported image formats + namespace ImageType { + const int psd = 12; //!< Photoshop (PSD) image type (see class PsdImage) + } + + /*! + @brief Class to access raw Photoshop images. + */ + class EXIV2API PsdImage : public Image { + //! @name NOT Implemented + //@{ + //! Copy constructor + PsdImage(const PsdImage& rhs); + //! Assignment operator + PsdImage& operator=(const PsdImage& rhs); + //@} + + public: + //! @name Creators + //@{ + /*! + @brief Constructor to open a Photoshop image. Since the + constructor can not return a result, callers should check the + good() method after object construction to determine success + or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + */ + explicit PsdImage(BasicIo::AutoPtr io); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + void writeMetadata(); + /*! + @brief Not supported. Calling this function will throw an Error(kerInvalidSettingForImage). + */ + void setComment(const std::string& comment); + //@} + + //! @name Accessors + //@{ + /*! + @brief Return the MIME type of the image. + + The MIME type returned for Photoshop images is "image/x-photoshop". + + @note This should really be "image/vnd.adobe.photoshop" + (officially registered with IANA in December 2005 -- see + http://www.iana.org/assignments/media-types/image/vnd.adobe.photoshop) + but Apple, as of Tiger (10.4.8), maps this official MIME type to a + dynamic UTI, rather than "com.adobe.photoshop-image" as it should. + */ + std::string mimeType() const; + //@} + + private: + //! @name Manipulators + //@{ + void readResourceBlock(uint16_t resourceId, uint32_t resourceSize); + /*! + @brief Provides the main implementation of writeMetadata() by + writing all buffered metadata to the provided BasicIo. + @param oIo BasicIo instance to write to (a temporary location). + + @return 4 if opening or writing to the associated BasicIo fails + */ + void doWriteMetadata(BasicIo& oIo); + uint32_t writeExifData(const ExifData& exifData, BasicIo& out); + //@} + + //! @name Accessors + //@{ + uint32_t writeIptcData(const IptcData& iptcData, BasicIo& out) const; + uint32_t writeXmpData(const XmpData& xmpData, BasicIo& out) const; + //@} + + }; // class PsdImage + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new PsdImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newPsdInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a Photoshop image. + EXIV2API bool isPsdType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef PSDIMAGE_HPP_ diff --git a/include/exiv2/quicktimevideo.hpp b/include/exiv2/quicktimevideo.hpp new file mode 100644 index 0000000..f9faf49 --- /dev/null +++ b/include/exiv2/quicktimevideo.hpp @@ -0,0 +1,252 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file quicktimevideo.hpp + @brief An Image subclass to support Quick Time video files + @author Abhinav Badola for GSoC 2012 + mail.abu.to@gmail.com + @date 28-Jun-12, AB: created + */ +#ifndef QUICKTIMEVIDEO_HPP +#define QUICKTIMEVIDEO_HPP + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "exif.hpp" +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Add qtime to the supported image formats + namespace ImageType { + const int qtime = 22; //!< Treating qtime as an image type> + } + + /*! + @brief Class to access QuickTime video files. + */ + class EXIV2LIB_DEPRECATED_EXPORT QuickTimeVideo:public Image + { + public: + //! @name Creators + //@{ + /*! + @brief Constructor for a QuickTime video. Since the constructor + can not return a result, callers should check the good() method + after object construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + */ + QuickTimeVideo(BasicIo::AutoPtr io); + //@} + + //! @name Manipulators + //@{ + void readMetadata(); + void writeMetadata(); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + //@} + + protected: + /*! + @brief Check for a valid tag and decode the block at the current IO + position. Calls tagDecoder() or skips to next tag, if required. + */ + void decodeBlock(); + /*! + @brief Interpret tag information, and call the respective function + to save it in the respective XMP container. Decodes a Tag + Information and saves it in the respective XMP container, if + the block size is small. + @param buf Data buffer which cotains tag ID. + @param size Size of the data block used to store Tag Information. + */ + void tagDecoder(Exiv2::DataBuf & buf, unsigned long size); + + private: + /*! + @brief Interpret file type of the video, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void fileTypeDecoder(unsigned long size); + /*! + @brief Interpret Media Header Tag, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void mediaHeaderDecoder(unsigned long size); + /*! + @brief Interpret Video Header Tag, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void videoHeaderDecoder(unsigned long size); + /*! + @brief Interpret Movie Header Tag, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void movieHeaderDecoder(unsigned long size); + /*! + @brief Interpret Track Header Tag, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void trackHeaderDecoder(unsigned long size); + /*! + @brief Interpret Handler Tag, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void handlerDecoder(unsigned long size); + /*! + @brief Interpret Tag which contain other sub-tags, + and save it in the respective XMP container. + */ + void multipleEntriesDecoder(); + /*! + @brief Interpret Sample Description Tag, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void sampleDesc(unsigned long size); + /*! + @brief Interpret Image Description Tag, and save it + in the respective XMP container. + */ + void imageDescDecoder(); + /*! + @brief Interpret User Data Tag, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void userDataDecoder(unsigned long size); + /*! + @brief Interpret Preview Tag, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void previewTagDecoder(unsigned long size); + /*! + @brief Interpret Meta Keys Tags, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void keysTagDecoder(unsigned long size); + /*! + @brief Interpret Track Aperture Tags, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void trackApertureTagDecoder(unsigned long size); + /*! + @brief Interpret Nikon Tag, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void NikonTagsDecoder(unsigned long size); + /*! + @brief Interpret Tags from Different Camera make, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void CameraTagsDecoder(unsigned long size); + /*! + @brief Interpret Audio Description Tag, and save it + in the respective XMP container. + */ + void audioDescDecoder(); + /*! + @brief Helps to calculate Frame Rate from timeToSample chunk, + and save it in the respective XMP container. + */ + void timeToSampleDecoder(); + /*! + @brief Recognizes which stream is currently under processing, + and save its information in currentStream_ . + */ + void setMediaStream(); + /*! + @brief Used to discard a tag along with its data. The Tag will + be skipped and not decoded. + @param size Size of the data block that is to skipped. + */ + void discard(unsigned long size); + /*! + @brief Calculates Aspect Ratio of a video, and stores it in the + respective XMP container. + */ + void aspectRatio(); + + private: + //! @name NOT Implemented + //@{ + //! Copy constructor + QuickTimeVideo(const QuickTimeVideo& rhs); + //! Assignment operator + QuickTimeVideo& operator=(const QuickTimeVideo& rhs); + //@} + + private: + //! Variable which stores Time Scale unit, used to calculate time. + uint64_t timeScale_; + //! Variable which stores current stream being processsed. + int currentStream_; + //! Variable to check the end of metadata traversing. + bool continueTraversing_; + //! Variable to store height and width of a video frame. + uint64_t height_, width_; + + }; //QuickTimeVideo End + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new QuicktimeVideo instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newQTimeInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a Quick Time Video. + EXIV2LIB_DEPRECATED_EXPORT bool isQTimeType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // QUICKTIMEVIDEO_HPP diff --git a/include/exiv2/rafimage.hpp b/include/exiv2/rafimage.hpp new file mode 100644 index 0000000..aade5ea --- /dev/null +++ b/include/exiv2/rafimage.hpp @@ -0,0 +1,140 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file rafimage.hpp + @brief Fujifilm RAW image + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @date 05-Feb-07, ahu: created + */ +#ifndef RAFIMAGE_HPP_ +#define RAFIMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" +#include "basicio.hpp" +#include "types.hpp" + +// + standard includes +#include + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Add RAF to the supported image formats + namespace ImageType { + const int raf = 8; //!< RAF image type (see class RafImage) + } + + /*! + @brief Class to access raw Fujifilm RAF images. Exif metadata is + supported directly, IPTC is read from the Exif data, if present. + */ + class EXIV2API RafImage : public Image { + public: + //! @name Creators + //@{ + /*! + @brief Constructor that can either open an existing RAF image or create + a new image from scratch. If a new image is to be created, any + existing data is overwritten. Since the constructor can not return + a result, callers should check the good() method after object + construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + @param create Specifies if an existing image should be read (false) + or if a new file should be created (true). + */ + RafImage(BasicIo::AutoPtr io, bool create); + //@} + + //! @name Manipulators + //@{ + void printStructure(std::ostream& out, PrintStructureOption option,int depth); + void readMetadata(); + /*! + @brief Todo: Write metadata back to the image. This method is not + yet implemented. Calling it will throw an Error(kerWritingImageFormatUnsupported). + */ + void writeMetadata(); + /*! + @brief Todo: Not supported yet, requires writeMetadata(). Calling + this function will throw an Error(kerInvalidSettingForImage). + */ + void setExifData(const ExifData& exifData); + /*! + @brief Todo: Not supported yet, requires writeMetadata(). Calling + this function will throw an Error(kerInvalidSettingForImage). + */ + void setIptcData(const IptcData& iptcData); + /*! + @brief Not supported. RAF format does not contain a comment. + Calling this function will throw an Error(kerInvalidSettingForImage). + */ + void setComment(const std::string& comment); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + int pixelWidth() const; + int pixelHeight() const; + //@} + + private: + //! @name NOT implemented + //@{ + //! Copy constructor + RafImage(const RafImage& rhs); + //! Assignment operator + RafImage& operator=(const RafImage& rhs); + //@} + + }; // class RafImage + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new RafImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newRafInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a RAF image. + EXIV2API bool isRafType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef RAFIMAGE_HPP_ diff --git a/include/exiv2/riffvideo.hpp b/include/exiv2/riffvideo.hpp new file mode 100644 index 0000000..2568ed9 --- /dev/null +++ b/include/exiv2/riffvideo.hpp @@ -0,0 +1,220 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file riffvideo.hpp + @brief An Image subclass to support RIFF video files + @author Abhinav Badola for GSoC 2012 + mail.abu.to@gmail.com + @date 18-Jun-12, AB: created + */ +#ifndef RIFFVIDEO_HPP +#define RIFFVIDEO_HPP + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "exif.hpp" +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Add RIFF to the supported image formats + namespace ImageType { + const int riff = 20; //!< Treating riff as an image type> + } + + /*! + @brief Class to access RIFF video files. + */ + class EXIV2LIB_DEPRECATED_EXPORT RiffVideo:public Image + { + public: + //! @name Creators + //@{ + /*! + @brief Constructor for a Riff video. Since the constructor + can not return a result, callers should check the good() method + after object construction to determine success or failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + */ + RiffVideo(BasicIo::AutoPtr io); + //@} + + //! @name Manipulators + //@{ + void printStructure(std::ostream& out, PrintStructureOption option,int depth); + void readMetadata(); + void writeMetadata(); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + const char* printAudioEncoding(uint64_t i); + //@} + + protected: + /*! + @brief Check for a valid tag and decode the block at the current IO + position. Calls tagDecoder() or skips to next tag, if required. + */ + void decodeBlock(); + /*! + @brief Interpret tag information, and call the respective function + to save it in the respective XMP container. Decodes a Tag + Information and saves it in the respective XMP container, if + the block size is small. + @param buf Data buffer which cotains tag ID. + @param size Size of the data block used to store Tag Information. + */ + void tagDecoder(Exiv2::DataBuf& buf, unsigned long size); + /*! + @brief Interpret Junk tag information, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void junkHandler(long size); + /*! + @brief Interpret Stream tag information, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void streamHandler(long size); + /*! + @brief Interpret Stream Format tag information, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void streamFormatHandler(long size); + /*! + @brief Interpret Riff Header tag information, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void aviHeaderTagsHandler(long size); + /*! + @brief Interpret Riff List tag information, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void listHandler(long size); + /*! + @brief Interpret Riff Stream Data tag information, and save it + in the respective XMP container. + @param size Size of the data block used to store Tag Information. + */ + void streamDataTagHandler(long size); + /*! + @brief Interpret INFO tag information, and save it + in the respective XMP container. + */ + void infoTagsHandler(); + /*! + @brief Interpret Nikon Tags related to Video information, and + save it in the respective XMP container. + */ + void nikonTagsHandler(); + /*! + @brief Interpret OpenDML tag information, and save it + in the respective XMP container. + */ + void odmlTagsHandler(); + //! @brief Skips Particular Blocks of Metadata List. + void skipListData(); + /*! + @brief Interprets DateTimeOriginal tag or stream name tag + information, and save it in the respective XMP container. + @param size Size of the data block used to store Tag Information. + @param i parameter used to overload function + */ + void dateTimeOriginal(long size, int i = 0); + /*! + @brief Calculates Sample Rate of a particular stream. + @param buf Data buffer with the dividend. + @param divisor The Divisor required to calculate sample rate. + @return Return the sample rate of the stream. + */ + double returnSampleRate(Exiv2::DataBuf& buf, long divisor = 1); + /*! + @brief Calculates Aspect Ratio of a video, and stores it in the + respective XMP container. + @param width Width of the video. + @param height Height of the video. + */ + void fillAspectRatio(long width = 1,long height = 1); + /*! + @brief Calculates Duration of a video, and stores it in the + respective XMP container. + @param frame_rate Frame rate of the video. + @param frame_count Total number of frames present in the video. + */ + void fillDuration(double frame_rate, long frame_count); + + private: + //! @name NOT Implemented + //@{ + //! Copy constructor + RiffVideo(const RiffVideo& rhs); + //! Assignment operator + RiffVideo& operator=(const RiffVideo& rhs); + bool equalsRiffTag(Exiv2::DataBuf& buf ,const char* str); + //@} + + private: + const static int RIFF_TAG_SIZE; + const static char* RIFF_CHUNK_HEADER_ICCP; + const static char* RIFF_CHUNK_HEADER_EXIF; + const static char* RIFF_CHUNK_HEADER_XMP; + //! Variable to check the end of metadata traversing. + bool continueTraversing_; + //! Variable which stores current stream being processsed. + int streamType_; + + }; //Class RiffVideo + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new RiffVideo instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newRiffInstance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a Riff Video. + EXIV2LIB_DEPRECATED_EXPORT bool isRiffType(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // RIFFVIDEO_HPP diff --git a/include/exiv2/rw2image.hpp b/include/exiv2/rw2image.hpp new file mode 100644 index 0000000..4bca371 --- /dev/null +++ b/include/exiv2/rw2image.hpp @@ -0,0 +1,155 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file rw2image.hpp + @brief Class Rw2Image + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @date 06-Jan-09, ahu: created + */ +#ifndef RW2IMAGE_HPP_ +#define RW2IMAGE_HPP_ + +// ***************************************************************************** +#include "exiv2lib_export.h" + +// included header files +#include "image.hpp" + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class definitions + + // Add RW2 to the supported image formats + namespace ImageType { + const int rw2 = 16; //!< RW2 image type (see class Rw2Image) + } + + /*! + @brief Class to access raw Panasonic RW2 images. Exif metadata is + supported directly, IPTC and XMP are read from the Exif data, if + present. + */ + class EXIV2API Rw2Image : public Image { + public: + //! @name Creators + //@{ + /*! + @brief Constructor to open an existing RW2 image. Since the + constructor can not return a result, callers should check the + good() method after object construction to determine success or + failure. + @param io An auto-pointer that owns a BasicIo instance used for + reading and writing image metadata. \b Important: The constructor + takes ownership of the passed in BasicIo instance through the + auto-pointer. Callers should not continue to use the BasicIo + instance after it is passed to this method. Use the Image::io() + method to get a temporary reference. + */ + explicit Rw2Image(BasicIo::AutoPtr io); + //@} + + //! @name Manipulators + //@{ + void printStructure(std::ostream& out, PrintStructureOption option,int depth); + void readMetadata(); + /*! + @brief Todo: Write metadata back to the image. This method is not + yet implemented. Calling it will throw an Error(kerWritingImageFormatUnsupported). + */ + void writeMetadata(); + /*! + @brief Todo: Not supported yet, requires writeMetadata(). Calling + this function will throw an Error(kerInvalidSettingForImage). + */ + void setExifData(const ExifData& exifData); + /*! + @brief Todo: Not supported yet, requires writeMetadata(). Calling + this function will throw an Error(kerInvalidSettingForImage). + */ + void setIptcData(const IptcData& iptcData); + /*! + @brief Not supported. RW2 format does not contain a comment. + Calling this function will throw an Error(kerInvalidSettingForImage). + */ + void setComment(const std::string& comment); + //@} + + //! @name Accessors + //@{ + std::string mimeType() const; + int pixelWidth() const; + int pixelHeight() const; + //@} + + private: + //! @name NOT implemented + //@{ + //! Copy constructor + Rw2Image(const Rw2Image& rhs); + //! Assignment operator + Rw2Image& operator=(const Rw2Image& rhs); + //@} + + }; // class Rw2Image + + /*! + @brief Stateless parser class for data in RW2 format. Images use this + class to decode and encode RW2 data. Only decoding is currently + implemented. See class TiffParser for details. + */ + class EXIV2API Rw2Parser { + public: + /*! + @brief Decode metadata from a buffer \em pData of length \em size + with data in RW2 format to the provided metadata containers. + See TiffParser::decode(). + */ + static ByteOrder decode( + ExifData& exifData, + IptcData& iptcData, + XmpData& xmpData, + const byte* pData, + uint32_t size + ); + + }; // class Rw2Parser + +// ***************************************************************************** +// template, inline and free functions + + // These could be static private functions on Image subclasses but then + // ImageFactory needs to be made a friend. + /*! + @brief Create a new Rw2Image instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that + it will be deleted. + */ + EXIV2API Image::AutoPtr newRw2Instance(BasicIo::AutoPtr io, bool create); + + //! Check if the file iIo is a RW2 image. + EXIV2API bool isRw2Type(BasicIo& iIo, bool advance); + +} // namespace Exiv2 + +#endif // #ifndef RW2IMAGE_HPP_ diff --git a/include/exiv2/rwlock.hpp b/include/exiv2/rwlock.hpp new file mode 100644 index 0000000..1ebbdb9 --- /dev/null +++ b/include/exiv2/rwlock.hpp @@ -0,0 +1,191 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 authors + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef RW_LOCK_HPP +#define RW_LOCK_HPP + +#ifdef _MSC_VER +#include +#else +#include +#endif + +namespace Exiv2 { +#ifdef _MSC_VER + /*! + @brief Class to provide a Read-Write Lock + */ + class RWLock + { + public: + RWLock() + { + InitializeCriticalSection(&lock_); + } + + ~RWLock() + { + DeleteCriticalSection(&lock_); + } + + void wrlock() { enter(); } + + bool trywrlock() { return tryenter(); } + + void rdlock() { enter(); } + + bool tryrdlock() { return tryenter(); } + + void rdunlock() { leave(); } + + void wrunlock() { leave(); } + + private: + void enter() + { + EnterCriticalSection(&lock_); + } + + void leave() + { + LeaveCriticalSection(&lock_); + } + + bool tryenter() + { +#if defined(MSDEV_2003) || defined(MSDEV_2005) + EnterCriticalSection(&lock_); + return true; +#else + return 0 != TryEnterCriticalSection(&lock_); +#endif + } + + private: + CRITICAL_SECTION lock_; + }; +#else + /*! + @brief Class to provide a Read-Write Lock + */ + // UNIX systems (including MinGW and Cygwin) + class RWLock + { + public: + //! constructor (acquires the lock) + explicit RWLock(const pthread_rwlockattr_t *attr = 0) + { + pthread_rwlock_init(&rwlock_, attr); + } + + //! constructor (releases lock) + ~RWLock() + { + pthread_rwlock_destroy(&rwlock_); + } + + //! acquire rw lock + void wrlock() + { + pthread_rwlock_wrlock(&rwlock_); + } + + //! test to see if the rw lock can be acquired + bool trywrlock() + { + return 0 == pthread_rwlock_trywrlock(&rwlock_); + } + + //! acquire rd lock + void rdlock() + { + pthread_rwlock_rdlock(&rwlock_); + } + + //! test to see if the rd lock can be acquired + bool tryrdlock() + { + return 0 == pthread_rwlock_tryrdlock(&rwlock_); + } + + //! release rw lock + void unlock() + { + pthread_rwlock_unlock(&rwlock_); + } + + //! unlock rd lock + void rdunlock() { unlock(); } + + //! unlock rw lock + void wrunlock() { unlock(); } + + private: + //! the lock itself + pthread_rwlock_t rwlock_; + }; +#endif + + /*! + @brief Class to provide a ScopedReadLock. + The lock is applied by the constructor and released by the destructor. + */ + class ScopedReadLock + { + public: + //! constructor - locks the object + explicit ScopedReadLock(RWLock &rwlock): + rwlock_(rwlock) + { + rwlock_.rdlock(); + } + + //! destructor - unlocks the object used in constructor + ~ScopedReadLock() { rwlock_.rdunlock(); } + + private: + //! object locked by the constructor (and released by destructor) + RWLock &rwlock_; + }; + + /*! + @brief Class to provide a ScopedWriteLock. + The lock is applied by the constructor and released by the destructor. + */ + class ScopedWriteLock + { + public: + //! constructor - locks the object + explicit ScopedWriteLock(RWLock &rwlock): + rwlock_(rwlock) + { + rwlock_.wrlock(); + } + + //! destructor - unlocks the object used in constructor + ~ScopedWriteLock() { rwlock_.wrunlock(); } + + private: + //! object locked by the constructor (and released by destructor) + RWLock &rwlock_; + }; +} + +#endif // RW_LOCK_HPP diff --git a/include/exiv2/slice.hpp b/include/exiv2/slice.hpp new file mode 100644 index 0000000..c26d058 --- /dev/null +++ b/include/exiv2/slice.hpp @@ -0,0 +1,726 @@ +// ********************************************************* -*- C++ -*- +/* + * Copyright (C) 2004-2018 Exiv2 maintainers + * + * This program is part of the Exiv2 distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file slice.hpp + @brief Simple implementation of slices (=views) for STL containers and C-arrays + @author Dan Čermák (D4N) + dan.cermak@cgc-instruments.com + @date 30-March-18, D4N: created + */ + +#ifndef EXIV2_INCLUDE_SLICE_HPP +#define EXIV2_INCLUDE_SLICE_HPP + +#include +#include +#include +#include + +namespace Exiv2 +{ + namespace Internal + { + // TODO: remove these custom implementations once we have C++11 + template + struct remove_const + { + typedef T type; + }; + + template + struct remove_const + { + typedef T type; + }; + + template + struct remove_volatile + { + typedef T type; + }; + template + struct remove_volatile + { + typedef T type; + }; + template + struct remove_cv + { + typedef typename remove_const::type>::type type; + }; + + template + struct remove_pointer + { + typedef T type; + }; + + template + struct remove_pointer + { + typedef T type; + }; + + template + struct remove_pointer + { + typedef T type; + }; + + /*! + * Common base class of all slice implementations. + * + * Implements only the most basic functions, which do not require any + * knowledge about the stored data. + */ + struct SliceBase + { + inline SliceBase(size_t begin, size_t end) : begin_(begin), end_(end) + { + if (begin >= end) { + throw std::out_of_range("Begin must be smaller than end"); + } + } + + /*! + * Return the number of elements in the slice. + */ + inline size_t size() const throw() + { + // cannot underflow, as we know that begin < end + return end_ - begin_; + } + + protected: + /*! + * Throw an exception when index is too large. + * + * @throw std::out_of_range when `index` will access an element + * outside of the slice + */ + inline void rangeCheck(size_t index) const + { + if (index >= size()) { + throw std::out_of_range("Index outside of the slice"); + } + } + + /*! + * lower and upper bounds of the slice with respect to the + * container/array stored in storage_ + */ + const size_t begin_, end_; + }; + + /*! + * @brief This class provides the public-facing const-qualified methods + * of a slice. + * + * The public methods are implemented in a generic fashion using a + * storage_type. This type contains the actual reference to the data to + * which the slice points and provides the following methods: + * + * - (const) value_type& unsafeAt(size_t index) (const) + * Return the value at the given index of the underlying container, + * without promising to perform a range check and without any + * knowledge of the slices' size + * + * - const_iterator/iterator unsafeGetIteratorAt(size_t index) (const) + * Return a (constant) iterator at the given index of the underlying + * container. Again, no range checks are promised. + * + * - Constructor(data_type& data, size_t begin, size_t end) + * Can use `begin` & `end` to perform range checks on `data`, but + * should not store both values. Must not take ownership of `data`! + * + * - Must save data as a public member named `data_`. + * + * - Must provide appropriate typedefs for iterator, const_iterator and + * value_type + */ + template