openjpeg: Remove compatibility with openjpeg 2.0

Everyone seems to be shipping 2.1 as the oldest v2 version, even debian
oldstable (jessie).

Also remove an unneeded (debug?) #include <stdio.h>.

https://bugzilla.gnome.org/show_bug.cgi?id=788703
This commit is contained in:
Jan Alexander Steffens (heftig) 2017-10-20 11:44:50 +02:00 committed by Sebastian Dröge
parent bff2d834a4
commit e5977b8794
5 changed files with 8 additions and 33 deletions

View file

@ -2864,14 +2864,8 @@ dnl *** OpenJPEG ***
translit(dnm, m, l) AM_CONDITIONAL(USE_OPENJPEG, true)
AG_GST_CHECK_FEATURE(OPENJPEG, [openjpeg library], openjpeg, [
HAVE_OPENJPEG="no"
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_2_1" = x"yes"; then
AC_DEFINE([HAVE_OPENJPEG_2_1], 1, [Define if OpenJPEG 2.1 is used])
fi
else
AG_GST_PKG_CHECK_MODULES(OPENJPEG, libopenjp2 >= 2.1)
if test x"$HAVE_OPENJPEG" != x"yes"; then
# Fallback to v1.5
OPENJPEG_LIBS=""
PKG_CHECK_MODULES(OPENJPEG, libopenjpeg1,

View file

@ -21,8 +21,9 @@
#ifndef __GST_OPENJPEG_H__
#define __GST_OPENJPEG_H__
#ifdef HAVE_OPENJPEG_1
#include <openjpeg.h>
#ifdef HAVE_OPENJPEG_1
#define OPJ_CLRSPC_UNKNOWN CLRSPC_UNKNOWN
#define OPJ_CLRSPC_SRGB CLRSPC_SRGB
#define OPJ_CLRSPC_GRAY CLRSPC_GRAY
@ -36,13 +37,6 @@
#define OPJ_RPCL RPCL
#define OPJ_PCRL PCRL
#define OPJ_CPRL CPRL
#else
#include <stdio.h>
# if defined(HAVE_OPENJPEG_2_1)
# include <openjpeg.h>
# else
# include <openjpeg-2.0/openjpeg.h>
# endif
#endif
#endif /* __GST_OPENJPEG_H__ */

View file

@ -1138,11 +1138,7 @@ 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

@ -958,11 +958,7 @@ 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))

View file

@ -6,16 +6,11 @@ openjpeg_sources = [
openjpeg_cargs = []
# Check for 2.1, then 2.0, then 1.5
openjpeg_dep = dependency('libopenjp2', version : '>=2.1', required : false)
if openjpeg_dep.found()
openjpeg_cargs += ['-DHAVE_OPENJPEG_2_1']
else
openjpeg_dep = dependency('libopenjp2', required : false)
if not openjpeg_dep.found()
openjpeg_dep = dependency('libopenjpeg1', required : false)
openjpeg_cargs += ['-DHAVE_OPENJPEG_1']
endif
if not openjpeg_dep.found()
# Fallback to v1.5
openjpeg_dep = dependency('libopenjpeg1', required : false)
openjpeg_cargs += ['-DHAVE_OPENJPEG_1']
endif
if openjpeg_dep.found()