translit(dnm, m, l) AM_CONDITIONAL(USE_OPENJPEG, true)
AG_GST_CHECK_FEATURE(OPENJPEG, [openjpeg library], openjpeg, [
HAVE_OPENJPEG="no"
-
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- OPENJPEG_LIBS="-lopenjp2"
- LIBS="$LIBS $OPENJPEG_LIBS"
- CFLAGS="$CFLAGS $OPENJPEG_CFLAGS"
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([#include <openjpeg-2.0/openjpeg.h>],
- [return (int) *opj_version ();])
- ], [HAVE_OPENJPEG=yes], [HAVE_OPENJPEG=no])
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- if test x"$HAVE_OPENJPEG" = x"no"; then
+ AG_GST_PKG_CHECK_MODULES(OPENJPEG, libopenjp2 >= 2.0)
+ if test x"$HAVE_OPENJPEG" = x"yes"; then
+ dnl minor API changes in v2.1
+ AG_GST_PKG_CHECK_MODULES(OPENJPEG_2_1, libopenjp2 >= 2.1)
+ if test x"$HAVE_OPENJPEG" = x"yes"; then
+ AC_DEFINE([HAVE_OPENJPEG_2_1], 1, [Define if OpenJPEG 2.1 is used])
+ fi
+ else
+ # Fallback to v1.5
OPENJPEG_LIBS=""
PKG_CHECK_MODULES(OPENJPEG, libopenjpeg1,
HAVE_OPENJPEG="yes",
#define OPJ_CPRL CPRL
#else
#include <stdio.h>
-#include <openjpeg-2.0/openjpeg.h>
+# ifdef HAVE_OPENJPEG_2_1
+# include <openjpeg-2.1/openjpeg.h>
+# else
+# include <openjpeg-2.0/openjpeg.h>
+# endif
#endif
#endif /* __GST_OPENJPEG_H__ */
opj_stream_set_write_function (stream, write_fn);
opj_stream_set_skip_function (stream, skip_fn);
opj_stream_set_seek_function (stream, seek_fn);
+#ifdef HAVE_OPENJPEG_2_1
+ opj_stream_set_user_data (stream, &mstream, NULL);
+#else
opj_stream_set_user_data (stream, &mstream);
+#endif
opj_stream_set_user_data_length (stream, mstream.size);
image = NULL;
opj_stream_set_write_function (stream, write_fn);
opj_stream_set_skip_function (stream, skip_fn);
opj_stream_set_seek_function (stream, seek_fn);
+#ifdef HAVE_OPENJPEG_2_1
+ opj_stream_set_user_data (stream, &mstream, NULL);
+#else
opj_stream_set_user_data (stream, &mstream);
+#endif
opj_stream_set_user_data_length (stream, mstream.size);
if (!opj_start_compress (enc, image, stream))