diff -urN transcode-1.1.7/configure.in transcode-1.1.7-imagemagick7/configure.in --- transcode-1.1.7/configure.in 2023-09-01 05:20:25.861740075 +0000 +++ transcode-1.1.7-imagemagick7/configure.in 2023-09-01 05:19:44.612157421 +0000 @@ -1119,8 +1119,8 @@ dnl ImageMagick dnl IMAGEMAGICK_EXTRA_LIBS="$IMAGEMAGICK_EXTRA_LIBS $($PKG_CONFIG --libs ImageMagick)" -TC_PKG_CHECK(imagemagick, no, IMAGEMAGICK, no, [magick/api.h], - none, InitializeMagick, Wand, [http://www.imagemagick.org/]) +TC_PKG_CHECK(imagemagick, no, IMAGEMAGICK, no, [MagickWand/MagickWand.h], + none, InitializeMagick, MagickWand, [http://www.imagemagick.org/]) TC_PKG_HAVE(imagemagick, IMAGEMAGICK) if test x"$have_imagemagick" = x"yes" ; then SAVE_CPPFLAGS="$CPPFLAGS" @@ -1128,6 +1128,7 @@ AC_CHECK_HEADER([wand/magick-wand.h], [AC_DEFINE([HAVE_BROKEN_WAND], [1], ["have old wand header"])]) CPPFLAGS="$SAVE_CPPFLAGS" + IMAGEMAGICK_CFLAGS="$IMAGEMAGICK_CFLAGS $($PKG_CONFIG --cflags ImageMagick)" fi dnl diff -urN transcode-1.1.7/configure.in.orig transcode-1.1.7-imagemagick7/configure.in.orig --- transcode-1.1.7/configure.in.orig 1970-01-01 00:00:00.000000000 +0000 +++ transcode-1.1.7-imagemagick7/configure.in.orig 2023-09-01 05:19:44.611157431 +0000 @@ -0,0 +1,1448 @@ +# Process this file with autoconf to produce a configure script. + +AC_INIT(transcode,1.1.7) +AC_CONFIG_AUX_DIR(autotools) +AC_CONFIG_SRCDIR(src/transcode.c) + +dnl Detect the canonical host and target build environment +AC_CANONICAL_SYSTEM + +AM_INIT_AUTOMAKE(transcode,1.1.7) +AM_CONFIG_HEADER(config.h) + +AM_MAINTAINER_MODE + +dnl Checks for programs. +AC_LANG([C]) +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_CPP +AC_PROG_AWK +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AM_PROG_AS +AM_CONDITIONAL(HAVE_GCC, test x"$GCC" = x"yes") + +dnl Check for gcc2, which doesn't seem to handle asm templates +dnl And check for gcc4, which also has problems with filter_tomsmocomp +dnl +gcc2=no +gcc4=no +if test x"$GCC" = x"yes" ; then + gcc_ver="`LANG=C $CC -dumpversion`" + if test x"$gcc_ver" != x"" ; then + if echo $gcc_ver | grep -q ^2 ; then + gcc2=yes + fi + if echo $gcc_ver | grep -q ^4 ; then + gcc4=yes + fi + fi +fi +AM_CONDITIONAL(HAVE_GCC2, test x"$gcc2" = x"yes") +AM_CONDITIONAL(HAVE_GCC4, test x"$gcc4" = x"yes") + +dnl we got $AWK already, but not its full path +AC_PATH_PROG(PATH_TO_AWK, $AWK) + +dnl Check the OS. This has to be done here, after checks for proograms and +dnl before checks for libraries. + +deflib="/lib" +is_linux=no +is_bsd=no +is_osx=no +case "${target_os}" in + *linux*) + is_linux=yes + AC_DEFINE([OS_LINUX], 1, [Define if your system is Linux]) + ;; + freebsd*|openbsd*|netbsd*|bsdi*|darwin*|rhapsody*) + is_bsd=yes + AC_DEFINE([OS_BSD], 1, [Define if your system is modern BSD]) + + # darwin is a subcase of BSD + case "${target_os}" in + darwin*) + is_osx=yes + CFLAGS="${CFLAGS} -no-cpp-precomp -D_INTL_REDIRECT_MACROS" + #LDFLAGS="${LDFLAGS} -all_load" + + AC_DEFINE([OS_DARWIN], 1, [Define if this is a Darwin / MacOS X system.]) + AC_DEFINE([BROKEN_PTHREADS], 1, [Define if you have weird pthreads.]) + + # Include Fink in compile and link if present + if test -d /sw; then + CPPFLAGS="${CPPFLAGS} -I/sw/include" + LDFLAGS="${LDFLAGS} -L/sw/lib" + fi + ;; + esac + ;; +esac +AM_CONDITIONAL([OS_LINUX], test x"$is_linux" = x"yes") +AM_CONDITIONAL([OS_BSD], test x"$is_bsd" = x"yes") +AM_CONDITIONAL([OS_DARWIN], test x"$is_osx" = x"yes") + + +dnl Checks for libraries. +AC_CHECK_LIB(dl, dlopen) +AC_CHECK_FUNCS([dlopen]) +if test x"$is_osx" = x"true" ; then + AC_CHECK_FUNCS(dlsym_prepend_underscore, + [CFLAGS="${CFLAGS} -Ddlsym=dlsym_prepend_underscore"], + AC_MSG_WARN([Function 'dlsym_prepend_underscore' not found.]) + AC_MSG_WARN([Using function 'dlsym' directly instead.]) + AC_MSG_WARN([This can be a problem if the installed dlsym]) + AC_MSG_WARN([does not automatically prepend an underscore]) + AC_MSG_WARN([to symbols.])) +fi + +USE_DLDARWIN=no +if test x"$ac_cv_lib_dl_dlopen" = x"no" ; then + case x${target_os} in + xdarwin*) + USE_DLDARWIN=yes + DLDARWIN_CFLAGS="-I\$(top_srcdir)/libdldarwin/" + DLDARWIN_LIBS="\$(top_builddir)/libdldarwin/libdldarwin.a" + ;; + esac +fi +AC_SUBST(USE_DLDARWIN) +AC_SUBST(DLDARWIN_CFLAGS) +AC_SUBST(DLDARWIN_LIBS) +AM_CONDITIONAL(USE_DLDARWIN, test x"$USE_DLDARWIN" = x"yes") + +dnl libtool setup +AC_PROVIDE([AC_PROG_CXX]) dnl we don't want it! +AC_PROVIDE([AC_PROG_F77]) dnl likewise +AC_DISABLE_STATIC +AC_LIBTOOL_DLOPEN +AC_PROG_LIBTOOL + + +dnl Checks for header files. +TC_CHECK_STD_HEADERS +AC_CHECK_HEADERS([endian.h malloc.h sys/mman.h sys/select.h]) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_C_BIGENDIAN([words_bigendian=true + AC_DEFINE([WORDS_BIGENDIAN], 1, [Define if your CPU is big-endian.])], + words_bigendian=false) +AM_CONDITIONAL(WORDS_BIGENDIAN, test x"$words_bigendian" = x"true") +TC_C_GCC_ATTRIBUTES +TC_C_ATTRIBUTE_ALIGNED + +dnl Checks for library functions. +AC_FUNC_MALLOC +AC_TYPE_SIGNAL +AC_CHECK_FUNCS([getopt_long_only getpagesize gettimeofday mmap strlcat strlcpy strtof vsscanf]) +AM_CONDITIONAL(HAVE_GETOPT_LONG_ONLY, test x"$ac_cv_func_getopt_long_only" = x"yes") +AM_CONDITIONAL(HAVE_MMAP, test x"$ac_cv_func_mmap" = x"yes") +AM_CONDITIONAL(HAVE_GETTIMEOFDAY, test x"$ac_cv_func_gettimeofday" = x"yes") + +dnl Special check for sysconf() to ensure _SC_PAGESIZE is also available. +AC_CACHE_CHECK([for sysconf(_SC_PAGESIZE)], ac_cv_sysconf_with_sc_pagesize, + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[sysconf(_SC_PAGESIZE);]])], + [ac_cv_sysconf_with_sc_pagesize=yes], + [ac_cv_sysconf_with_sc_pagesize=no])]) +if test x"$ac_cv_sysconf_with_sc_pagesize" = x"yes"; then + AC_DEFINE([HAVE_SYSCONF_WITH_SC_PAGESIZE], 1, + [Define to 1 if you have sysconf(_SC_PAGESIZE).]) +fi + +dnl Large file support. +AC_SYS_LARGEFILE +AC_FUNC_FSEEKO + +dnl Thread support (pthreads). +case "$host" in + *-*-freebsd*) + pthread_cflags="-pthread -D_REENTRANT -D_THREAD_SAFE" + pthread_libs="-pthread" + ;; + *-*-openbsd*) + pthread_cflags="-D_REENTRANT" + pthread_libs="-pthread" + ;; + *-*-bsdi*) + pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + pthread_libs="" + ;; + *) + pthread_cflags="-D_REENTRANT" + pthread_libs="-lpthread" + ;; +esac +# let user override +if test -n "$PTHREAD_LIBS" ; then + pthread_libs="$PTHREAD_LIBS" +fi +if test -n "$PTHREAD_CFLAGS" ; then + pthread_cflags="$PTHREAD_CFLAGS" +fi +save_LIBS="$LIBS" +LIBS="$LIBS $pthread_libs" +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $pthread_cflags" +AC_MSG_CHECKING(for pthreads in $pthread_libs) +AC_TRY_LINK([ +#include +],[ + pthread_attr_t type; + pthread_attr_init(&type); +], + [use_pthreads="yes"], + [use_pthreads="no"] +); +LIBS="$save_LIBS" +CFLAGS="$save_CFLAGS" +AC_MSG_RESULT($use_pthreads) +if test x"$use_pthreads" = x"yes" ; then + PTHREAD_LIBS="$pthread_libs" + PTHREAD_CFLAGS="$pthread_cflags" +else + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +fi +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) + + +dnl +dnl Architecture specific instructions +dnl + +AC_MSG_CHECKING([for build architecture]) +have_x86cpu=false +have_x86_64cpu=false +have_ppccpu=false +case x"$host_cpu" in + xi?86*|xk6*) + have_x86cpu=true + AC_MSG_RESULT([Intel Pentium architecture (IA32)]) + AC_DEFINE([ARCH_X86], 1, [Define if your machine is x86 based]) + ;; + xx86_64*|xamd64*) + have_x86_64cpu=true + AC_MSG_RESULT([AMD64 architecture (AMD64)]) + AC_DEFINE([ARCH_X86_64], 1, [Define if your machine is AMD64 based]) + ;; + xpowerpc*) + have_ppccpu=true + AC_MSG_RESULT([Mac PPC architecture (PPC)]) + AC_DEFINE([ARCH_PPC], 1, [Define if your machine is PPC based]) + ;; + *) + ;; +esac +AM_CONDITIONAL(ARCH_X86, test x"$have_x86cpu" = x"true") +AM_CONDITIONAL(ARCH_X86_64, test x"$have_x86_64cpu" = x"true") +AM_CONDITIONAL(ARCH_PPC, test x"$have_ppccpu" = x"true") + + +dnl x86 & x86_64 architectures + +dnl MMX support +dnl +explicit_mmx=no +AC_ARG_ENABLE(mmx, + AC_HELP_STRING([--enable-mmx], + [enable MMX code portions (yes)]), + [case "${enableval}" in + yes) use_mmx=yes ;; + no) use_mmx=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmx) ;; + esac + explicit_mmx=yes], + [if test x"$have_x86cpu" = x"true" -o x"$have_x86_64cpu" = x"true" ; then + use_mmx=yes + else + use_mmx=no + fi]) + +have_asm_mmx="no" +if test x"$use_mmx" = x"yes" ; then + AC_MSG_CHECKING([if \$CC groks MMX inline assembly]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));])], + [have_asm_mmx="yes"]) + if test x"$have_asm_mmx" = x"yes" ; then + AC_DEFINE([HAVE_ASM_MMX], 1, + [Define if your compiler understands MMX assembly instructions]) + fi + AC_MSG_RESULT($have_asm_mmx) + if test x"$have_asm_mmx" = x"no" -a x"$explicit_mmx" = x"yes" ; then + AC_MSG_WARN(*** Ignoring --enable-mmx due to no compiler support ***) + fi +fi +AM_CONDITIONAL(HAVE_ASM_MMX, test x"$have_asm_mmx" = x"yes") +if test x"$have_asm_mmx" = x"no" ; then + AC_MSG_WARN(*** All MMX dependent parts will be disabled ***) +fi + +dnl 3DNow support +dnl +explicit_3dnow=no +AC_ARG_ENABLE(3dnow, + AC_HELP_STRING([--enable-3dnow], + [enable 3DNow code portions (yes)]), + [case "${enableval}" in + yes) if test x"$have_asm_mmx" = x"no"; then + AC_MSG_ERROR(--enable-3dnow requires --enable-mmx) + else + use_3dnow=yes + fi ;; + no) use_3dnow=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;; + esac + explicit_3dnow=yes], + [if test x"$have_asm_mmx" = x"yes" -a \( x"$have_x86cpu" = x"true" -o x"$have_x86_64cpu" = x"true" \) ; then + use_3dnow=yes + else + use_3dnow=no + fi]) +have_asm_3dnow="no" +if test x"$use_3dnow" = x"yes" ; then + AC_MSG_CHECKING([if \$CC groks 3DNow inline assembly]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [void *p;asm volatile("pfmul %%mm3,%%mm4"::"r"(p));])], + [have_asm_3dnow="yes"]) + if test x"$have_asm_3dnow" = x"yes" ; then + AC_DEFINE([HAVE_ASM_3DNOW], 1, + [Define if your compiler understands 3DNow assembly instructions]) + fi + AC_MSG_RESULT($have_asm_3dnow) + if test x"$have_asm_3dnow" = x"no" -a x"$explicit_3dnow" = x"yes" ; then + AC_MSG_WARN(*** Ignoring --enable-3dnow due to no compiler support ***) + fi +fi +AM_CONDITIONAL(HAVE_ASM_3DNOW, test x"$have_asm_3dnow" = x"yes") +if test x"$have_asm_3dnow" = x"no" ; then + AC_MSG_WARN(*** All 3DNow dependent parts will be disabled ***) +fi + + +dnl SSE support +dnl +explicit_sse=no +AC_ARG_ENABLE(sse, + AC_HELP_STRING([--enable-sse], + [enable SSE code portions (yes)]), + [case "${enableval}" in + yes) if test x"$have_asm_mmx" = x"no"; then + AC_MSG_ERROR(--enable-sse requires --enable-mmx) + else + use_sse=yes + fi ;; + no) use_sse=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;; + esac + explicit_sse=yes], + [if test x"$have_asm_mmx" = x"yes" -a \( x"$have_x86cpu" = x"true" -o x"$have_x86_64cpu" = x"true" \) ; then + use_sse=yes + else + use_sse=no + fi]) +have_asm_sse="no" +if test x"$use_sse" = x"yes" ; then + AC_MSG_CHECKING([if \$CC groks SSE inline assembly]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [void *p; asm volatile("movntps %%xmm0, 0"::"r"(p));])], + [have_asm_sse=yes]) + if test x"$have_asm_sse" = x"yes" ; then + AC_DEFINE([HAVE_ASM_SSE], 1, + [Define if your compiler understands SSE assembly instructions]) + fi + AC_MSG_RESULT($have_asm_sse) + if test x"$have_asm_sse" = x"no" -a x"$explicit_sse" = x"yes" ; then + AC_MSG_WARN(*** Ignoring --enable-sse due to no compiler support ***) + fi +fi +AM_CONDITIONAL(HAVE_ASM_SSE, test x"$have_asm_sse" = x"yes") +if test x"$have_asm_sse" = x"no" ; then + AC_MSG_WARN(*** All SSE dependent parts will be disabled ***) +fi + + +dnl SSE2 support +dnl +explicit_sse2=no +AC_ARG_ENABLE(sse2, + AC_HELP_STRING([--enable-sse2], + [enable SSE2 code portions (yes)]), + [case "${enableval}" in + yes) if test x"$have_asm_sse" = x"no"; then + AC_MSG_ERROR(--enable-sse2 requires --enable-sse) + else + use_sse2=yes + fi ;; + no) use_sse2=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse2) ;; + esac + explicit_sse2=yes], + [if test x"$have_asm_sse" = x"yes" -a \( x"$have_x86cpu" = x"true" -o x"$have_x86_64cpu" = x"true" \) ; then + use_sse2=yes + else + use_sse2=no + fi]) +have_asm_sse2="no" +if test x"$use_sse2" = x"yes" ; then + AC_MSG_CHECKING([if \$CC can handle SSE2 inline asm]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [void *p; asm volatile("movdqa %%xmm2, %%xmm3"::"r"(p));])], + [have_asm_sse2=yes]) + if test x"$have_asm_sse2" = x"yes" ; then + AC_DEFINE([HAVE_ASM_SSE2], 1, + [Define if your compiler understands SSE2 assembly instructions]) + fi + AC_MSG_RESULT($have_asm_sse2) + if test x"$have_asm_sse2" = x"no" -a x"$explicit_sse2" = x"yes" ; then + AC_MSG_WARN(*** Ignoring --enable-sse2 due to no compiler support ***) + fi +fi +AM_CONDITIONAL(HAVE_ASM_SSE2, test x"$have_asm_sse2" = x"yes") +if test x"$have_asm_sse2" = x"no" ; then + AC_MSG_RESULT(*** All SSE2 dependent parts will be disabled ***) +fi + + + +dnl ppc architectures + + +dnl +dnl Altivec support +dnl +AC_ARG_ENABLE(altivec, + AC_HELP_STRING([--enable-altivec], + [enable Altivec code portions (yes)]), + [case "${enableval}" in + yes) use_altivec=yes ;; + no) use_altivec=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;; + esac], + [if test x"$have_ppccpu" = x"true" ; then + use_altivec=yes + else + use_altivec=no + fi]) +dnl if test x"$use_altivec" = x"no" ; then +dnl AC_MSG_WARN(*** All Altivec dependent parts will be disabled ***) +dnl fi + + +AC_MSG_CHECKING([if \$CC groks AltiVec inline assembly]) +have_asm_altivec=no +if test x"$use_altivec" = x"yes" ; then + AC_COMPILE_IFELSE([AC_LANG_SOURCE([], [asm volatile("vperm 0,1,2,3");])], + [have_asm_altivec=yes], + [save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wa,-m7400" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([], [asm volatile("vperm 0,1,2,3");])], + [have_asm_altivec=yes]) + CFLAGS="$save_CFLAGS"]) +fi +AC_MSG_RESULT($have_asm_altivec) +if test x"$have_asm_altivec" = x"yes" ; then + AC_DEFINE([HAVE_ASM_ALTIVEC], 1, + [Define if your compiler understands AltiVec inline assembly]) +fi + +AC_MSG_CHECKING([if \$CC groks AltiVec C extensions]) +have_c_altivec=no +if test x"$use_altivec" = x"yes" ; then + # Darwin test + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -faltivec" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [vec_mtvscr((vector unsigned int)(0));])], + [have_c_altivec=yes + ALTIVEC_CFLAGS="-faltivec"], + [# Linux/PPC test + CFLAGS="${save_CFLAGS} -fvec" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [vec_mtvscr((vector unsigned int)(0));])], + [have_c_altivec=yes + ALTIVEC_CFLAGS="-fvec"]) + ]) + CFLAGS="$save_CFLAGS" +fi +AC_MSG_RESULT($have_c_altivec) +AM_CONDITIONAL(CAN_COMPILE_C_ALTIVEC, test x"$have_c_altivec" = x"yes") +if test x"$have_c_altivec" = x"yes" ; then + AC_DEFINE([CAN_COMPILE_C_ALTIVEC], 1, + [Define if your compiler groks C AltiVec extensions.]) + AC_SUBST(ALTIVEC_CFLAGS) +fi + +AC_MSG_CHECKING([if linker needs -framework vecLib]) +if test x"$use_altivec" = x"yes" ; then + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -framework vecLib" + ld_altivec=no + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [ld_altivec=yes]) + LDFLAGS="$save_LDFLAGS" +fi +AC_MSG_RESULT($ld_altivec) +if test x"$ld_altivec" = x"yes" ; then + LDFLAGS="$LDFLAGS -framework vecLib" +fi + + +dnl --------------------------------------------------------------------- +dnl +dnl pkgconfig +dnl +PKG_PROG_PKG_CONFIG([0.20]) +if test -z "$PKG_CONFIG" ; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) +fi + + +dnl --------------------------------------------------------------------- +dnl X11 checks + +AC_PATH_XTRA +if test x"${no_x}" = x"yes" ; then + AC_MSG_WARN(can not find X11) + USE_X11=no +else + AC_DEFINE([HAVE_X11], 1, [Have X11 support]) + USE_X11=yes +fi + +AC_SUBST(X_CFLAGS) +AC_SUBST(X_PRE_LIBS) +AC_SUBST(X_EXTRA_LIBS) +AC_SUBST(X_LIBS) +AC_SUBST(x_includes) +AC_SUBST(x_libraries) + +dnl fi + +AM_CONDITIONAL(HAVE_X11, test x"${USE_X11}" = x"yes") + +if test x"${USE_X11}" = x"yes" ; then + AC_CHECK_LIB(Xv, XvQueryExtension, + [have_xv=yes + AC_DEFINE([HAVE_LIBXV], 1, + [Have libxv support])], + [have_xv=no], + [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS]) + + AC_CHECK_LIB(X11, XShmQueryExtension, + [have_xshm=yes + AC_DEFINE([HAVE_X11_SHM], 1, + [Have Xshm support])], + [have_xshm=no], + [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS]) + + AC_CHECK_HEADERS([X11/Xaw/Simple.h], + [have_xaw_simple=yes + AC_DEFINE([HAVE_XAW_SIMPLE], 1, + [Have the Xaw Simple.h file support])], + [have_xaw_simple=no]) + + AC_CHECK_LIB(Xpm, XpmFreeAttributes, + [have_xpm=yes + AC_DEFINE([HAVE_LIBXPM], 1, + [Have libXpm support])], + [have_xpm=no], + [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS]) +else + have_xv="no" + have_xshm="no" + have_xaw_simple="no" + have_xpm="no" +fi + +AM_CONDITIONAL(HAVE_LIBXV, test x"$have_xv" = x"yes") +AM_CONDITIONAL(HAVE_X11_SHM, test x"$have_xshm" = x"yes") +AM_CONDITIONAL(HAVE_XAW_SIMPLE, test x"$have_xaw_simple" = x"yes" ) +AM_CONDITIONAL(HAVE_LIBXPM, test x"$have_xpm" = x"yes") + +dnl end X11 checks +dnl --------------------------------------------------------------------- + +AC_CHECK_LIB(z, gzopen, + [], + [AC_MSG_ERROR([transcode depends on libz, but cannot links against libz])], + []) + +AC_CHECK_LIB(m, sin, + [], + [AC_MSG_ERROR([transcode depends on libm (>= 2.0), but cannot link against libm])], + [-lc]) + +TC_PKG_INIT + +have_libavcodec=no +have_libavformat=no +AC_MSG_CHECKING([for ffmpeg support]) +AC_ARG_ENABLE(ffmpeg, + AC_HELP_STRING([--enable-ffmpeg], + [enable support for FFmpeg libraries - RECOMMENDED (yes)]), + [case "${enableval}" in + yes) ;; + no) ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-ffmpeg) ;; + esac], + [enable_ffmpeg=yes]) +if test x"$enable_ffmpeg" = x"no" ; then + AC_MSG_RESULT(disabled) +else + AC_MSG_RESULT(requested, checking for libraries) + + dnl + dnl libavcodec + dnl + TC_PKG_CONFIG_CHECK(libavcodec, "$enable_ffmpeg", LIBAVCODEC, libavcodec, [http://www.ffmpeg.org/]) + + dnl + dnl libavformat + dnl + TC_PKG_CONFIG_CHECK(libavformat, "$enable_ffmpeg", LIBAVFORMAT, libavformat, [http://www.ffmpeg.org/]) + + dnl + dnl libavutil + dnl + TC_PKG_CONFIG_CHECK(libavutil, "$enable_ffmpeg", LIBAVUTIL, libavutil, [http://www.ffmpeg.org/]) + + dnl + dnl libavresample + dnl + TC_PKG_CONFIG_CHECK(libavresample, "$enable_ffmpeg", LIBAVRESAMPLE, libavresample, [http://www.ffmpeg.org/]) + + + AC_DEFINE([HAVE_FFMPEG], 1, [Have FFmpeg libraries support]) +fi + +TC_PKG_HAVE(libavcodec, LIBAVCODEC) +TC_PKG_HAVE(libavformat, LIBAVFORMAT) +TC_PKG_HAVE(libavutil, LIBAVUTIL) +TC_PKG_HAVE(libavresample, LIBAVRESAMPLE) + +AM_CONDITIONAL(HAVE_FFMPEG, test x"$enable_ffmpeg" = x"yes") + + + +dnl +dnl setup layout define once +dnl + +dnl +dnl libv4l toolkit +dnl +TC_PKG_CONFIG_CHECK(libv4l2, no, LIBV4L2, libv4l2, + [http://hansdegoede.livejournal.com/3636.html]) +TC_PKG_CONFIG_CHECK(libv4lconvert, no, LIBV4LCONVERT, + libv4lconvert, + [http://hansdegoede.livejournal.com/3636.html]) +TC_PKG_HAVE(libv4l2, LIBV4L2) +TC_PKG_HAVE(libv4lconvert, LIBV4LCONVERT) + +dnl +dnl libmpeg2 +dnl +TC_PKG_CONFIG_CHECK(libmpeg2, no, LIBMPEG2, libmpeg2, + [http://libmpeg2.sf.net/]) +TC_PKG_CONFIG_CHECK(libmpeg2convert, no, LIBMPEG2CONVERT, + libmpeg2convert, [http://libmpeg2.sf.net/]) +TC_PKG_HAVE(libmpeg2, LIBMPEG2) +TC_PKG_HAVE(libmpeg2convert, LIBMPEG2CONVERT) + +dnl +dnl build options +dnl + +dnl +dnl support for new/experimental features (1.1.0: NMS) +dnl +AC_MSG_CHECKING([enable new or experimental components]) +AC_ARG_ENABLE(experimental, + AC_HELP_STRING([--enable-experimental], + [enable new, experimental or even incomplete transcode components (no)]), + [case "${enableval}" in + yes) ;; + no) ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-experimental) ;; + esac], + [enable_experimental=no]) +AC_MSG_RESULT($enable_experimental) +if test x"$enable_experimental" = x"yes" ; then + AC_DEFINE([ENABLE_EXPERIMENTAL], 1, [Enable experimental components]) +fi +AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test x"$enable_experimental" = x"yes") + +dnl +dnl support for deprecated features (1.1.0: tcrequant) +dnl +AC_MSG_CHECKING([enable deprecated components]) +AC_ARG_ENABLE(deprecated, + AC_HELP_STRING([--enable-deprecated], + [enable deprecated or even broken transcode components (no)]), + [case "${enableval}" in + yes) ;; + no) ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-deprecated) ;; + esac], + [enable_deprecated=no]) +AC_MSG_RESULT($enable_deprecated) +if test x"$enable_deprecated" = x"yes" ; then + AC_DEFINE([ENABLE_DEPRECATED], 1, [Enable deprecated components]) +fi +AM_CONDITIONAL(ENABLE_DEPRECATED, test x"$enable_deprecated" = x"yes") + +dnl +dnl static import frame buffer +dnl +AC_MSG_CHECKING([for internal static framebuffer support]) +AC_ARG_ENABLE(statbuffer, + AC_HELP_STRING([--enable-statbuffer], + [enable internal static framebuffer support; recommended (yes)]), + [case "${enableval}" in + yes) ;; + no) ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-statbuffer) ;; + esac], + [enable_statbuffer=yes]) +AC_MSG_RESULT($enable_statbuffer) +if test x"$enable_statbuffer" = x"yes" ; then + AC_DEFINE([STATBUFFER], 1, [Use the static buffers]) +fi + + +dnl +dnl hardware/OS dependent modules +dnl + +dnl +dnl v4l +dnl +TC_CHECK_V4L(AC_DEFINE([HAVE_V4L], 1, [Have video4linux(2)])) +AM_CONDITIONAL(HAVE_V4L, test x"$have_v4l" = x"yes") +AM_CONDITIONAL(HAVE_V4L2, test x"$have_v4l2" = x"yes") + +dnl +dnl bktr +dnl +TC_CHECK_BKTR(AC_DEFINE([HAVE_BKTR], 1, [Have bktr(4)])) +AM_CONDITIONAL(HAVE_BKTR, test x"$have_bktr" = x"yes") + +dnl +dnl sunau +dnl +TC_CHECK_SUNAU(AC_DEFINE([HAVE_SUNAU], 1, [Have Sun style audio(4)])) +AM_CONDITIONAL(HAVE_SUNAU, test x"$have_sunau" = x"yes") + +dnl +dnl OSS +dnl +TC_CHECK_OSS(AC_DEFINE([HAVE_OSS], 1, [Have OSS audio])) +AM_CONDITIONAL(HAVE_OSS, test x"$have_oss" = x"yes") + +dnl +dnl ALSA +dnl +TC_CHECK_ALSA(AC_DEFINE([HAVE_ALSA], 1, [Have ALSA audio])) +AM_CONDITIONAL(HAVE_ALSA, test x"$have_alsa" = x"yes") + +dnl +dnl optional 3rd party package support +dnl + +dnl +dnl Divx4linux +dnl +AC_CHECK_HEADERS([encore2.h]) + +dnl +dnl libpostproc +dnl +TC_PKG_CONFIG_CHECK(libpostproc, no, LIBPOSTPROC, libpostproc, [http://ffmpeg.mplayerhq.hu/]) +TC_PKG_HAVE(libpostproc, LIBPOSTPROC) + +dnl +dnl freetype2 +dnl +TC_PKG_CONFIG_CHECK(freetype2, no, FREETYPE2, freetype2, [http://www.freetype.org/]) +TC_PKG_HAVE(freetype2, FREETYPE2) + +dnl +dnl lame +dnl +TC_PKG_CHECK(lame, yes, LAME, no, none, mp3lame, lame_init, lame, + [http://www.mp3dev.org/]) +if test x"$have_lame" = x"yes" ; then + lame_inc="no" + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $lame_ii" + AC_CHECK_HEADER([lame/lame.h], + [AC_DEFINE([HAVE_LAME_INC], [1], + [Have Lame includes in separate path]) lame_inc=yes]) + if test x"$lame_inc" = x"no" ; then + AC_CHECK_HEADER([lame.h], lame_inc="yes") + fi + if test x"$lame_inc" = x"no" ; then + have_lame="no" + TC_PKG_ERROR(lame, lame.h, yes, lame, [http://www.mp3dev.org/], + [cannot compile lame.h]) + else + LAME_CFLAGS="$lame_ii" + fi + CPPFLAGS="$save_CPPFLAGS" + + AC_MSG_CHECKING([lame version]) + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $LAME_CFLAGS" + LIBS="$LIBS $LAME_LIBS" + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include + +#ifdef HAVE_LAME_INC +#include +#else +#include +#endif + +int main () { + lame_version_t lv; + get_lame_version_numerical(&lv); + if(lv.alpha || lv.beta) lv.minor--; + printf("%d%d\n", lv.major, lv.minor); + return 0; +} +]])], + [lame_version="`./conftest$ac_exeext`"], + [AC_MSG_RESULT([failed]) + TC_PKG_ERROR(lame, lame.h, yes, lame, [http://www.mp3dev.org/], + [cannot compile and run a test program])],, + [AC_MSG_RESULT([cross compiling; assumed OK...])]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + + if test 393 -ge "$lame_version" ; then + have_lame="no" + TC_PKG_ERROR(lame, lame.h, yes, lame, [http://www.mp3dev.org/], + [lame version < 3.93]) + fi +fi +TC_PKG_HAVE(lame, LAME) + +dnl +dnl xvid +dnl +TC_PKG_CHECK(xvid, no, xvid, no, xvid.h, xvidcore, xvid_global, xvid, + [http://www.xvid.org/]) +if test x"$have_xvid" = x"yes" ; then + AC_MSG_CHECKING([xvid version >= 1.0]) + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#include + +int main() { + printf("%s\n", (XVID_API >= XVID_MAKE_API(4, 0)) ?"yes" :"no"); + return 0; +} +]])], + [xvid_version_ok="`./conftest$ac_exeext`"], + [AC_MSG_RESULT([failed]) + TC_PKG_ERROR(xvid, xvid.h, yes, xvid, [http://www.xvid.org/], + [cannot compile and run a test program])],, + [AC_MSG_RESULT([cross compiling; assumed OK...])]) + if test x"$xvid_version_ok" = x"yes"; then + XVID_LIBS="-lxvidcore" + else + have_xvid="no" + TC_PKG_ERROR(xvid, xvid.h, yes, xvid, [http://www.xvid.org/], + [XviD version < 1.0]) + fi +fi +TC_PKG_HAVE(xvid, XVID) + +dnl +dnl x264 +dnl +TC_PKG_CONFIG_CHECK(x264, no, X264, x264, [http://developers.videolan.org/x264.html]) +if test x"$have_x264" = x"yes" ; then + AC_MSG_CHECKING([x264 version]) + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#include /* required by x264.h */ +#include + +int main() { + printf("%d\n", X264_BUILD); + return 0; +} +]])], + [x264_version="`./conftest$ac_exeext`"], + [AC_MSG_RESULT([failed]) + TC_PKG_ERROR(x264, x264.h, yes, x264, + [http://developers.videolan.org/x264.html], + [cannot compile and run a test program])], + [AC_MSG_RESULT([cross compiling; assumed OK...]) + x264_version=54]) + if test 54 -gt "$x264_version"; then + have_x264="no" + TC_PKG_ERROR(x264, x264.h, yes, x264, + [http://developers.videolan.org/x264.html], + [x264 version too old (must be at least 54)]) + fi +fi +TC_PKG_HAVE(x264, X264) + +dnl +dnl ogg +dnl +TC_PKG_CONFIG_CHECK(ogg, no, OGG, ogg, [http://www.xiph.org/ogg/]) +TC_PKG_HAVE(ogg, OGG) + +dnl +dnl vorbis +dnl +TC_PKG_CONFIG_CHECK(vorbis, no, VORBIS, vorbis, [http://www.xiph.org/ogg/vorbis/]) +TC_PKG_HAVE(vorbis, VORBIS) + +dnl +dnl theora +dnl +TC_PKG_CONFIG_CHECK(theora, no, THEORA, theora, [http://www.theora.org/]) +TC_PKG_HAVE(theora, THEORA) + +dnl +dnl libdvdread +dnl +LIBDVDREAD_EXTRA_LIBS="$LIBDVDREAD_EXTRA_LIBS -lm" +TC_PKG_CHECK(libdvdread, yes, LIBDVDREAD, no, none, dvdread, DVDOpen, + libdvdread, [http://www.dtek.chalmers.se/groups/dvd/downloads.shtml]) +if test x"$have_libdvdread" = x"yes" ; then + libdvdread_inc="no" + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $libdvdread_ii" + AC_CHECK_HEADER([dvdread/dvd_reader.h], + [AC_DEFINE([HAVE_LIBDVDREAD_INC], [1], + [have libdvdread includes in separate path]) + libdvdread_inc="yes"]) + if test x"$libdvdread_inc" = x"no" ; then + AC_CHECK_HEADER([dvd_reader.h], + [libdvdread_inc="yes"]) + fi + CPPFLAGS="$save_CPPFLAGS" + if test x"$libdvdread_inc" = x"no" ; then + have_libdvdread="no" + TC_PKG_ERROR(libdvdread, dvd_reader.h, yes, libdvdread, + [http://www.dtek.chalmers.se/groups/dvd/downloads.shtml], + [cannot compile dvd_reader.h]) + else + LIBDVDREAD_CFLAGS="$libdvdread_ii" + fi +fi +TC_PKG_HAVE(libdvdread, LIBDVDREAD) + +dnl +dnl PVM3 +dnl +PVM3_EXTRA_LIBS="$PVM3_EXTRA_LIBS -lgpvm3" +TC_PKG_CHECK(pvm3, no, PVM3, no, pvm3.h, pvm3, pvm_initsend, + pvm3, []) +if test x"$have_pvm3" = x"yes" ; then + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $PVM3_CFLAGS" + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#include +int main () +{ + if ((PVM_MAJOR_VERSION == 3) && (PVM_MINOR_VERSION < 4)) + { + printf("You need to upgrade pvm3 to version > 3.4\n"); + return(1); + } + if (PVM_MAJOR_VERSION < 3) + { + printf("You need to upgrade pvm3 to version > 3.4\n"); + return(1); + } + return 0; +} +]])], + [have_pvm3="yes"], + [have_pvm3="no"], + [AC_MSG_RESULT([cross compiling; assumed OK...]) + have_pvm3="yes"]) + CPPFLAGS="$save_CPPFLAGS" + # also include the in-tree pvm3 headers + PVM3_CFLAGS="$PVM3_CFLAGS -I\$(top_srcdir)/pvm3" + PVM3_PVMGS="$w_pvm3_l/pvmgs" +fi +AC_SUBST(PVM3_PVMGS) +TC_PKG_HAVE(pvm3, PVM3) + +dnl +dnl libdv +dnl +TC_PKG_CONFIG_CHECK(libdv, no, LIBDV, libdv, [http://libdv.sourceforge.net/]) +TC_PKG_HAVE(libdv, LIBDV) + +dnl +dnl libquicktime +dnl +TC_PKG_CONFIG_CHECK(libquicktime, no, LIBQUICKTIME, libquicktime, + [http://libquicktime.sourceforge.net/]) +if test x"$have_libquicktime" = x"yes" ; then + AC_CHECK_LIB(quicktime, lqt_encode_video, + [AC_DEFINE([LIBQUICKTIME_000904], [1], [Have libquicktime 1.0.0 or newer])], + [], + [$LIBQUICKTIME_LIBS $LIBQUICKTIME_EXTRA_LIBS]) +fi +TC_PKG_HAVE(libquicktime, LIBQUICKTIME) + +dnl +dnl LZO +dnl +TC_PKG_CHECK(lzo, no, LZO, no, [lzo/lzo1x.h], lzo2, lzo_version, lzo, + [http://www.oberhumer.com/opensource/lzo/]) +TC_PKG_HAVE(lzo, LZO) + +dnl +dnl A52 +dnl +A52_EXTRA_LIBS="$A52_EXTRA_LIBS -lm" +TC_PKG_CHECK(a52, no, A52, no, [a52dec/a52.h], a52, a52_init, liba52, + [http://liba52.sourceforge.net/]) +TC_PKG_HAVE(a52, A52) +if test x"$have_a52" = x"yes" ; then + enable_a52_default_decoder="yes" +else + enable_a52_default_decoder="no" +fi + +dnl +dnl FAAC +dnl +TC_PKG_CHECK(faac, no, FAAC, no, [faac.h], faac, faacEncGetVersion, no, + [http://www.audiocoding.com/]) +TC_PKG_HAVE(faac, FAAC) + +dnl +dnl libxml2 +dnl +TC_PKG_CONFIG_CHECK(libxml2, no, LIBXML2, libxml-2.0, [http://xmlsoft.org]) +TC_PKG_HAVE(libxml2, LIBXML2) + +dnl +dnl ibp, lors and libxio -- must be after libxml2 +dnl +TC_PATH_IBP(AC_DEFINE([HAVE_IBP], 1, [ibp and lors support])) +AM_CONDITIONAL(HAVE_IBP, test x"$have_ibp" = x"yes") + +XIO_CFLAGS="-I\$(top_srcdir)/libtc" +if test x"$have_ibp" = x"yes" ; then + XIO_LIBS="\$(top_builddir)/libtc/libtc.la $IBP_LIBS $LIBXML2_LIBS" +else + XIO_LIBS="" +fi +AC_SUBST(XIO_CFLAGS) +AC_SUBST(XIO_LIBS) + +dnl +dnl mjpegtools (actually only YUV4MPEG) +dnl +TC_PKG_CONFIG_CHECK(mjpegtools, no, MJPEGTOOLS, mjpegtools, + [http://mjpeg.sourceforge.net/]) +if test x"$have_mjpegtools" = x"yes" ; then + # check if mjpegtools version >= Mar 31 2004 + save_CFLAGS="$CFLAGS" + save_LIBS="$LIBS" + CFLAGS="$CFLAGS $MJPEGTOOLS_CFLAGS" + LIBS="$LIBS $MJPEGTOOLS_LIBS" + AC_LINK_IFELSE([AC_LANG_PROGRAM([ +#if defined(HAVE_MJPEGTOOLS_INC) +#include "yuv4mpeg.h" +#include "mpegconsts.h" +#else +#include "mjpegtools/yuv4mpeg.h" +#include "mjpegtools/mpegconsts.h" +#endif +], + [y4m_write_frame_header(1, NULL, NULL)])], + [AC_DEFINE([USE_NEW_MJPEGTOOLS_CODE], [1], + [using mjpegtools post Mar 31 2004])]) + CFLAGS="$save_CFLAGS" + LIBS="$save_LIBS" +fi +TC_PKG_HAVE(mjpegtools, MJPEGTOOLS) + +dnl +dnl SDL +dnl +TC_PKG_CONFIG_CHECK(sdl, no, SDL, sdl, [http://www.libsdl.org/]) +if test x"$have_sdl" = x"yes" ; then + sdl_major_version=1 + sdl_minor_version=2 + sdl_micro_version=5 + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#include +#include +#include "SDL.h" +int main (int argc, char *argv[]) +{ + if ( (SDL_MAJOR_VERSION > $sdl_major_version) || + ((SDL_MAJOR_VERSION == $sdl_major_version) && + (SDL_MINOR_VERSION > $sdl_minor_version)) || + ((SDL_MAJOR_VERSION == $sdl_major_version) && + (SDL_MINOR_VERSION == $sdl_minor_version) && + (SDL_PATCHLEVEL >= $sdl_micro_version)) ) + { + return 0; + } + else + { + fprintf(stderr, "SDL version %d.%d.%d is too old!\n", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL); + return 1; + } +} +]])], + [have_sdl="yes"], + [have_sdl="no"], + [AC_MSG_RESULT([cross compiling; assumed OK...]) + have_sdl="yes"]) + CPPFLAGS="$save_CPPFLAGS" +fi +TC_PKG_HAVE(sdl, SDL) + +dnl +dnl ImageMagick +dnl +IMAGEMAGICK_EXTRA_LIBS="$IMAGEMAGICK_EXTRA_LIBS $($PKG_CONFIG --libs ImageMagick)" +TC_PKG_CHECK(imagemagick, no, IMAGEMAGICK, no, [magick/api.h], + none, InitializeMagick, Wand, [http://www.imagemagick.org/]) +TC_PKG_HAVE(imagemagick, IMAGEMAGICK) +if test x"$have_imagemagick" = x"yes" ; then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$IMAGEMAGICK_CFLAGS $CPPFLAGS" + AC_CHECK_HEADER([wand/magick-wand.h], + [AC_DEFINE([HAVE_BROKEN_WAND], [1], ["have old wand header"])]) + CPPFLAGS="$SAVE_CPPFLAGS" +fi + +dnl +dnl libjpegmmx or libjpeg +dnl +TC_PKG_CHECK(libjpegmmx, no, LIBJPEGMMX, no, jpeglib.h, jpeg-mmx, + jpeg_CreateCompress, jpeg-mmx, [http://sourceforge.net/projects/mjpeg/]) +if test x"$have_libjpegmmx" = x"no" ; then + TC_PKG_CHECK(libjpeg, yes, LIBJPEG, no, jpeglib.h, jpeg, + jpeg_CreateCompress, jpeg, [ftp://ftp.uu.net/graphics/jpeg/]) +else + have_libjpeg="yes" + LIBJPEG_CFLAGS="$LIBJPEGMMX_CFLAGS" + LIBJPEG_LIBS="$LIBJPEGMMX_LIBS" +fi +TC_PKG_HAVE(libjpeg, LIBJPEG) + + +dnl +dnl bsdav +dnl +TC_PKG_CHECK(bsdav, no, BSDAV, no, bsdav.h, bsdav, + bsdav_read_stream_header, bsdav, [http://www.jakemsr.com/bsdav/]) +TC_PKG_HAVE(bsdav, BSDAV) + + +dnl +dnl iconv +dnl +TC_PKG_CHECK(iconv, yes, ICONV, no, iconv.h, none, none, libiconv, + [http://www.gnu.org/software/libiconv/]) +if test x"$have_iconv" = x"yes" ; then + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $iconv_ll" + AC_CHECK_LIB(iconv, iconv_open, + [], + [have_iconv="no"], + [$ICONV_EXTRA_LIBS]) + LDFLAGS="$save_LDFLAGS" + if test x"$have_iconv" = x"no" ; then + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $iconv_ll" + AC_CHECK_LIB(iconv, libiconv_open, + [have_iconv="yes"], + [have_iconv="no"], + [$ICONV_EXTRA_LIBS]) + LDFLAGS="$save_LDFLAGS" + fi + # see if iconv_open is in (g)libc + have_libc_iconv="no" + if test x"$have_iconv" = x"no" ; then + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $iconv_ll" + AC_CHECK_LIB(c, iconv_open, + [have_iconv="yes" have_libc_iconv="yes"], + [have_iconv="no"], + [$ICONV_EXTRA_LIBS]) + LDFLAGS="$save_LDFLAGS" + fi + if test x"$have_iconv" = x"yes" ; then + if test x"$have_libc_iconv" != x"yes" ; then + ICONV_LIBS="$iconv_ll -liconv $ICONV_EXTRA_LIBS" + fi + else + TC_PKG_ERROR(iconv, [iconv_open()], yes, libiconv, + [http://www.gnu.org/software/libiconv/], + [cannot find either iconv_open() or libiconv_open()]) + fi +fi +TC_PKG_HAVE(iconv, ICONV) + + +dnl +dnl Other modules +dnl + +dnl +dnl import_pv3 +dnl +AC_MSG_CHECKING([for PV3 support]) +AC_ARG_ENABLE(pv3, + AC_HELP_STRING([--enable-pv3], + [enable PV3 support (no)]), + [case "${enableval}" in + yes) if test true != "$have_x86cpu" -o yes != "$is_linux" -o yes != "$ac_cv_func_mmap"; then + AC_MSG_ERROR(PV3 not supported on this platform) + fi + ;; + no) ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-pv3) ;; + esac], + [enable_pv3=no]) +AC_MSG_RESULT($enable_pv3) +AM_CONDITIONAL(ENABLE_PV3, test "yes" = "$enable_pv3") + +dnl +dnl import_nuv +dnl +AC_MSG_CHECKING([for NuppelVideo support]) +AC_ARG_ENABLE(nuv, + AC_HELP_STRING([--enable-nuv], + [enable NuppelVideo support (no)]), + [case "${enableval}" in + yes) if test yes != "$have_lzo"; then + AC_MSG_ERROR([liblzo2 is required for NuppelVideo support, try --enable-lzo]) + fi + if test true == "$have_x86_64cpu"; then + AC_MSG_WARN([NuppelVideo support on x86_64 platform is ***EXPERIMENTAL***]) + elif test true != "$have_x86cpu"; then + AC_MSG_ERROR([NuppelVideo is supported only on x86 and x86_64 platforms yet]) + fi + ;; + no) ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-nuv) ;; + esac], + [enable_nuv=no]) +AC_MSG_RESULT($enable_nuv) +AM_CONDITIONAL(ENABLE_NUV, test "yes" = "$enable_nuv") + + +dnl +dnl The following come with transcode +dnl + +dnl +dnl libtc +dnl +LIBTC_LIBS="\$(top_builddir)/libtc/libtc.la" +AC_SUBST(LIBTC_LIBS) + +dnl +dnl libtcaudio +dnl +LIBTCAUDIO_LIBS="\$(top_builddir)/libtcaudio/libtcaudio.la" +AC_SUBST(LIBTCAUDIO_LIBS) + +dnl +dnl libtcvideo +dnl +LIBTCVIDEO_LIBS="\$(top_builddir)/libtcvideo/libtcvideo.la" +AC_SUBST(LIBTCVIDEO_LIBS) + +dnl +dnl avilib +dnl +AVILIB_LIBS="\$(top_builddir)/avilib/libavi.la" +AC_SUBST(AVILIB_LIBS) + +dnl +dnl wavlib +dnl +WAVLIB_LIBS="\$(top_builddir)/avilib/libwav.la" +AC_SUBST(WAVLIB_LIBS) + + +dnl +dnl aclib +dnl +AC_ARG_ENABLE([x86-textrels], + AC_HELP_STRING([--enable-x86-textrels], [enable x86-32 optimizations which use text relocations (yes)]), + [if test "no" = "$enableval"; then + AC_DEFINE([ACLIB_DISABLE_X86_TEXTRELS], [1], [Disable x86-32 optimizations in aclib that require text relocations]) + fi]) +ACLIB_LIBS="\$(top_builddir)/aclib/libac.la" +AC_SUBST(ACLIB_LIBS) + + + +dnl +dnl warning flags; always add -Wall -Wstrict-prototypes -Wmissing-prototypes +dnl note that autoconf uses an unprototyped main(), so we disable prototype +dnl warnings when checking whether -Werror works +dnl +AC_ARG_ENABLE([warnings-as-errors], + AC_HELP_STRING([--enable-warnings-as-errors], [treat warnings as errors])) +dnl GCC 4.2.x spits out bogus warnings when un-consting arguments in a +dnl function call (GCC bug 29478), so don't use -Werror there +if test x"$GCC" = x"yes" && test -n "`$CC -v 2>&1 | tail -1 | grep '4\.2\.'`"; then + AC_MSG_WARN([GCC 4.2.x produces spurious warnings, -Werror disabled]) +elif test x"$GCC" = x"yes" ; then + OPT_CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes" + TMP_CFLAGS="" + TC_TRY_CFLAGS([$OPT_CFLAGS $CFLAGS],[TMP_CFLAGS="$OPT_CFLAGS "]) + dnl Don't assign this yet, as -Wall would counteract the -Wno-XXX options + if test x"$enable_warnings_as_errors" = x"yes" ; then + dnl compiler warnings treated as errors + dnl we don't care about pointer sign warnings, and empty format + dnl strings are occasionally useful, so disable those warnings + OPT_CFLAGS="-Werror -Wno-pointer-sign -Wno-format-zero-length $CFLAGS" + TC_TRY_CFLAGS([$OPT_CFLAGS -Wno-strict-prototypes -Wno-missing-prototypes],[CFLAGS=$OPT_CFLAGS]) + fi + CFLAGS="$TMP_CFLAGS$CFLAGS" +fi +AC_SUBST(CFLAGS) + +dnl import/export module path +dnl +MOD_PATH="\${libdir}/transcode" +AC_ARG_WITH(mod-path, + AC_HELP_STRING([--with-mod-path], + [where export/import modules are installed (${libdir}/transcode)]), + MOD_PATH=$withval) +AC_SUBST(MOD_PATH) + +dnl export profiles data path +dnl +PROF_PATH="\${datadir}/transcode/profiles" +AC_ARG_WITH(prof-path, + AC_HELP_STRING([--with-prof-path], + [where export profiles data are installed (${datadir}/transcode/profiles)]), + PROF_PATH=$withval) +AC_SUBST(PROF_PATH) + + +X_CFLAGS=`echo $X_CFLAGS | sed -e 's/ */ /g'` +X_PRE_LIBS=`echo $X_PRE_LIBS | sed -e 's/ */ /g'` +X_LIBS=`echo $X_LIBS | sed -e 's/ */ /g'` +X_EXTRA_LIBS=`echo $X_EXTRA_LIBS | sed -e 's/ */ /g'` + +CC=`echo $CC | sed -e 's/ */ /g'` +CFLAGS=`echo $CFLAGS | sed -e 's/ */ /g'` +CPPFLAGS=`echo $CPPFLAGS | sed -e 's/ */ /g'` +CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ */ /g'` +LDFLAGS=`echo $LDFLAGS | sed -e 's/ */ /g'` + +AC_SUBST(CFLAGS) +AC_SUBST(CC) +AC_SUBST(LDFLAGS) +AC_SUBST(SIMD_FLAGS) + +AC_CONFIG_FILES([ + Makefile + aclib/Makefile + avilib/Makefile + docs/Makefile + docs/html/Makefile + docs/man/Makefile + docs/pvm3/Makefile + docs/tech/Makefile + docs/tech/html/Makefile + encode/Makefile + export/Makefile + filter/Makefile + filter/divxkey/Makefile + filter/extsub/Makefile + filter/preview/Makefile + filter/subtitler/Makefile + filter/tomsmocomp/Makefile + filter/yuvdenoise/Makefile + filter/stabilize/Makefile + import/Makefile + import/framegen/Makefile + import/nuv/Makefile + import/v4l/Makefile + multiplex/Makefile + libdldarwin/Makefile + libtc/Makefile + libtcaudio/Makefile + libtcvideo/Makefile + pvm3/Makefile + src/Makefile + testsuite/Makefile + tools/Makefile + transcode.spec + filter/parse_csv.awk + filter/filter_list.awk +]) +AC_OUTPUT + + +AC_MSG_RESULT([ +---------------------------------------- +Summary for transcode $VERSION: +---------------------------------------- + +core options +---------------------------------------- +enable experimental code $enable_experimental +enable deprecated code $enable_deprecated +static AV-frame buffering $enable_statbuffer +A52 default decoder $enable_a52_default_decoder +FFmpeg support $enable_ffmpeg + +hardware support +---------------------------------------- +v4l (legacy) $have_v4l +v4l2 $have_v4l2 +ALSA $have_alsa +OSS $have_oss +bktr $have_bktr +sunau $have_sunau + +optional module support +---------------------------------------- +PV3 $enable_pv3 +NuppelVideo $enable_nuv + +optional package support +---------------------------------------- +IBP (libxio) $have_ibp +X11 $USE_X11 + Xv extension $have_xv + Xshm extension $have_xshm + Xaw library $have_xaw_simple + Xpm library $have_xpm +]) + +TC_PKG_REPORT + +if test x"yes" = x"$have_pvm3"; then + AC_MSG_WARN([PVM3 support is yet untested, unsupported and may be BROKEN!.]) + AC_MSG_WARN([Please be careful and be prepared for bugs or nasty behaviours.]) + AC_MSG_WARN([Report problems on transcode-devel mailing list.]) + # ugly -- has anyone a better idea? + echo + echo +fi + diff -urN transcode-1.1.7/export/export_im.c transcode-1.1.7-imagemagick7/export/export_im.c --- transcode-1.1.7/export/export_im.c 2023-09-01 05:13:38.000000000 +0000 +++ transcode-1.1.7-imagemagick7/export/export_im.c 2023-09-01 05:19:44.612157421 +0000 @@ -23,7 +23,7 @@ /* Note: because of ImageMagick bogosity, this must be included first, so * we can undefine the PACKAGE_* symbols it splats into our namespace */ -#include +#include #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING @@ -82,7 +82,7 @@ codec = (vob->im_v_codec == CODEC_YUV) ? CODEC_YUV : CODEC_RGB; - InitializeMagick(""); + MagickCoreGenesis("", MagickFalse); image_info=CloneImageInfo((ImageInfo *) NULL); @@ -169,8 +169,8 @@ MOD_encode { - ExceptionInfo exception_info; - char *out_buffer = param->buffer; + ExceptionInfo *exception_info; + unsigned char *out_buffer = param->buffer; Image *image=NULL; int res; @@ -179,7 +179,7 @@ if(param->flag == TC_VIDEO) { - GetExceptionInfo(&exception_info); + exception_info = AcquireExceptionInfo(); res = tc_snprintf(buf2, PATH_MAX, "%s%06d.%s", prefix, counter++, type); if (res < 0) { @@ -193,11 +193,11 @@ out_buffer = tmp_buffer; } - image=ConstituteImage (width, height, "RGB", CharPixel, out_buffer, &exception_info); + image=ConstituteImage (width, height, "RGB", CharPixel, out_buffer, exception_info); strlcpy(image->filename, buf2, MaxTextExtent); - WriteImage(image_info, image); + WriteImage(image_info, image, exception_info); DestroyImage(image); return(0); @@ -220,8 +220,7 @@ if(param->flag == TC_VIDEO) { DestroyImageInfo(image_info); - ConstituteComponentTerminus(); - DestroyMagick(); + MagickCoreTerminus(); free(tmp_buffer); tmp_buffer = NULL; diff -urN transcode-1.1.7/filter/filter_compare.c transcode-1.1.7-imagemagick7/filter/filter_compare.c --- transcode-1.1.7/filter/filter_compare.c 2023-09-01 05:13:38.000000000 +0000 +++ transcode-1.1.7-imagemagick7/filter/filter_compare.c 2023-09-01 05:19:44.612157421 +0000 @@ -24,7 +24,7 @@ /* Note: because of ImageMagick bogosity, this must be included first, so * we can undefine the PACKAGE_* symbols it splats into our namespace */ -#include +#include #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING @@ -111,9 +111,9 @@ Image *pattern, *resized, *orig = 0; ImageInfo *image_info; - PixelPacket *pixel_packet; + Quantum *pixel_quantum; pixelsMask *pixel_last; - ExceptionInfo exception_info; + ExceptionInfo *exception_info; if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[128]; @@ -139,7 +139,7 @@ if(ptr->tag & TC_FILTER_INIT) { - unsigned int t,r,index; + unsigned int t,r; pixelsMask *temp; compare[instance] = tc_malloc(sizeof(compareData)); @@ -190,22 +190,22 @@ tc_log_perror(MOD_NAME, "could not open file for writing"); } - InitializeMagick(""); + MagickCoreGenesis("", MagickFalse); if (verbose > 1) tc_log_info(MOD_NAME, "Magick Initialized successfully"); - GetExceptionInfo(&exception_info); + exception_info = AcquireExceptionInfo(); image_info = CloneImageInfo ((ImageInfo *) NULL); strlcpy(image_info->filename, pattern_name, MaxTextExtent); if (verbose > 1) tc_log_info(MOD_NAME, "Trying to open image"); orig = ReadImage(image_info, - &exception_info); + exception_info); if (orig == (Image *) NULL) { - MagickWarning(exception_info.severity, - exception_info.reason, - exception_info.description); + MagickWarning(exception_info->severity, + exception_info->reason, + exception_info->description); strlcpy(pattern_name, "/dev/null", sizeof(pattern_name)); }else{ if (verbose > 1) @@ -228,42 +228,41 @@ if (orig != NULL){ // Flip and resize if (compare[instance]->vob->im_v_codec == CODEC_YUV) - TransformRGBImage(orig,YCbCrColorspace); + TransformImageColorspace(orig, YCbCrColorspace, exception_info); if (verbose > 1) tc_log_info(MOD_NAME, "Resizing the Image"); resized = ResizeImage(orig, compare[instance]->width, compare[instance]->height, GaussianFilter, - 1, - &exception_info); + exception_info); if (verbose > 1) tc_log_info(MOD_NAME, "Flipping the Image"); - pattern = FlipImage(resized, &exception_info); + pattern = FlipImage(resized, exception_info); if (pattern == (Image *) NULL) { - MagickError (exception_info.severity, - exception_info.reason, - exception_info.description); + MagickError (exception_info->severity, + exception_info->reason, + exception_info->description); } // Filling the matrix with the pixels values not // alpha if (verbose > 1) tc_log_info(MOD_NAME, "GetImagePixels"); - pixel_packet = GetImagePixels(pattern,0,0, + pixel_quantum = GetAuthenticPixels(pattern,0,0, pattern->columns, - pattern->rows); + pattern->rows, + exception_info); if (verbose > 1) tc_log_info(MOD_NAME, "Filling the Image matrix"); for (t = 0; t < pattern->rows; t++) for (r = 0; r < pattern->columns; r++){ - index = t*pattern->columns + r; - if (pixel_packet[index].opacity == 0){ + if (GetPixelAlpha(pattern, pixel_quantum) == QuantumRange) { temp=tc_malloc(sizeof(struct pixelsMask)); temp->row=t; temp->col=r; - temp->r = (uint8_t)ScaleQuantumToChar(pixel_packet[index].red); - temp->g = (uint8_t)ScaleQuantumToChar(pixel_packet[index].green); - temp->b = (uint8_t)ScaleQuantumToChar(pixel_packet[index].blue); + temp->r = (uint8_t)ScaleQuantumToChar(GetPixelRed(pattern, pixel_quantum)); + temp->g = (uint8_t)ScaleQuantumToChar(GetPixelGreen(pattern, pixel_quantum)); + temp->b = (uint8_t)ScaleQuantumToChar(GetPixelBlue(pattern, pixel_quantum)); temp->next=NULL; if (pixel_last == NULL){ @@ -274,6 +273,7 @@ pixel_last = temp; } } + pixel_quantum += GetPixelChannels(pattern); } if (verbose) @@ -297,7 +297,7 @@ fclose(compare[instance]->results); free(compare[instance]); } - DestroyMagick(); + MagickCoreTerminus(); compare[instance]=NULL; return(0); diff -urN transcode-1.1.7/filter/filter_logo.c transcode-1.1.7-imagemagick7/filter/filter_logo.c --- transcode-1.1.7/filter/filter_logo.c 2023-09-01 05:13:38.000000000 +0000 +++ transcode-1.1.7-imagemagick7/filter/filter_logo.c 2023-09-01 05:19:44.613157410 +0000 @@ -36,7 +36,7 @@ /* Note: because of ImageMagick bogosity, this must be included first, so * we can undefine the PACKAGE_* symbols it splats into our namespace */ -#include +#include #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING @@ -227,7 +227,8 @@ ImageFormat ifmt, int do_rgbswap) { - PixelPacket *pixel_packet; + ExceptionInfo *exception_info; + Quantum *pixel_packet; uint8_t *dst_ptr = dst; int row, col; @@ -246,16 +247,17 @@ } g_off = 1; - pixel_packet = GetImagePixels(src, 0, 0, width, height); + exception_info = AcquireExceptionInfo(); + pixel_packet = GetAuthenticPixels(src, 0, 0, width, height, exception_info); for (row = 0; row < height; row++) { for (col = 0; col < width; col++) { - *(dst_ptr + r_off) = (uint8_t)ScaleQuantumToChar(pixel_packet->red); - *(dst_ptr + g_off) = (uint8_t)ScaleQuantumToChar(pixel_packet->green); - *(dst_ptr + b_off) = (uint8_t)ScaleQuantumToChar(pixel_packet->blue); + *(dst_ptr + r_off) = (uint8_t)ScaleQuantumToChar(GetPixelRed(src, pixel_packet)); + *(dst_ptr + g_off) = (uint8_t)ScaleQuantumToChar(GetPixelGreen(src, pixel_packet)); + *(dst_ptr + b_off) = (uint8_t)ScaleQuantumToChar(GetPixelBlue(src, pixel_packet)); dst_ptr += 3; - pixel_packet++; + pixel_packet += GetPixelChannels(src); } } @@ -310,7 +312,7 @@ Image *timg; Image *nimg; ImageInfo *image_info; - ExceptionInfo exception_info; + ExceptionInfo *exception_info; int rgb_off = 0; @@ -376,19 +378,19 @@ * semaphore. */ magick_usecount++; - if (!IsMagickInstantiated()) { - InitializeMagick(""); + if (!IsMagickCoreInstantiated()) { + MagickCoreGenesis("", MagickFalse); } - GetExceptionInfo(&exception_info); + exception_info = AcquireExceptionInfo(); image_info = CloneImageInfo((ImageInfo *) NULL); strlcpy(image_info->filename, mfd->file, MaxTextExtent); - mfd->image = ReadImage(image_info, &exception_info); + mfd->image = ReadImage(image_info, exception_info); if (mfd->image == (Image *) NULL) { - MagickWarning(exception_info.severity, - exception_info.reason, - exception_info.description); + MagickWarning(exception_info->severity, + exception_info->reason, + exception_info->description); strlcpy(mfd->file, "/dev/null", PATH_MAX); return 0; } @@ -413,11 +415,11 @@ while (mfd->images != (Image *)NULL) { if (mfd->flip || flip) { - timg = FlipImage(mfd->images, &exception_info); + timg = FlipImage(mfd->images, exception_info); if (timg == (Image *) NULL) { - MagickError(exception_info.severity, - exception_info.reason, - exception_info.description); + MagickError(exception_info->severity, + exception_info->reason, + exception_info->description); return -1; } AppendImageToList(&nimg, timg); @@ -573,7 +575,7 @@ /* Set up image/video coefficient lookup tables */ if (img_coeff_lookup[0] < 0) { int i; - float maxrgbval = (float)MaxRGB; // from ImageMagick + float maxrgbval = (float)QuantumRange; // from ImageMagick for (i = 0; i <= MAX_UINT8_VAL; i++) { float x = (float)ScaleCharToQuantum(i); @@ -615,8 +617,8 @@ } magick_usecount--; - if (magick_usecount == 0 && IsMagickInstantiated()) { - DestroyMagick(); + if (magick_usecount == 0 && IsMagickCoreInstantiated()) { + MagickCoreTerminus(); } return 0; @@ -638,7 +640,8 @@ && (ptr->tag & TC_VIDEO) && !(ptr->attributes & TC_FRAME_IS_SKIPPED) ) { - PixelPacket *pixel_packet; + ExceptionInfo *exception_info; + Quantum *pixel_packet; uint8_t *video_buf; int do_fade = 0; @@ -647,6 +650,7 @@ /* Note: ImageMagick defines opacity = 0 as fully visible, and * opacity = MaxRGB as fully transparent. + * alpha rather than opacity (0 transparent; QuantumRange opaque). */ Quantum opacity; @@ -682,9 +686,11 @@ mfd->cur_delay = mfd->images->delay * vob->fps/100; } - pixel_packet = GetImagePixels(mfd->images, 0, 0, + exception_info = AcquireExceptionInfo(); + pixel_packet = GetAuthenticPixels(mfd->images, 0, 0, mfd->images->columns, - mfd->images->rows); + mfd->images->rows, + exception_info); if (vob->im_v_codec == CODEC_RGB) { unsigned long r_off, g_off, b_off; @@ -702,30 +708,30 @@ video_buf = ptr->video_buf + 3 * ((row + mfd->posy) * vob->ex_v_width + mfd->posx); for (col = 0; col < mfd->image->columns; col++) { - opacity = pixel_packet->opacity; + opacity = QuantumRange - GetPixelAlpha(mfd->images, pixel_packet); if (do_fade) - opacity += (Quantum)((MaxRGB - opacity) * fade_coeff); + opacity += (Quantum)((QuantumRange - opacity) * fade_coeff); if (opacity == 0) { - *(video_buf + r_off) = ScaleQuantumToChar(pixel_packet->red); - *(video_buf + g_off) = ScaleQuantumToChar(pixel_packet->green); - *(video_buf + b_off) = ScaleQuantumToChar(pixel_packet->blue); - } else if (opacity < MaxRGB) { + *(video_buf + r_off) = ScaleQuantumToChar(GetPixelRed(mfd->images, pixel_packet)); + *(video_buf + g_off) = ScaleQuantumToChar(GetPixelGreen(mfd->images, pixel_packet)); + *(video_buf + b_off) = ScaleQuantumToChar(GetPixelBlue(mfd->images, pixel_packet)); + } else if (opacity < QuantumRange) { unsigned char opacity_uchar = ScaleQuantumToChar(opacity); img_coeff = img_coeff_lookup[opacity_uchar]; vid_coeff = vid_coeff_lookup[opacity_uchar]; *(video_buf + r_off) = (uint8_t)((*(video_buf + r_off)) * vid_coeff) - + (uint8_t)(ScaleQuantumToChar(pixel_packet->red) * img_coeff); + + (uint8_t)(ScaleQuantumToChar(GetPixelRed(mfd->images, pixel_packet)) * img_coeff); *(video_buf + g_off) = (uint8_t)((*(video_buf + g_off)) * vid_coeff) - + (uint8_t)(ScaleQuantumToChar(pixel_packet->green) * img_coeff); + + (uint8_t)(ScaleQuantumToChar(GetPixelGreen(mfd->images, pixel_packet)) * img_coeff); *(video_buf + b_off) = (uint8_t)((*(video_buf + b_off)) * vid_coeff) - + (uint8_t)(ScaleQuantumToChar(pixel_packet->blue) * img_coeff); + + (uint8_t)(ScaleQuantumToChar(GetPixelBlue(mfd->images, pixel_packet)) * img_coeff); } video_buf += 3; - pixel_packet++; + pixel_packet += GetPixelChannels(mfd->images); } } } else { /* !RGB */ @@ -745,10 +751,10 @@ vid_pixel_V = vid_pixel_U + vid_size/4; for (col = 0; col < mfd->images->columns; col++) { int do_UV_pixels = (mfd->grayout == 0 && !(row % 2) && !(col % 2)) ? 1 : 0; - opacity = pixel_packet->opacity; + opacity = QuantumRange - GetPixelAlpha(mfd->images, pixel_packet); if (do_fade) - opacity += (Quantum)((MaxRGB - opacity) * fade_coeff); + opacity += (Quantum)((QuantumRange - opacity) * fade_coeff); if (opacity == 0) { *vid_pixel_Y = *img_pixel_Y; @@ -756,7 +762,7 @@ *vid_pixel_U = *img_pixel_U; *vid_pixel_V = *img_pixel_V; } - } else if (opacity < MaxRGB) { + } else if (opacity < QuantumRange) { unsigned char opacity_uchar = ScaleQuantumToChar(opacity); img_coeff = img_coeff_lookup[opacity_uchar]; vid_coeff = vid_coeff_lookup[opacity_uchar]; diff -urN transcode-1.1.7/filter/filter_logoaway.c transcode-1.1.7-imagemagick7/filter/filter_logoaway.c --- transcode-1.1.7/filter/filter_logoaway.c 2023-09-01 05:13:38.000000000 +0000 +++ transcode-1.1.7-imagemagick7/filter/filter_logoaway.c 2023-09-01 05:19:44.612157421 +0000 @@ -70,7 +70,7 @@ /* Note: because of ImageMagick bogosity, this must be included first, so * we can undefine the PACKAGE_* symbols it splats into our namespace */ -#include +#include #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING @@ -103,10 +103,10 @@ int alpha; - ExceptionInfo exception_info; + ExceptionInfo *exception_info; Image *image; ImageInfo *image_info; - PixelPacket *pixel_packet; + Quantum *pixel_packet; int dump; char *dump_buf; @@ -174,7 +174,7 @@ * instance filter instance * @return void nothing *********************************************************/ -static void work_with_rgb_frame(logoaway_data *LD, char *buffer, int width, int height) +static void work_with_rgb_frame(logoaway_data *LD, unsigned char *buffer, int width, int height) { int row, col, i; int xdistance, ydistance, distance_west, distance_north; @@ -201,10 +201,10 @@ } } - LD->dumpimage = ConstituteImage(LD->width-LD->xpos, LD->height-LD->ypos, "RGB", CharPixel, LD->dump_buf, &LD->exception_info); + LD->dumpimage = ConstituteImage(LD->width-LD->xpos, LD->height-LD->ypos, "RGB", CharPixel, LD->dump_buf, LD->exception_info); tc_snprintf(LD->dumpimage->filename, MaxTextExtent, "dump[%d].png", LD->id); - WriteImage(LD->dumpimage_info, LD->dumpimage); + WriteImage(LD->dumpimage_info, LD->dumpimage, LD->exception_info); } switch(LD->mode) { @@ -218,27 +218,28 @@ for(row=LD->ypos; rowheight; ++row) { for(col=LD->xpos; colwidth; ++col) { + Quantum *pixel = LD->pixel_packet + (row*LD->width+col)*GetPixelChannels(LD->image); buf_off = ((height-row)*width+col) * 3; pkt_off = (row-LD->ypos) * (LD->width-LD->xpos) + (col-LD->xpos); /* R */ if (!LD->alpha) { buffer[buf_off +0] = LD->rcolor; } else { - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, pixel)); buffer[buf_off +0] = alpha_blending(buffer[buf_off +0], LD->rcolor, alpha_px); } /* G */ if (!LD->alpha) { buffer[buf_off +1] = LD->gcolor; } else { - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].green); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelGreen(LD->image, pixel)); buffer[buf_off +1] = alpha_blending(buffer[buf_off +1], LD->gcolor, alpha_px); } /* B */ if (!LD->alpha) { buffer[buf_off +2] = LD->bcolor; } else { - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].blue); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelBlue(LD->image, pixel)); buffer[buf_off +2] = alpha_blending(buffer[buf_off +2], LD->bcolor, alpha_px); } } @@ -268,6 +269,7 @@ buf_off = ((height-row)*width+col) * 3; pkt_off = (row-LD->ypos) * (LD->width-LD->xpos) + (col-LD->xpos); + Quantum *pixel = LD->pixel_packet + pkt_off*GetPixelChannels(LD->image); /* R */ hcalc = alpha_blending(buffer[buf_off_xpos +0], buffer[buf_off_width +0], alpha_hori); @@ -276,7 +278,7 @@ if (!LD->alpha) { buffer[buf_off +0] = new_px; } else { - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, pixel)); buffer[buf_off +0] = alpha_blending(buffer[buf_off +0], new_px, alpha_px); } /* G */ @@ -286,7 +288,7 @@ if (!LD->alpha) { buffer[buf_off +1] = new_px; } else { - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].green); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelGreen(LD->image, pixel)); buffer[buf_off +1] = alpha_blending(buffer[buf_off +1], new_px, alpha_px); } /* B */ @@ -296,7 +298,7 @@ if (!LD->alpha) { buffer[buf_off +2] = new_px; } else { - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelBlue(LD->image, pixel)); buffer[buf_off +2] = alpha_blending(buffer[buf_off +2], new_px, alpha_px); } } @@ -327,28 +329,28 @@ buf_off_height = ((height-LD->height)*width+col) * 3; i = 0; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off-i].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off-i)*GetPixelChannels(LD->image))); while ((alpha_px != 255) && (col-i>LD->xpos)) i++; buf_off_xpos = ((height-row)*width + col-i) * 3; i = 0; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off+i].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off+i)*GetPixelChannels(LD->image))); while ((alpha_px != 255) && (col+iwidth)) i++; buf_off_width = ((height-row)*width + col+i) * 3; i = 0; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off-i*(LD->width-LD->xpos)].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off-i*(LD->width-LD->xpos))*GetPixelChannels(LD->image))); while ((alpha_px != 255) && (row-i>LD->ypos)) i++; buf_off_ypos = (height*width*3)-((row-i)*width - col) * 3; i = 0; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off+i*(LD->width-LD->xpos)].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off+i*(LD->width-LD->xpos))*GetPixelChannels(LD->image))); while ((alpha_px != 255) && (row+iheight)) i++; buf_off_height = (height*width*3)-((row+i)*width - col) * 3; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + pkt_off*GetPixelChannels(LD->image))); /* R */ hcalc = alpha_blending(buffer[buf_off_xpos +0], buffer[buf_off_width +0], alpha_hori); vcalc = alpha_blending(buffer[buf_off_ypos +0], buffer[buf_off_height +0], alpha_vert); @@ -405,7 +407,7 @@ * instance filter instance * @return void nothing *********************************************************/ -static void work_with_yuv_frame(logoaway_data *LD, char *buffer, int width, int height) +static void work_with_yuv_frame(logoaway_data *LD, unsigned char *buffer, int width, int height) { int row, col, i; int craddr, cbaddr; @@ -431,10 +433,11 @@ buf_off = row*width+col; pkt_off = (row-LD->ypos) * (LD->width-LD->xpos) + (col-LD->xpos); + Quantum *pixel = LD->pixel_packet + pkt_off*GetPixelChannels(LD->image); if (!LD->alpha) { buffer[buf_off] = LD->ycolor; } else { - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, pixel)); buffer[buf_off] = alpha_blending(buffer[buf_off], LD->ycolor, alpha_px); } } @@ -446,8 +449,9 @@ buf_off = row*width/2+col; pkt_off = (row*2-LD->ypos) * (LD->width-LD->xpos) + (col*2-LD->xpos); + Quantum *pixel = LD->pixel_packet + pkt_off*GetPixelChannels(LD->image); /* sic */ - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, pixel)); if (!LD->alpha) { buffer[craddr + buf_off] = LD->ucolor; buffer[cbaddr + buf_off] = LD->vcolor; @@ -483,10 +487,11 @@ buf_off_height = LD->height*width+col; pkt_off = (row-LD->ypos) * (LD->width-LD->xpos) + (col-LD->xpos); + Quantum *pixel = LD->pixel_packet + pkt_off*GetPixelChannels(LD->image); hcalc = alpha_blending(buffer[buf_off_xpos], buffer[buf_off_width], alpha_hori); vcalc = alpha_blending(buffer[buf_off_ypos], buffer[buf_off_height], alpha_vert); - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, pixel)); new_px = (hcalc*LD->xweight + vcalc*LD->yweight)/100; if (!LD->alpha) { buffer[buf_off] = new_px; @@ -517,7 +522,8 @@ buf_off_height = LD->height/2*width/2+col; pkt_off = (row*2-LD->ypos) * (LD->width-LD->xpos) + (col*2-LD->xpos); - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red); + Quantum *pixel = LD->pixel_packet + pkt_off*GetPixelChannels(LD->image); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, pixel)); /* sic, reuse red alpha_px */ hcalc = alpha_blending(buffer[craddr + buf_off_xpos], buffer[craddr + buf_off_width], alpha_hori); @@ -560,30 +566,30 @@ pkt_off = (row-LD->ypos) * (LD->width-LD->xpos) + (col-LD->xpos); i = 0; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off-i].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off-i)*GetPixelChannels(LD->image))); while ((alpha_px != 255) && (col-i>LD->xpos)) i++; buf_off_xpos = (row*width + col-i); i = 0; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off+i].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off+i)*GetPixelChannels(LD->image))); while ((alpha_px != 255) && (col+iwidth)) i++; buf_off_width = (row*width + col+i); i = 0; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off-i*(LD->width-LD->xpos)].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off-i*(LD->width-LD->xpos))*GetPixelChannels(LD->image))); while ((alpha_px != 255) && (row-i>LD->ypos)) i++; buf_off_ypos = ((row-i)*width + col); i = 0; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off+i*(LD->width-LD->xpos)].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off+i*(LD->width-LD->xpos))*GetPixelChannels(LD->image))); while ((alpha_px != 255) && (row+iheight)) i++; buf_off_height = ((row+i)*width + col); hcalc = alpha_blending( buffer[buf_off_xpos], buffer[buf_off_width], alpha_hori ); vcalc = alpha_blending( buffer[buf_off_ypos], buffer[buf_off_height], alpha_vert ); - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + pkt_off*GetPixelChannels(LD->image))); new_px = (hcalc*LD->xweight + vcalc*LD->yweight)/100; buffer[buf_off] = alpha_blending(buffer[buf_off], new_px, alpha_px); } @@ -603,23 +609,23 @@ alpha_hori = xdistance * distance_west; i = 0; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off-i].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off-i)*GetPixelChannels(LD->image))); while ((alpha_px != 255) && (col-i>LD->xpos)) i++; buf_off_xpos = (row*width/2 + col-i); i = 0; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off+i].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off+i)*GetPixelChannels(LD->image))); while ((alpha_px != 255) && (col+iwidth)) i++; buf_off_width = (row*width/2 + col+i); i = 0; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off-i*(LD->width-LD->xpos)].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off-i*(LD->width-LD->xpos))*GetPixelChannels(LD->image))); while ((alpha_px != 255) && (row-i>LD->ypos)) i++; buf_off_ypos = ((row-i)*width/2 + col); i = 0; - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off+i*(LD->width-LD->xpos)].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off+i*(LD->width-LD->xpos))*GetPixelChannels(LD->image))); while ((alpha_px != 255) && (row+iheight)) i++; buf_off_height = ((row+i)*width/2 + col); @@ -630,7 +636,7 @@ pkt_off = (row*2-LD->ypos) * (LD->width-LD->xpos) + (col*2-LD->xpos); - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red); + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + pkt_off*GetPixelChannels(LD->image))); /* sic: reuse the red component */ hcalc = alpha_blending(buffer[craddr + buf_off_xpos], buffer[craddr + buf_off_width], alpha_hori); vcalc = alpha_blending(buffer[craddr + buf_off_ypos], buffer[craddr + buf_off_height], alpha_vert); @@ -815,17 +821,17 @@ } if((data[instance]->alpha) || (data[instance]->dump)) { - InitializeMagick(""); - GetExceptionInfo(&data[instance]->exception_info); + MagickCoreGenesis("", MagickFalse); + data[instance]->exception_info = AcquireExceptionInfo(); if(data[instance]->alpha) { data[instance]->image_info = CloneImageInfo((ImageInfo *) NULL); strlcpy(data[instance]->image_info->filename, data[instance]->file, MaxTextExtent); - data[instance]->image = ReadImage(data[instance]->image_info, &data[instance]->exception_info); + data[instance]->image = ReadImage(data[instance]->image_info, data[instance]->exception_info); if (data[instance]->image == (Image *) NULL) { tc_log_error(MOD_NAME, "\n"); - MagickWarning (data[instance]->exception_info.severity, data[instance]->exception_info.reason, data[instance]->exception_info.description); + MagickWarning (data[instance]->exception_info->severity, data[instance]->exception_info->reason, data[instance]->exception_info->description); return TC_ERROR; } @@ -835,7 +841,7 @@ return TC_ERROR; } - data[instance]->pixel_packet = GetImagePixels(data[instance]->image, 0, 0, data[instance]->image->columns, data[instance]->image->rows); + data[instance]->pixel_packet = GetAuthenticPixels(data[instance]->image, 0, 0, data[instance]->image->columns, data[instance]->image->rows, data[instance]->exception_info); } if(data[instance]->dump) { if((data[instance]->dump_buf = tc_malloc ((data[instance]->width-data[instance]->xpos)*(data[instance]->height-data[instance]->ypos)*3)) == NULL) @@ -865,10 +871,9 @@ if (data[instance]->dumpimage != (Image *)NULL) { DestroyImage(data[instance]->dumpimage); DestroyImageInfo(data[instance]->dumpimage_info); - ConstituteComponentTerminus(); } - DestroyExceptionInfo(&data[instance]->exception_info); - DestroyMagick(); + DestroyExceptionInfo(data[instance]->exception_info); + MagickCoreTerminus(); if(data[instance]->dump_buf) free(data[instance]->dump_buf); if(data[instance]) free(data[instance]); diff -urN transcode-1.1.7/import/import_im.c transcode-1.1.7-imagemagick7/import/import_im.c --- transcode-1.1.7/import/import_im.c 2023-09-01 05:13:38.000000000 +0000 +++ transcode-1.1.7-imagemagick7/import/import_im.c 2023-09-01 05:21:00.888412751 +0000 @@ -34,9 +34,9 @@ /* Note: because of ImageMagick bogosity, this must be included first, so * we can undefine the PACKAGE_* symbols it splats into our namespace */ #ifdef HAVE_BROKEN_WAND -#include +#include #else /* we have a SANE wand header */ -#include +#include #endif /* HAVE_BROKEN_WAND */ #undef PACKAGE_BUGREPORT @@ -289,7 +289,7 @@ MagickSetLastIterator(wand); - status = MagickGetImagePixels(wand, + status = MagickExportImagePixels(wand, 0, 0, width, height, "RGB", CharPixel, param->buffer); diff -urN transcode-1.1.7/import/import_im.c~ transcode-1.1.7-imagemagick7/import/import_im.c~ --- transcode-1.1.7/import/import_im.c~ 1970-01-01 00:00:00.000000000 +0000 +++ transcode-1.1.7-imagemagick7/import/import_im.c~ 2023-09-01 05:19:44.613157410 +0000 @@ -0,0 +1,361 @@ +/* + * import_im.c + * + * Copyright (C) Thomas Oestreich - June 2001 + * port to MagickWand API: + * Copyright (C) Francesco Romani - July 2007 + * + * This file is part of transcode, a video stream processing tool + * + * transcode is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * transcode 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 GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#define MOD_NAME "import_im.so" +#define MOD_VERSION "v0.1.3 (2008-10-07)" +#define MOD_CODEC "(video) RGB" + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +/* Note: because of ImageMagick bogosity, this must be included first, so + * we can undefine the PACKAGE_* symbols it splats into our namespace */ +#ifdef HAVE_BROKEN_WAND +#include +#else /* we have a SANE wand header */ +#include +#endif /* HAVE_BROKEN_WAND */ + +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION + +#include "transcode.h" +#include "libtc/optstr.h" + +#include +#include + +/*%* + *%* DESCRIPTION + *%* This module reads single images from disk using ImageMagick; + *%* a stream of correlated images can be automatically read if + *%* their filenames contains a common prefix and a serial number. + *%* All formats supported by ImageMagick are supported as well. + *%* + *%* BUILD-DEPENDS + *%* libMagick >= 6.2.4.0 + *%* + *%* DEPENDS + *%* libMagick >= 6.2.4.0 + *%* + *%* PROCESSING + *%* import/demuxer + *%* + *%* MEDIA + *%* video + *%* + *%* #INPUT + *%* + *%* OUTPUT + *%* RGB24 + *%* + *%* OPTION + *%* noseq (flag) + *%* disable internal auto loading of images with similar names. + *%*/ + +static int verbose_flag = TC_QUIET; +static int capability_flag = TC_CAP_RGB|TC_CAP_VID; + +#define MOD_PRE im +#include "import_def.h" + +#include +#include +#include + + +static char *head = NULL, *tail = NULL; +static int first_frame = 0, current_frame = 0, decoded_frame = 0, pad = 0; +static int total_frame = 0; +static int width = 0, height = 0; +static MagickWand *wand = NULL; +static int auto_seq_read = TC_TRUE; +/* + * automagically read further images with filename like the first one + * enabled by default for backward compatibility, but obsoleted + * by core option --multi_input + */ + +static int TCHandleMagickError(MagickWand *wand) +{ + ExceptionType severity; + const char *description = MagickGetException(wand, &severity); + + tc_log_error(MOD_NAME, "%s", description); + + MagickRelinquishMemory((void*)description); + return TC_IMPORT_ERROR; +} + + +/* ------------------------------------------------------------ + * + * open stream + * + * ------------------------------------------------------------*/ + + +/* I suspect we have a lot of potential memleaks in here -- FRomani */ +MOD_open +{ + int result, slen = 0; + char *regex = NULL, *frame = NULL; + regex_t preg; + regmatch_t pmatch[4]; + + if (param->flag == TC_AUDIO) { + return TC_IMPORT_OK; + } + + if (param->flag == TC_VIDEO) { + param->fd = NULL; + + // get the frame name and range + regex = "\\([^0-9]\\+[-._]\\?\\)\\?\\([0-9]\\+\\)\\([-._].\\+\\)\\?"; + result = regcomp(&preg, regex, 0); + if (result) { + tc_log_perror(MOD_NAME, "ERROR: Regex compile failed.\n"); + return TC_IMPORT_ERROR; + } + + result = regexec(&preg, vob->video_in_file, 4, pmatch, 0); + if (result) { + tc_log_warn(MOD_NAME, "Regex match failed: no image sequence"); + slen = strlen(vob->video_in_file) + 1; + head = tc_malloc(slen); + if (head == NULL) { + tc_log_perror(MOD_NAME, "filename head"); + return TC_IMPORT_ERROR; + } + strlcpy(head, vob->video_in_file, slen); + tail = tc_malloc(1); /* URGH -- FRomani */ + tail[0] = 0; + first_frame = -1; + } else { + // split the name into head, frame number, and tail + slen = pmatch[1].rm_eo - pmatch[1].rm_so + 1; + head = tc_malloc(slen); + if (head == NULL) { + tc_log_perror(MOD_NAME, "filename head"); + return TC_IMPORT_ERROR; + } + strlcpy(head, vob->video_in_file, slen); + + slen = pmatch[2].rm_eo - pmatch[2].rm_so + 1; + frame = tc_malloc(slen); + if (frame == NULL) { + tc_log_perror(MOD_NAME, "filename frame"); + return TC_IMPORT_ERROR; + } + strlcpy(frame, vob->video_in_file + pmatch[2].rm_so, slen); + + // If the frame number is padded with zeros, record how many digits + // are actually being used. + if (frame[0] == '0') { + pad = pmatch[2].rm_eo - pmatch[2].rm_so; + } + first_frame = atoi(frame); + + slen = pmatch[3].rm_eo - pmatch[3].rm_so + 1; + tail = tc_malloc(slen); + if (tail == NULL) { + tc_log_perror(MOD_NAME, "filename tail"); + return TC_IMPORT_ERROR; + } + strlcpy(tail, vob->video_in_file + pmatch[3].rm_so, slen); + + tc_free(frame); + } + + if (vob->im_v_string != NULL) { + if (optstr_lookup(vob->im_v_string, "noseq")) { + auto_seq_read = TC_FALSE; + if (verbose > TC_INFO) { + tc_log_info(MOD_NAME, "automagic image sequential read disabled"); + } + } + } + + current_frame = first_frame; + decoded_frame = 0; + width = vob->im_v_width; + height = vob->im_v_height; + + if (total_frame == 0) { + /* only the very first time */ + MagickWandGenesis(); + } + + wand = NewMagickWand(); + if (wand == NULL) { + tc_log_error(MOD_NAME, "cannot create magick wand"); + return TC_IMPORT_ERROR; + } + + return TC_IMPORT_OK; + } + + return TC_IMPORT_ERROR; +} + + +/* ------------------------------------------------------------ + * + * decode stream + * + * ------------------------------------------------------------*/ + +MOD_decode +{ + char *frame = NULL, *filename = NULL; + int slen; + MagickBooleanType status; + + if (param->flag == TC_AUDIO) { + return TC_IMPORT_OK; + } + + if (param->flag == TC_VIDEO) { + if (!auto_seq_read) { + if (decoded_frame > 0) { + return TC_IMPORT_ERROR; + } + filename = tc_strdup(vob->video_in_file); + } else { + // build the filename for the current frame + slen = strlen(head) + pad + strlen(tail) + 1; + filename = tc_malloc(slen); + if (pad) { + char framespec[10]; + frame = tc_malloc(pad+1); + tc_snprintf(framespec, 10, "%%0%dd", pad); + tc_snprintf(frame, pad+1, framespec, current_frame); + frame[pad] = '\0'; + } else if (first_frame >= 0) { + frame = tc_malloc(10); + tc_snprintf(frame, 10, "%d", current_frame); + } + strlcpy(filename, head, slen); + if (frame != NULL) { + strlcat(filename, frame, slen); + tc_free(frame); + frame = NULL; + } + strlcat(filename, tail, slen); + } + + ClearMagickWand(wand); + /* + * This avoids IM to buffer all read images. + * I'm quite sure that this can be done in a smarter way, + * but I haven't yet figured out how. -- FRomani + */ + + status = MagickReadImage(wand, filename); + if (status == MagickFalse) { + if (auto_seq_read) { + /* let's assume that image sequence ends here */ + return TC_IMPORT_ERROR; + } + return TCHandleMagickError(wand); + } + + MagickSetLastIterator(wand); + + status = MagickGetImagePixels(wand, + 0, 0, width, height, + "RGB", CharPixel, + param->buffer); + /* param->size already set correctly by caller */ + if (status == MagickFalse) { + return TCHandleMagickError(wand); + } + + param->attributes |= TC_FRAME_IS_KEYFRAME; + + total_frame++; + current_frame++; + decoded_frame++; + + tc_free(filename); + + return TC_IMPORT_OK; + } + return TC_IMPORT_ERROR; +} + +/* ------------------------------------------------------------ + * + * close stream + * + * ------------------------------------------------------------*/ + +MOD_close +{ + if (param->flag == TC_AUDIO) { + return TC_IMPORT_OK; + } + + if (param->flag == TC_VIDEO) { + vob_t *vob = tc_get_vob(); + + if (param->fd != NULL) + pclose(param->fd); + if (head != NULL) + tc_free(head); + if (tail != NULL) + tc_free(tail); + + if (wand != NULL) { + DestroyMagickWand(wand); + wand = NULL; + + if (!tc_has_more_video_in_file(vob)) { + /* ...can you hear that? is the sound of the ugliness... */ + MagickWandTerminus(); + } + } + return TC_IMPORT_OK; + } + return TC_IMPORT_ERROR; +} + +/*************************************************************************/ + +/* + * Local variables: + * c-file-style: "stroustrup" + * c-file-offsets: ((case-label . *) (statement-case-intro . *)) + * indent-tabs-mode: nil + * End: + * + * vim: expandtab shiftwidth=4: + */ + diff -urN transcode-1.1.7/import/import_imlist.c transcode-1.1.7-imagemagick7/import/import_imlist.c --- transcode-1.1.7/import/import_imlist.c 2023-09-01 05:13:38.000000000 +0000 +++ transcode-1.1.7-imagemagick7/import/import_imlist.c 2023-09-01 05:21:14.541285734 +0000 @@ -34,9 +34,9 @@ /* Note: because of ImageMagick bogosity, this must be included first, so * we can undefine the PACKAGE_* symbols it splats into our namespace */ #ifdef HAVE_BROKEN_WAND -#include +#include #else /* we have a SANE wand header */ -#include +#include #endif /* HAVE_BROKEN_WAND */ #undef PACKAGE_BUGREPORT @@ -155,7 +155,7 @@ MagickSetLastIterator(wand); - status = MagickGetImagePixels(wand, + status = MagickExportImagePixels(wand, 0, 0, width, height, "RGB", CharPixel, param->buffer); diff -urN transcode-1.1.7/import/import_imlist.c~ transcode-1.1.7-imagemagick7/import/import_imlist.c~ --- transcode-1.1.7/import/import_imlist.c~ 1970-01-01 00:00:00.000000000 +0000 +++ transcode-1.1.7-imagemagick7/import/import_imlist.c~ 2023-09-01 05:19:44.613157410 +0000 @@ -0,0 +1,213 @@ +/* + * import_imlist.c + * + * Copyright (C) Thomas Oestreich - February 2002 + * port to MagickWand API: + * Copyright (C) Francesco Romani - July 2007 + * + * This file is part of transcode, a video stream processing tool + * + * transcode is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * transcode 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 GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#define MOD_NAME "import_imlist.so" +#define MOD_VERSION "v0.1.1 (2007-08-04)" +#define MOD_CODEC "(video) RGB" + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +/* Note: because of ImageMagick bogosity, this must be included first, so + * we can undefine the PACKAGE_* symbols it splats into our namespace */ +#ifdef HAVE_BROKEN_WAND +#include +#else /* we have a SANE wand header */ +#include +#endif /* HAVE_BROKEN_WAND */ + +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION + +#include +#include + +#include "src/transcode.h" + +static int verbose_flag = TC_QUIET; +static int capability_flag = TC_CAP_RGB|TC_CAP_VID; + +#define MOD_PRE imlist +#include "import_def.h" + + +static int TCHandleMagickError(MagickWand *wand) +{ + ExceptionType severity; + const char *description = MagickGetException(wand, &severity); + + tc_log_error(MOD_NAME, "%s", description); + + MagickRelinquishMemory((void*)description); + return TC_IMPORT_ERROR; +} + +static int width = 0, height = 0; +static FILE *fd = NULL; +static MagickWand *wand = NULL; + +/* ------------------------------------------------------------ + * + * open stream + * + * ------------------------------------------------------------*/ + +MOD_open +{ + if (param->flag == TC_AUDIO) { + return(TC_IMPORT_OK); + } + + if (param->flag == TC_VIDEO) { + param->fd = NULL; + + width = vob->im_v_width; + height = vob->im_v_height; + + tc_log_warn(MOD_NAME, + "This module is DEPRECATED."); + tc_log_warn(MOD_NAME, + "Please consider to use the multi input mode" + " (--multi_input) with import_im module."); + tc_log_warn(MOD_NAME, + "(e.g.) transcode --multi_input -x im ..."); + + fd = fopen(vob->video_in_file, "r"); + if (fd == NULL) { + return TC_IMPORT_ERROR; + } + + MagickWandGenesis(); + wand = NewMagickWand(); + + if (wand == NULL) { + tc_log_error(MOD_NAME, "cannot create magick wand"); + return TC_IMPORT_ERROR; + } + + return TC_IMPORT_OK; + } + + return TC_IMPORT_ERROR; +} + + +/* ------------------------------------------------------------ + * + * decode stream + * + * ------------------------------------------------------------*/ + +MOD_decode +{ + char filename[PATH_MAX+1]; + MagickBooleanType status; + + if (param->flag == TC_AUDIO) { + return TC_IMPORT_OK; + } + + if (param->flag == TC_VIDEO) { + // read a filename from the list + if (fgets(filename, PATH_MAX, fd) == NULL) { + return TC_IMPORT_ERROR; + } + filename[PATH_MAX] = '\0'; /* enforce */ + tc_strstrip(filename); + + ClearMagickWand(wand); + /* + * This avoids IM to buffer all read images. + * I'm quite sure that this can be done in a smarter way, + * but I haven't yet figured out how. -- FRomani + */ + + status = MagickReadImage(wand, filename); + if (status == MagickFalse) { + return TCHandleMagickError(wand); + } + + MagickSetLastIterator(wand); + + status = MagickGetImagePixels(wand, + 0, 0, width, height, + "RGB", CharPixel, + param->buffer); + if (status == MagickFalse) { + return TCHandleMagickError(wand); + } + + param->attributes |= TC_FRAME_IS_KEYFRAME; + + return TC_IMPORT_OK; + } + return TC_IMPORT_ERROR; +} + +/* ------------------------------------------------------------ + * + * close stream + * + * ------------------------------------------------------------*/ + +MOD_close +{ + if (param->flag == TC_AUDIO) { + return TC_IMPORT_OK; + } + + if (param->flag == TC_VIDEO) { + if (fd != NULL) { + fclose(fd); + fd = NULL; + } + + if (wand != NULL) { + DestroyMagickWand(wand); + MagickWandTerminus(); + wand = NULL; + } + + return TC_IMPORT_OK; + } + + return TC_IMPORT_ERROR; +} + +/*************************************************************************/ + +/* + * Local variables: + * c-file-style: "stroustrup" + * c-file-offsets: ((case-label . *) (statement-case-intro . *)) + * indent-tabs-mode: nil + * End: + * + * vim: expandtab shiftwidth=4: + */ diff -urN transcode-1.1.7/import/probe_im.c transcode-1.1.7-imagemagick7/import/probe_im.c --- transcode-1.1.7/import/probe_im.c 2023-09-01 05:13:38.000000000 +0000 +++ transcode-1.1.7-imagemagick7/import/probe_im.c 2023-09-01 05:19:44.613157410 +0000 @@ -40,9 +40,9 @@ # undef PACKAGE_VERSION # ifdef HAVE_BROKEN_WAND -# include +# include # else /* we have a SANE wand header */ -# include +# include # endif /* HAVE_BROKEN_WAND */ # undef PACKAGE_BUGREPORT