From eb0180e7b4df18d806ceb31e4a96e9a771b4db3e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 21 Oct 2021 11:36:41 +0200 Subject: [PATCH] wmphoto: Use the bundled jxrlib. Signed-off-by: Alexandre Julliard --- configure | 122 -------------------------- configure.ac | 16 ---- dlls/wmphoto/Makefile.in | 9 +- dlls/wmphoto/{unix_lib.c => jxrlib.c} | 108 +---------------------- dlls/wmphoto/main.c | 4 +- include/config.h.in | 6 -- 6 files changed, 10 insertions(+), 255 deletions(-) rename dlls/wmphoto/{unix_lib.c => jxrlib.c} (79%) diff --git a/configure b/configure index 1e18ad994a4..909ac1e414d 100755 --- a/configure +++ b/configure @@ -639,8 +639,6 @@ NETAPI_CFLAGS PROCSTAT_LIBS MPG123_LIBS MPG123_CFLAGS -JXRLIB_LIBS -JXRLIB_CFLAGS JPEG_LIBS JPEG_CFLAGS GSSAPI_LIBS @@ -871,7 +869,6 @@ with_gstreamer with_hal with_inotify with_jpeg -with_jxrlib with_krb5 with_ldap with_mingw @@ -1990,8 +1987,6 @@ GSSAPI_CFLAGS GSSAPI_LIBS JPEG_CFLAGS JPEG_LIBS -JXRLIB_CFLAGS -JXRLIB_LIBS MPG123_CFLAGS MPG123_LIBS NETAPI_CFLAGS @@ -2662,7 +2657,6 @@ Optional Packages: --without-hal do not use HAL (dynamic device support) --without-inotify do not use inotify (filesystem change notifications) --without-jpeg do not use JPEG - --without-jxrlib do not use JPEG-XR --without-krb5 do not use krb5 (Kerberos) --without-ldap do not use LDAP --without-mingw do not use the MinGW cross-compiler @@ -2814,9 +2808,6 @@ Some influential environment variables: GSSAPI_LIBS Linker flags for krb5-gssapi, overriding pkg-config JPEG_CFLAGS C compiler flags for libjpeg, overriding pkg-config JPEG_LIBS Linker flags for libjpeg, overriding pkg-config - JXRLIB_CFLAGS - C compiler flags for jxrlib, overriding pkg-config - JXRLIB_LIBS Linker flags for jxrlib, overriding pkg-config MPG123_CFLAGS C compiler flags for libmpg123, overriding pkg-config MPG123_LIBS Linker flags for libmpg123, overriding pkg-config @@ -4114,12 +4105,6 @@ if test "${with_jpeg+set}" = set; then : fi -# Check whether --with-jxrlib was given. -if test "${with_jxrlib+set}" = set; then : - withval=$with_jxrlib; -fi - - # Check whether --with-krb5 was given. if test "${with_krb5+set}" = set; then : withval=$with_krb5; @@ -15408,111 +15393,6 @@ esac fi -if test "x$with_jxrlib" != "xno" -then - if ${JXRLIB_CFLAGS:+false} :; then : - if ${PKG_CONFIG+:} false; then : - JXRLIB_CFLAGS=`$PKG_CONFIG --cflags jxrlib 2>/dev/null` -fi -fi -test "$cross_compiling" = yes || JXRLIB_CFLAGS=${JXRLIB_CFLAGS:-${JXRLIB_CFLAGS:--I/usr/include/jxrlib}} -if ${JXRLIB_LIBS:+false} :; then : - if ${PKG_CONFIG+:} false; then : - JXRLIB_LIBS=`$PKG_CONFIG --libs jxrlib 2>/dev/null` -fi -fi - - -$as_echo "$as_me:${as_lineno-$LINENO}: jxrlib cflags: $JXRLIB_CFLAGS" >&5 -$as_echo "$as_me:${as_lineno-$LINENO}: jxrlib libs: $JXRLIB_LIBS" >&5 -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $JXRLIB_CFLAGS" -for ac_header in JXRGlue.h -do : - ac_fn_c_check_header_compile "$LINENO" "JXRGlue.h" "ac_cv_header_JXRGlue_h" "#define FAR -" -if test "x$ac_cv_header_JXRGlue_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_JXRGLUE_H 1 -_ACEOF - -fi - -done - - if test "$ac_cv_header_JXRGlue_h" = "yes" - then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ljxrglue" >&5 -$as_echo_n "checking for -ljxrglue... " >&6; } -if ${ac_cv_lib_soname_jxrglue+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_soname_save_LIBS=$LIBS -LIBS="-ljxrglue $JXRLIB_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char PKImageDecode_Create_WMP (); -int -main () -{ -return PKImageDecode_Create_WMP (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_jxrglue=`$ac_cv_path_LDD conftest.exe | grep "jxrglue" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_jxrglue=`$OTOOL -L conftest$ac_exeext | grep "libjxrglue\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libjxrglue\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_jxrglue=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libjxrglue\\.$LIBEXT" | sed -e "s/^.*\\[\\(libjxrglue\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_jxrglue:+false} :; then : - ac_cv_lib_soname_jxrglue=`$LDD conftest$ac_exeext | grep "libjxrglue\\.$LIBEXT" | sed -e "s/^.*\(libjxrglue\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else - ac_cv_lib_soname_jxrglue= -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_jxrglue:+false} :; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - JXRLIB_CFLAGS="" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_jxrglue" >&5 -$as_echo "$ac_cv_lib_soname_jxrglue" >&6; } - -cat >>confdefs.h <<_ACEOF -#define SONAME_LIBJXRGLUE "$ac_cv_lib_soname_jxrglue" -_ACEOF - - -fi - else - JXRLIB_CFLAGS="" - fi -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "x$ac_cv_lib_soname_jxrglue" = "x"; then : - case "x$with_jxrlib" in - x) as_fn_append wine_notices "|jxrlib ${notice_platform}development files not found, JPEG-XR won't be supported." ;; - xno) ;; - *) as_fn_error $? "jxrlib ${notice_platform}development files not found, JPEG-XR won't be supported. -This is an error since --with-jxrlib was requested." "$LINENO" 5 ;; -esac - -fi - if test "x$with_mpg123" != "xno" then if ${MPG123_CFLAGS:+false} :; then : @@ -19030,8 +18910,6 @@ GSSAPI_CFLAGS = $GSSAPI_CFLAGS GSSAPI_LIBS = $GSSAPI_LIBS JPEG_CFLAGS = $JPEG_CFLAGS JPEG_LIBS = $JPEG_LIBS -JXRLIB_CFLAGS = $JXRLIB_CFLAGS -JXRLIB_LIBS = $JXRLIB_LIBS MPG123_CFLAGS = $MPG123_CFLAGS MPG123_LIBS = $MPG123_LIBS PROCSTAT_LIBS = $PROCSTAT_LIBS diff --git a/configure.ac b/configure.ac index 06d727baa80..3b71bfe38c6 100644 --- a/configure.ac +++ b/configure.ac @@ -56,7 +56,6 @@ AC_ARG_WITH(gstreamer, AS_HELP_STRING([--without-gstreamer],[do not use GStreame AC_ARG_WITH(hal, AS_HELP_STRING([--without-hal],[do not use HAL (dynamic device support)])) AC_ARG_WITH(inotify, AS_HELP_STRING([--without-inotify],[do not use inotify (filesystem change notifications)])) AC_ARG_WITH(jpeg, AS_HELP_STRING([--without-jpeg],[do not use JPEG])) -AC_ARG_WITH(jxrlib, AS_HELP_STRING([--without-jxrlib],[do not use JPEG-XR])) AC_ARG_WITH(krb5, AS_HELP_STRING([--without-krb5],[do not use krb5 (Kerberos)])) AC_ARG_WITH(ldap, AS_HELP_STRING([--without-ldap],[do not use LDAP]), [if test "x$withval" = "xno"; then ac_cv_header_ldap_h=no; ac_cv_header_lber_h=no; fi]) @@ -1722,21 +1721,6 @@ fi WINE_WARNING_WITH(jpeg,[test "x$ac_cv_lib_soname_jpeg" = "x"], [libjpeg ${notice_platform}development files not found, JPEG won't be supported.]) -dnl **** Check for libjxrglue **** -if test "x$with_jxrlib" != "xno" -then - WINE_PACKAGE_FLAGS(JXRLIB,[jxrlib],,[${JXRLIB_CFLAGS:--I/usr/include/jxrlib}],, - [AC_CHECK_HEADERS([JXRGlue.h],,,[#define FAR]) - if test "$ac_cv_header_JXRGlue_h" = "yes" - then - WINE_CHECK_SONAME(jxrglue,PKImageDecode_Create_WMP,,[JXRLIB_CFLAGS=""],[$JXRLIB_LIBS]) - else - JXRLIB_CFLAGS="" - fi]) -fi -WINE_NOTICE_WITH(jxrlib,[test "x$ac_cv_lib_soname_jxrglue" = "x"], - [jxrlib ${notice_platform}development files not found, JPEG-XR won't be supported.]) - dnl **** Check for mpg123 **** if test "x$with_mpg123" != "xno" then diff --git a/dlls/wmphoto/Makefile.in b/dlls/wmphoto/Makefile.in index 2c70b4438eb..cb095120e94 100644 --- a/dlls/wmphoto/Makefile.in +++ b/dlls/wmphoto/Makefile.in @@ -1,15 +1,14 @@ -MODULE = wmphoto.dll -IMPORTS = windowscodecs uuid ole32 oleaut32 propsys rpcrt4 shlwapi +MODULE = wmphoto.dll +IMPORTS = $(JXR_PE_LIBS) windowscodecs uuid ole32 oleaut32 propsys rpcrt4 shlwapi +EXTRAINCL = $(JXR_PE_CFLAGS) PARENTSRC = ../windowscodecs -EXTRAINCL = $(JXRLIB_CFLAGS) EXTRADLLFLAGS = -Wb,--prefer-native C_SRCS = \ decoder.c \ + jxrlib.c \ main.c \ - unix_iface.c \ - unix_lib.c \ wincodecs_common.c IDL_SRCS = wmphoto.idl diff --git a/dlls/wmphoto/unix_lib.c b/dlls/wmphoto/jxrlib.c similarity index 79% rename from dlls/wmphoto/unix_lib.c rename to dlls/wmphoto/jxrlib.c index 2fa353ba13e..757312b5f0f 100644 --- a/dlls/wmphoto/unix_lib.c +++ b/dlls/wmphoto/jxrlib.c @@ -1,5 +1,5 @@ /* - * unix_lib.c - This is the Unix side of the Unix interface. + * Interface with jxr library * * Copyright 2020 Esme Povirk * @@ -18,44 +18,24 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#if 0 -#pragma makedep unix -#endif - -#include "config.h" -#include "wine/port.h" - #include #define NONAMELESSUNION - #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" #include "winternl.h" #include "winbase.h" #include "objbase.h" - -#include "initguid.h" -#ifdef SONAME_LIBJXRGLUE #define ERR JXR_ERR -#define __in_win __in -#define __out_win __out -#include +#include "JXRGlue.h" #undef ERR -#endif #include "wincodecs_private.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); -#include "wincodecs_common.h" - -#ifdef SONAME_LIBJXRGLUE -static void *libjxrglue; -static typeof(PKImageDecode_Create_WMP) *pPKImageDecode_Create_WMP; - static const struct { const WICPixelFormatGUID *format; @@ -375,7 +355,7 @@ HRESULT CDECL wmp_decoder_create(struct decoder_info *info, struct decoder **res struct wmp_decoder *This; PKImageDecode *decoder; - if (!pPKImageDecode_Create_WMP || pPKImageDecode_Create_WMP(&decoder)) return E_FAIL; + if (PKImageDecode_Create_WMP(&decoder)) return E_FAIL; This = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(*This)); if (!This) return E_OUTOFMEMORY; @@ -402,85 +382,3 @@ HRESULT CDECL wmp_decoder_create(struct decoder_info *info, struct decoder **res return S_OK; } -#endif - -static const struct win32_funcs *win32_funcs; - -HRESULT CDECL stream_getsize(IStream *stream, ULONGLONG *size) -{ - return win32_funcs->stream_getsize(stream, size); -} - -HRESULT CDECL stream_read(IStream *stream, void *buffer, ULONG read, ULONG *bytes_read) -{ - return win32_funcs->stream_read(stream, buffer, read, bytes_read); -} - -HRESULT CDECL stream_seek(IStream *stream, LONGLONG ofs, DWORD origin, ULONGLONG *new_position) -{ - return win32_funcs->stream_seek(stream, ofs, origin, new_position); -} - -HRESULT CDECL stream_write(IStream *stream, const void *buffer, ULONG write, ULONG *bytes_written) -{ - return win32_funcs->stream_write(stream, buffer, write, bytes_written); -} - -HRESULT CDECL decoder_create(const CLSID *decoder_clsid, struct decoder_info *info, struct decoder **result) -{ - if (IsEqualGUID(decoder_clsid, &CLSID_WICWmpDecoder)) -#ifdef SONAME_LIBJXRGLUE - return wmp_decoder_create(info, result); -#else - { - WARN("jxrlib support not compiled in, returning E_NOINTERFACE.\n"); - return E_NOINTERFACE; - } -#endif - - FIXME("encoder_clsid %s, info %p, result %p, stub!\n", debugstr_guid(decoder_clsid), info, result); - return E_NOTIMPL; -} - -HRESULT CDECL encoder_create(const CLSID *encoder_clsid, struct encoder_info *info, struct encoder **result) -{ - FIXME("encoder_clsid %s, info %p, result %p, stub!\n", debugstr_guid(encoder_clsid), info, result); - return E_NOTIMPL; -} - -static const struct unix_funcs unix_funcs = { - decoder_create, - decoder_initialize, - decoder_get_frame_info, - decoder_copy_pixels, - decoder_get_metadata_blocks, - decoder_get_color_context, - decoder_destroy, - encoder_create, - encoder_initialize, - encoder_get_supported_format, - encoder_create_frame, - encoder_write_lines, - encoder_commit_frame, - encoder_commit_file, - encoder_destroy -}; - -NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out ) -{ - if (reason != DLL_PROCESS_ATTACH) return STATUS_SUCCESS; - - win32_funcs = ptr_in; - -#ifdef SONAME_LIBJXRGLUE - if (!(libjxrglue = dlopen(SONAME_LIBJXRGLUE, RTLD_NOW))) - ERR("failed to load %s\n", SONAME_LIBJXRGLUE); - else if (!(pPKImageDecode_Create_WMP = dlsym(libjxrglue, "PKImageDecode_Create_WMP"))) - ERR("unable to find PKImageDecode_Create_WMP in %s!\n", SONAME_LIBJXRGLUE); -#else - ERR("jxrlib support not compiled in!\n"); -#endif - - *(const struct unix_funcs **)ptr_out = &unix_funcs; - return STATUS_SUCCESS; -} diff --git a/dlls/wmphoto/main.c b/dlls/wmphoto/main.c index 5d0ff302be3..6de6119d212 100644 --- a/dlls/wmphoto/main.c +++ b/dlls/wmphoto/main.c @@ -31,6 +31,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); +extern HRESULT CDECL wmp_decoder_create(struct decoder_info *info, struct decoder **result); + HRESULT create_instance(const CLSID *clsid, const IID *iid, void **ppv) { return CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, ppv); @@ -98,7 +100,7 @@ static HRESULT WINAPI wmp_class_factory_CreateInstance(IClassFactory *iface, IUn *out = NULL; if (outer) return CLASS_E_NOAGGREGATION; - hr = get_unix_decoder(&CLSID_WICWmpDecoder, &decoder_info, &decoder); + hr = wmp_decoder_create(&decoder_info, &decoder); if (SUCCEEDED(hr)) hr = CommonDecoder_CreateInstance(decoder, &decoder_info, iid, out); diff --git a/include/config.h.in b/include/config.h.in index 529364476c1..2a408c3e74f 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -177,9 +177,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_JPEGLIB_H -/* Define to 1 if you have the header file. */ -#undef HAVE_JXRGLUE_H - /* Define to 1 if you have the `kqueue' function. */ #undef HAVE_KQUEUE @@ -947,9 +944,6 @@ /* Define to the soname of the libjpeg library. */ #undef SONAME_LIBJPEG -/* Define to the soname of the libjxrglue library. */ -#undef SONAME_LIBJXRGLUE - /* Define to the soname of the libkrb5 library. */ #undef SONAME_LIBKRB5