summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-07-04 13:08:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-07-04 13:08:49 +0000
commit8bd9bc260d11b82b59e452fc8cebcd0a340a33e2 (patch)
treee5a7f0ca7c2716f5b526fa90fc5ad21765402f99
parentReleasing progress-linux version 1.1.0-2~dschinn1. (diff)
downloadlibheif-8bd9bc260d11b82b59e452fc8cebcd0a340a33e2.zip
libheif-8bd9bc260d11b82b59e452fc8cebcd0a340a33e2.tar.xz
Merging upstream version 1.2.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--.travis.yml35
-rw-r--r--CMakeLists.txt10
-rw-r--r--Makefile.am9
-rw-r--r--Makefile.in9
-rw-r--r--README.md11
-rw-r--r--appveyor.yml3
-rwxr-xr-xbuild-emscripten.sh2
-rwxr-xr-xconfigure56
-rw-r--r--configure.ac17
-rw-r--r--examples/CMakeLists.txt27
-rw-r--r--examples/Makefile.am37
-rw-r--r--examples/Makefile.in182
-rw-r--r--examples/encoder.cc2
-rw-r--r--examples/encoder.h2
-rw-r--r--examples/encoder_jpeg.cc4
-rw-r--r--examples/encoder_png.cc1
-rw-r--r--examples/heif_convert.cc2
-rw-r--r--examples/heif_enc.cc2
-rw-r--r--examples/heif_info.cc2
-rw-r--r--examples/heif_test.cc163
-rw-r--r--examples/heif_thumbnailer.cc187
-rw-r--r--gnome/Makefile.am9
-rw-r--r--gnome/Makefile.in554
-rw-r--r--gnome/heif.thumbnailer4
-rw-r--r--gnome/heif.xml10
-rw-r--r--go/Makefile.am3
-rw-r--r--go/Makefile.in473
-rw-r--r--go/src/heif-test.go90
-rw-r--r--go/src/heif/heif.go318
-rw-r--r--libheif/CMakeLists.txt (renamed from src/CMakeLists.txt)2
-rw-r--r--libheif/Makefile.am (renamed from src/Makefile.am)26
-rw-r--r--libheif/Makefile.in (renamed from src/Makefile.in)152
-rw-r--r--libheif/bitstream.cc (renamed from src/bitstream.cc)0
-rw-r--r--libheif/bitstream.h (renamed from src/bitstream.h)7
-rw-r--r--libheif/box.cc (renamed from src/box.cc)13
-rw-r--r--libheif/box.h (renamed from src/box.h)6
-rw-r--r--libheif/box_fuzzer.cc (renamed from src/box-fuzzer.cc)0
-rw-r--r--libheif/encoder_fuzzer.cc (renamed from src/encoder-fuzzer.cc)9
-rw-r--r--libheif/error.cc (renamed from src/error.cc)4
-rw-r--r--libheif/error.h (renamed from src/error.h)0
-rw-r--r--libheif/file_fuzzer.cc (renamed from src/file-fuzzer.cc)5
-rw-r--r--libheif/heif.cc (renamed from src/heif.cc)114
-rw-r--r--libheif/heif.h (renamed from src/heif.h)39
-rw-r--r--libheif/heif_api_structs.h (renamed from src/heif_api_structs.h)2
-rw-r--r--libheif/heif_context.cc (renamed from src/heif_context.cc)21
-rw-r--r--libheif/heif_context.h (renamed from src/heif_context.h)1
-rw-r--r--libheif/heif_cxx.h864
-rw-r--r--libheif/heif_decoder_libde265.cc (renamed from src/heif_decoder_libde265.cc)36
-rw-r--r--libheif/heif_decoder_libde265.h (renamed from src/heif_decoder_libde265.h)0
-rw-r--r--libheif/heif_emscripten.h (renamed from src/heif-emscripten.h)2
-rw-r--r--libheif/heif_encoder_x265.cc (renamed from src/heif_encoder_x265.cc)54
-rw-r--r--libheif/heif_encoder_x265.h (renamed from src/heif_encoder_x265.h)0
-rw-r--r--libheif/heif_file.cc (renamed from src/heif_file.cc)15
-rw-r--r--libheif/heif_file.h (renamed from src/heif_file.h)2
-rw-r--r--libheif/heif_hevc.cc (renamed from src/heif_hevc.cc)0
-rw-r--r--libheif/heif_hevc.h (renamed from src/heif_hevc.h)0
-rw-r--r--libheif/heif_image.cc (renamed from src/heif_image.cc)49
-rw-r--r--libheif/heif_image.h (renamed from src/heif_image.h)2
-rw-r--r--libheif/heif_limits.h (renamed from src/heif_limits.h)6
-rw-r--r--libheif/heif_plugin.cc (renamed from src/heif_plugin.cc)4
-rw-r--r--libheif/heif_plugin.h (renamed from src/heif_plugin.h)2
-rw-r--r--libheif/heif_plugin_registry.cc (renamed from src/heif_plugin_registry.cc)2
-rw-r--r--libheif/heif_plugin_registry.h (renamed from src/heif_plugin_registry.h)0
-rw-r--r--libheif/heif_version.h (renamed from src/heif-version.h)6
-rw-r--r--libheif/heif_version.h.in (renamed from src/heif-version.h.in)2
-rw-r--r--libheif/logging.h (renamed from src/logging.h)0
-rw-r--r--scripts/Makefile.am10
-rw-r--r--scripts/Makefile.in10
-rwxr-xr-xscripts/check-emscripten-enums.sh14
-rwxr-xr-xscripts/install-ci-linux.sh (renamed from scripts/install-ci.sh)10
-rwxr-xr-xscripts/install-ci-osx.sh64
-rwxr-xr-xscripts/pre-commit.hook2
-rwxr-xr-xscripts/prepare-ci.sh14
-rwxr-xr-xscripts/run-ci.sh17
74 files changed, 3502 insertions, 310 deletions
diff --git a/.travis.yml b/.travis.yml
index 4c19dbb..6aa3eda 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,8 +4,14 @@ language: cpp
compiler:
- gcc
- clang
+os:
+ - linux
+ - osx
cache: ccache
sudo: required
+addons:
+ apt:
+ update: true
env:
- CHECK_LICENSES=1
- CPPLINT=1
@@ -20,9 +26,11 @@ env:
- EMSCRIPTEN_VERSION=1.37.26
- WITH_LIBDE265=1 WITH_X265=1 WITH_GRAPHICS=1 TARBALL=1
- WITH_LIBDE265=1 WITH_X265=1 WITH_GRAPHICS=1 CMAKE=1
+ - WITH_LIBDE265= WITH_X265= WITH_GRAPHICS= MINGW64=1
matrix:
exclude:
+ # Don't build various targets with clang.
- compiler: clang
env: CHECK_LICENSES=1
- compiler: clang
@@ -41,9 +49,34 @@ matrix:
env: WITH_LIBDE265=1 WITH_X265=1 WITH_GRAPHICS=1 TARBALL=1
- compiler: clang
env: WITH_LIBDE265=1 WITH_X265=1 WITH_GRAPHICS=1 CMAKE=1
+ - compiler: clang
+ env: WITH_LIBDE265= WITH_X265= WITH_GRAPHICS= MINGW64=1
+ # Don't build various targets on OSX.
+ - os: osx
+ env: CHECK_LICENSES=1
+ - os: osx
+ env: CPPLINT=1
+ - os: osx
+ env: WITH_LIBDE265= WITH_X265= WITH_GRAPHICS=1
+ - os: osx
+ env: WITH_LIBDE265= WITH_X265=1 WITH_GRAPHICS=
+ - os: osx
+ env: WITH_LIBDE265= WITH_X265=1 WITH_GRAPHICS=1
+ - os: osx
+ env: WITH_LIBDE265=1 WITH_X265= WITH_GRAPHICS=1
+ - os: osx
+ env: WITH_LIBDE265=2 WITH_X265= WITH_GRAPHICS=1
+ - os: osx
+ env: WITH_LIBDE265=2 WITH_X265=1 WITH_GRAPHICS=1
+ - os: osx
+ env: EMSCRIPTEN_VERSION=1.37.26
+ - os: osx
+ env: WITH_LIBDE265=1 WITH_X265=1 WITH_GRAPHICS=1 TARBALL=1
+ - os: osx
+ env: WITH_LIBDE265= WITH_X265= WITH_GRAPHICS= MINGW64=1
before_install:
- - ./scripts/install-ci.sh
+ - ./scripts/install-ci-$TRAVIS_OS_NAME.sh
before_script:
- ./scripts/prepare-ci.sh
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4764c5d..d36f1a5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,8 +30,8 @@ if (HAVE_UNISTD_H)
endif()
configure_file (
- "${PROJECT_SOURCE_DIR}/src/heif-version.h.in"
- "${PROJECT_SOURCE_DIR}/src/heif-version.h"
+ "${PROJECT_SOURCE_DIR}/libheif/heif_version.h.in"
+ "${PROJECT_SOURCE_DIR}/libheif/heif_version.h"
)
if(CMAKE_COMPILER_IS_GNUCXX)
@@ -41,6 +41,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-Wsign-compare)
add_definitions(-Wconversion)
add_definitions(-Wno-sign-conversion)
+ add_definitions(-Wno-error=conversion)
set(CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_definitions(-Wall)
@@ -48,10 +49,11 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_definitions(-Wsign-compare)
add_definitions(-Wconversion)
add_definitions(-Wno-sign-conversion)
+ add_definitions(-Wno-error=conversion)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
endif()
-include_directories ("${PROJECT_SOURCE_DIR}/src")
+include_directories ("${PROJECT_SOURCE_DIR}")
if(UNIX)
set(LIBHEIF_LIBRARY_NAME heif)
@@ -60,4 +62,4 @@ else()
endif()
add_subdirectory (examples)
-add_subdirectory (src)
+add_subdirectory (libheif)
diff --git a/Makefile.am b/Makefile.am
index ff33238..94c5694 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,9 +1,11 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = \
- src \
+ libheif \
examples \
extra \
+ gnome \
+ go \
scripts
pkgconfigdir = $(libdir)/pkgconfig
@@ -14,10 +16,11 @@ EXTRA_DIST = \
appveyor.yml \
autogen.sh \
CMakeLists.txt \
- */CMakeLists.txt \
+ examples/CMakeLists.txt \
+ libheif/CMakeLists.txt \
CPPLINT.cfg \
README.md \
pre.js \
post.js \
build-emscripten.sh \
- */COPYING
+ examples/COPYING
diff --git a/Makefile.in b/Makefile.in
index bb35c0d..5c61618 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -387,9 +387,11 @@ x265_CFLAGS = @x265_CFLAGS@
x265_LIBS = @x265_LIBS@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = \
- src \
+ libheif \
examples \
extra \
+ gnome \
+ go \
scripts
pkgconfigdir = $(libdir)/pkgconfig
@@ -399,13 +401,14 @@ EXTRA_DIST = \
appveyor.yml \
autogen.sh \
CMakeLists.txt \
- */CMakeLists.txt \
+ examples/CMakeLists.txt \
+ libheif/CMakeLists.txt \
CPPLINT.cfg \
README.md \
pre.js \
post.js \
build-emscripten.sh \
- */COPYING
+ examples/COPYING
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
diff --git a/README.md b/README.md
index 2b5f0b1..debbfc6 100644
--- a/README.md
+++ b/README.md
@@ -57,7 +57,6 @@ Writing an HEIF file can be done like this:
```C
heif_context* ctx = heif_context_alloc();
-heif_context_new_heic(ctx);
// get the default encoder
heif_encoder* encoder;
@@ -105,7 +104,7 @@ This is `libheif` running in JavaScript in your browser.
## Example programs
-Two example programs are provided in the `examples` directory.
+Some example programs are provided in the `examples` directory.
The program `heif-convert` converts all images stored in an HEIF file to JPEG or PNG.
`heif-enc` lets you convert JPEG files to HEIF.
The program `heif-info` is a simple, minimal decoder that dumps the file structure to the console.
@@ -113,6 +112,14 @@ The program `heif-info` is a simple, minimal decoder that dumps the file structu
There is also a GIMP plugin using libheif [here](https://github.com/strukturag/heif-gimp-plugin).
+## HEIF thumbnails for the Gnome desktop
+
+The program `heif-thumbnailer` can be used as a HEIF thumbnailer for the Gnome desktop.
+The matching Gnome configuration files are in the `gnome` directory.
+Place the file `heif.xml` into `/usr/share/mime/packages` and `heif.thumbnailer` into `/usr/share/thumbnailers`.
+You may have to run `update-mime-database /usr/share/mime` to update the list of known MIME types.
+
+
## License
The libheif is distributed under the terms of the GNU Lesser General Public License.
diff --git a/appveyor.yml b/appveyor.yml
index 5d5df60..796edb5 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -21,7 +21,8 @@ build:
build_script:
- ps: if($env:PLATFORM -eq "x64") { $env:CMAKE_GEN_SUFFIX=" Win64" }
- - cmake "-G%GENERATOR%%CMAKE_GEN_SUFFIX%" -H. -Bbuild
+ - cmd: scripts\prepare-appveyor.cmd
+ - cmake "-G%GENERATOR%%CMAKE_GEN_SUFFIX%" -H. -Bbuild -DLIBDE265_FOUND=1 -DLIBDE265_CFLAGS=/I"%APPVEYOR_BUILD_FOLDER%\build-libde265" -DLIBDE265_LIBRARIES="%APPVEYOR_BUILD_FOLDER%\build-libde265\libde265.lib" -DX265_FOUND=1 -DX265_CFLAGS=/I"%APPVEYOR_BUILD_FOLDER%\build-x265" -DX265_LIBRARIES="%APPVEYOR_BUILD_FOLDER%\build-x265\libx265.lib"
- cmake --build build --config %CONFIGURATION%
artifacts:
diff --git a/build-emscripten.sh b/build-emscripten.sh
index 4cb2e1c..a45c051 100755
--- a/build-emscripten.sh
+++ b/build-emscripten.sh
@@ -36,7 +36,7 @@ emmake make -j${CORES}
export TOTAL_MEMORY=16777216
echo "Running Emscripten..."
-emcc src/.libs/libheif.so \
+emcc libheif/.libs/libheif.so \
--bind \
-s NO_EXIT_RUNTIME=1 \
-s TOTAL_MEMORY=${TOTAL_MEMORY} \
diff --git a/configure b/configure
index fbae095..eb267bd 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libheif 1.1.0.
+# Generated by GNU Autoconf 2.69 for libheif 1.2.0.
#
# Report bugs to <opensource@struktur.de>.
#
@@ -590,12 +590,12 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libheif'
PACKAGE_TARNAME='libheif'
-PACKAGE_VERSION='1.1.0'
-PACKAGE_STRING='libheif 1.1.0'
+PACKAGE_VERSION='1.2.0'
+PACKAGE_STRING='libheif 1.2.0'
PACKAGE_BUGREPORT='opensource@struktur.de'
PACKAGE_URL=''
-ac_unique_file="src/box.cc"
+ac_unique_file="libheif/box.cc"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
@@ -691,6 +691,8 @@ VERSION
PACKAGE
CYGPATH_W
am__isrc
+MINGW_FALSE
+MINGW_TRUE
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
@@ -1390,7 +1392,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libheif 1.1.0 to adapt to many kinds of systems.
+\`configure' configures libheif 1.2.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1462,7 +1464,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libheif 1.1.0:";;
+ short | recursive ) echo "Configuration of libheif 1.2.0:";;
esac
cat <<\_ACEOF
@@ -1595,7 +1597,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libheif configure 1.1.0
+libheif configure 1.2.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2193,7 +2195,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libheif $as_me 1.1.0, which was
+It was created by libheif $as_me 1.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2545,12 +2547,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers config.h"
-NUMERIC_VERSION=0x01010000 # Numeric representation of the version (A.B.C[.D] = 0xAABBCCDD)
+NUMERIC_VERSION=0x01020000 # Numeric representation of the version (A.B.C[.D] = 0xAABBCCDD)
-LIBHEIF_CURRENT=2
+LIBHEIF_CURRENT=3
LIBHEIF_REVISION=0
-LIBHEIF_AGE=1
+LIBHEIF_AGE=2
@@ -16191,6 +16193,14 @@ $as_echo "$ac_cv_path_GREP" >&6; }
GREP="$ac_cv_path_GREP"
+ if expr $host : '.*-mingw' >/dev/null 2>&1; then
+ MINGW_TRUE=
+ MINGW_FALSE='#'
+else
+ MINGW_TRUE='#'
+ MINGW_FALSE=
+fi
+
am__api_version='1.15'
@@ -16531,7 +16541,7 @@ fi
# Define the identity of the package.
PACKAGE='libheif'
- VERSION='1.1.0'
+ VERSION='1.2.0'
cat >>confdefs.h <<_ACEOF
@@ -18005,11 +18015,15 @@ ac_config_files="$ac_config_files examples/Makefile"
ac_config_files="$ac_config_files extra/Makefile"
+ac_config_files="$ac_config_files go/Makefile"
+
+ac_config_files="$ac_config_files gnome/Makefile"
+
ac_config_files="$ac_config_files scripts/Makefile"
-ac_config_files="$ac_config_files src/Makefile"
+ac_config_files="$ac_config_files libheif/Makefile"
-ac_config_files="$ac_config_files src/heif-version.h"
+ac_config_files="$ac_config_files libheif/heif_version.h"
ac_config_files="$ac_config_files libheif.pc"
@@ -18130,6 +18144,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${MINGW_TRUE}" && test -z "${MINGW_FALSE}"; then
+ as_fn_error $? "conditional \"MINGW\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
$as_echo_n "checking that generated files are newer than configure... " >&6; }
if test -n "$am_sleep_pid"; then
@@ -18575,7 +18593,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libheif $as_me 1.1.0, which was
+This file was extended by libheif $as_me 1.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18641,7 +18659,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libheif config.status 1.1.0
+libheif config.status 1.2.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -19157,9 +19175,11 @@ do
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
"extra/Makefile") CONFIG_FILES="$CONFIG_FILES extra/Makefile" ;;
+ "go/Makefile") CONFIG_FILES="$CONFIG_FILES go/Makefile" ;;
+ "gnome/Makefile") CONFIG_FILES="$CONFIG_FILES gnome/Makefile" ;;
"scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;;
- "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
- "src/heif-version.h") CONFIG_FILES="$CONFIG_FILES src/heif-version.h" ;;
+ "libheif/Makefile") CONFIG_FILES="$CONFIG_FILES libheif/Makefile" ;;
+ "libheif/heif_version.h") CONFIG_FILES="$CONFIG_FILES libheif/heif_version.h" ;;
"libheif.pc") CONFIG_FILES="$CONFIG_FILES libheif.pc" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
diff --git a/configure.ac b/configure.ac
index 7ecb7d1..2d61612 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,14 +1,14 @@
AC_PREREQ([2.68])
-AC_INIT([libheif], [1.1.0], [opensource@struktur.de])
-AC_CONFIG_SRCDIR([src/box.cc])
+AC_INIT([libheif], [1.2.0], [opensource@struktur.de])
+AC_CONFIG_SRCDIR([libheif/box.cc])
AC_CONFIG_HEADERS([config.h])
-NUMERIC_VERSION=0x01010000 # Numeric representation of the version (A.B.C[.D] = 0xAABBCCDD)
+NUMERIC_VERSION=0x01020000 # Numeric representation of the version (A.B.C[.D] = 0xAABBCCDD)
AC_SUBST(NUMERIC_VERSION)
-LIBHEIF_CURRENT=2
+LIBHEIF_CURRENT=3
LIBHEIF_REVISION=0
-LIBHEIF_AGE=1
+LIBHEIF_AGE=2
AC_SUBST(LIBHEIF_CURRENT)
AC_SUBST(LIBHEIF_REVISION)
AC_SUBST(LIBHEIF_AGE)
@@ -25,6 +25,7 @@ AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_GREP
+AM_CONDITIONAL(MINGW, expr $host : '.*-mingw' >/dev/null 2>&1)
AM_INIT_AUTOMAKE([foreign])
@@ -131,8 +132,10 @@ AC_MSG_NOTICE([---------------------------------------])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([examples/Makefile])
AC_CONFIG_FILES([extra/Makefile])
+AC_CONFIG_FILES([go/Makefile])
+AC_CONFIG_FILES([gnome/Makefile])
AC_CONFIG_FILES([scripts/Makefile])
-AC_CONFIG_FILES([src/Makefile])
-AC_CONFIG_FILES([src/heif-version.h])
+AC_CONFIG_FILES([libheif/Makefile])
+AC_CONFIG_FILES([libheif/heif_version.h])
AC_CONFIG_FILES([libheif.pc])
AC_OUTPUT
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 6a80725..2835c1b 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -36,6 +36,10 @@ set (heif_enc_sources
heif_enc.cc
)
+set (heif_test_sources
+ heif_test.cc
+)
+
if(MSVC)
set (heif_convert_sources
${heif_convert_sources}
@@ -55,6 +59,12 @@ if(MSVC)
../extra/getopt.h
../extra/getopt_long.c
)
+ set (heif_test_sources
+ ${heif_test_sources}
+ ../extra/getopt.c
+ ../extra/getopt.h
+ ../extra/getopt_long.c
+ )
include_directories ("../extra")
endif()
@@ -66,3 +76,20 @@ target_link_libraries (heif-info ${LIBHEIF_LIBRARY_NAME})
add_executable (heif-enc ${heif_enc_sources})
target_link_libraries (heif-enc ${LIBHEIF_LIBRARY_NAME} ${JPEG_LIBRARIES} ${LIBPNG_LIBRARIES})
+
+add_executable (heif-test ${heif_test_sources})
+target_link_libraries (heif-test ${LIBHEIF_LIBRARY_NAME})
+
+
+if(LIBPNG_FOUND)
+ set (heif_thumbnailer_sources
+ encoder.cc
+ encoder.h
+ heif_thumbnailer.cc
+ encoder_png.cc
+ encoder_png.h
+ )
+
+ add_executable (heif-thumbnailer ${heif_thumbnailer_sources})
+ target_link_libraries (heif-thumbnailer ${LIBHEIF_LIBRARY_NAME} ${LIBPNG_LIBRARIES})
+endif()
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 621f739..99023c8 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -5,12 +5,25 @@ bin_PROGRAMS = \
heif-enc \
heif-info
-heif_convert_DEPENDENCIES = ../src/libheif.la
-heif_convert_CXXFLAGS = -I../src
+noinst_PROGRAMS = \
+ heif-test
+
+heif_convert_DEPENDENCIES = ../libheif/libheif.la
+heif_convert_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir)/.
heif_convert_LDFLAGS =
-heif_convert_LDADD = ../src/libheif.la
+heif_convert_LDADD = ../libheif/libheif.la
heif_convert_SOURCES = encoder.cc encoder.h heif_convert.cc
+
+if HAVE_LIBPNG
+bin_PROGRAMS += heif-thumbnailer
+heif_thumbnailer_DEPENDENCIES = ../libheif/libheif.la
+heif_thumbnailer_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir) $(libpng_CFLAGS)
+heif_thumbnailer_LDFLAGS = $(libpng_LIBS)
+heif_thumbnailer_LDADD = ../libheif/libheif.la
+heif_thumbnailer_SOURCES = encoder.cc encoder.h heif_thumbnailer.cc encoder_png.cc encoder_png.h
+endif
+
if HAVE_LIBJPEG
heif_convert_CXXFLAGS += $(libjpeg_CFLAGS)
heif_convert_LDADD += $(libjpeg_LIBS)
@@ -23,16 +36,16 @@ heif_convert_LDADD += $(libpng_LIBS)
heif_convert_SOURCES += encoder_png.cc encoder_png.h
endif
-heif_info_DEPENDENCIES = ../src/libheif.la
-heif_info_CXXFLAGS = -I../src
+heif_info_DEPENDENCIES = ../libheif/libheif.la
+heif_info_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir)
heif_info_LDFLAGS =
-heif_info_LDADD = ../src/libheif.la
+heif_info_LDADD = ../libheif/libheif.la
heif_info_SOURCES = heif_info.cc
-heif_enc_DEPENDENCIES = ../src/libheif.la
-heif_enc_CXXFLAGS = -I../src
+heif_enc_DEPENDENCIES = ../libheif/libheif.la
+heif_enc_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir)
heif_enc_LDFLAGS =
-heif_enc_LDADD = ../src/libheif.la
+heif_enc_LDADD = ../libheif/libheif.la
heif_enc_SOURCES = heif_enc.cc
if HAVE_LIBJPEG
@@ -45,6 +58,12 @@ heif_enc_CXXFLAGS += $(libpng_CFLAGS)
heif_enc_LDADD += $(libpng_LIBS)
endif
+heif_test_DEPENDENCIES = ../libheif/libheif.la
+heif_test_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir)
+heif_test_LDFLAGS =
+heif_test_LDADD = ../libheif/libheif.la
+heif_test_SOURCES = heif_test.cc
+
EXTRA_DIST = \
demo.html \
example.heic
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 2c693d4..ccc083c 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -90,17 +90,19 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
bin_PROGRAMS = heif-convert$(EXEEXT) heif-enc$(EXEEXT) \
- heif-info$(EXEEXT)
-@HAVE_LIBJPEG_TRUE@am__append_1 = $(libjpeg_CFLAGS)
-@HAVE_LIBJPEG_TRUE@am__append_2 = $(libjpeg_LIBS)
-@HAVE_LIBJPEG_TRUE@am__append_3 = encoder_jpeg.cc encoder_jpeg.h
-@HAVE_LIBPNG_TRUE@am__append_4 = $(libpng_CFLAGS)
-@HAVE_LIBPNG_TRUE@am__append_5 = $(libpng_LIBS)
-@HAVE_LIBPNG_TRUE@am__append_6 = encoder_png.cc encoder_png.h
-@HAVE_LIBJPEG_TRUE@am__append_7 = $(libjpeg_CFLAGS)
-@HAVE_LIBJPEG_TRUE@am__append_8 = $(libjpeg_LIBS)
-@HAVE_LIBPNG_TRUE@am__append_9 = $(libpng_CFLAGS)
-@HAVE_LIBPNG_TRUE@am__append_10 = $(libpng_LIBS)
+ heif-info$(EXEEXT) $(am__EXEEXT_1)
+noinst_PROGRAMS = heif-test$(EXEEXT)
+@HAVE_LIBPNG_TRUE@am__append_1 = heif-thumbnailer
+@HAVE_LIBJPEG_TRUE@am__append_2 = $(libjpeg_CFLAGS)
+@HAVE_LIBJPEG_TRUE@am__append_3 = $(libjpeg_LIBS)
+@HAVE_LIBJPEG_TRUE@am__append_4 = encoder_jpeg.cc encoder_jpeg.h
+@HAVE_LIBPNG_TRUE@am__append_5 = $(libpng_CFLAGS)
+@HAVE_LIBPNG_TRUE@am__append_6 = $(libpng_LIBS)
+@HAVE_LIBPNG_TRUE@am__append_7 = encoder_png.cc encoder_png.h
+@HAVE_LIBJPEG_TRUE@am__append_8 = $(libjpeg_CFLAGS)
+@HAVE_LIBJPEG_TRUE@am__append_9 = $(libjpeg_LIBS)
+@HAVE_LIBPNG_TRUE@am__append_10 = $(libpng_CFLAGS)
+@HAVE_LIBPNG_TRUE@am__append_11 = $(libpng_LIBS)
subdir = examples
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
@@ -115,8 +117,9 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+@HAVE_LIBPNG_TRUE@am__EXEEXT_1 = heif-thumbnailer$(EXEEXT)
am__installdirs = "$(DESTDIR)$(bindir)"
-PROGRAMS = $(bin_PROGRAMS)
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
am__heif_convert_SOURCES_DIST = encoder.cc encoder.h heif_convert.cc \
encoder_jpeg.cc encoder_jpeg.h encoder_png.cc encoder_png.h
@HAVE_LIBJPEG_TRUE@am__objects_1 = \
@@ -146,6 +149,22 @@ heif_info_OBJECTS = $(am_heif_info_OBJECTS)
heif_info_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(heif_info_CXXFLAGS) \
$(CXXFLAGS) $(heif_info_LDFLAGS) $(LDFLAGS) -o $@
+am_heif_test_OBJECTS = heif_test-heif_test.$(OBJEXT)
+heif_test_OBJECTS = $(am_heif_test_OBJECTS)
+heif_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(heif_test_CXXFLAGS) \
+ $(CXXFLAGS) $(heif_test_LDFLAGS) $(LDFLAGS) -o $@
+am__heif_thumbnailer_SOURCES_DIST = encoder.cc encoder.h \
+ heif_thumbnailer.cc encoder_png.cc encoder_png.h
+@HAVE_LIBPNG_TRUE@am_heif_thumbnailer_OBJECTS = \
+@HAVE_LIBPNG_TRUE@ heif_thumbnailer-encoder.$(OBJEXT) \
+@HAVE_LIBPNG_TRUE@ heif_thumbnailer-heif_thumbnailer.$(OBJEXT) \
+@HAVE_LIBPNG_TRUE@ heif_thumbnailer-encoder_png.$(OBJEXT)
+heif_thumbnailer_OBJECTS = $(am_heif_thumbnailer_OBJECTS)
+heif_thumbnailer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+ $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) \
+ $(heif_thumbnailer_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
@@ -199,9 +218,11 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(heif_convert_SOURCES) $(heif_enc_SOURCES) \
- $(heif_info_SOURCES)
+ $(heif_info_SOURCES) $(heif_test_SOURCES) \
+ $(heif_thumbnailer_SOURCES)
DIST_SOURCES = $(am__heif_convert_SOURCES_DIST) $(heif_enc_SOURCES) \
- $(heif_info_SOURCES)
+ $(heif_info_SOURCES) $(heif_test_SOURCES) \
+ $(am__heif_thumbnailer_SOURCES_DIST)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -377,22 +398,36 @@ top_srcdir = @top_srcdir@
x265_CFLAGS = @x265_CFLAGS@
x265_LIBS = @x265_LIBS@
AUTOMAKE_OPTIONS = subdir-objects
-heif_convert_DEPENDENCIES = ../src/libheif.la
-heif_convert_CXXFLAGS = -I../src $(am__append_1) $(am__append_4)
+heif_convert_DEPENDENCIES = ../libheif/libheif.la
+heif_convert_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir)/. \
+ $(am__append_2) $(am__append_5)
heif_convert_LDFLAGS =
-heif_convert_LDADD = ../src/libheif.la $(am__append_2) $(am__append_5)
+heif_convert_LDADD = ../libheif/libheif.la $(am__append_3) \
+ $(am__append_6)
heif_convert_SOURCES = encoder.cc encoder.h heif_convert.cc \
- $(am__append_3) $(am__append_6)
-heif_info_DEPENDENCIES = ../src/libheif.la
-heif_info_CXXFLAGS = -I../src
+ $(am__append_4) $(am__append_7)
+@HAVE_LIBPNG_TRUE@heif_thumbnailer_DEPENDENCIES = ../libheif/libheif.la
+@HAVE_LIBPNG_TRUE@heif_thumbnailer_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir) $(libpng_CFLAGS)
+@HAVE_LIBPNG_TRUE@heif_thumbnailer_LDFLAGS = $(libpng_LIBS)
+@HAVE_LIBPNG_TRUE@heif_thumbnailer_LDADD = ../libheif/libheif.la
+@HAVE_LIBPNG_TRUE@heif_thumbnailer_SOURCES = encoder.cc encoder.h heif_thumbnailer.cc encoder_png.cc encoder_png.h
+heif_info_DEPENDENCIES = ../libheif/libheif.la
+heif_info_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir)
heif_info_LDFLAGS =
-heif_info_LDADD = ../src/libheif.la
+heif_info_LDADD = ../libheif/libheif.la
heif_info_SOURCES = heif_info.cc
-heif_enc_DEPENDENCIES = ../src/libheif.la
-heif_enc_CXXFLAGS = -I../src $(am__append_7) $(am__append_9)
+heif_enc_DEPENDENCIES = ../libheif/libheif.la
+heif_enc_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir) $(am__append_8) \
+ $(am__append_10)
heif_enc_LDFLAGS =
-heif_enc_LDADD = ../src/libheif.la $(am__append_8) $(am__append_10)
+heif_enc_LDADD = ../libheif/libheif.la $(am__append_9) \
+ $(am__append_11)
heif_enc_SOURCES = heif_enc.cc
+heif_test_DEPENDENCIES = ../libheif/libheif.la
+heif_test_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir)
+heif_test_LDFLAGS =
+heif_test_LDADD = ../libheif/libheif.la
+heif_test_SOURCES = heif_test.cc
EXTRA_DIST = \
demo.html \
example.heic
@@ -480,6 +515,15 @@ clean-binPROGRAMS:
echo " rm -f" $$list; \
rm -f $$list
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
heif-convert$(EXEEXT): $(heif_convert_OBJECTS) $(heif_convert_DEPENDENCIES) $(EXTRA_heif_convert_DEPENDENCIES)
@rm -f heif-convert$(EXEEXT)
$(AM_V_CXXLD)$(heif_convert_LINK) $(heif_convert_OBJECTS) $(heif_convert_LDADD) $(LIBS)
@@ -492,6 +536,14 @@ heif-info$(EXEEXT): $(heif_info_OBJECTS) $(heif_info_DEPENDENCIES) $(EXTRA_heif_
@rm -f heif-info$(EXEEXT)
$(AM_V_CXXLD)$(heif_info_LINK) $(heif_info_OBJECTS) $(heif_info_LDADD) $(LIBS)
+heif-test$(EXEEXT): $(heif_test_OBJECTS) $(heif_test_DEPENDENCIES) $(EXTRA_heif_test_DEPENDENCIES)
+ @rm -f heif-test$(EXEEXT)
+ $(AM_V_CXXLD)$(heif_test_LINK) $(heif_test_OBJECTS) $(heif_test_LDADD) $(LIBS)
+
+heif-thumbnailer$(EXEEXT): $(heif_thumbnailer_OBJECTS) $(heif_thumbnailer_DEPENDENCIES) $(EXTRA_heif_thumbnailer_DEPENDENCIES)
+ @rm -f heif-thumbnailer$(EXEEXT)
+ $(AM_V_CXXLD)$(heif_thumbnailer_LINK) $(heif_thumbnailer_OBJECTS) $(heif_thumbnailer_LDADD) $(LIBS)
+
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -504,6 +556,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heif_convert-heif_convert.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heif_enc-heif_enc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heif_info-heif_info.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heif_test-heif_test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heif_thumbnailer-encoder.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heif_thumbnailer-encoder_png.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heif_thumbnailer-heif_thumbnailer.Po@am__quote@
.cc.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -613,6 +669,62 @@ heif_info-heif_info.obj: heif_info.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_info_CXXFLAGS) $(CXXFLAGS) -c -o heif_info-heif_info.obj `if test -f 'heif_info.cc'; then $(CYGPATH_W) 'heif_info.cc'; else $(CYGPATH_W) '$(srcdir)/heif_info.cc'; fi`
+heif_test-heif_test.o: heif_test.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_test_CXXFLAGS) $(CXXFLAGS) -MT heif_test-heif_test.o -MD -MP -MF $(DEPDIR)/heif_test-heif_test.Tpo -c -o heif_test-heif_test.o `test -f 'heif_test.cc' || echo '$(srcdir)/'`heif_test.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_test-heif_test.Tpo $(DEPDIR)/heif_test-heif_test.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='heif_test.cc' object='heif_test-heif_test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_test_CXXFLAGS) $(CXXFLAGS) -c -o heif_test-heif_test.o `test -f 'heif_test.cc' || echo '$(srcdir)/'`heif_test.cc
+
+heif_test-heif_test.obj: heif_test.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_test_CXXFLAGS) $(CXXFLAGS) -MT heif_test-heif_test.obj -MD -MP -MF $(DEPDIR)/heif_test-heif_test.Tpo -c -o heif_test-heif_test.obj `if test -f 'heif_test.cc'; then $(CYGPATH_W) 'heif_test.cc'; else $(CYGPATH_W) '$(srcdir)/heif_test.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_test-heif_test.Tpo $(DEPDIR)/heif_test-heif_test.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='heif_test.cc' object='heif_test-heif_test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_test_CXXFLAGS) $(CXXFLAGS) -c -o heif_test-heif_test.obj `if test -f 'heif_test.cc'; then $(CYGPATH_W) 'heif_test.cc'; else $(CYGPATH_W) '$(srcdir)/heif_test.cc'; fi`
+
+heif_thumbnailer-encoder.o: encoder.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) -MT heif_thumbnailer-encoder.o -MD -MP -MF $(DEPDIR)/heif_thumbnailer-encoder.Tpo -c -o heif_thumbnailer-encoder.o `test -f 'encoder.cc' || echo '$(srcdir)/'`encoder.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_thumbnailer-encoder.Tpo $(DEPDIR)/heif_thumbnailer-encoder.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encoder.cc' object='heif_thumbnailer-encoder.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) -c -o heif_thumbnailer-encoder.o `test -f 'encoder.cc' || echo '$(srcdir)/'`encoder.cc
+
+heif_thumbnailer-encoder.obj: encoder.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) -MT heif_thumbnailer-encoder.obj -MD -MP -MF $(DEPDIR)/heif_thumbnailer-encoder.Tpo -c -o heif_thumbnailer-encoder.obj `if test -f 'encoder.cc'; then $(CYGPATH_W) 'encoder.cc'; else $(CYGPATH_W) '$(srcdir)/encoder.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_thumbnailer-encoder.Tpo $(DEPDIR)/heif_thumbnailer-encoder.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encoder.cc' object='heif_thumbnailer-encoder.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) -c -o heif_thumbnailer-encoder.obj `if test -f 'encoder.cc'; then $(CYGPATH_W) 'encoder.cc'; else $(CYGPATH_W) '$(srcdir)/encoder.cc'; fi`
+
+heif_thumbnailer-heif_thumbnailer.o: heif_thumbnailer.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) -MT heif_thumbnailer-heif_thumbnailer.o -MD -MP -MF $(DEPDIR)/heif_thumbnailer-heif_thumbnailer.Tpo -c -o heif_thumbnailer-heif_thumbnailer.o `test -f 'heif_thumbnailer.cc' || echo '$(srcdir)/'`heif_thumbnailer.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_thumbnailer-heif_thumbnailer.Tpo $(DEPDIR)/heif_thumbnailer-heif_thumbnailer.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='heif_thumbnailer.cc' object='heif_thumbnailer-heif_thumbnailer.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) -c -o heif_thumbnailer-heif_thumbnailer.o `test -f 'heif_thumbnailer.cc' || echo '$(srcdir)/'`heif_thumbnailer.cc
+
+heif_thumbnailer-heif_thumbnailer.obj: heif_thumbnailer.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) -MT heif_thumbnailer-heif_thumbnailer.obj -MD -MP -MF $(DEPDIR)/heif_thumbnailer-heif_thumbnailer.Tpo -c -o heif_thumbnailer-heif_thumbnailer.obj `if test -f 'heif_thumbnailer.cc'; then $(CYGPATH_W) 'heif_thumbnailer.cc'; else $(CYGPATH_W) '$(srcdir)/heif_thumbnailer.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_thumbnailer-heif_thumbnailer.Tpo $(DEPDIR)/heif_thumbnailer-heif_thumbnailer.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='heif_thumbnailer.cc' object='heif_thumbnailer-heif_thumbnailer.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) -c -o heif_thumbnailer-heif_thumbnailer.obj `if test -f 'heif_thumbnailer.cc'; then $(CYGPATH_W) 'heif_thumbnailer.cc'; else $(CYGPATH_W) '$(srcdir)/heif_thumbnailer.cc'; fi`
+
+heif_thumbnailer-encoder_png.o: encoder_png.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) -MT heif_thumbnailer-encoder_png.o -MD -MP -MF $(DEPDIR)/heif_thumbnailer-encoder_png.Tpo -c -o heif_thumbnailer-encoder_png.o `test -f 'encoder_png.cc' || echo '$(srcdir)/'`encoder_png.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_thumbnailer-encoder_png.Tpo $(DEPDIR)/heif_thumbnailer-encoder_png.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encoder_png.cc' object='heif_thumbnailer-encoder_png.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) -c -o heif_thumbnailer-encoder_png.o `test -f 'encoder_png.cc' || echo '$(srcdir)/'`encoder_png.cc
+
+heif_thumbnailer-encoder_png.obj: encoder_png.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) -MT heif_thumbnailer-encoder_png.obj -MD -MP -MF $(DEPDIR)/heif_thumbnailer-encoder_png.Tpo -c -o heif_thumbnailer-encoder_png.obj `if test -f 'encoder_png.cc'; then $(CYGPATH_W) 'encoder_png.cc'; else $(CYGPATH_W) '$(srcdir)/encoder_png.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_thumbnailer-encoder_png.Tpo $(DEPDIR)/heif_thumbnailer-encoder_png.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encoder_png.cc' object='heif_thumbnailer-encoder_png.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_thumbnailer_CXXFLAGS) $(CXXFLAGS) -c -o heif_thumbnailer-encoder_png.obj `if test -f 'encoder_png.cc'; then $(CYGPATH_W) 'encoder_png.cc'; else $(CYGPATH_W) '$(srcdir)/encoder_png.cc'; fi`
+
mostlyclean-libtool:
-rm -f *.lo
@@ -740,7 +852,8 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -811,15 +924,16 @@ uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
- clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
- ctags ctags-am distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-binPROGRAMS \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
+ clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-binPROGRAMS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
diff --git a/examples/encoder.cc b/examples/encoder.cc
index c26c8fc..143a868 100644
--- a/examples/encoder.cc
+++ b/examples/encoder.cc
@@ -21,6 +21,8 @@
#include "config.h"
#endif
+#include <stdlib.h>
+
#if defined(HAVE_STRINGS_H)
#include <strings.h>
#endif
diff --git a/examples/encoder.h b/examples/encoder.h
index 1f374c2..da3385b 100644
--- a/examples/encoder.h
+++ b/examples/encoder.h
@@ -23,7 +23,7 @@
#include <string>
#include <memory>
-#include "heif.h"
+#include <libheif/heif.h>
class Encoder {
public:
diff --git a/examples/encoder_jpeg.cc b/examples/encoder_jpeg.cc
index 396bdee..c8186d8 100644
--- a/examples/encoder_jpeg.cc
+++ b/examples/encoder_jpeg.cc
@@ -71,9 +71,9 @@ bool JpegEncoder::Encode(const struct heif_image_handle* handle,
cinfo.input_components = 3;
cinfo.in_color_space = JCS_YCbCr;
jpeg_set_defaults(&cinfo);
- static const bool kForceBaseline = true;
+ static const boolean kForceBaseline = TRUE;
jpeg_set_quality(&cinfo, quality_, kForceBaseline);
- static const bool kWriteAllTables = true;
+ static const boolean kWriteAllTables = TRUE;
jpeg_start_compress(&cinfo, kWriteAllTables);
size_t exifsize = 0;
diff --git a/examples/encoder_png.cc b/examples/encoder_png.cc
index a13f1da..92c1cc1 100644
--- a/examples/encoder_png.cc
+++ b/examples/encoder_png.cc
@@ -18,6 +18,7 @@
* along with convert. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
+#include <errno.h>
#include <math.h>
#include <png.h>
#include <string.h>
diff --git a/examples/heif_convert.cc b/examples/heif_convert.cc
index 3f148e8..b5d2050 100644
--- a/examples/heif_convert.cc
+++ b/examples/heif_convert.cc
@@ -31,7 +31,7 @@
#include <sstream>
#include <assert.h>
-#include "heif.h"
+#include <libheif/heif.h>
#include "encoder.h"
#if HAVE_LIBJPEG
diff --git a/examples/heif_enc.cc b/examples/heif_enc.cc
index 6590b1e..2b7b95b 100644
--- a/examples/heif_enc.cc
+++ b/examples/heif_enc.cc
@@ -31,7 +31,7 @@
#include <algorithm>
#include <vector>
-#include "heif.h"
+#include <libheif/heif.h>
#if HAVE_LIBJPEG
extern "C" {
diff --git a/examples/heif_info.cc b/examples/heif_info.cc
index 3c2d06a..2384a24 100644
--- a/examples/heif_info.cc
+++ b/examples/heif_info.cc
@@ -29,7 +29,7 @@
#define STDOUT_FILENO 1
#endif
-#include "heif.h"
+#include <libheif/heif.h>
#include <fstream>
#include <iostream>
diff --git a/examples/heif_test.cc b/examples/heif_test.cc
new file mode 100644
index 0000000..711e210
--- /dev/null
+++ b/examples/heif_test.cc
@@ -0,0 +1,163 @@
+/*
+ * libheif testing application
+ * Copyright (c) 2017 struktur AG, Dirk Farin <farin@struktur.de>
+ *
+ * This file is part of libheif. It performs test calculations for CI checks.
+ *
+ * heif 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * heif 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 heif. If not, see <http://www.gnu.org/licenses/>.
+ */
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <errno.h>
+#include <string.h>
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#else
+#define STDOUT_FILENO 1
+#endif
+
+#include <libheif/heif_cxx.h>
+
+#include <fstream>
+#include <iostream>
+#include <memory>
+#include <getopt.h>
+#include <assert.h>
+
+
+static struct option long_options[] = {
+ //{"write-raw", required_argument, 0, 'w' },
+ //{"output", required_argument, 0, 'o' },
+ {"decode-img", required_argument, 0, 'd' },
+ {"metadata", required_argument, 0, 'm' },
+ {0, 0, 0, 0 }
+};
+
+void show_help(const char* argv0)
+{
+ fprintf(stderr," heif-test libheif version: %s\n",heif_get_version());
+ fprintf(stderr,"------------------------------------\n");
+ fprintf(stderr,"usage: heif-test [options] image.heic\n");
+ fprintf(stderr,"\n");
+ fprintf(stderr,"options:\n");
+ fprintf(stderr," -d, --decode-img ID decode image and output raw pixel data of all planes\n");
+ fprintf(stderr," -m, --metadata ID output metadata\n");
+ fprintf(stderr," -h, --help show help\n");
+}
+
+
+std::pair<heif_item_id, heif_item_id> parse_id_pair(std::string s)
+{
+ std::string::size_type p = s.find_first_of(':');
+ if (p==std::string::npos) {
+ fprintf(stderr,"id pair has to be in this format: 'ID:ID'\n");
+ exit(1);
+ }
+
+ std::pair<heif_item_id, heif_item_id> pair;
+ pair.first = atoi(s.substr(0,p).c_str());
+ pair.second = atoi(s.substr(p+1).c_str());
+ return pair;
+}
+
+
+int main(int argc, char** argv)
+{
+ std::vector<heif_item_id> image_IDs;
+ std::vector<std::pair<heif_item_id,heif_item_id>> metadata_IDs; // first: image, second: metadata
+
+ while (true) {
+ int option_index = 0;
+ int c = getopt_long(argc, argv, "d:m:h", long_options, &option_index);
+ if (c == -1)
+ break;
+
+ switch (c) {
+ case 'd':
+ image_IDs.push_back(atoi(optarg));
+ break;
+ case 'm':
+ metadata_IDs.push_back(parse_id_pair(optarg));
+ break;
+ case 'h':
+ show_help(argv[0]);
+ return 0;
+ }
+ }
+
+ if (optind != argc-1) {
+ show_help(argv[0]);
+ return 0;
+ }
+
+
+ const char* input_filename = argv[optind];
+
+ // ==============================================================================
+
+ try {
+ heif::Context ctx;
+ ctx.read_from_file(input_filename);
+
+
+ // --- dump images
+
+ for (auto id : image_IDs) {
+ heif::ImageHandle handle = ctx.get_image_handle(id);
+
+ heif::Image img = handle.decode_image(heif_colorspace_undefined, heif_chroma_undefined);
+
+ std::vector<heif_channel> channel_candidates {
+ heif_channel_Y,
+ heif_channel_Cb,
+ heif_channel_Cr,
+ heif_channel_R,
+ heif_channel_G,
+ heif_channel_B,
+ heif_channel_Alpha,
+ heif_channel_interleaved
+ };
+
+ for (heif_channel channel : channel_candidates) {
+ if (img.has_channel(channel)) {
+ int width = img.get_width(channel);
+ int height = img.get_height(channel);
+ int bytes = (img.get_bits_per_pixel(channel)+7)/8;
+
+ int stride;
+ const uint8_t* p = img.get_plane(channel, &stride);
+ for (int y=0;y<height;y++) {
+ fwrite(p+y*stride, width, bytes, stdout);
+ }
+ }
+ }
+ }
+
+
+ // --- dump metadata
+
+ for (auto idpair : metadata_IDs) {
+ heif::ImageHandle handle = ctx.get_image_handle(idpair.first);
+ std::vector<uint8_t> data = handle.get_metadata(idpair.second);
+ fwrite(data.data(), data.size(),1, stdout);
+ }
+ }
+ catch (heif::Error err) {
+ std::cerr << err.get_message() << "\n";
+ }
+
+ return 0;
+}
diff --git a/examples/heif_thumbnailer.cc b/examples/heif_thumbnailer.cc
new file mode 100644
index 0000000..b93a439
--- /dev/null
+++ b/examples/heif_thumbnailer.cc
@@ -0,0 +1,187 @@
+/*
+ * libheif thumbnailer for Gnome desktop.
+ * Copyright (c) 2018 struktur AG, Dirk Farin <farin@struktur.de>
+ *
+ * This file is part of convert, an example application using libheif.
+ *
+ * convert 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * convert 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 convert. If not, see <http://www.gnu.org/licenses/>.
+ */
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include "string.h"
+
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+#include <fstream>
+#include <iostream>
+#include <sstream>
+#include <assert.h>
+
+#include <libheif/heif.h>
+
+#include "encoder.h"
+#if HAVE_LIBPNG
+#include "encoder_png.h"
+#endif
+
+#if defined(_MSC_VER)
+#include "getopt.h"
+#endif
+
+
+static int usage(const char* command) {
+ fprintf(stderr, "usage: %s [-s size] <filename> <output>\n", command);
+ return 1;
+}
+
+
+int main(int argc, char** argv)
+{
+ int opt;
+ int size = 512; // default thumbnail size
+
+ while ((opt = getopt(argc, argv, "s:h")) != -1) {
+ switch (opt) {
+ case 's':
+ size = atoi(optarg);
+ break;
+ case 'h':
+ default:
+ return usage(argv[0]);
+ }
+ }
+
+ if (optind + 2 > argc) {
+ // Need input and output filenames as additional arguments.
+ return usage(argv[0]);
+ }
+
+ std::string input_filename(argv[optind++]);
+ std::string output_filename(argv[optind++]);
+
+
+ // --- read heif file
+
+ std::shared_ptr<heif_context> context(heif_context_alloc(),
+ [] (heif_context* c) { heif_context_free(c); });
+
+ struct heif_error err;
+ err = heif_context_read_from_file(context.get(), input_filename.c_str(), nullptr);
+ if (err.code != 0) {
+ std::cerr << "Could not read HEIF file: " << err.message << "\n";
+ return 1;
+ }
+
+
+
+ // --- get primary image
+
+ struct heif_image_handle* image_handle = NULL;
+ err = heif_context_get_primary_image_handle(context.get(), &image_handle);
+ if (err.code) {
+ std::cerr << "Could not read HEIF image : " << err.message << "\n";
+ return 1;
+ }
+
+
+ // --- if image has a thumbnail, use that instead
+
+ heif_item_id thumbnail_ID;
+ int nThumbnails = heif_image_handle_get_list_of_thumbnail_IDs(image_handle, &thumbnail_ID, 1);
+ if (nThumbnails > 0) {
+ struct heif_image_handle* thumbnail_handle;
+ err = heif_image_handle_get_thumbnail(image_handle, thumbnail_ID, &thumbnail_handle);
+ if (err.code) {
+ std::cerr << "Could not read HEIF image : " << err.message << "\n";
+ return 1;
+ }
+
+ // replace image handle with thumbnail handle
+
+ heif_image_handle_release(image_handle);
+ image_handle = thumbnail_handle;
+ }
+
+
+
+ // --- decode the image (or its thumbnail)
+
+ std::unique_ptr<Encoder> encoder(new PngEncoder());
+
+ struct heif_image* image = NULL;
+ err = heif_decode_image(image_handle,
+ &image,
+ encoder->colorspace(false),
+ encoder->chroma(false),
+ NULL);
+ if (err.code) {
+ std::cerr << "Could not decode HEIF image : " << err.message << "\n";
+ return 1;
+ }
+
+ assert(image);
+
+ // --- compute output thumbnail size
+
+ int input_width = heif_image_handle_get_width(image_handle);
+ int input_height = heif_image_handle_get_height(image_handle);
+
+ int thumbnail_width = input_width;
+ int thumbnail_height = input_height;
+
+ if (input_width>size || input_height>size) {
+ if (input_width>input_height) {
+ thumbnail_height = input_height * size/input_width;
+ thumbnail_width = size;
+ }
+ else {
+ thumbnail_width = input_width * size/input_height;
+ thumbnail_height = size;
+ }
+
+
+ // --- output thumbnail smaller than HEIF thumbnail -> scale down
+
+ struct heif_image* scaled_image = NULL;
+ err = heif_image_scale_image(image, &scaled_image,
+ thumbnail_width, thumbnail_height,
+ NULL);
+ if (err.code) {
+ std::cerr << "Could not scale image : " << err.message << "\n";
+ return 1;
+ }
+
+ heif_image_release(image);
+ image = scaled_image;
+ }
+
+
+
+ // --- write thumbnail image to PNG
+
+ bool written = encoder->Encode(image_handle, image, output_filename.c_str());
+ if (!written) {
+ fprintf(stderr,"could not write image\n");
+ return 1;
+ }
+
+ heif_image_release(image);
+
+ heif_image_handle_release(image_handle);
+
+ return 0;
+}
diff --git a/gnome/Makefile.am b/gnome/Makefile.am
new file mode 100644
index 0000000..4d0c719
--- /dev/null
+++ b/gnome/Makefile.am
@@ -0,0 +1,9 @@
+thumbnailer_dir = $(prefix)/share/thumbnailers
+thumbnailer__DATA = heif.thumbnailer
+
+mime_dir = $(prefix)/share/mime/packages
+mime__DATA = heif.xml
+
+EXTRA_DIST = \
+ heif.thumbnailer \
+ heif.xml
diff --git a/gnome/Makefile.in b/gnome/Makefile.in
new file mode 100644
index 0000000..38addf1
--- /dev/null
+++ b/gnome/Makefile.in
@@ -0,0 +1,554 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = gnome
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/visibility.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(mime_dir)" \
+ "$(DESTDIR)$(thumbnailer_dir)"
+DATA = $(mime__DATA) $(thumbnailer__DATA)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_LIBFUZZER = @ENABLE_LIBFUZZER@
+ENABLE_PARALLEL_TILE_DECODING = @ENABLE_PARALLEL_TILE_DECODING@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBHEIF_AGE = @LIBHEIF_AGE@
+LIBHEIF_CURRENT = @LIBHEIF_CURRENT@
+LIBHEIF_REVISION = @LIBHEIF_REVISION@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUMERIC_VERSION = @NUMERIC_VERSION@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libde265_CFLAGS = @libde265_CFLAGS@
+libde265_LIBS = @libde265_LIBS@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libjpeg_CFLAGS = @libjpeg_CFLAGS@
+libjpeg_LIBS = @libjpeg_LIBS@
+libpng_CFLAGS = @libpng_CFLAGS@
+libpng_LIBS = @libpng_LIBS@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+x265_CFLAGS = @x265_CFLAGS@
+x265_LIBS = @x265_LIBS@
+thumbnailer_dir = $(prefix)/share/thumbnailers
+thumbnailer__DATA = heif.thumbnailer
+mime_dir = $(prefix)/share/mime/packages
+mime__DATA = heif.xml
+EXTRA_DIST = \
+ heif.thumbnailer \
+ heif.xml
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gnome/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign gnome/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-mime_DATA: $(mime__DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(mime__DATA)'; test -n "$(mime_dir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(mime_dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(mime_dir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(mime_dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(mime_dir)" || exit $$?; \
+ done
+
+uninstall-mime_DATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(mime__DATA)'; test -n "$(mime_dir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(mime_dir)'; $(am__uninstall_files_from_dir)
+install-thumbnailer_DATA: $(thumbnailer__DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(thumbnailer__DATA)'; test -n "$(thumbnailer_dir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(thumbnailer_dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(thumbnailer_dir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(thumbnailer_dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(thumbnailer_dir)" || exit $$?; \
+ done
+
+uninstall-thumbnailer_DATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(thumbnailer__DATA)'; test -n "$(thumbnailer_dir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(thumbnailer_dir)'; $(am__uninstall_files_from_dir)
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(mime_dir)" "$(DESTDIR)$(thumbnailer_dir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-mime_DATA install-thumbnailer_DATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-mime_DATA uninstall-thumbnailer_DATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ cscopelist-am ctags-am distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-mime_DATA install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip install-thumbnailer_DATA \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
+ uninstall-am uninstall-mime_DATA uninstall-thumbnailer_DATA
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/gnome/heif.thumbnailer b/gnome/heif.thumbnailer
new file mode 100644
index 0000000..a5b35ef
--- /dev/null
+++ b/gnome/heif.thumbnailer
@@ -0,0 +1,4 @@
+[Thumbnailer Entry]
+TryExec=heif-thumbnailer
+Exec=heif-thumbnailer -s %s %i %o
+MimeType=image/heif;
diff --git a/gnome/heif.xml b/gnome/heif.xml
new file mode 100644
index 0000000..d82ee83
--- /dev/null
+++ b/gnome/heif.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+ <mime-type type="image/heif">
+ <comment>HEIF image</comment>
+ <comment xml:lang="de">HEIF-Bild</comment>
+ <glob pattern="*.heic"/>
+ <glob pattern="*.heif"/>
+ <alias type="image/heic"/>
+ </mime-type>
+</mime-info>
diff --git a/go/Makefile.am b/go/Makefile.am
new file mode 100644
index 0000000..36650a6
--- /dev/null
+++ b/go/Makefile.am
@@ -0,0 +1,3 @@
+EXTRA_DIST = \
+ src/heif-test.go \
+ src/heif/heif.go
diff --git a/go/Makefile.in b/go/Makefile.in
new file mode 100644
index 0000000..d0b5de6
--- /dev/null
+++ b/go/Makefile.in
@@ -0,0 +1,473 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = go
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/visibility.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_LIBFUZZER = @ENABLE_LIBFUZZER@
+ENABLE_PARALLEL_TILE_DECODING = @ENABLE_PARALLEL_TILE_DECODING@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBHEIF_AGE = @LIBHEIF_AGE@
+LIBHEIF_CURRENT = @LIBHEIF_CURRENT@
+LIBHEIF_REVISION = @LIBHEIF_REVISION@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUMERIC_VERSION = @NUMERIC_VERSION@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libde265_CFLAGS = @libde265_CFLAGS@
+libde265_LIBS = @libde265_LIBS@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libjpeg_CFLAGS = @libjpeg_CFLAGS@
+libjpeg_LIBS = @libjpeg_LIBS@
+libpng_CFLAGS = @libpng_CFLAGS@
+libpng_LIBS = @libpng_LIBS@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+x265_CFLAGS = @x265_CFLAGS@
+x265_LIBS = @x265_LIBS@
+EXTRA_DIST = \
+ src/heif-test.go \
+ src/heif/heif.go
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign go/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign go/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ cscopelist-am ctags-am distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/go/src/heif-test.go b/go/src/heif-test.go
new file mode 100644
index 0000000..f0c7e02
--- /dev/null
+++ b/go/src/heif-test.go
@@ -0,0 +1,90 @@
+/*
+ * Simple GO interface test program
+ * Copyright (c) 2017 struktur AG, Dirk Farin <farin@struktur.de>
+ *
+ * This file is part of heif, an example application using libheif.
+ *
+ * heif 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * heif 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 heif. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package main
+
+
+/*
+#cgo CPPFLAGS: -I/home/domain/farindk/sys/include/libheif
+#cgo pkg-config: libheif
+#include <stdlib.h>
+#include <heif.h>
+*/
+import "C"
+
+import (
+ "fmt"
+ "runtime"
+ "time"
+ "os"
+)
+
+import . "heif"
+
+
+// ==================================================
+// TEST
+// ==================================================
+
+func test_heif(filename string) {
+ var c *HeifContext = NewHeifContext()
+
+ var err = c.ReadFromFile(filename)
+ fmt.Printf("%s\n", err.Message)
+ if (err.Code != 0) {
+ return
+ }
+
+ var nImages = c.GetNumberofTopLevelImages()
+ fmt.Printf("GetNumberofTopLevelImages: %v\n", nImages)
+
+ var IDs = c.GetListOfTopLevelImageIDs()
+ fmt.Printf("List of top level image IDs %s\n", IDs);
+
+ var pID int;
+ pID, err = c.GetPrimaryImageID()
+
+ fmt.Printf("Primary image: %v\n", pID);
+
+ var handle *HeifImageHandle
+ handle, _ = c.GetPrimaryImageHandle();
+
+ fmt.Printf("image size: %v %v\n", handle.GetWidth(), handle.GetHeight())
+
+ var image, _ = handle.DecodeImage(C.heif_colorspace_RGB,
+ C.heif_chroma_444,
+ nil)
+
+ var access = image.GetPlane(C.heif_channel_R)
+
+ fmt.Printf("stride: %v\n",access.Stride)
+}
+
+
+func main() {
+ fmt.Printf("libheif version: %v\n", HeifGetVersion())
+
+ test_heif(os.Args[1])
+
+ runtime.GC()
+
+ time.Sleep(time.Second)
+ fmt.Println("done.")
+}
diff --git a/go/src/heif/heif.go b/go/src/heif/heif.go
new file mode 100644
index 0000000..07bd1ef
--- /dev/null
+++ b/go/src/heif/heif.go
@@ -0,0 +1,318 @@
+/*
+ * GO interface to libheif
+ * Copyright (c) 2018 struktur AG, Dirk Farin <farin@struktur.de>
+ *
+ * This file is part of heif, an example application using libheif.
+ *
+ * heif 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * heif 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 heif. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package heif
+
+/*
+#cgo pkg-config: libheif
+#include <stdlib.h>
+#include <libheif/heif.h>
+*/
+import "C"
+
+import (
+ "runtime"
+ "unsafe"
+)
+
+
+func HeifGetVersion() string {
+ return C.GoString(C.heif_get_version())
+}
+
+
+
+// --- HeifError
+
+type HeifError struct {
+ Code int
+ Subcode int
+ Message string
+}
+
+func NewHeifError(cerror C.struct_heif_error) HeifError {
+ var error HeifError
+ error.Code = int(cerror.code)
+ error.Subcode = int(cerror.subcode)
+ error.Message = C.GoString(cerror.message)
+ return error
+}
+
+
+
+// --- HeifContext
+
+type HeifContext struct {
+ context *C.struct_heif_context;
+}
+
+
+func NewHeifContext() *HeifContext {
+ ctx := new(HeifContext)
+
+ ctx.context = C.heif_context_alloc()
+ runtime.SetFinalizer(ctx, free_heif_context)
+
+ return ctx
+}
+
+
+func free_heif_context(c *HeifContext) {
+ C.heif_context_free(c.context)
+ c.context = nil;
+ runtime.SetFinalizer(c, nil)
+}
+
+
+func (c *HeifContext) ReadFromFile(filename string) HeifError {
+ var c_filename = C.CString(filename)
+ defer C.free(unsafe.Pointer(c_filename))
+
+ var err = C.heif_context_read_from_file(c.context, c_filename, nil)
+ return NewHeifError(err);
+}
+
+
+func (c *HeifContext) GetNumberofTopLevelImages() int {
+ return int(C.heif_context_get_number_of_top_level_images(c.context))
+}
+
+
+func (c *HeifContext) IsTopLevelImageID(ID int) bool {
+ return C.heif_context_is_top_level_image_ID(c.context, C.heif_item_id(ID)) != 0
+}
+
+
+func (c *HeifContext) GetListOfTopLevelImageIDs() []int {
+ var nToplevel = int(C.heif_context_get_number_of_top_level_images(c.context))
+ var origIDs = make([]C.heif_item_id, nToplevel)
+
+ C.heif_context_get_list_of_top_level_image_IDs(c.context, &origIDs[0], C.int(nToplevel))
+
+ var IDs = make([]int, nToplevel)
+ for i:=0; i<nToplevel; i++ {
+ IDs[i] = int(origIDs[i])
+ }
+
+ return IDs
+}
+
+
+func (c *HeifContext) GetPrimaryImageID() (int, HeifError) {
+ var c_id C.heif_item_id
+ var err = C.heif_context_get_primary_image_ID(c.context, &c_id)
+
+ return int(c_id), NewHeifError(err)
+}
+
+
+
+// --- HeifImageHandle
+
+type HeifImageHandle struct {
+ handle *C.struct_heif_image_handle
+}
+
+func free_heif_image_handle(c *HeifImageHandle) {
+ C.heif_image_handle_release(c.handle)
+ c.handle = nil;
+ runtime.SetFinalizer(c, nil)
+}
+
+func (c *HeifContext) GetPrimaryImageHandle() (*HeifImageHandle, HeifError) {
+ var handle HeifImageHandle
+ var err = C.heif_context_get_primary_image_handle(c.context, &handle.handle)
+ runtime.SetFinalizer(&handle, free_heif_image_handle)
+ return &handle, NewHeifError(err)
+}
+
+func (c *HeifContext) GetImageHandle(id int) (*HeifImageHandle, HeifError) {
+ var handle HeifImageHandle
+ var error = C.heif_context_get_image_handle(c.context, C.heif_item_id(id), &handle.handle)
+ runtime.SetFinalizer(&handle, free_heif_image_handle)
+ return &handle, NewHeifError(error)
+}
+
+
+func (h *HeifImageHandle) IsPrimaryImage() bool {
+ return C.heif_image_handle_is_primary_image(h.handle) != 0
+}
+
+
+func (h *HeifImageHandle) GetWidth() int {
+ return int(C.heif_image_handle_get_width(h.handle))
+}
+
+func (h *HeifImageHandle) GetHeight() int {
+ return int(C.heif_image_handle_get_height(h.handle))
+}
+
+func (h *HeifImageHandle) HasAlphaChannel() bool {
+ return C.heif_image_handle_has_alpha_channel(h.handle) != 0
+}
+
+
+func (h *HeifImageHandle) HasDepthImage() bool {
+ return C.heif_image_handle_has_depth_image(h.handle) != 0
+}
+
+
+func (h *HeifImageHandle) GetNumberOfDepthImages() int {
+ return int(C.heif_image_handle_get_number_of_depth_images(h.handle))
+}
+
+func (h *HeifImageHandle) GetListOfDepthImageIDs() []int {
+ var num = int(C.heif_image_handle_get_number_of_depth_images(h.handle))
+ var origIDs = make([]C.heif_item_id, num)
+
+ C.heif_image_handle_get_list_of_depth_image_IDs(h.handle, &origIDs[0], C.int(num))
+
+ var IDs = make([]int, num)
+ for i:=0; i<num; i++ {
+ IDs[i] = int(origIDs[i])
+ }
+ return IDs
+}
+
+func (h *HeifImageHandle) GetDepthImageHandle(depth_image_id int) (*HeifImageHandle, HeifError) {
+ var handle HeifImageHandle
+ var error = C.heif_image_handle_get_depth_image_handle(h.handle, C.heif_item_id(depth_image_id), &handle.handle)
+ runtime.SetFinalizer(&handle, free_heif_image_handle)
+ return &handle, NewHeifError(error)
+}
+
+
+func (h *HeifImageHandle) GetNumberOfThumbnails() int {
+ return int(C.heif_image_handle_get_number_of_thumbnails(h.handle))
+}
+
+func (h *HeifImageHandle) GetListOfThumbnailIDs() []int {
+ var num = int(C.heif_image_handle_get_number_of_thumbnails(h.handle))
+ var origIDs = make([]C.heif_item_id, num)
+
+ C.heif_image_handle_get_list_of_thumbnail_IDs(h.handle, &origIDs[0], C.int(num))
+
+ var IDs = make([]int, num)
+ for i:=0; i<num; i++ {
+ IDs[i] = int(origIDs[i])
+ }
+ return IDs
+}
+
+func (h *HeifImageHandle) GetThumbnail(thumbnail_id int) (*HeifImageHandle, HeifError) {
+ var handle HeifImageHandle
+ var error = C.heif_image_handle_get_thumbnail(h.handle, C.heif_item_id(thumbnail_id), &handle.handle)
+ runtime.SetFinalizer(&handle, free_heif_image_handle)
+ return &handle, NewHeifError(error)
+}
+
+
+// TODO: EXIF metadata
+
+
+// --- HeifImage
+
+type HeifDecodingOptions struct {
+ options *C.struct_heif_decoding_options
+}
+
+func NewHeifDecodingOptions() *HeifDecodingOptions {
+ var options HeifDecodingOptions;
+ options.options = C.heif_decoding_options_alloc();
+
+ runtime.SetFinalizer(&options, free_heif_decoding_options)
+ return &options
+}
+
+func free_heif_decoding_options(options *HeifDecodingOptions) {
+ C.heif_decoding_options_free(options.options)
+ options.options = nil;
+ runtime.SetFinalizer(options, nil)
+}
+
+type HeifImage struct {
+ image *C.struct_heif_image
+}
+
+func free_heif_image(image *HeifImage) {
+ C.heif_image_release(image.image)
+ image.image = nil;
+ runtime.SetFinalizer(image, nil)
+}
+
+func (h *HeifImageHandle) DecodeImage(colorspace C.enum_heif_colorspace, chroma C.enum_heif_chroma, options *HeifDecodingOptions) (*HeifImage, HeifError) {
+ var image HeifImage;
+
+ var opt *C.struct_heif_decoding_options;
+ if (options != nil) {
+ opt = options.options;
+ }
+
+ var err = C.heif_decode_image(h.handle, &image.image, colorspace, chroma, opt)
+ runtime.SetFinalizer(&image, free_heif_image)
+ return &image, NewHeifError(err)
+}
+
+
+func (img *HeifImage) GetColorspace() C.enum_heif_colorspace {
+ return C.heif_image_get_colorspace(img.image);
+}
+
+func (img *HeifImage) GetChromaFormat() C.enum_heif_chroma {
+ return C.heif_image_get_chroma_format(img.image);
+}
+
+func (img *HeifImage) GetWidth(channel C.enum_heif_channel) int {
+ return int(C.heif_image_get_width(img.image, channel))
+}
+
+func (img *HeifImage) GetHeight(channel C.enum_heif_channel) int {
+ return int(C.heif_image_get_height(img.image, channel))
+}
+
+func (img *HeifImage) GetBitsPerPixel(channel C.enum_heif_channel) int {
+ return int(C.heif_image_get_bits_per_pixel(img.image, channel))
+}
+
+type HeifImageAccess struct {
+ Plane unsafe.Pointer
+ Stride int
+
+ image *HeifImage // need this reference to make sure the image is not GC'ed while we access it
+}
+
+func (img* HeifImage) GetPlane(channel C.enum_heif_channel) HeifImageAccess {
+ var access HeifImageAccess
+
+ var stride C.int;
+ var plane = C.heif_image_get_plane(img.image, channel, &stride)
+
+ access.Plane = unsafe.Pointer(plane)
+ access.Stride = int(stride)
+ access.image = img
+ return access
+}
+
+func (img* HeifImage) ScaleImage(width int, height int) (*HeifImage, HeifError) {
+ var scaled_image HeifImage;
+ var err = C.heif_image_scale_image(img.image, &scaled_image.image, C.int(width), C.int(height), nil)
+ runtime.SetFinalizer(&scaled_image, free_heif_image)
+ return &scaled_image, NewHeifError(err)
+}
diff --git a/src/CMakeLists.txt b/libheif/CMakeLists.txt
index d06e318..7911edf 100644
--- a/src/CMakeLists.txt
+++ b/libheif/CMakeLists.txt
@@ -21,7 +21,7 @@ heif_plugin_registry.cc
heif_limits.h
heif_plugin.h
heif_plugin.cc
-heif-version.h
+heif_version.h
logging.h
)
diff --git a/src/Makefile.am b/libheif/Makefile.am
index f31c4c4..185897e 100644
--- a/src/Makefile.am
+++ b/libheif/Makefile.am
@@ -29,6 +29,9 @@ libheif_la_CXXFLAGS = \
libheif_la_LIBADD = $(ADDITIONAL_LIBS)
libheif_la_LDFLAGS = -version-info $(LIBHEIF_CURRENT):$(LIBHEIF_REVISION):$(LIBHEIF_AGE)
+if MINGW
+libheif_la_LDFLAGS += -no-undefined
+endif
libheif_la_SOURCES = \
bitstream.h \
@@ -71,10 +74,11 @@ endif
libheif_la_HEADERS = \
heif.h \
heif_plugin.h \
- heif-version.h
+ heif_version.h \
+ heif_cxx.h
noinst_HEADERS = \
- heif-emscripten.h
+ heif_emscripten.h
if HAVE_VISIBILITY
libheif_la_CFLAGS += -DHAVE_VISIBILITY
@@ -92,25 +96,25 @@ endif
else
noinst_LIBRARIES = libfuzzers.a
libfuzzers_a_SOURCES = \
- box-fuzzer.cc \
- encoder-fuzzer.cc \
- file-fuzzer.cc
+ box_fuzzer.cc \
+ encoder_fuzzer.cc \
+ file_fuzzer.cc
endif
box_fuzzer_DEPENDENCIES =
-box_fuzzer_CXXFLAGS =
+box_fuzzer_CXXFLAGS = $(libde265_CFLAGS)
box_fuzzer_LDFLAGS = -fsanitize=fuzzer
box_fuzzer_LDADD = $(ADDITIONAL_LIBS)
-box_fuzzer_SOURCES = $(libheif_la_SOURCES) box-fuzzer.cc
+box_fuzzer_SOURCES = $(libheif_la_SOURCES) box_fuzzer.cc
encoder_fuzzer_DEPENDENCIES =
-encoder_fuzzer_CXXFLAGS =
+encoder_fuzzer_CXXFLAGS = $(libde265_CFLAGS)
encoder_fuzzer_LDFLAGS = -fsanitize=fuzzer
encoder_fuzzer_LDADD = $(ADDITIONAL_LIBS)
-encoder_fuzzer_SOURCES = $(libheif_la_SOURCES) encoder-fuzzer.cc
+encoder_fuzzer_SOURCES = $(libheif_la_SOURCES) encoder_fuzzer.cc
file_fuzzer_DEPENDENCIES =
-file_fuzzer_CXXFLAGS =
+file_fuzzer_CXXFLAGS = $(libde265_CFLAGS)
file_fuzzer_LDFLAGS = -fsanitize=fuzzer
file_fuzzer_LDADD = $(ADDITIONAL_LIBS)
-file_fuzzer_SOURCES = $(libheif_la_SOURCES) file-fuzzer.cc
+file_fuzzer_SOURCES = $(libheif_la_SOURCES) file_fuzzer.cc
diff --git a/src/Makefile.in b/libheif/Makefile.in
index ba274c1..779e13b 100644
--- a/src/Makefile.in
+++ b/libheif/Makefile.in
@@ -95,20 +95,21 @@ target_triplet = @target@
bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3)
@HAVE_LIBDE265_TRUE@am__append_1 = $(libde265_LIBS)
@HAVE_X265_TRUE@am__append_2 = $(x265_LIBS)
-@HAVE_LIBDE265_TRUE@am__append_3 = \
+@MINGW_TRUE@am__append_3 = -no-undefined
+@HAVE_LIBDE265_TRUE@am__append_4 = \
@HAVE_LIBDE265_TRUE@ heif_decoder_libde265.cc \
@HAVE_LIBDE265_TRUE@ heif_decoder_libde265.h
-@HAVE_X265_TRUE@am__append_4 = \
+@HAVE_X265_TRUE@am__append_5 = \
@HAVE_X265_TRUE@ heif_encoder_x265.cc \
@HAVE_X265_TRUE@ heif_encoder_x265.h
-@HAVE_VISIBILITY_TRUE@am__append_5 = -DHAVE_VISIBILITY
@HAVE_VISIBILITY_TRUE@am__append_6 = -DHAVE_VISIBILITY
-@ENABLE_LIBFUZZER_TRUE@am__append_7 = box-fuzzer
-@ENABLE_LIBFUZZER_TRUE@@HAVE_LIBDE265_TRUE@am__append_8 = file-fuzzer
-@ENABLE_LIBFUZZER_TRUE@@HAVE_X265_TRUE@am__append_9 = encoder-fuzzer
-subdir = src
+@HAVE_VISIBILITY_TRUE@am__append_7 = -DHAVE_VISIBILITY
+@ENABLE_LIBFUZZER_TRUE@am__append_8 = box-fuzzer
+@ENABLE_LIBFUZZER_TRUE@@HAVE_LIBDE265_TRUE@am__append_9 = file-fuzzer
+@ENABLE_LIBFUZZER_TRUE@@HAVE_X265_TRUE@am__append_10 = encoder-fuzzer
+subdir = libheif
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
@@ -121,7 +122,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(libheif_la_HEADERS) \
$(noinst_HEADERS) $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = heif-version.h
+CONFIG_CLEAN_FILES = heif_version.h
CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
@@ -131,12 +132,12 @@ am__v_AR_0 = @echo " AR " $@;
am__v_AR_1 =
libfuzzers_a_AR = $(AR) $(ARFLAGS)
libfuzzers_a_LIBADD =
-am__libfuzzers_a_SOURCES_DIST = box-fuzzer.cc encoder-fuzzer.cc \
- file-fuzzer.cc
+am__libfuzzers_a_SOURCES_DIST = box_fuzzer.cc encoder_fuzzer.cc \
+ file_fuzzer.cc
@ENABLE_LIBFUZZER_FALSE@am_libfuzzers_a_OBJECTS = \
-@ENABLE_LIBFUZZER_FALSE@ box-fuzzer.$(OBJEXT) \
-@ENABLE_LIBFUZZER_FALSE@ encoder-fuzzer.$(OBJEXT) \
-@ENABLE_LIBFUZZER_FALSE@ file-fuzzer.$(OBJEXT)
+@ENABLE_LIBFUZZER_FALSE@ box_fuzzer.$(OBJEXT) \
+@ENABLE_LIBFUZZER_FALSE@ encoder_fuzzer.$(OBJEXT) \
+@ENABLE_LIBFUZZER_FALSE@ file_fuzzer.$(OBJEXT)
libfuzzers_a_OBJECTS = $(am_libfuzzers_a_OBJECTS)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@@ -209,7 +210,7 @@ am__box_fuzzer_SOURCES_DIST = bitstream.h bitstream.cc box.h box.cc \
heif_plugin_registry.h heif_plugin_registry.cc heif_plugin.h \
heif_plugin.cc logging.h heif_decoder_libde265.cc \
heif_decoder_libde265.h heif_encoder_x265.cc \
- heif_encoder_x265.h box-fuzzer.cc
+ heif_encoder_x265.h box_fuzzer.cc
@HAVE_LIBDE265_TRUE@am__objects_3 = box_fuzzer-heif_decoder_libde265.$(OBJEXT)
@HAVE_X265_TRUE@am__objects_4 = \
@HAVE_X265_TRUE@ box_fuzzer-heif_encoder_x265.$(OBJEXT)
@@ -222,7 +223,7 @@ am__objects_5 = box_fuzzer-bitstream.$(OBJEXT) \
box_fuzzer-heif_plugin.$(OBJEXT) $(am__objects_3) \
$(am__objects_4)
am_box_fuzzer_OBJECTS = $(am__objects_5) \
- box_fuzzer-box-fuzzer.$(OBJEXT)
+ box_fuzzer-box_fuzzer.$(OBJEXT)
box_fuzzer_OBJECTS = $(am_box_fuzzer_OBJECTS)
box_fuzzer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(box_fuzzer_CXXFLAGS) \
@@ -234,7 +235,7 @@ am__encoder_fuzzer_SOURCES_DIST = bitstream.h bitstream.cc box.h \
heif_hevc.cc heif_plugin_registry.h heif_plugin_registry.cc \
heif_plugin.h heif_plugin.cc logging.h \
heif_decoder_libde265.cc heif_decoder_libde265.h \
- heif_encoder_x265.cc heif_encoder_x265.h encoder-fuzzer.cc
+ heif_encoder_x265.cc heif_encoder_x265.h encoder_fuzzer.cc
@HAVE_LIBDE265_TRUE@am__objects_6 = encoder_fuzzer-heif_decoder_libde265.$(OBJEXT)
@HAVE_X265_TRUE@am__objects_7 = \
@HAVE_X265_TRUE@ encoder_fuzzer-heif_encoder_x265.$(OBJEXT)
@@ -249,7 +250,7 @@ am__objects_8 = encoder_fuzzer-bitstream.$(OBJEXT) \
encoder_fuzzer-heif_plugin.$(OBJEXT) $(am__objects_6) \
$(am__objects_7)
am_encoder_fuzzer_OBJECTS = $(am__objects_8) \
- encoder_fuzzer-encoder-fuzzer.$(OBJEXT)
+ encoder_fuzzer-encoder_fuzzer.$(OBJEXT)
encoder_fuzzer_OBJECTS = $(am_encoder_fuzzer_OBJECTS)
encoder_fuzzer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
@@ -262,7 +263,7 @@ am__file_fuzzer_SOURCES_DIST = bitstream.h bitstream.cc box.h box.cc \
heif_plugin_registry.h heif_plugin_registry.cc heif_plugin.h \
heif_plugin.cc logging.h heif_decoder_libde265.cc \
heif_decoder_libde265.h heif_encoder_x265.cc \
- heif_encoder_x265.h file-fuzzer.cc
+ heif_encoder_x265.h file_fuzzer.cc
@HAVE_LIBDE265_TRUE@am__objects_9 = file_fuzzer-heif_decoder_libde265.$(OBJEXT)
@HAVE_X265_TRUE@am__objects_10 = \
@HAVE_X265_TRUE@ file_fuzzer-heif_encoder_x265.$(OBJEXT)
@@ -276,7 +277,7 @@ am__objects_11 = file_fuzzer-bitstream.$(OBJEXT) \
file_fuzzer-heif_plugin.$(OBJEXT) $(am__objects_9) \
$(am__objects_10)
am_file_fuzzer_OBJECTS = $(am__objects_11) \
- file_fuzzer-file-fuzzer.$(OBJEXT)
+ file_fuzzer-file_fuzzer.$(OBJEXT)
file_fuzzer_OBJECTS = $(am_file_fuzzer_OBJECTS)
file_fuzzer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(file_fuzzer_CXXFLAGS) \
@@ -365,7 +366,7 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
-am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/heif-version.h.in \
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/heif_version.h.in \
$(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
@@ -524,46 +525,49 @@ libheif_ladir = \
ADDITIONAL_LIBS = $(am__append_1) $(am__append_2)
libheif_la_CPPFLAGS =
libheif_la_CFLAGS = $(CFLAG_VISIBILITY) -DLIBHEIF_EXPORTS \
- $(am__append_5)
+ $(am__append_6)
libheif_la_CXXFLAGS = $(CFLAG_VISIBILITY) $(libde265_CFLAGS) \
- $(x265_CFLAGS) -DLIBHEIF_EXPORTS $(am__append_6)
+ $(x265_CFLAGS) -DLIBHEIF_EXPORTS $(am__append_7)
libheif_la_LIBADD = $(ADDITIONAL_LIBS)
-libheif_la_LDFLAGS = -version-info $(LIBHEIF_CURRENT):$(LIBHEIF_REVISION):$(LIBHEIF_AGE)
+libheif_la_LDFLAGS = -version-info \
+ $(LIBHEIF_CURRENT):$(LIBHEIF_REVISION):$(LIBHEIF_AGE) \
+ $(am__append_3)
libheif_la_SOURCES = bitstream.h bitstream.cc box.h box.cc error.h \
error.cc heif_api_structs.h heif_file.h heif_file.cc \
heif_image.h heif_image.cc heif_limits.h heif.h heif.cc \
heif_context.h heif_context.cc heif_hevc.h heif_hevc.cc \
heif_plugin_registry.h heif_plugin_registry.cc heif_plugin.h \
- heif_plugin.cc logging.h $(am__append_3) $(am__append_4)
+ heif_plugin.cc logging.h $(am__append_4) $(am__append_5)
libheif_la_HEADERS = \
heif.h \
heif_plugin.h \
- heif-version.h
+ heif_version.h \
+ heif_cxx.h
noinst_HEADERS = \
- heif-emscripten.h
+ heif_emscripten.h
@ENABLE_LIBFUZZER_FALSE@noinst_LIBRARIES = libfuzzers.a
@ENABLE_LIBFUZZER_FALSE@libfuzzers_a_SOURCES = \
-@ENABLE_LIBFUZZER_FALSE@ box-fuzzer.cc \
-@ENABLE_LIBFUZZER_FALSE@ encoder-fuzzer.cc \
-@ENABLE_LIBFUZZER_FALSE@ file-fuzzer.cc
+@ENABLE_LIBFUZZER_FALSE@ box_fuzzer.cc \
+@ENABLE_LIBFUZZER_FALSE@ encoder_fuzzer.cc \
+@ENABLE_LIBFUZZER_FALSE@ file_fuzzer.cc
box_fuzzer_DEPENDENCIES =
-box_fuzzer_CXXFLAGS =
+box_fuzzer_CXXFLAGS = $(libde265_CFLAGS)
box_fuzzer_LDFLAGS = -fsanitize=fuzzer
box_fuzzer_LDADD = $(ADDITIONAL_LIBS)
-box_fuzzer_SOURCES = $(libheif_la_SOURCES) box-fuzzer.cc
+box_fuzzer_SOURCES = $(libheif_la_SOURCES) box_fuzzer.cc
encoder_fuzzer_DEPENDENCIES =
-encoder_fuzzer_CXXFLAGS =
+encoder_fuzzer_CXXFLAGS = $(libde265_CFLAGS)
encoder_fuzzer_LDFLAGS = -fsanitize=fuzzer
encoder_fuzzer_LDADD = $(ADDITIONAL_LIBS)
-encoder_fuzzer_SOURCES = $(libheif_la_SOURCES) encoder-fuzzer.cc
+encoder_fuzzer_SOURCES = $(libheif_la_SOURCES) encoder_fuzzer.cc
file_fuzzer_DEPENDENCIES =
-file_fuzzer_CXXFLAGS =
+file_fuzzer_CXXFLAGS = $(libde265_CFLAGS)
file_fuzzer_LDFLAGS = -fsanitize=fuzzer
file_fuzzer_LDADD = $(ADDITIONAL_LIBS)
-file_fuzzer_SOURCES = $(libheif_la_SOURCES) file-fuzzer.cc
+file_fuzzer_SOURCES = $(libheif_la_SOURCES) file_fuzzer.cc
all: all-am
.SUFFIXES:
@@ -577,9 +581,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libheif/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign src/Makefile
+ $(AUTOMAKE) --foreign libheif/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -597,7 +601,7 @@ $(top_srcdir)/configure: $(am__configure_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
-heif-version.h: $(top_builddir)/config.status $(srcdir)/heif-version.h.in
+heif_version.h: $(top_builddir)/config.status $(srcdir)/heif_version.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
clean-noinstLIBRARIES:
@@ -713,10 +717,9 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box-fuzzer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-bitstream.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-box-fuzzer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-box.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-box_fuzzer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-error.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-heif.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-heif_context.Po@am__quote@
@@ -727,10 +730,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-heif_image.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-heif_plugin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-heif_plugin_registry.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder-fuzzer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-bitstream.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-box.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-encoder-fuzzer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-encoder_fuzzer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-error.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-heif.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-heif_context.Po@am__quote@
@@ -741,11 +744,11 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-heif_image.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-heif_plugin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-heif_plugin_registry.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file-fuzzer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-bitstream.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-box.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-error.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-file-fuzzer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-file_fuzzer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-heif.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-heif_context.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-heif_decoder_libde265.Po@am__quote@
@@ -755,6 +758,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-heif_image.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-heif_plugin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-heif_plugin_registry.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheif_la-bitstream.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheif_la-box.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheif_la-error.Plo@am__quote@
@@ -1044,19 +1048,19 @@ box_fuzzer-heif_encoder_x265.obj: heif_encoder_x265.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o box_fuzzer-heif_encoder_x265.obj `if test -f 'heif_encoder_x265.cc'; then $(CYGPATH_W) 'heif_encoder_x265.cc'; else $(CYGPATH_W) '$(srcdir)/heif_encoder_x265.cc'; fi`
-box_fuzzer-box-fuzzer.o: box-fuzzer.cc
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT box_fuzzer-box-fuzzer.o -MD -MP -MF $(DEPDIR)/box_fuzzer-box-fuzzer.Tpo -c -o box_fuzzer-box-fuzzer.o `test -f 'box-fuzzer.cc' || echo '$(srcdir)/'`box-fuzzer.cc
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/box_fuzzer-box-fuzzer.Tpo $(DEPDIR)/box_fuzzer-box-fuzzer.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='box-fuzzer.cc' object='box_fuzzer-box-fuzzer.o' libtool=no @AMDEPBACKSLASH@
+box_fuzzer-box_fuzzer.o: box_fuzzer.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT box_fuzzer-box_fuzzer.o -MD -MP -MF $(DEPDIR)/box_fuzzer-box_fuzzer.Tpo -c -o box_fuzzer-box_fuzzer.o `test -f 'box_fuzzer.cc' || echo '$(srcdir)/'`box_fuzzer.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/box_fuzzer-box_fuzzer.Tpo $(DEPDIR)/box_fuzzer-box_fuzzer.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='box_fuzzer.cc' object='box_fuzzer-box_fuzzer.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o box_fuzzer-box-fuzzer.o `test -f 'box-fuzzer.cc' || echo '$(srcdir)/'`box-fuzzer.cc
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o box_fuzzer-box_fuzzer.o `test -f 'box_fuzzer.cc' || echo '$(srcdir)/'`box_fuzzer.cc
-box_fuzzer-box-fuzzer.obj: box-fuzzer.cc
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT box_fuzzer-box-fuzzer.obj -MD -MP -MF $(DEPDIR)/box_fuzzer-box-fuzzer.Tpo -c -o box_fuzzer-box-fuzzer.obj `if test -f 'box-fuzzer.cc'; then $(CYGPATH_W) 'box-fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/box-fuzzer.cc'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/box_fuzzer-box-fuzzer.Tpo $(DEPDIR)/box_fuzzer-box-fuzzer.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='box-fuzzer.cc' object='box_fuzzer-box-fuzzer.obj' libtool=no @AMDEPBACKSLASH@
+box_fuzzer-box_fuzzer.obj: box_fuzzer.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT box_fuzzer-box_fuzzer.obj -MD -MP -MF $(DEPDIR)/box_fuzzer-box_fuzzer.Tpo -c -o box_fuzzer-box_fuzzer.obj `if test -f 'box_fuzzer.cc'; then $(CYGPATH_W) 'box_fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/box_fuzzer.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/box_fuzzer-box_fuzzer.Tpo $(DEPDIR)/box_fuzzer-box_fuzzer.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='box_fuzzer.cc' object='box_fuzzer-box_fuzzer.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o box_fuzzer-box-fuzzer.obj `if test -f 'box-fuzzer.cc'; then $(CYGPATH_W) 'box-fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/box-fuzzer.cc'; fi`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o box_fuzzer-box_fuzzer.obj `if test -f 'box_fuzzer.cc'; then $(CYGPATH_W) 'box_fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/box_fuzzer.cc'; fi`
encoder_fuzzer-bitstream.o: bitstream.cc
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT encoder_fuzzer-bitstream.o -MD -MP -MF $(DEPDIR)/encoder_fuzzer-bitstream.Tpo -c -o encoder_fuzzer-bitstream.o `test -f 'bitstream.cc' || echo '$(srcdir)/'`bitstream.cc
@@ -1226,19 +1230,19 @@ encoder_fuzzer-heif_encoder_x265.obj: heif_encoder_x265.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o encoder_fuzzer-heif_encoder_x265.obj `if test -f 'heif_encoder_x265.cc'; then $(CYGPATH_W) 'heif_encoder_x265.cc'; else $(CYGPATH_W) '$(srcdir)/heif_encoder_x265.cc'; fi`
-encoder_fuzzer-encoder-fuzzer.o: encoder-fuzzer.cc
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT encoder_fuzzer-encoder-fuzzer.o -MD -MP -MF $(DEPDIR)/encoder_fuzzer-encoder-fuzzer.Tpo -c -o encoder_fuzzer-encoder-fuzzer.o `test -f 'encoder-fuzzer.cc' || echo '$(srcdir)/'`encoder-fuzzer.cc
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encoder_fuzzer-encoder-fuzzer.Tpo $(DEPDIR)/encoder_fuzzer-encoder-fuzzer.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encoder-fuzzer.cc' object='encoder_fuzzer-encoder-fuzzer.o' libtool=no @AMDEPBACKSLASH@
+encoder_fuzzer-encoder_fuzzer.o: encoder_fuzzer.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT encoder_fuzzer-encoder_fuzzer.o -MD -MP -MF $(DEPDIR)/encoder_fuzzer-encoder_fuzzer.Tpo -c -o encoder_fuzzer-encoder_fuzzer.o `test -f 'encoder_fuzzer.cc' || echo '$(srcdir)/'`encoder_fuzzer.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encoder_fuzzer-encoder_fuzzer.Tpo $(DEPDIR)/encoder_fuzzer-encoder_fuzzer.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encoder_fuzzer.cc' object='encoder_fuzzer-encoder_fuzzer.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o encoder_fuzzer-encoder-fuzzer.o `test -f 'encoder-fuzzer.cc' || echo '$(srcdir)/'`encoder-fuzzer.cc
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o encoder_fuzzer-encoder_fuzzer.o `test -f 'encoder_fuzzer.cc' || echo '$(srcdir)/'`encoder_fuzzer.cc
-encoder_fuzzer-encoder-fuzzer.obj: encoder-fuzzer.cc
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT encoder_fuzzer-encoder-fuzzer.obj -MD -MP -MF $(DEPDIR)/encoder_fuzzer-encoder-fuzzer.Tpo -c -o encoder_fuzzer-encoder-fuzzer.obj `if test -f 'encoder-fuzzer.cc'; then $(CYGPATH_W) 'encoder-fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/encoder-fuzzer.cc'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encoder_fuzzer-encoder-fuzzer.Tpo $(DEPDIR)/encoder_fuzzer-encoder-fuzzer.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encoder-fuzzer.cc' object='encoder_fuzzer-encoder-fuzzer.obj' libtool=no @AMDEPBACKSLASH@
+encoder_fuzzer-encoder_fuzzer.obj: encoder_fuzzer.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT encoder_fuzzer-encoder_fuzzer.obj -MD -MP -MF $(DEPDIR)/encoder_fuzzer-encoder_fuzzer.Tpo -c -o encoder_fuzzer-encoder_fuzzer.obj `if test -f 'encoder_fuzzer.cc'; then $(CYGPATH_W) 'encoder_fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/encoder_fuzzer.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encoder_fuzzer-encoder_fuzzer.Tpo $(DEPDIR)/encoder_fuzzer-encoder_fuzzer.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encoder_fuzzer.cc' object='encoder_fuzzer-encoder_fuzzer.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o encoder_fuzzer-encoder-fuzzer.obj `if test -f 'encoder-fuzzer.cc'; then $(CYGPATH_W) 'encoder-fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/encoder-fuzzer.cc'; fi`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o encoder_fuzzer-encoder_fuzzer.obj `if test -f 'encoder_fuzzer.cc'; then $(CYGPATH_W) 'encoder_fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/encoder_fuzzer.cc'; fi`
file_fuzzer-bitstream.o: bitstream.cc
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT file_fuzzer-bitstream.o -MD -MP -MF $(DEPDIR)/file_fuzzer-bitstream.Tpo -c -o file_fuzzer-bitstream.o `test -f 'bitstream.cc' || echo '$(srcdir)/'`bitstream.cc
@@ -1408,19 +1412,19 @@ file_fuzzer-heif_encoder_x265.obj: heif_encoder_x265.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o file_fuzzer-heif_encoder_x265.obj `if test -f 'heif_encoder_x265.cc'; then $(CYGPATH_W) 'heif_encoder_x265.cc'; else $(CYGPATH_W) '$(srcdir)/heif_encoder_x265.cc'; fi`
-file_fuzzer-file-fuzzer.o: file-fuzzer.cc
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT file_fuzzer-file-fuzzer.o -MD -MP -MF $(DEPDIR)/file_fuzzer-file-fuzzer.Tpo -c -o file_fuzzer-file-fuzzer.o `test -f 'file-fuzzer.cc' || echo '$(srcdir)/'`file-fuzzer.cc
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/file_fuzzer-file-fuzzer.Tpo $(DEPDIR)/file_fuzzer-file-fuzzer.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='file-fuzzer.cc' object='file_fuzzer-file-fuzzer.o' libtool=no @AMDEPBACKSLASH@
+file_fuzzer-file_fuzzer.o: file_fuzzer.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT file_fuzzer-file_fuzzer.o -MD -MP -MF $(DEPDIR)/file_fuzzer-file_fuzzer.Tpo -c -o file_fuzzer-file_fuzzer.o `test -f 'file_fuzzer.cc' || echo '$(srcdir)/'`file_fuzzer.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/file_fuzzer-file_fuzzer.Tpo $(DEPDIR)/file_fuzzer-file_fuzzer.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='file_fuzzer.cc' object='file_fuzzer-file_fuzzer.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o file_fuzzer-file-fuzzer.o `test -f 'file-fuzzer.cc' || echo '$(srcdir)/'`file-fuzzer.cc
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o file_fuzzer-file_fuzzer.o `test -f 'file_fuzzer.cc' || echo '$(srcdir)/'`file_fuzzer.cc
-file_fuzzer-file-fuzzer.obj: file-fuzzer.cc
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT file_fuzzer-file-fuzzer.obj -MD -MP -MF $(DEPDIR)/file_fuzzer-file-fuzzer.Tpo -c -o file_fuzzer-file-fuzzer.obj `if test -f 'file-fuzzer.cc'; then $(CYGPATH_W) 'file-fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/file-fuzzer.cc'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/file_fuzzer-file-fuzzer.Tpo $(DEPDIR)/file_fuzzer-file-fuzzer.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='file-fuzzer.cc' object='file_fuzzer-file-fuzzer.obj' libtool=no @AMDEPBACKSLASH@
+file_fuzzer-file_fuzzer.obj: file_fuzzer.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT file_fuzzer-file_fuzzer.obj -MD -MP -MF $(DEPDIR)/file_fuzzer-file_fuzzer.Tpo -c -o file_fuzzer-file_fuzzer.obj `if test -f 'file_fuzzer.cc'; then $(CYGPATH_W) 'file_fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/file_fuzzer.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/file_fuzzer-file_fuzzer.Tpo $(DEPDIR)/file_fuzzer-file_fuzzer.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='file_fuzzer.cc' object='file_fuzzer-file_fuzzer.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o file_fuzzer-file-fuzzer.obj `if test -f 'file-fuzzer.cc'; then $(CYGPATH_W) 'file-fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/file-fuzzer.cc'; fi`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o file_fuzzer-file_fuzzer.obj `if test -f 'file_fuzzer.cc'; then $(CYGPATH_W) 'file_fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/file_fuzzer.cc'; fi`
mostlyclean-libtool:
-rm -f *.lo
diff --git a/src/bitstream.cc b/libheif/bitstream.cc
index 5f87476..5f87476 100644
--- a/src/bitstream.cc
+++ b/libheif/bitstream.cc
diff --git a/src/bitstream.h b/libheif/bitstream.h
index b9ce760..bba65d6 100644
--- a/src/bitstream.h
+++ b/libheif/bitstream.h
@@ -138,6 +138,8 @@ namespace heif {
std::istream* get_istream() { return m_istr; }
+ int get_nesting_level() const { return m_nesting_level; }
+
protected:
void construct(std::istream* istr, uint64_t length, BitstreamRange* parent) {
m_remaining = length;
@@ -145,11 +147,16 @@ namespace heif {
m_istr = istr;
m_parent_range = parent;
+
+ if (parent) {
+ m_nesting_level = parent->m_nesting_level + 1;
+ }
}
private:
std::istream* m_istr = nullptr;
BitstreamRange* m_parent_range = nullptr;
+ int m_nesting_level = 0;
uint64_t m_remaining;
bool m_end_reached = false;
diff --git a/src/box.cc b/libheif/box.cc
index 5f80ba6..2a86606 100644
--- a/src/box.cc
+++ b/libheif/box.cc
@@ -288,6 +288,11 @@ Error Box::parse(BitstreamRange& range)
else {
uint64_t content_size = get_box_size() - get_header_size();
if (range.read(content_size)) {
+ if (content_size > MAX_BOX_SIZE) {
+ return Error(heif_error_Invalid_input,
+ heif_suberror_Invalid_box_size);
+ }
+
range.get_istream()->seekg(get_box_size() - get_header_size(), std::ios_base::cur);
}
}
@@ -427,6 +432,14 @@ Error Box::read(BitstreamRange& range, std::shared_ptr<heif::Box>* result)
sstr.str());
}
+
+ if (range.get_nesting_level() > MAX_BOX_NESTING_LEVEL) {
+ return Error(heif_error_Memory_allocation_error,
+ heif_suberror_Security_limit_exceeded,
+ "Security limit for maximum nesting of boxes has been exceeded");
+ }
+
+
BitstreamRange boxrange(range.get_istream(),
hdr.get_box_size() - hdr.get_header_size(),
&range);
diff --git a/src/box.h b/libheif/box.h
index fc5e351..f2f87d9 100644
--- a/src/box.h
+++ b/libheif/box.h
@@ -50,6 +50,9 @@
namespace heif {
+#define fourcc(id) (((uint32_t)(id[0])<<24) | (id[1]<<16) | (id[2]<<8) | (id[3]))
+
+ /*
constexpr uint32_t fourcc(const char* string)
{
return ((string[0]<<24) |
@@ -57,6 +60,7 @@ namespace heif {
(string[2]<< 8) |
(string[3]));
}
+ */
class Fraction {
@@ -360,6 +364,8 @@ namespace heif {
void set_item_name(std::string name) { m_item_name = name; }
+ std::string get_content_type() const { return m_content_type; }
+
void derive_box_version() override;
Error write(StreamWriter& writer) const override;
diff --git a/src/box-fuzzer.cc b/libheif/box_fuzzer.cc
index 5e64a73..5e64a73 100644
--- a/src/box-fuzzer.cc
+++ b/libheif/box_fuzzer.cc
diff --git a/src/encoder-fuzzer.cc b/libheif/encoder_fuzzer.cc
index c3beade..c204290 100644
--- a/src/encoder-fuzzer.cc
+++ b/libheif/encoder_fuzzer.cc
@@ -127,11 +127,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
encoder_descriptors, kMaxEncoders);
assert(count > 0);
-
heif_encoder* encoder;
- heif_context_get_encoder(context.get(), encoder_descriptors[0], &encoder);
+ err = heif_context_get_encoder(context.get(), encoder_descriptors[0], &encoder);
+ if (err.code != heif_error_Ok) {
+ return 0;
+ }
if (size < 2) {
+ heif_encoder_release(encoder);
return 0;
}
int quality = data[0] % 101;;
@@ -145,6 +148,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
size_t read = create_image(data, size, &image);
assert(read <= size);
if (!read) {
+ heif_encoder_release(encoder);
return 0;
}
@@ -154,6 +158,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
struct heif_image_handle* img;
err = heif_context_encode_image(context.get(), image, encoder, nullptr, &img);
heif_image_release(image);
+ heif_encoder_release(encoder);
if (err.code != heif_error_Ok) {
return 0;
}
diff --git a/src/error.cc b/libheif/error.cc
index 971aa60..80a3553 100644
--- a/src/error.cc
+++ b/libheif/error.cc
@@ -56,6 +56,7 @@ const char* heif::Error::get_error_string(heif_error_code err)
case heif_error_Memory_allocation_error: return "Memory allocation error";
case heif_error_Decoder_plugin_error: return "Decoder plugin generated an error";
case heif_error_Encoder_plugin_error: return "Encoder plugin generated an error";
+ case heif_error_Encoding_error: return "Error during encoding or writing output file";
}
assert(false);
@@ -120,6 +121,9 @@ const char* heif::Error::get_error_string(heif_suberror_code err)
// --- Encoder_plugin_error --
+ // --- Encoding_error --
+
+ case heif_suberror_Cannot_write_output_data: return "Cannot write output data";
}
assert(false);
diff --git a/src/error.h b/libheif/error.h
index ca7b440..ca7b440 100644
--- a/src/error.h
+++ b/libheif/error.h
diff --git a/src/file-fuzzer.cc b/libheif/file_fuzzer.cc
index 0e77d3f..09568fe 100644
--- a/src/file-fuzzer.cc
+++ b/libheif/file_fuzzer.cc
@@ -19,7 +19,7 @@
*/
#include <assert.h>
-#include <alloca.h>
+#include <stdlib.h>
#include "heif.h"
@@ -77,7 +77,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
goto quit;
}
- image_IDs = (heif_item_id*)alloca(images_count * sizeof(heif_item_id));
+ image_IDs = (heif_item_id*)malloc(images_count * sizeof(heif_item_id));
for (int i = 0; i < images_count; ++i) {
err = heif_context_get_image_handle(ctx, image_IDs[i], &handle);
@@ -103,5 +103,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
quit:
heif_context_free(ctx);
+ free(image_IDs);
return 0;
}
diff --git a/src/heif.cc b/libheif/heif.cc
index d4a7e51..2022e9a 100644
--- a/src/heif.cc
+++ b/libheif/heif.cc
@@ -31,7 +31,7 @@
#include "bitstream.h"
#if defined(__EMSCRIPTEN__)
-#include "heif-emscripten.h"
+#include "heif_emscripten.h"
#endif
#include <algorithm>
@@ -507,6 +507,12 @@ int heif_image_get_bits_per_pixel(const struct heif_image* img,enum heif_channel
}
+int heif_image_has_channel(const struct heif_image* img, enum heif_channel channel)
+{
+ return img->image->has_channel(channel);
+}
+
+
struct heif_error heif_image_add_plane(struct heif_image* image,
heif_channel channel, int width, int height, int bit_depth)
{
@@ -619,6 +625,21 @@ const char* heif_image_handle_get_metadata_type(const struct heif_image_handle*
}
+const char* heif_image_handle_get_metadata_content_type(const struct heif_image_handle* handle,
+ heif_item_id metadata_id)
+{
+ auto metadata_list = handle->image->get_metadata();
+
+ for (auto metadata : metadata_list) {
+ if (metadata->item_id == metadata_id) {
+ return metadata->content_type.c_str();
+ }
+ }
+
+ return NULL;
+}
+
+
size_t heif_image_handle_get_metadata_size(const struct heif_image_handle* handle,
heif_item_id metadata_id)
{
@@ -819,7 +840,14 @@ struct heif_error heif_context_get_encoder(struct heif_context* context,
heif_suberror_Null_pointer_argument).error_struct(nullptr);
}
- *encoder = new struct heif_encoder(context->context, descriptor->plugin);
+ if (context==nullptr) {
+ *encoder = new struct heif_encoder(nullptr, descriptor->plugin);
+ }
+ else {
+ // DEPRECATED. We do not need the context anywhere.
+ *encoder = new struct heif_encoder(context->context, descriptor->plugin);
+ }
+
(*encoder)->alloc();
struct heif_error err = { heif_error_Ok, heif_suberror_Unspecified, kSuccess };
@@ -840,7 +868,14 @@ struct heif_error heif_context_get_encoder_for_format(struct heif_context* conte
descriptors = get_filtered_encoder_descriptors(format, nullptr);
if (descriptors.size()>0) {
- *encoder = new struct heif_encoder(context->context, descriptors[0]->plugin);
+ if (context==nullptr) {
+ *encoder = new struct heif_encoder(nullptr, descriptors[0]->plugin);
+ }
+ else {
+ // DEPRECATED. We do not need the context anywhere.
+ *encoder = new struct heif_encoder(context->context, descriptors[0]->plugin);
+ }
+
(*encoder)->alloc();
struct heif_error err = { heif_error_Ok, heif_suberror_Unspecified, kSuccess };
@@ -946,6 +981,47 @@ struct heif_error heif_encoder_get_parameter_integer(struct heif_encoder* encode
return encoder->plugin->get_parameter_integer(encoder->encoder, parameter_name, value_ptr);
}
+struct heif_error
+heif_encoder_parameter_get_valid_integer_range(const struct heif_encoder_parameter* param,
+ int* have_minimum_maximum,
+ int* minimum, int* maximum)
+{
+ if (param->type != heif_encoder_parameter_type_integer) {
+ return error_unsupported_parameter; // TODO: correct error ?
+ }
+
+ if (param->integer.have_minimum_maximum) {
+ if (minimum) {
+ *minimum = param->integer.minimum;
+ }
+
+ if (maximum) {
+ *maximum = param->integer.maximum;
+ }
+ }
+
+ if (have_minimum_maximum) {
+ *have_minimum_maximum = param->integer.have_minimum_maximum;
+ }
+
+ return error_Ok;
+}
+
+struct heif_error
+heif_encoder_parameter_get_valid_string_values(const struct heif_encoder_parameter* param,
+ const char*const** out_stringarray)
+{
+ if (param->type != heif_encoder_parameter_type_string) {
+ return error_unsupported_parameter; // TODO: correct error ?
+ }
+
+ if (out_stringarray) {
+ *out_stringarray = param->string.valid_values;
+ }
+
+ return error_Ok;
+}
+
struct heif_error heif_encoder_parameter_integer_valid_range(struct heif_encoder* encoder,
const char* parameter_name,
int* have_minimum_maximum,
@@ -955,25 +1031,8 @@ struct heif_error heif_encoder_parameter_integer_valid_range(struct heif_encoder
*params;
params++) {
if (strcmp((*params)->name, parameter_name)==0) {
- if ((*params)->type != heif_encoder_parameter_type_integer) {
- return error_unsupported_parameter; // TODO: correct error ?
- }
-
- if ((*params)->integer.have_minimum_maximum) {
- if (minimum) {
- *minimum = (*params)->integer.minimum;
- }
-
- if (maximum) {
- *maximum = (*params)->integer.maximum;
- }
- }
-
- if (have_minimum_maximum) {
- *have_minimum_maximum = (*params)->integer.have_minimum_maximum;
- }
-
- return error_Ok;
+ return heif_encoder_parameter_get_valid_integer_range(*params, have_minimum_maximum,
+ minimum, maximum);
}
}
@@ -1017,15 +1076,7 @@ struct heif_error heif_encoder_parameter_string_valid_values(struct heif_encoder
*params;
params++) {
if (strcmp((*params)->name, parameter_name)==0) {
- if ((*params)->type != heif_encoder_parameter_type_string) {
- return error_unsupported_parameter; // TODO: correct error ?
- }
-
- if (out_stringarray) {
- *out_stringarray = (*params)->string.valid_values;
- }
-
- return error_Ok;
+ return heif_encoder_parameter_get_valid_string_values(*params, out_stringarray);
}
}
@@ -1148,6 +1199,7 @@ struct heif_error heif_context_encode_image(struct heif_context* ctx,
std::shared_ptr<HeifContext::Image> image;
Error error(heif_error_Encoder_plugin_error, heif_suberror_Unsupported_codec);
+
switch (encoder->plugin->compression_format) {
case heif_compression_HEVC:
image = ctx->context->add_new_hvc1_image();
diff --git a/src/heif.h b/libheif/heif.h
index 9d252eb..7080256 100644
--- a/src/heif.h
+++ b/libheif/heif.h
@@ -28,7 +28,7 @@ extern "C" {
#include <stddef.h>
#include <stdint.h>
-#include "heif-version.h"
+#include "heif_version.h"
// API versions table
@@ -46,7 +46,7 @@ extern "C" {
#else
#define LIBHEIF_API __declspec(dllimport)
#endif
-#elif HAVE_VISIBILITY
+#elif defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
#ifdef LIBHEIF_EXPORTS
#define LIBHEIF_API __attribute__((__visibility__("default")))
#else
@@ -105,7 +105,10 @@ enum heif_error_code {
heif_error_Decoder_plugin_error = 7,
// The decoder plugin generated an error
- heif_error_Encoder_plugin_error = 8
+ heif_error_Encoder_plugin_error = 8,
+
+ // Error during encoding or when writing to the output
+ heif_error_Encoding_error = 9
};
@@ -228,6 +231,10 @@ enum heif_suberror_code {
// --- Encoder_plugin_error ---
+
+ // --- Encoding_error ---
+
+ heif_suberror_Cannot_write_output_data = 5000,
};
@@ -447,6 +454,10 @@ LIBHEIF_API
const char* heif_image_handle_get_metadata_type(const struct heif_image_handle* handle,
heif_item_id metadata_id);
+LIBHEIF_API
+const char* heif_image_handle_get_metadata_content_type(const struct heif_image_handle* handle,
+ heif_item_id metadata_id);
+
// Get the size of the raw metadata, as stored in the HEIF file.
LIBHEIF_API
size_t heif_image_handle_get_metadata_size(const struct heif_image_handle* handle,
@@ -582,6 +593,9 @@ int heif_image_get_height(const struct heif_image*,enum heif_channel channel);
LIBHEIF_API
int heif_image_get_bits_per_pixel(const struct heif_image*,enum heif_channel channel);
+LIBHEIF_API
+int heif_image_has_channel(const struct heif_image*, enum heif_channel channel);
+
// Get a pointer to the actual pixel data.
// The 'out_stride' is returned as "bytes per line".
// When out_stride is NULL, no value will be written.
@@ -623,7 +637,7 @@ struct heif_writer {
int writer_api_version;
// --- version 1 functions ---
- struct heif_error (*write)(struct heif_context* ctx,
+ struct heif_error (*write)(struct heif_context* ctx, // TODO: why do we need this parameter?
const void* data,
size_t size,
void* userdata);
@@ -654,7 +668,7 @@ struct heif_encoder_parameter;
// The returned list of encoders is sorted by their priority (which is a plugin property).
// Note: to get the actual encoder from the descriptors returned here, use heif_context_get_encoder().
LIBHEIF_API
-int heif_context_get_encoder_descriptors(struct heif_context*,
+int heif_context_get_encoder_descriptors(struct heif_context*, // TODO: why do we need this parameter?
enum heif_compression_format format_filter,
const char* name_filter,
const struct heif_encoder_descriptor** out_encoders,
@@ -681,6 +695,7 @@ int heif_encoder_descriptor_supportes_lossless_compression(const struct heif_enc
// Get an encoder instance that can be used to actually encode images from a descriptor.
+// TODO: why do we need the context here? I think we should remove this. You may pass a NULL context.
LIBHEIF_API
struct heif_error heif_context_get_encoder(struct heif_context* context,
const struct heif_encoder_descriptor*,
@@ -688,6 +703,7 @@ struct heif_error heif_context_get_encoder(struct heif_context* context,
// Get an encoder for the given compression format. If there are several encoder plugins
// for this format, the encoder with the highest plugin priority will be returned.
+// TODO: why do we need the context here? I think we should remove this. You may pass a NULL context.
LIBHEIF_API
struct heif_error heif_context_get_encoder_for_format(struct heif_context* context,
enum heif_compression_format format,
@@ -746,6 +762,16 @@ LIBHEIF_API
enum heif_encoder_parameter_type heif_encoder_parameter_get_type(const struct heif_encoder_parameter*);
LIBHEIF_API
+struct heif_error heif_encoder_parameter_get_valid_integer_range(const struct heif_encoder_parameter*,
+ int* have_minimum_maximum,
+ int* minimum, int* maximum);
+
+LIBHEIF_API
+struct heif_error heif_encoder_parameter_get_valid_string_values(const struct heif_encoder_parameter*,
+ const char*const** out_stringarray);
+
+
+LIBHEIF_API
struct heif_error heif_encoder_set_parameter_integer(struct heif_encoder*,
const char* parameter_name,
int value);
@@ -755,7 +781,8 @@ struct heif_error heif_encoder_get_parameter_integer(struct heif_encoder*,
const char* parameter_name,
int* value);
-LIBHEIF_API
+// TODO: name should be changed to heif_encoder_get_valid_integer_parameter_range
+LIBHEIF_API // DEPRECATED.
struct heif_error heif_encoder_parameter_integer_valid_range(struct heif_encoder*,
const char* parameter_name,
int* have_minimum_maximum,
diff --git a/src/heif_api_structs.h b/libheif/heif_api_structs.h
index 4106823..5eb0ac6 100644
--- a/src/heif_api_structs.h
+++ b/libheif/heif_api_structs.h
@@ -55,7 +55,7 @@ struct heif_encoder
void release();
- std::shared_ptr<heif::HeifContext> context;
+ //std::shared_ptr<heif::HeifContext> context;
const struct heif_encoder_plugin* plugin;
void* encoder = nullptr;
};
diff --git a/src/heif_context.cc b/libheif/heif_context.cc
index 13a1807..f85987d 100644
--- a/src/heif_context.cc
+++ b/libheif/heif_context.cc
@@ -57,7 +57,7 @@ using namespace heif;
heif_encoder::heif_encoder(std::shared_ptr<heif::HeifContext> _context,
const struct heif_encoder_plugin* _plugin)
- : context(_context),
+ : //context(_context),
plugin(_plugin)
{
@@ -669,11 +669,15 @@ Error HeifContext::interpret_heif_file()
// --- read metadata and assign to image
for (heif_item_id id : image_IDs) {
- std::string item_type = m_heif_file->get_item_type(id);
- if (item_type == "Exif") {
+ std::string item_type = m_heif_file->get_item_type(id);
+ std::string content_type = m_heif_file->get_content_type(id);
+
+ if (item_type == "Exif" ||
+ (item_type=="mime" && content_type=="application/rdf+xml")) {
std::shared_ptr<ImageMetadata> metadata = std::make_shared<ImageMetadata>();
metadata->item_id = id;
metadata->item_type = item_type;
+ metadata->content_type = content_type;
Error err = m_heif_file->get_compressed_image_data(id, &(metadata->m_data));
if (err) {
@@ -1302,7 +1306,7 @@ void HeifContext::Image::set_preencoded_hevc_image(const std::vector<uint8_t>& d
bool first=true;
bool eof=false;
- int prev_start_code_start;
+ int prev_start_code_start = -1; // init to an invalid value, will always be overwritten before use
int start_code_start;
int ptr = 0;
@@ -1335,9 +1339,7 @@ void HeifContext::Image::set_preencoded_hevc_image(const std::vector<uint8_t>& d
//printf("-> state= %d\n",state);
if (ptr == (int)data.size()) {
- printf("to end of file\n");
start_code_start = (int)data.size();
- printf("end of file pos: %04x\n",(uint32_t)start_code_start);
dump_nal = true;
eof = true;
}
@@ -1350,16 +1352,11 @@ void HeifContext::Image::set_preencoded_hevc_image(const std::vector<uint8_t>& d
std::vector<uint8_t> nal_data;
size_t length = start_code_start - (prev_start_code_start+3);
- printf("found start code at position: %08x (prev: %08x)\n",
- (uint32_t)start_code_start,
- (uint32_t)prev_start_code_start);
-
nal_data.resize(length);
+ assert(prev_start_code_start>=0);
memcpy(nal_data.data(), data.data() + prev_start_code_start+3, length);
- printf("read nal %02x with length %08x\n",nal_data[0], (uint32_t)length);
-
int nal_type = (nal_data[0]>>1);
switch (nal_type) {
diff --git a/src/heif_context.h b/libheif/heif_context.h
index 19d257d..f50fa4d 100644
--- a/src/heif_context.h
+++ b/libheif/heif_context.h
@@ -49,6 +49,7 @@ namespace heif {
public:
heif_item_id item_id;
std::string item_type; // e.g. "Exif"
+ std::string content_type;
std::vector<uint8_t> m_data;
};
diff --git a/libheif/heif_cxx.h b/libheif/heif_cxx.h
new file mode 100644
index 0000000..8bf4d3b
--- /dev/null
+++ b/libheif/heif_cxx.h
@@ -0,0 +1,864 @@
+/*
+ * C++ interface to libheif
+ * Copyright (c) 2018 struktur AG, Dirk Farin <farin@struktur.de>
+ *
+ * This file is part of libheif.
+ *
+ * heif 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * heif 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 heif. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LIBHEIF_HEIF_CXX_H
+#define LIBHEIF_HEIF_CXX_H
+
+#include <memory>
+#include <string>
+#include <vector>
+
+extern "C" {
+#include <libheif/heif.h>
+}
+
+
+namespace heif {
+
+ class Error
+ {
+ public:
+ Error() {
+ m_code = heif_error_Ok;
+ m_subcode = heif_suberror_Unspecified;
+ m_message = "Ok";
+ }
+
+ Error(const heif_error& err) {
+ m_code = err.code;
+ m_subcode = err.subcode;
+ m_message = err.message;
+ }
+
+ std::string get_message() const { return m_message; }
+
+ heif_error_code get_code() const { return m_code; }
+
+ heif_suberror_code get_subcode() const { return m_subcode; }
+
+ operator bool() const { return m_code != heif_error_Ok; }
+
+ private:
+ heif_error_code m_code;
+ heif_suberror_code m_subcode;
+ std::string m_message;
+ };
+
+
+ class ImageHandle;
+ class Image;
+
+ class Encoder;
+ class EncoderParameter;
+ class EncoderDescriptor;
+
+
+ class Context
+ {
+ public:
+ Context();
+
+ class ReadingOptions { };
+
+ // throws Error
+ void read_from_file(std::string filename, const ReadingOptions& opts = ReadingOptions());
+
+ // throws Error
+ void read_from_memory(const void* mem, size_t size, const ReadingOptions& opts = ReadingOptions());
+
+ int get_number_of_top_level_images() const noexcept;
+
+ bool is_top_level_image_ID(heif_item_id id) const noexcept;
+
+ std::vector<heif_item_id> get_list_of_top_level_image_IDs() const noexcept;
+
+ // throws Error
+ heif_item_id get_primary_image_ID() const;
+
+ // throws Error
+ ImageHandle get_primary_image_handle() const;
+
+ ImageHandle get_image_handle(heif_item_id id) const;
+
+
+
+ class EncodingOptions { };
+
+ // throws Error
+ ImageHandle encode_image(const Image& img, Encoder& encoder,
+ const EncodingOptions& options = EncodingOptions());
+
+ class Writer {
+ public:
+ virtual ~Writer() { }
+
+ virtual heif_error write(const void* data, size_t size) = 0;
+ };
+
+ // throws Error
+ void write(Writer&);
+
+ // throws Error
+ void write_to_file(std::string filename) const;
+
+ private:
+ std::shared_ptr<heif_context> m_context;
+
+ friend struct ::heif_error heif_writer_trampoline_write(struct heif_context* ctx,
+ const void* data,
+ size_t size,
+ void* userdata);
+
+ //static Context wrap_without_releasing(heif_context*); // internal use in friend function only
+ };
+
+
+
+ class ImageHandle
+ {
+ public:
+ ImageHandle() { }
+
+ ImageHandle(heif_image_handle* handle);
+
+ bool is_primary_image() const noexcept;
+
+ int get_width() const noexcept;
+
+ int get_height() const noexcept;
+
+ bool has_alpha_channel() const noexcept;
+
+ // ------------------------- depth images -------------------------
+
+ // TODO
+
+ // ------------------------- thumbnails -------------------------
+
+ int get_number_of_thumbnails() const noexcept;
+
+ std::vector<heif_item_id> get_list_of_thumbnail_IDs() const noexcept;
+
+ // throws Error
+ ImageHandle get_thumbnail(heif_item_id id);
+
+ // ------------------------- metadata (Exif / XMP) -------------------------
+
+ // Can optionally be filtered by type ("Exif" / "XMP")
+ std::vector<heif_item_id> get_list_of_metadata_block_IDs(const char* type_filter = nullptr) const noexcept;
+
+ std::string get_metadata_type(heif_item_id metadata_id) const noexcept;
+
+ std::string get_metadata_content_type(heif_item_id metadata_id) const noexcept;
+
+ // throws error
+ std::vector<uint8_t> get_metadata(heif_item_id) const;
+
+
+ class DecodingOptions { };
+
+ // throws Error
+ Image decode_image(heif_colorspace colorspace, heif_chroma chroma,
+ const DecodingOptions& options = DecodingOptions());
+
+
+ heif_image_handle* get_raw_image_handle() noexcept { return m_image_handle.get(); }
+ const heif_image_handle* get_raw_image_handle() const noexcept { return m_image_handle.get(); }
+
+ private:
+ std::shared_ptr<heif_image_handle> m_image_handle;
+ };
+
+
+ class Image
+ {
+ public:
+ Image() { }
+ Image(heif_image* image);
+
+
+ // throws Error
+ void create(int width, int height,
+ enum heif_colorspace colorspace,
+ enum heif_chroma chroma);
+
+ // throws Error
+ void add_plane(enum heif_channel channel,
+ int width, int height, int bit_depth);
+
+ heif_colorspace get_colorspace() const noexcept;
+
+ heif_chroma get_chroma_format() const noexcept;
+
+ int get_width(enum heif_channel channel) const noexcept;
+
+ int get_height(enum heif_channel channel) const noexcept;
+
+ int get_bits_per_pixel(enum heif_channel channel) const noexcept;
+
+ bool has_channel(enum heif_channel channel) const noexcept;
+
+ const uint8_t* get_plane(enum heif_channel channel, int* out_stride) const noexcept;
+
+ uint8_t* get_plane(enum heif_channel channel, int* out_stride) noexcept;
+
+ class ScalingOptions { };
+
+ // throws Error
+ Image scale_image(int width, int height,
+ const ScalingOptions& options = ScalingOptions()) const;
+
+ private:
+ std::shared_ptr<heif_image> m_image;
+
+ friend class Context;
+ };
+
+
+
+ class EncoderDescriptor
+ {
+ public:
+ static std::vector<EncoderDescriptor>
+ get_encoder_descriptors(enum heif_compression_format format_filter,
+ const char* name_filter) noexcept;
+
+ std::string get_name() const noexcept;
+
+ std::string get_id_name() const noexcept;
+
+ enum heif_compression_format get_compression_format() const noexcept;
+
+ bool supportes_lossy_compression() const noexcept;
+
+ bool supportes_lossless_compression() const noexcept;
+
+
+ // throws Error
+ Encoder get_encoder() const;
+
+
+ private:
+ EncoderDescriptor(const struct heif_encoder_descriptor* descr) : m_descriptor(descr) { }
+
+ const struct heif_encoder_descriptor* m_descriptor = nullptr;
+ };
+
+
+
+ class EncoderParameter
+ {
+ public:
+ std::string get_name() const noexcept;
+
+ enum heif_encoder_parameter_type get_type() const noexcept;
+
+ bool is_integer() const noexcept;
+ // Returns 'true' if the integer range is limited.
+ bool get_valid_integer_range(int& out_minimum, int& out_maximum);
+
+ bool is_boolean() const noexcept;
+
+ bool is_string() const noexcept;
+ std::vector<std::string> get_valid_string_values() const;
+
+ private:
+ EncoderParameter(const heif_encoder_parameter*);
+
+ const struct heif_encoder_parameter* m_parameter;
+
+ friend class Encoder;
+ };
+
+
+ class Encoder
+ {
+ public:
+ // throws Error
+ Encoder(enum heif_compression_format format);
+
+ // throws Error
+ void set_lossy_quality(int quality);
+
+ // throws Error
+ void set_lossless(bool enable_lossless);
+
+ std::vector<EncoderParameter> list_parameters() const noexcept;
+
+ void set_integer_parameter(std::string parameter_name, int value);
+ int get_integer_parameter(std::string parameter_name) const;
+
+ void set_boolean_parameter(std::string parameter_name, bool value);
+ bool get_boolean_parameter(std::string parameter_name) const;
+
+ void set_string_parameter(std::string parameter_name, std::string value);
+ std::string get_string_parameter(std::string parameter_name) const;
+
+ void set_parameter(std::string parameter_name, std::string parameter_value);
+ std::string get_parameter(std::string parameter_name) const;
+
+ private:
+ Encoder(struct heif_encoder*) noexcept;
+
+ std::shared_ptr<heif_encoder> m_encoder;
+
+ friend class EncoderDescriptor;
+ friend class Context;
+ };
+
+
+ // ==========================================================================================
+ // IMPLEMENTATION
+ // ==========================================================================================
+
+ inline Context::Context() {
+ heif_context* ctx = heif_context_alloc();
+ m_context = std::shared_ptr<heif_context>(ctx,
+ [] (heif_context* c) { heif_context_free(c); });
+ }
+
+ inline void Context::read_from_file(std::string filename, const ReadingOptions& /*opts*/) {
+ Error err = Error(heif_context_read_from_file(m_context.get(), filename.c_str(), NULL));
+ if (err) {
+ throw err;
+ }
+ }
+
+ inline void Context::read_from_memory(const void* mem, size_t size, const ReadingOptions& /*opts*/) {
+ Error err = Error(heif_context_read_from_memory(m_context.get(), mem, size, NULL));
+ if (err) {
+ throw err;
+ }
+ }
+
+
+ inline int Context::get_number_of_top_level_images() const noexcept {
+ return heif_context_get_number_of_top_level_images(m_context.get());
+ }
+
+ inline bool Context::is_top_level_image_ID(heif_item_id id) const noexcept {
+ return heif_context_is_top_level_image_ID(m_context.get(), id);
+ }
+
+ inline std::vector<heif_item_id> Context::get_list_of_top_level_image_IDs() const noexcept {
+ int num = get_number_of_top_level_images();
+ std::vector<heif_item_id> IDs(num);
+ heif_context_get_list_of_top_level_image_IDs(m_context.get(), IDs.data(), num);
+ return IDs;
+ }
+
+ inline heif_item_id Context::get_primary_image_ID() const {
+ heif_item_id id;
+ Error err = Error(heif_context_get_primary_image_ID(m_context.get(), &id));
+ if (err) {
+ throw err;
+ }
+ return id;
+ }
+
+ inline ImageHandle Context::get_primary_image_handle() const {
+ heif_image_handle* handle;
+ Error err = Error(heif_context_get_primary_image_handle(m_context.get(), &handle));
+ if (err) {
+ throw err;
+ }
+
+ return ImageHandle(handle);
+ }
+
+ inline ImageHandle Context::get_image_handle(heif_item_id id) const {
+ struct heif_image_handle* handle;
+ Error err = Error(heif_context_get_image_handle(m_context.get(), id, &handle));
+ if (err) {
+ throw err;
+ }
+ return ImageHandle(handle);
+ }
+
+#if 0
+ inline Context Context::wrap_without_releasing(heif_context* ctx) {
+ Context context;
+ context.m_context = std::shared_ptr<heif_context>(ctx,
+ [] (heif_context*) { /* NOP */ });
+ return context;
+ }
+#endif
+
+ inline struct ::heif_error heif_writer_trampoline_write(struct heif_context* ctx,
+ const void* data,
+ size_t size,
+ void* userdata) {
+ Context::Writer* writer = (Context::Writer*)userdata;
+
+ (void)ctx;
+
+ //Context context = Context::wrap_without_releasing(ctx);
+ //return writer->write(context, data, size);
+ return writer->write(data, size);
+ }
+
+ static struct heif_writer heif_writer_trampoline =
+ {
+ 1,
+ &heif_writer_trampoline_write
+ };
+
+ inline void Context::write(Writer& writer) {
+ Error err = Error(heif_context_write(m_context.get(), &heif_writer_trampoline, &writer));
+ if (err) {
+ throw err;
+ }
+ }
+
+ inline void Context::write_to_file(std::string filename) const {
+ Error err = Error(heif_context_write_to_file(m_context.get(), filename.c_str()));
+ if (err) {
+ throw err;
+ }
+ }
+
+
+
+ inline ImageHandle::ImageHandle(heif_image_handle* handle) {
+ m_image_handle = std::shared_ptr<heif_image_handle>(handle,
+ [] (heif_image_handle* h) { heif_image_handle_release(h); });
+ }
+
+ inline bool ImageHandle::is_primary_image() const noexcept {
+ return heif_image_handle_is_primary_image(m_image_handle.get()) != 0;
+ }
+
+ inline int ImageHandle::get_width() const noexcept {
+ return heif_image_handle_get_width(m_image_handle.get());
+ }
+
+ inline int ImageHandle::get_height() const noexcept {
+ return heif_image_handle_get_height(m_image_handle.get());
+ }
+
+ inline bool ImageHandle::has_alpha_channel() const noexcept {
+ return heif_image_handle_has_alpha_channel(m_image_handle.get()) != 0;
+ }
+
+ // ------------------------- depth images -------------------------
+
+ // TODO
+
+ // ------------------------- thumbnails -------------------------
+
+ inline int ImageHandle::get_number_of_thumbnails() const noexcept {
+ return heif_image_handle_get_number_of_thumbnails(m_image_handle.get());
+ }
+
+ inline std::vector<heif_item_id> ImageHandle::get_list_of_thumbnail_IDs() const noexcept {
+ int num = get_number_of_thumbnails();
+ std::vector<heif_item_id> IDs(num);
+ heif_image_handle_get_list_of_thumbnail_IDs(m_image_handle.get(), IDs.data(), num);
+ return IDs;
+ }
+
+ inline ImageHandle ImageHandle::get_thumbnail(heif_item_id id) {
+ heif_image_handle* handle;
+ Error err = Error(heif_image_handle_get_thumbnail(m_image_handle.get(), id, &handle));
+ if (err) {
+ throw err;
+ }
+
+ return ImageHandle(handle);
+ }
+
+ inline Image ImageHandle::decode_image(heif_colorspace colorspace, heif_chroma chroma,
+ const DecodingOptions& /*options*/) {
+ heif_image* out_img;
+ Error err = Error(heif_decode_image(m_image_handle.get(),
+ &out_img,
+ colorspace,
+ chroma,
+ nullptr)); //const struct heif_decoding_options* options);
+ if (err) {
+ throw err;
+ }
+
+ return Image(out_img);
+ }
+
+
+ inline std::vector<heif_item_id> ImageHandle::get_list_of_metadata_block_IDs(const char* type_filter) const noexcept {
+ int nBlocks = heif_image_handle_get_number_of_metadata_blocks(m_image_handle.get(),
+ type_filter);
+ std::vector<heif_item_id> ids(nBlocks);
+ int n = heif_image_handle_get_list_of_metadata_block_IDs(m_image_handle.get(),
+ type_filter,
+ ids.data(), nBlocks);
+ (void)n;
+ //assert(n==nBlocks);
+ return ids;
+ }
+
+ inline std::string ImageHandle::get_metadata_type(heif_item_id metadata_id) const noexcept {
+ return heif_image_handle_get_metadata_type(m_image_handle.get(), metadata_id);
+ }
+
+ inline std::string ImageHandle::get_metadata_content_type(heif_item_id metadata_id) const noexcept {
+ return heif_image_handle_get_metadata_content_type(m_image_handle.get(), metadata_id);
+ }
+
+ inline std::vector<uint8_t> ImageHandle::get_metadata(heif_item_id metadata_id) const {
+ size_t data_size = heif_image_handle_get_metadata_size(m_image_handle.get(),
+ metadata_id);
+
+ std::vector<uint8_t> data(data_size);
+
+ Error err = Error(heif_image_handle_get_metadata(m_image_handle.get(),
+ metadata_id,
+ data.data()));
+ if (err) {
+ throw err;
+ }
+
+ return data;
+ }
+
+
+
+ inline Image::Image(heif_image* image) {
+ m_image = std::shared_ptr<heif_image>(image,
+ [] (heif_image* h) { heif_image_release(h); });
+ }
+
+
+ inline void Image::create(int width, int height,
+ enum heif_colorspace colorspace,
+ enum heif_chroma chroma) {
+ heif_image* image;
+ Error err = Error(heif_image_create(width, height, colorspace, chroma, &image));
+ if (err) {
+ m_image.reset();
+ throw err;
+ }
+ else {
+ m_image = std::shared_ptr<heif_image>(image,
+ [] (heif_image* h) { heif_image_release(h); });
+ }
+ }
+
+ inline void Image::add_plane(enum heif_channel channel,
+ int width, int height, int bit_depth) {
+ Error err = Error(heif_image_add_plane(m_image.get(), channel, width, height, bit_depth));
+ if (err) {
+ throw err;
+ }
+ }
+
+ inline heif_colorspace Image::get_colorspace() const noexcept {
+ return heif_image_get_colorspace(m_image.get());
+ }
+
+ inline heif_chroma Image::get_chroma_format() const noexcept {
+ return heif_image_get_chroma_format(m_image.get());
+ }
+
+ inline int Image::get_width(enum heif_channel channel) const noexcept {
+ return heif_image_get_width(m_image.get(), channel);
+ }
+
+ inline int Image::get_height(enum heif_channel channel) const noexcept {
+ return heif_image_get_height(m_image.get(), channel);
+ }
+
+ inline int Image::get_bits_per_pixel(enum heif_channel channel) const noexcept {
+ return heif_image_get_bits_per_pixel(m_image.get(), channel);
+ }
+
+ inline bool Image::has_channel(enum heif_channel channel) const noexcept {
+ return heif_image_has_channel(m_image.get(), channel);
+ }
+
+ inline const uint8_t* Image::get_plane(enum heif_channel channel, int* out_stride) const noexcept {
+ return heif_image_get_plane_readonly(m_image.get(), channel, out_stride);
+ }
+
+ inline uint8_t* Image::get_plane(enum heif_channel channel, int* out_stride) noexcept {
+ return heif_image_get_plane(m_image.get(), channel, out_stride);
+ }
+
+ inline Image Image::scale_image(int width, int height,
+ const ScalingOptions&) const {
+ heif_image* img;
+ Error err = Error(heif_image_scale_image(m_image.get(), &img, width,height,
+ nullptr)); // TODO: scaling options not defined yet
+ if (err) {
+ throw err;
+ }
+
+ return Image(img);
+ }
+
+
+
+ inline std::vector<EncoderDescriptor>
+ EncoderDescriptor::get_encoder_descriptors(enum heif_compression_format format_filter,
+ const char* name_filter) noexcept {
+ int maxDescriptors = 10;
+ int nDescriptors;
+ for (;;) {
+ const struct heif_encoder_descriptor** descriptors;
+ descriptors = new const heif_encoder_descriptor*[maxDescriptors];
+
+ nDescriptors = heif_context_get_encoder_descriptors(nullptr,
+ format_filter,
+ name_filter,
+ descriptors,
+ maxDescriptors);
+ if (nDescriptors < maxDescriptors) {
+ std::vector<EncoderDescriptor> outDescriptors;
+ for (int i=0;i<nDescriptors;i++) {
+ outDescriptors.push_back(EncoderDescriptor(descriptors[i]));
+ }
+
+ delete[] descriptors;
+
+ return outDescriptors;
+ }
+ else {
+ delete[] descriptors;
+ maxDescriptors *= 2;
+ }
+ }
+ }
+
+
+ inline std::string EncoderDescriptor::get_name() const noexcept {
+ return heif_encoder_descriptor_get_name(m_descriptor);
+ }
+
+ inline std::string EncoderDescriptor::get_id_name() const noexcept {
+ return heif_encoder_descriptor_get_id_name(m_descriptor);
+ }
+
+ inline enum heif_compression_format EncoderDescriptor::get_compression_format() const noexcept {
+ return heif_encoder_descriptor_get_compression_format(m_descriptor);
+ }
+
+ inline bool EncoderDescriptor::supportes_lossy_compression() const noexcept {
+ return heif_encoder_descriptor_supportes_lossy_compression(m_descriptor);
+ }
+
+ inline bool EncoderDescriptor::supportes_lossless_compression() const noexcept {
+ return heif_encoder_descriptor_supportes_lossless_compression(m_descriptor);
+ }
+
+ inline Encoder EncoderDescriptor::get_encoder() const {
+ heif_encoder* encoder;
+ Error err = Error(heif_context_get_encoder(nullptr, m_descriptor, &encoder));
+ if (err) {
+ throw err;
+ }
+
+ return Encoder(encoder);
+ }
+
+
+ inline Encoder::Encoder(enum heif_compression_format format) {
+ heif_encoder* encoder;
+ Error err = Error(heif_context_get_encoder_for_format(nullptr, format, &encoder));
+ if (err) {
+ throw err;
+ }
+
+ m_encoder = std::shared_ptr<heif_encoder>(encoder,
+ [] (heif_encoder* e) { heif_encoder_release(e); });
+ }
+
+ inline Encoder::Encoder(struct heif_encoder* encoder) noexcept
+ {
+ m_encoder = std::shared_ptr<heif_encoder>(encoder,
+ [] (heif_encoder* e) { heif_encoder_release(e); });
+ }
+
+
+ inline EncoderParameter::EncoderParameter(const heif_encoder_parameter* param)
+ : m_parameter(param)
+ {
+ }
+
+ inline std::string EncoderParameter::get_name() const noexcept {
+ return heif_encoder_parameter_get_name(m_parameter);
+ }
+
+ inline enum heif_encoder_parameter_type EncoderParameter::get_type() const noexcept {
+ return heif_encoder_parameter_get_type(m_parameter);
+ }
+
+ inline bool EncoderParameter::is_integer() const noexcept {
+ return get_type() == heif_encoder_parameter_type_integer;
+ }
+
+ inline bool EncoderParameter::get_valid_integer_range(int& out_minimum, int& out_maximum) {
+ int have_minimum_maximum;
+ Error err = Error(heif_encoder_parameter_get_valid_integer_range(m_parameter,
+ &have_minimum_maximum,
+ &out_minimum, &out_maximum));
+ if (err) {
+ throw err;
+ }
+
+ return have_minimum_maximum;
+ }
+
+ inline bool EncoderParameter::is_boolean() const noexcept {
+ return get_type() == heif_encoder_parameter_type_boolean;
+ }
+
+ inline bool EncoderParameter::is_string() const noexcept {
+ return get_type() == heif_encoder_parameter_type_string;
+ }
+
+ inline std::vector<std::string> EncoderParameter::get_valid_string_values() const {
+ const char*const* stringarray;
+ Error err = Error(heif_encoder_parameter_get_valid_string_values(m_parameter,
+ &stringarray));
+ if (err) {
+ throw err;
+ }
+
+ std::vector<std::string> values;
+ for (int i=0; stringarray[i]; i++) {
+ values.push_back(stringarray[i]);
+ }
+
+ return values;
+ }
+
+ inline std::vector<EncoderParameter> Encoder::list_parameters() const noexcept {
+ std::vector<EncoderParameter> parameters;
+
+ for (const struct heif_encoder_parameter*const* params = heif_encoder_list_parameters(m_encoder.get());
+ *params;
+ params++) {
+ parameters.push_back(EncoderParameter(*params));
+ }
+
+ return parameters;
+ }
+
+
+ inline void Encoder::set_lossy_quality(int quality) {
+ Error err = Error(heif_encoder_set_lossy_quality(m_encoder.get(), quality));
+ if (err) {
+ throw err;
+ }
+ }
+
+ inline void Encoder::set_lossless(bool enable_lossless) {
+ Error err = Error(heif_encoder_set_lossless(m_encoder.get(), enable_lossless));
+ if (err) {
+ throw err;
+ }
+ }
+
+ inline void Encoder::set_integer_parameter(std::string parameter_name, int value) {
+ Error err = Error(heif_encoder_set_parameter_integer(m_encoder.get(), parameter_name.c_str(), value));
+ if (err) {
+ throw err;
+ }
+ }
+
+ inline int Encoder::get_integer_parameter(std::string parameter_name) const {
+ int value;
+ Error err = Error(heif_encoder_get_parameter_integer(m_encoder.get(), parameter_name.c_str(), &value));
+ if (err) {
+ throw err;
+ }
+ return value;
+ }
+
+ inline void Encoder::set_boolean_parameter(std::string parameter_name, bool value) {
+ Error err = Error(heif_encoder_set_parameter_boolean(m_encoder.get(), parameter_name.c_str(), value));
+ if (err) {
+ throw err;
+ }
+ }
+
+ inline bool Encoder::get_boolean_parameter(std::string parameter_name) const {
+ int value;
+ Error err = Error(heif_encoder_get_parameter_boolean(m_encoder.get(), parameter_name.c_str(), &value));
+ if (err) {
+ throw err;
+ }
+ return value;
+ }
+
+ inline void Encoder::set_string_parameter(std::string parameter_name, std::string value) {
+ Error err = Error(heif_encoder_set_parameter_string(m_encoder.get(), parameter_name.c_str(), value.c_str()));
+ if (err) {
+ throw err;
+ }
+ }
+
+ inline std::string Encoder::get_string_parameter(std::string parameter_name) const {
+ const int max_size = 250;
+ char value[max_size];
+ Error err = Error(heif_encoder_get_parameter_string(m_encoder.get(), parameter_name.c_str(),
+ value, max_size));
+ if (err) {
+ throw err;
+ }
+ return value;
+ }
+
+ inline void Encoder::set_parameter(std::string parameter_name, std::string parameter_value) {
+ Error err = Error(heif_encoder_set_parameter(m_encoder.get(), parameter_name.c_str(),
+ parameter_value.c_str()));
+ if (err) {
+ throw err;
+ }
+ }
+
+ inline std::string Encoder::get_parameter(std::string parameter_name) const {
+ const int max_size = 250;
+ char value[max_size];
+ Error err = Error(heif_encoder_get_parameter(m_encoder.get(), parameter_name.c_str(),
+ value, max_size));
+ if (err) {
+ throw err;
+ }
+ return value;
+ }
+
+ inline ImageHandle Context::encode_image(const Image& img, Encoder& encoder,
+ const EncodingOptions&) {
+ struct heif_image_handle* image_handle;
+
+ Error err = Error(heif_context_encode_image(m_context.get(),
+ img.m_image.get(),
+ encoder.m_encoder.get(),
+ nullptr,
+ &image_handle));
+ if (err) {
+ throw err;
+ }
+
+ return ImageHandle(image_handle);
+ }
+}
+
+
+#endif
diff --git a/src/heif_decoder_libde265.cc b/libheif/heif_decoder_libde265.cc
index 6509058..1aa7dfb 100644
--- a/src/heif_decoder_libde265.cc
+++ b/libheif/heif_decoder_libde265.cc
@@ -309,30 +309,30 @@ struct heif_error libde265_v1_decode_image(void* decoder_raw, struct heif_image*
static const struct heif_decoder_plugin decoder_libde265
{
- .plugin_api_version = 1,
- .get_plugin_name = libde265_plugin_name,
- .init_plugin = libde265_init_plugin,
- .deinit_plugin = libde265_deinit_plugin,
- .does_support_format = libde265_does_support_format,
- .new_decoder = libde265_new_decoder,
- .free_decoder = libde265_free_decoder,
- .push_data = libde265_v2_push_data,
- .decode_image = libde265_v2_decode_image
+ 1,
+ libde265_plugin_name,
+ libde265_init_plugin,
+ libde265_deinit_plugin,
+ libde265_does_support_format,
+ libde265_new_decoder,
+ libde265_free_decoder,
+ libde265_v2_push_data,
+ libde265_v2_decode_image
};
#else
static const struct heif_decoder_plugin decoder_libde265
{
- .plugin_api_version = 1,
- .get_plugin_name = libde265_plugin_name,
- .init_plugin = libde265_init_plugin,
- .deinit_plugin = libde265_deinit_plugin,
- .does_support_format = libde265_does_support_format,
- .new_decoder = libde265_new_decoder,
- .free_decoder = libde265_free_decoder,
- .push_data = libde265_v1_push_data,
- .decode_image = libde265_v1_decode_image
+ 1,
+ libde265_plugin_name,
+ libde265_init_plugin,
+ libde265_deinit_plugin,
+ libde265_does_support_format,
+ libde265_new_decoder,
+ libde265_free_decoder,
+ libde265_v1_push_data,
+ libde265_v1_decode_image
};
#endif
diff --git a/src/heif_decoder_libde265.h b/libheif/heif_decoder_libde265.h
index 11c4744..11c4744 100644
--- a/src/heif_decoder_libde265.h
+++ b/libheif/heif_decoder_libde265.h
diff --git a/src/heif-emscripten.h b/libheif/heif_emscripten.h
index 580c64c..d207f29 100644
--- a/src/heif-emscripten.h
+++ b/libheif/heif_emscripten.h
@@ -311,9 +311,11 @@ EMSCRIPTEN_BINDINGS(libheif) {
.value("heif_error_Memory_allocation_error", heif_error_Memory_allocation_error)
.value("heif_error_Decoder_plugin_error", heif_error_Decoder_plugin_error)
.value("heif_error_Encoder_plugin_error", heif_error_Encoder_plugin_error)
+ .value("heif_error_Encoding_error", heif_error_Encoding_error)
;
emscripten::enum_<heif_suberror_code>("heif_suberror_code")
.value("heif_suberror_Unspecified", heif_suberror_Unspecified)
+ .value("heif_suberror_Cannot_write_output_data", heif_suberror_Cannot_write_output_data)
.value("heif_suberror_End_of_data", heif_suberror_End_of_data)
.value("heif_suberror_Invalid_box_size", heif_suberror_Invalid_box_size)
.value("heif_suberror_No_ftyp_box", heif_suberror_No_ftyp_box)
diff --git a/src/heif_encoder_x265.cc b/libheif/heif_encoder_x265.cc
index b4ff010..76e3830 100644
--- a/src/heif_encoder_x265.cc
+++ b/libheif/heif_encoder_x265.cc
@@ -545,33 +545,33 @@ struct heif_error x265_get_compressed_data(void* encoder_raw, uint8_t** data, in
static const struct heif_encoder_plugin encoder_plugin_x265
{
- .plugin_api_version = 1,
- .compression_format = heif_compression_HEVC,
- .id_name = "x265",
- .priority = X265_PLUGIN_PRIORITY,
- .supports_lossy_compression = true,
- .supports_lossless_compression = true,
- .get_plugin_name = x265_plugin_name,
- .init_plugin = x265_init_plugin,
- .cleanup_plugin = x265_cleanup_plugin,
- .new_encoder = x265_new_encoder,
- .free_encoder = x265_free_encoder,
- .set_parameter_quality = x265_set_parameter_quality,
- .get_parameter_quality = x265_get_parameter_quality,
- .set_parameter_lossless = x265_set_parameter_lossless,
- .get_parameter_lossless = x265_get_parameter_lossless,
- .set_parameter_logging_level = x265_set_parameter_logging_level,
- .get_parameter_logging_level = x265_get_parameter_logging_level,
- .list_parameters = x265_list_parameters,
- .set_parameter_integer = x265_set_parameter_integer,
- .get_parameter_integer = x265_get_parameter_integer,
- .set_parameter_boolean = x265_set_parameter_integer, // boolean also maps to integer function
- .get_parameter_boolean = x265_get_parameter_integer, // boolean also maps to integer function
- .set_parameter_string = x265_set_parameter_string,
- .get_parameter_string = x265_get_parameter_string,
- .query_input_colorspace = x265_query_input_colorspace,
- .encode_image = x265_encode_image,
- .get_compressed_data = x265_get_compressed_data
+ /* plugin_api_version */ 1,
+ /* compression_format */ heif_compression_HEVC,
+ /* id_name */ "x265",
+ /* priority */ X265_PLUGIN_PRIORITY,
+ /* supports_lossy_compression */ true,
+ /* supports_lossless_compression */ true,
+ /* get_plugin_name */ x265_plugin_name,
+ /* init_plugin */ x265_init_plugin,
+ /* cleanup_plugin */ x265_cleanup_plugin,
+ /* new_encoder */ x265_new_encoder,
+ /* free_encoder */ x265_free_encoder,
+ /* set_parameter_quality */ x265_set_parameter_quality,
+ /* get_parameter_quality */ x265_get_parameter_quality,
+ /* set_parameter_lossless */ x265_set_parameter_lossless,
+ /* get_parameter_lossless */ x265_get_parameter_lossless,
+ /* set_parameter_logging_level */ x265_set_parameter_logging_level,
+ /* get_parameter_logging_level */ x265_get_parameter_logging_level,
+ /* list_parameters */ x265_list_parameters,
+ /* set_parameter_integer */ x265_set_parameter_integer,
+ /* get_parameter_integer */ x265_get_parameter_integer,
+ /* set_parameter_boolean */ x265_set_parameter_integer, // boolean also maps to integer function
+ /* get_parameter_boolean */ x265_get_parameter_integer, // boolean also maps to integer function
+ /* set_parameter_string */ x265_set_parameter_string,
+ /* get_parameter_string */ x265_get_parameter_string,
+ /* query_input_colorspace */ x265_query_input_colorspace,
+ /* encode_image */ x265_encode_image,
+ /* get_compressed_data */ x265_get_compressed_data
};
const struct heif_encoder_plugin* get_encoder_plugin_x265()
diff --git a/src/heif_encoder_x265.h b/libheif/heif_encoder_x265.h
index 650c9c8..650c9c8 100644
--- a/src/heif_encoder_x265.h
+++ b/libheif/heif_encoder_x265.h
diff --git a/src/heif_file.cc b/libheif/heif_file.cc
index 551fcc8..45499cd 100644
--- a/src/heif_file.cc
+++ b/libheif/heif_file.cc
@@ -310,6 +310,17 @@ std::string HeifFile::get_item_type(heif_item_id ID) const
}
+std::string HeifFile::get_content_type(heif_item_id ID) const
+{
+ auto infe_box = get_infe(ID);
+ if (!infe_box) {
+ return "";
+ }
+
+ return infe_box->get_content_type();
+}
+
+
Error HeifFile::get_properties(heif_item_id imageID,
std::vector<Box_ipco::Property>& properties) const
{
@@ -345,6 +356,7 @@ Error HeifFile::get_compressed_image_data(heif_item_id ID, std::vector<uint8_t>*
std::string item_type = infe_box->get_item_type();
+ std::string content_type = infe_box->get_content_type();
// --- get coded image data pointers
@@ -401,7 +413,8 @@ Error HeifFile::get_compressed_image_data(heif_item_id ID, std::vector<uint8_t>*
error = m_iloc_box->read_data(*item, *m_input_stream.get(), m_idat_box, data);
} else if (item_type == "grid" ||
item_type == "iovl" ||
- item_type == "Exif") {
+ item_type == "Exif" ||
+ (item_type == "mime" && content_type=="application/rdf+xml")) {
error = m_iloc_box->read_data(*item, *m_input_stream.get(), m_idat_box, data);
}
diff --git a/src/heif_file.h b/libheif/heif_file.h
index 782cd28..15c2fd6 100644
--- a/src/heif_file.h
+++ b/libheif/heif_file.h
@@ -66,6 +66,8 @@ namespace heif {
std::string get_item_type(heif_item_id ID) const;
+ std::string get_content_type(heif_item_id ID) const;
+
Error get_compressed_image_data(heif_item_id ID, std::vector<uint8_t>* out_data) const;
diff --git a/src/heif_hevc.cc b/libheif/heif_hevc.cc
index 86d560c..86d560c 100644
--- a/src/heif_hevc.cc
+++ b/libheif/heif_hevc.cc
diff --git a/src/heif_hevc.h b/libheif/heif_hevc.h
index 4537125..4537125 100644
--- a/src/heif_hevc.h
+++ b/libheif/heif_hevc.h
diff --git a/src/heif_image.cc b/libheif/heif_image.cc
index d90686a..dd81632 100644
--- a/src/heif_image.cc
+++ b/libheif/heif_image.cc
@@ -261,13 +261,18 @@ std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_colorspace(heif_colorspa
target_chroma == heif_chroma_420) {
out_img = convert_RGB24_32_to_YCbCr420();
}
+
+ if (get_chroma_format() == heif_chroma_444) {
+ std::shared_ptr<HeifPixelImage> img_rgb = convert_RGB_to_RGB24_32();
+ out_img = img_rgb->convert_RGB24_32_to_YCbCr420();
+ }
}
else { // same colorspace
if (target_colorspace == heif_colorspace_RGB) {
if (get_chroma_format() == heif_chroma_444 &&
target_chroma == heif_chroma_interleaved_24bit) {
- out_img = convert_RGB_to_RGB24();
+ out_img = convert_RGB_to_RGB24_32();
}
}
@@ -462,22 +467,29 @@ std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_YCbCr420_to_RGB32() cons
}
-std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_RGB_to_RGB24() const
+std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_RGB_to_RGB24_32() const
{
+ bool has_alpha = has_channel(heif_channel_Alpha);
+
if (get_bits_per_pixel(heif_channel_R) != 8 ||
get_bits_per_pixel(heif_channel_G) != 8 ||
get_bits_per_pixel(heif_channel_B) != 8) {
return nullptr;
}
+ if (has_alpha && get_bits_per_pixel(heif_channel_Alpha) != 8) {
+ return nullptr;
+ }
+
auto outimg = std::make_shared<HeifPixelImage>();
- outimg->create(m_width, m_height, heif_colorspace_RGB, heif_chroma_interleaved_24bit);
+ outimg->create(m_width, m_height, heif_colorspace_RGB,
+ has_alpha ? heif_chroma_interleaved_32bit : heif_chroma_interleaved_24bit);
- outimg->add_plane(heif_channel_interleaved, m_width, m_height, 24);
+ outimg->add_plane(heif_channel_interleaved, m_width, m_height, has_alpha ? 32 : 24);
- const uint8_t *in_r,*in_g,*in_b;
- int in_r_stride=0, in_g_stride=0, in_b_stride=0;
+ const uint8_t *in_r,*in_g,*in_b,*in_a=nullptr;
+ int in_r_stride=0, in_g_stride=0, in_b_stride=0, in_a_stride=0;
uint8_t *out_p;
int out_p_stride=0;
@@ -487,12 +499,27 @@ std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_RGB_to_RGB24() const
in_b = get_plane(heif_channel_B, &in_b_stride);
out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
+ if (has_alpha) {
+ in_a = get_plane(heif_channel_Alpha, &in_a_stride);
+ }
+
int x,y;
for (y=0;y<m_height;y++) {
- for (x=0;x<m_width;x++) {
- out_p[y*out_p_stride + 3*x + 0] = in_r[x + y*in_r_stride];
- out_p[y*out_p_stride + 3*x + 1] = in_g[x + y*in_r_stride];
- out_p[y*out_p_stride + 3*x + 2] = in_b[x + y*in_r_stride];
+
+ if (has_alpha) {
+ for (x=0;x<m_width;x++) {
+ out_p[y*out_p_stride + 4*x + 0] = in_r[x + y*in_r_stride];
+ out_p[y*out_p_stride + 4*x + 1] = in_g[x + y*in_g_stride];
+ out_p[y*out_p_stride + 4*x + 2] = in_b[x + y*in_b_stride];
+ out_p[y*out_p_stride + 4*x + 3] = in_a[x + y*in_a_stride];
+ }
+ }
+ else {
+ for (x=0;x<m_width;x++) {
+ out_p[y*out_p_stride + 3*x + 0] = in_r[x + y*in_r_stride];
+ out_p[y*out_p_stride + 3*x + 1] = in_g[x + y*in_g_stride];
+ out_p[y*out_p_stride + 3*x + 2] = in_b[x + y*in_b_stride];
+ }
}
}
@@ -876,6 +903,8 @@ Error HeifPixelImage::fill_RGB_16bit(uint16_t r, uint16_t g, uint16_t b, uint16_
case heif_channel_B: val16=b; break;
case heif_channel_Alpha: val16=a; break;
default:
+ // initialization only to avoid warning of uninitalized variable.
+ val16 = 0;
// Should already be detected by the check above ("m_planes.find").
assert(false);
}
diff --git a/src/heif_image.h b/libheif/heif_image.h
index cb088ba..d3251e5 100644
--- a/src/heif_image.h
+++ b/libheif/heif_image.h
@@ -114,7 +114,7 @@ class HeifPixelImage : public std::enable_shared_from_this<HeifPixelImage>,
std::shared_ptr<HeifPixelImage> convert_YCbCr420_to_RGB() const;
std::shared_ptr<HeifPixelImage> convert_YCbCr420_to_RGB24() const;
std::shared_ptr<HeifPixelImage> convert_YCbCr420_to_RGB32() const;
- std::shared_ptr<HeifPixelImage> convert_RGB_to_RGB24() const;
+ std::shared_ptr<HeifPixelImage> convert_RGB_to_RGB24_32() const;
std::shared_ptr<HeifPixelImage> convert_mono_to_RGB(int bpp) const;
std::shared_ptr<HeifPixelImage> convert_mono_to_YCbCr420() const;
std::shared_ptr<HeifPixelImage> convert_RGB24_32_to_YCbCr420() const;
diff --git a/src/heif_limits.h b/libheif/heif_limits.h
index b839464..c6c367c 100644
--- a/src/heif_limits.h
+++ b/libheif/heif_limits.h
@@ -40,4 +40,10 @@ static const int MAX_MEMORY_BLOCK_SIZE = 50*1024*1024; // 50 MB
static const int MAX_IMAGE_WIDTH = 16384;
static const int MAX_IMAGE_HEIGHT = 16384;
+// Maximum nesting level of boxes in input files.
+// We put a limit on this to avoid unlimited stack usage by malicious input files.
+static const int MAX_BOX_NESTING_LEVEL = 20;
+
+static const int MAX_BOX_SIZE = 0x7FFFFFFF; // 2 GB
+
#endif // LIBHEIF_HEIF_LIMITS_H
diff --git a/src/heif_plugin.cc b/libheif/heif_plugin.cc
index 7b0ff36..652c981 100644
--- a/src/heif_plugin.cc
+++ b/libheif/heif_plugin.cc
@@ -18,8 +18,8 @@
* along with libheif. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <heif_plugin.h>
-#include <heif.h>
+#include "heif_plugin.h"
+#include "heif.h"
struct heif_error heif_error_ok = { heif_error_Ok, heif_suberror_Unspecified, "Success" };
diff --git a/src/heif_plugin.h b/libheif/heif_plugin.h
index e5e7b04..4e32485 100644
--- a/src/heif_plugin.h
+++ b/libheif/heif_plugin.h
@@ -25,7 +25,7 @@
extern "C" {
#endif
-#include <heif.h>
+#include <libheif/heif.h>
// ====================================================================================================
diff --git a/src/heif_plugin_registry.cc b/libheif/heif_plugin_registry.cc
index c15a5f8..d2fc55b 100644
--- a/src/heif_plugin_registry.cc
+++ b/libheif/heif_plugin_registry.cc
@@ -39,7 +39,7 @@ std::set<const struct heif_decoder_plugin*> heif::s_decoder_plugins;
struct encoder_descriptor_priority_order
{
bool operator() (const std::unique_ptr<struct heif_encoder_descriptor>& a,
- const std::unique_ptr<struct heif_encoder_descriptor>& b) {
+ const std::unique_ptr<struct heif_encoder_descriptor>& b) const {
return a->plugin->priority > b->plugin->priority; // highest priority first
}
};
diff --git a/src/heif_plugin_registry.h b/libheif/heif_plugin_registry.h
index 06b586d..06b586d 100644
--- a/src/heif_plugin_registry.h
+++ b/libheif/heif_plugin_registry.h
diff --git a/src/heif-version.h b/libheif/heif_version.h
index e58b117..a85cd7f 100644
--- a/src/heif-version.h
+++ b/libheif/heif_version.h
@@ -18,7 +18,7 @@
* along with libheif. If not, see <http://www.gnu.org/licenses/>.
*/
-/* heif-version.h
+/* heif_version.h
*
* This file was generated by autoconf when libheif was built.
*
@@ -28,9 +28,9 @@
#define LIBHEIF_HEIF_VERSION_H
/* Numeric representation of the version */
-#define LIBHEIF_NUMERIC_VERSION 0x01010000
+#define LIBHEIF_NUMERIC_VERSION 0x01020000
/* Version string */
-#define LIBHEIF_VERSION "1.1.0"
+#define LIBHEIF_VERSION "1.2.0"
#endif // LIBHEIF_HEIF_VERSION_H
diff --git a/src/heif-version.h.in b/libheif/heif_version.h.in
index 476093b..5da30e2 100644
--- a/src/heif-version.h.in
+++ b/libheif/heif_version.h.in
@@ -18,7 +18,7 @@
* along with libheif. If not, see <http://www.gnu.org/licenses/>.
*/
-/* heif-version.h
+/* heif_version.h
*
* This file was generated by autoconf when libheif was built.
*
diff --git a/src/logging.h b/libheif/logging.h
index 21ff0ad..21ff0ad 100644
--- a/src/logging.h
+++ b/libheif/logging.h
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index ede798e..2e29fa8 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,5 +1,11 @@
EXTRA_DIST = \
- *.hook \
- *.sh \
+ pre-commit.hook \
+ check-emscripten-enums.sh \
+ check-licenses.sh \
+ install-ci-linux.sh \
+ install-ci-osx.sh \
+ install-emscripten.sh \
+ prepare-ci.sh \
+ run-ci.sh \
cpplint.py \
test-javascript.js
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 70f2127..9a870cc 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -273,8 +273,14 @@ top_srcdir = @top_srcdir@
x265_CFLAGS = @x265_CFLAGS@
x265_LIBS = @x265_LIBS@
EXTRA_DIST = \
- *.hook \
- *.sh \
+ pre-commit.hook \
+ check-emscripten-enums.sh \
+ check-licenses.sh \
+ install-ci-linux.sh \
+ install-ci-osx.sh \
+ install-emscripten.sh \
+ prepare-ci.sh \
+ run-ci.sh \
cpplint.py \
test-javascript.js
diff --git a/scripts/check-emscripten-enums.sh b/scripts/check-emscripten-enums.sh
index 0937d8f..5c2d548 100755
--- a/scripts/check-emscripten-enums.sh
+++ b/scripts/check-emscripten-enums.sh
@@ -31,14 +31,14 @@ DEFINE_TYPES="
API_DEFINES=""
for type in $DEFINE_TYPES; do
- DEFINES=$(grep "^[ \t]*$type" src/heif.h | sed 's|[[:space:]]*\([^ \t=]*\)[[:space:]]*=.*|\1|g')
+ DEFINES=$(grep "^[ \t]*$type" libheif/heif.h | sed 's|[[:space:]]*\([^ \t=]*\)[[:space:]]*=.*|\1|g')
if [ -z "$API_DEFINES" ]; then
API_DEFINES="$DEFINES"
else
API_DEFINES="$API_DEFINES
$DEFINES"
fi
- ALIASES=$(grep "^[ \t]*#define $type" src/heif.h | sed 's|[[:space:]]*#define \([^ \t]*\)[[:space:]]*.*|\1|g')
+ ALIASES=$(grep "^[ \t]*#define $type" libheif/heif.h | sed 's|[[:space:]]*#define \([^ \t]*\)[[:space:]]*.*|\1|g')
if [ ! -z "$ALIASES" ]; then
API_DEFINES="$API_DEFINES
$ALIASES"
@@ -48,7 +48,7 @@ API_DEFINES=$(echo "$API_DEFINES" | sort)
EMSCRIPTEN_DEFINES=""
for type in $DEFINE_TYPES; do
- DEFINES=$(grep "\.value(\"$type" src/heif-emscripten.h | sed 's|[^\"]*\"\(.*\)\".*|\1|g')
+ DEFINES=$(grep "\.value(\"$type" libheif/heif_emscripten.h | sed 's|[^\"]*\"\(.*\)\".*|\1|g')
if [ -z "$EMSCRIPTEN_DEFINES" ]; then
EMSCRIPTEN_DEFINES="$DEFINES"
else
@@ -62,13 +62,13 @@ set +e
CHANGES=$(diff -u <(echo "$API_DEFINES") <(echo "$EMSCRIPTEN_DEFINES"))
set -e
if [ -z "$CHANGES" ]; then
- echo "All defines from heif.h are present in heif-emscripten.h"
+ echo "All defines from heif.h are present in heif_emscripten.h"
exit 0
fi
-echo "Differences found between enum defines in heif.h and heif-emscripten.h."
-echo "Lines prefixed with '+' are only in heif-emscripten.h, resulting in"
-echo "compile errors. Lines prefixed with '-' are missing in heif-emscripten.h"
+echo "Differences found between enum defines in heif.h and heif_emscripten.h."
+echo "Lines prefixed with '+' are only in heif_emscripten.h, resulting in"
+echo "compile errors. Lines prefixed with '-' are missing in heif_emscripten.h"
echo
echo "$CHANGES"
exit 1
diff --git a/scripts/install-ci.sh b/scripts/install-ci-linux.sh
index 671ff8e..dc7c77b 100755
--- a/scripts/install-ci.sh
+++ b/scripts/install-ci-linux.sh
@@ -79,6 +79,16 @@ if [ ! -z "$WITH_GRAPHICS" ]; then
"
fi
+if [ ! -z "$MINGW64" ]; then
+ INSTALL_PACKAGES="$INSTALL_PACKAGES \
+ binutils-mingw-w64-x86-64 \
+ g++-mingw-w64-x86-64 \
+ gcc-mingw-w64-x86-64 \
+ mingw-w64-x86-64-dev \
+ wine \
+ "
+fi
+
if [ ! -z "$UPDATE_APT" ]; then
echo "Updating package lists ..."
sudo apt-get update -qq
diff --git a/scripts/install-ci-osx.sh b/scripts/install-ci-osx.sh
new file mode 100755
index 0000000..0903728
--- /dev/null
+++ b/scripts/install-ci-osx.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+set -e
+#
+# HEIF codec.
+# Copyright (c) 2018 struktur AG, Joachim Bauch <bauch@struktur.de>
+#
+# This file is part of libheif.
+#
+# libheif 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 3 of the License, or
+# (at your option) any later version.
+#
+# libheif 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 libheif. If not, see <http://www.gnu.org/licenses/>.
+#
+
+INSTALL_PACKAGES=
+REMOVE_PACKAGES=
+
+if [ ! -z "$WITH_LIBDE265" ]; then
+ INSTALL_PACKAGES="$INSTALL_PACKAGES \
+ libde265 \
+ "
+fi
+
+if [ ! -z "$WITH_X265" ]; then
+ INSTALL_PACKAGES="$INSTALL_PACKAGES \
+ x265 \
+ "
+fi
+
+if [ -z "$WITH_GRAPHICS" ] && [ -z "$CHECK_LICENSES" ] && [ -z "$CPPLINT" ]; then
+ REMOVE_PACKAGES="$REMOVE_PACKAGES \
+ libjpeg \
+ libpng \
+ "
+fi
+
+if [ ! -z "$WITH_GRAPHICS" ]; then
+ INSTALL_PACKAGES="$INSTALL_PACKAGES \
+ libjpeg \
+ libpng \
+ "
+fi
+
+if [ ! -z "$REMOVE_PACKAGES" ]; then
+ echo "Removing packages $REMOVE_PACKAGES ..."
+ for package in $REMOVE_PACKAGES; do
+ brew list $package &>/dev/null && brew uninstall --ignore-dependencies $package
+ done
+fi
+
+if [ ! -z "$INSTALL_PACKAGES" ]; then
+ echo "Installing packages $INSTALL_PACKAGES ..."
+ for package in $INSTALL_PACKAGES; do
+ brew list $package &>/dev/null || brew install $package
+ done
+fi
diff --git a/scripts/pre-commit.hook b/scripts/pre-commit.hook
index 86f302e..c76c146 100755
--- a/scripts/pre-commit.hook
+++ b/scripts/pre-commit.hook
@@ -32,7 +32,7 @@ fi
check_enums=
for file in `git diff-index --cached --name-only HEAD --diff-filter=ACMR| grep -E "\.cc$|\.h$|\.c$"` ; do
"$CPPLINT" "$file"
- if [ "$file" = "src/heif.h" ] || [ "$file" = "src/heif-emscripten.h" ] ; then
+ if [ "$file" = "libheif/heif.h" ] || [ "$file" = "libheif/heif_emscripten.h" ] ; then
check_enums=1
fi
done
diff --git a/scripts/prepare-ci.sh b/scripts/prepare-ci.sh
index b404aea..9a0b183 100755
--- a/scripts/prepare-ci.sh
+++ b/scripts/prepare-ci.sh
@@ -26,7 +26,19 @@ if [ "$WITH_LIBDE265" = "2" ]; then
export PKG_CONFIG_PATH=$BUILD_ROOT/libde265/dist/lib/pkgconfig/
fi
+CONFIGURE_HOST=
+if [ ! -z "$MINGW64" ]; then
+ CONFIGURE_HOST=x86_64-w64-mingw32
+fi
+
if [ -z "$CHECK_LICENSES" ] && [ -z "$CPPLINT" ] && [ -z "$CMAKE" ]; then
./autogen.sh
- ./configure
+ if [ -z "$CONFIGURE_HOST" ]; then
+ ./configure
+ else
+ # Make sure the correct compiler will be used.
+ unset CC
+ unset CXX
+ ./configure --host=$CONFIGURE_HOST
+ fi
fi
diff --git a/scripts/run-ci.sh b/scripts/run-ci.sh
index 6c68712..f656c01 100755
--- a/scripts/run-ci.sh
+++ b/scripts/run-ci.sh
@@ -32,6 +32,17 @@ if [ ! -z "$CPPLINT" ]; then
exit 0
fi
+BIN_SUFFIX=
+BIN_WRAPPER=
+if [ ! -z "$MINGW64" ]; then
+ # Make sure the correct compiler will be used.
+ unset CC
+ unset CXX
+ BIN_SUFFIX=.exe
+ BIN_WRAPPER=wine64
+ export WINEPATH="/usr/lib/gcc/x86_64-w64-mingw32/4.8/;/usr/x86_64-w64-mingw32/lib"
+fi
+
if [ ! -z "$CMAKE" ]; then
echo "Preparing cmake build files ..."
cmake .
@@ -41,16 +52,16 @@ if [ -z "$EMSCRIPTEN_VERSION" ] && [ -z "$CHECK_LICENSES" ] && [ -z "$TARBALL" ]
echo "Building libheif ..."
make
echo "Dumping information of sample file ..."
- ./examples/heif-info --dump-boxes examples/example.heic
+ ${BIN_WRAPPER} ./examples/heif-info${BIN_SUFFIX} --dump-boxes examples/example.heic
if [ ! -z "$WITH_GRAPHICS" ] && [ ! -z "$WITH_LIBDE265" ]; then
echo "Converting sample file to JPEG ..."
- ./examples/heif-convert examples/example.heic example.jpg
+ ${BIN_WRAPPER} ./examples/heif-convert${BIN_SUFFIX} examples/example.heic example.jpg
echo "Checking first generated file ..."
[ -s "example-1.jpg" ] || exit 1
echo "Checking second generated file ..."
[ -s "example-2.jpg" ] || exit 1
echo "Converting sample file to PNG ..."
- ./examples/heif-convert examples/example.heic example.png
+ ${BIN_WRAPPER} ./examples/heif-convert${BIN_SUFFIX} examples/example.heic example.png
echo "Checking first generated file ..."
[ -s "example-1.png" ] || exit 1
echo "Checking second generated file ..."