openjpeg: Port to 2.1 and require a pkg-config file for 2.0 and 2.1

The port was trivial, and according to the NEWS file nothing else has changed,
but it is possible that other API was changed without proper notification.

OpenJPEG upstream has shipped a pkg-config file for the past 4 years, and all
distros should be shipping it by now.

https://bugzilla.gnome.org/show_bug.cgi?id=766213
This commit is contained in:
Nirbheek Chauhan 2016-05-10 16:24:08 +05:30 committed by Sebastian Dröge
parent ddcc1c6442
commit 1536f30cc2
4 changed files with 22 additions and 15 deletions

View file

@ -2739,20 +2739,15 @@ dnl *** OpenJPEG ***
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",

View file

@ -38,7 +38,11 @@
#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__ */

View file

@ -1039,7 +1039,11 @@ gst_openjpeg_dec_handle_frame (GstVideoDecoder * decoder,
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;

View file

@ -901,7 +901,11 @@ gst_openjpeg_enc_handle_frame (GstVideoEncoder * encoder,
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))