From 58b5a3f6bea4403a97c29b45dd27f9cc7ebbb0a2 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Mon, 3 Aug 2009 15:48:32 +0200 Subject: [PATCH] msgsm32.acm: Implement a stub dll. --- configure | 117 ++++++++++++++++++ configure.ac | 12 ++ dlls/msgsm32.acm/Makefile.in | 12 ++ dlls/msgsm32.acm/msgsm32.acm.spec | 1 + dlls/msgsm32.acm/msgsm32.c | 198 ++++++++++++++++++++++++++++++ include/config.h.in | 6 + tools/wine.inf.in | 2 + 7 files changed, 348 insertions(+) create mode 100644 dlls/msgsm32.acm/Makefile.in create mode 100644 dlls/msgsm32.acm/msgsm32.acm.spec create mode 100644 dlls/msgsm32.acm/msgsm32.c diff --git a/configure b/configure index 246ab2b6e0c..d467088e042 100755 --- a/configure +++ b/configure @@ -826,6 +826,7 @@ with_freetype with_gphoto with_glu with_gnutls +with_libgsm with_hal with_jack with_jpeg @@ -1516,6 +1517,7 @@ Optional Packages: --without-gphoto do not use gphoto (Digital Camera support) --without-glu do not use the GLU library --without-gnutls do not use GnuTLS (schannel support) + --without-libgsm do not use libgsm (GSM 06.10 codec support) --without-hal do not use HAL (dynamic device support) --without-jack do not use the Jack sound support --without-jpeg do not use JPEG @@ -2141,6 +2143,12 @@ if test "${with_gnutls+set}" = set; then fi +# Check whether --with-libgsm was given. +if test "${with_libgsm+set}" = set; then + withval=$with_libgsm; if test "x$withval" = "xno"; then ac_cv_header_gsm_h=no; fi +fi + + # Check whether --with-hal was given. if test "${with_hal+set}" = set; then withval=$with_hal; @@ -5739,6 +5747,7 @@ done + for ac_header in \ @@ -5764,6 +5773,7 @@ for ac_header in \ fontconfig/fontconfig.h \ getopt.h \ grp.h \ + gsm.h \ ieeefp.h \ inet/mib2.h \ io.h \ @@ -16644,6 +16654,104 @@ esac fi +if test "$ac_cv_header_gsm_h" = "yes" +then + { $as_echo "$as_me:$LINENO: checking for -lgsm" >&5 +$as_echo_n "checking for -lgsm... " >&6; } +if test "${ac_cv_lib_soname_gsm+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_soname_save_LIBS=$LIBS +LIBS="-lgsm $LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 gsm_create (); +int +main () +{ +return gsm_create (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + case "$LIBEXT" in + dll) ;; + dylib) ac_cv_lib_soname_gsm=`otool -L conftest$ac_exeext | grep "libgsm\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libgsm\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; + *) ac_cv_lib_soname_gsm=`$ac_cv_path_LDD conftest$ac_exeext | grep "libgsm\\.$LIBEXT" | sed -e "s/^.*\(libgsm\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;; + esac +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_soname_save_LIBS +fi +if test "x$ac_cv_lib_soname_gsm" = "x"; then + { $as_echo "$as_me:$LINENO: result: not found" >&5 +$as_echo "not found" >&6; } + +else + { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_soname_gsm" >&5 +$as_echo "$ac_cv_lib_soname_gsm" >&6; } + +cat >>confdefs.h <<_ACEOF +#define SONAME_LIBGSM "$ac_cv_lib_soname_gsm" +_ACEOF + + +fi + +fi +if test "x$ac_cv_lib_soname_gsm" = "x"; then + case "x$with_libgsm" in + x) wine_warnings="$wine_warnings|libgsm ${notice_platform}development files not found, gsm 06.10 codec won't be supported." ;; + xno) ;; + *) { { $as_echo "$as_me:$LINENO: error: libgsm ${notice_platform}development files not found, gsm 06.10 codec won't be supported. +This is an error since --with-libgsm was requested." >&5 +$as_echo "$as_me: error: libgsm ${notice_platform}development files not found, gsm 06.10 codec won't be supported. +This is an error since --with-libgsm was requested." >&2;} + { (exit 1); exit 1; }; } ;; +esac +fi + + if test "$ac_cv_header_jpeglib_h" = "yes" then { $as_echo "$as_me:$LINENO: checking for -ljpeg" >&5 @@ -26360,6 +26468,14 @@ ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS dlls/msg711.acm/Makefile: dlls/msg711.acm/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/msg711.acm/Makefile" +ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/msgsm32.acm/Makefile" +test "x$enable_msgsm32_acm" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + msgsm32.acm" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/msgsm32.acm/Makefile: dlls/msgsm32.acm/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/msgsm32.acm/Makefile" + ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/mshtml.tlb/Makefile" test "x$enable_mshtml_tlb" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ @@ -29605,6 +29721,7 @@ do "dlls/msdmo/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msdmo/Makefile" ;; "dlls/msftedit/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msftedit/Makefile" ;; "dlls/msg711.acm/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msg711.acm/Makefile" ;; + "dlls/msgsm32.acm/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msgsm32.acm/Makefile" ;; "dlls/mshtml.tlb/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/mshtml.tlb/Makefile" ;; "dlls/mshtml/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/mshtml/Makefile" ;; "dlls/mshtml/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/mshtml/tests/Makefile" ;; diff --git a/configure.ac b/configure.ac index 505c2cead81..d8d06795dfc 100644 --- a/configure.ac +++ b/configure.ac @@ -40,6 +40,8 @@ AC_ARG_WITH(gphoto, AS_HELP_STRING([--without-gphoto],[do not use gphoto (Dig AC_ARG_WITH(glu, AS_HELP_STRING([--without-glu],[do not use the GLU library]), [if test "x$withval" = "xno"; then ac_cv_header_GL_glu_h=no; fi]) AC_ARG_WITH(gnutls, AS_HELP_STRING([--without-gnutls],[do not use GnuTLS (schannel support)])) +AC_ARG_WITH(libgsm, AS_HELP_STRING([--without-libgsm],[do not use libgsm (GSM 06.10 codec support)]), + [if test "x$withval" = "xno"; then ac_cv_header_gsm_h=no; fi]) AC_ARG_WITH(hal, AS_HELP_STRING([--without-hal],[do not use HAL (dynamic device support)])) AC_ARG_WITH(jack, AS_HELP_STRING([--without-jack],[do not use the Jack sound support]), [if test "x$withval" = "xno"; then ac_cv_header_jack_jack_h=no; fi]) @@ -286,6 +288,7 @@ AC_CHECK_HEADERS(\ fontconfig/fontconfig.h \ getopt.h \ grp.h \ + gsm.h \ ieeefp.h \ inet/mib2.h \ io.h \ @@ -1338,6 +1341,14 @@ fi WINE_WARNING_WITH(openssl,[test "x$ac_cv_lib_soname_ssl" = "x" -o "x$ac_cv_lib_soname_crypto" = "x"], [OpenSSL ${notice_platform}development files not found, SSL won't be supported.]) +dnl **** Check for gsm codec **** +if test "$ac_cv_header_gsm_h" = "yes" +then + WINE_CHECK_SONAME(gsm,gsm_create) +fi +WINE_WARNING_WITH(libgsm,[test "x$ac_cv_lib_soname_gsm" = "x"], + [libgsm ${notice_platform}development files not found, gsm 06.10 codec won't be supported.]) + dnl **** Check for libjpeg **** if test "$ac_cv_header_jpeglib_h" = "yes" then @@ -2226,6 +2237,7 @@ WINE_CONFIG_MAKEFILE([dlls/msdaps/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL WINE_CONFIG_MAKEFILE([dlls/msdmo/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/msftedit/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/msg711.acm/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/msgsm32.acm/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/mshtml.tlb/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/mshtml/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/mshtml/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) diff --git a/dlls/msgsm32.acm/Makefile.in b/dlls/msgsm32.acm/Makefile.in new file mode 100644 index 00000000000..f9b6602b3a5 --- /dev/null +++ b/dlls/msgsm32.acm/Makefile.in @@ -0,0 +1,12 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = msgsm32.acm +IMPORTS = winmm user32 kernel32 + +C_SRCS = msgsm32.c + +@MAKE_DLL_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/msgsm32.acm/msgsm32.acm.spec b/dlls/msgsm32.acm/msgsm32.acm.spec new file mode 100644 index 00000000000..9275f0dae09 --- /dev/null +++ b/dlls/msgsm32.acm/msgsm32.acm.spec @@ -0,0 +1 @@ +@ stdcall -private DriverProc(long long long long long) GSM_DriverProc diff --git a/dlls/msgsm32.acm/msgsm32.c b/dlls/msgsm32.acm/msgsm32.c new file mode 100644 index 00000000000..09dd72d4327 --- /dev/null +++ b/dlls/msgsm32.acm/msgsm32.c @@ -0,0 +1,198 @@ +/* + * GSM 06.10 codec handling + * Copyright (C) 2009 Maarten Lankhorst + * + * Based on msg711.acm + * Copyright (C) 2002 Eric Pouech + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" +#include + +#include +#include +#include + +#ifdef HAVE_GSM_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winnls.h" +#include "mmsystem.h" +#include "mmreg.h" +#include "msacm.h" +#include "msacmdrv.h" +#include "wine/library.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gsm); + +#ifdef SONAME_LIBGSM + +static void *libgsm_handle; +#define FUNCPTR(f) static typeof(f) * p##f +FUNCPTR(gsm_create); +FUNCPTR(gsm_destroy); +FUNCPTR(gsm_option); +FUNCPTR(gsm_encode); +FUNCPTR(gsm_decode); + +#define LOAD_FUNCPTR(f) \ + if((p##f = wine_dlsym(libgsm_handle, #f, NULL, 0)) == NULL) { \ + wine_dlclose(libgsm_handle, NULL, 0); \ + libgsm_handle = NULL; \ + return 0; \ + } + +/*********************************************************************** + * GSM_drvLoad + */ +static LRESULT GSM_drvLoad(void) +{ + char error[128]; + + libgsm_handle = wine_dlopen(SONAME_LIBGSM, RTLD_NOW, error, sizeof(error)); + if (libgsm_handle) + { + LOAD_FUNCPTR(gsm_create); + LOAD_FUNCPTR(gsm_destroy); + LOAD_FUNCPTR(gsm_option); + LOAD_FUNCPTR(gsm_encode); + LOAD_FUNCPTR(gsm_decode); + return 1; + } + else + { + ERR("Couldn't load " SONAME_LIBGSM ": %s\n", error); + return 0; + } +} + +/*********************************************************************** + * GSM_drvFree + */ +static LRESULT GSM_drvFree(void) +{ + if (libgsm_handle) + wine_dlclose(libgsm_handle, NULL, 0); + return 1; +} + +#else + +static LRESULT GSM_drvLoad(void) +{ + return 1; +} + +static LRESULT GSM_drvFree(void) +{ + return 1; +} + +#endif + +/*********************************************************************** + * GSM_DriverDetails + * + */ +static LRESULT GSM_DriverDetails(PACMDRIVERDETAILSW add) +{ + add->fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC; + add->fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED; + /* Details found from probing native msgsm32.acm */ + add->wMid = MM_MICROSOFT; + add->wPid = 36; + add->vdwACM = 0x3320000; + add->vdwDriver = 0x4000000; + add->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; + add->cFormatTags = 2; + add->cFilterTags = 0; + add->hicon = NULL; + MultiByteToWideChar( CP_ACP, 0, "Wine GSM 6.10", -1, + add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, "Wine GSM 6.10 libgsm codec", -1, + add->szLongName, sizeof(add->szLongName)/sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, "Brought to you by the Wine team...", -1, + add->szCopyright, sizeof(add->szCopyright)/sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, "Refer to LICENSE file", -1, + add->szLicensing, sizeof(add->szLicensing)/sizeof(WCHAR) ); + add->szFeatures[0] = 0; + return MMSYSERR_NOERROR; +} + +/************************************************************************** + * GSM_DriverProc [exported] + */ +LRESULT CALLBACK GSM_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg, + LPARAM dwParam1, LPARAM dwParam2) +{ + TRACE("(%08lx %p %04x %08lx %08lx);\n", + dwDevID, hDriv, wMsg, dwParam1, dwParam2); + + switch (wMsg) + { + case DRV_LOAD: return GSM_drvLoad(); + case DRV_FREE: return GSM_drvFree(); + case DRV_OPEN: return 1; + case DRV_CLOSE: return 1; + case DRV_ENABLE: return 1; + case DRV_DISABLE: return 1; + case DRV_QUERYCONFIGURE: return 1; + case DRV_CONFIGURE: MessageBoxA(0, "GSM 06.10 codec", "Wine Driver", MB_OK); return 1; + case DRV_INSTALL: return DRVCNF_RESTART; + case DRV_REMOVE: return DRVCNF_RESTART; + + case ACMDM_DRIVER_NOTIFY: + /* no caching from other ACM drivers is done so far */ + return MMSYSERR_NOERROR; + + case ACMDM_DRIVER_DETAILS: + return GSM_DriverDetails((PACMDRIVERDETAILSW)dwParam1); + + /* Not implemented yet */ + case ACMDM_FORMATTAG_DETAILS: + case ACMDM_FORMAT_DETAILS: + case ACMDM_FORMAT_SUGGEST: + case ACMDM_STREAM_OPEN: + case ACMDM_STREAM_CLOSE: + case ACMDM_STREAM_SIZE: + case ACMDM_STREAM_CONVERT: + return MMSYSERR_NOTSUPPORTED; + + case ACMDM_HARDWARE_WAVE_CAPS_INPUT: + case ACMDM_HARDWARE_WAVE_CAPS_OUTPUT: + /* this converter is not a hardware driver */ + case ACMDM_FILTERTAG_DETAILS: + case ACMDM_FILTER_DETAILS: + /* this converter is not a filter */ + case ACMDM_STREAM_RESET: + /* only needed for asynchronous driver... we aren't, so just say it */ + return MMSYSERR_NOTSUPPORTED; + case ACMDM_STREAM_PREPARE: + case ACMDM_STREAM_UNPREPARE: + /* nothing special to do here... so don't do anything */ + return MMSYSERR_NOERROR; + + default: + return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); + } +} diff --git a/include/config.h.in b/include/config.h.in index 6ef0892af9f..34de7d9afbe 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -234,6 +234,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_GRP_H +/* Define to 1 if you have the header file. */ +#undef HAVE_GSM_H + /* Define to 1 if you have the header file. */ #undef HAVE_HAL_LIBHAL_H @@ -1128,6 +1131,9 @@ /* Define to the soname of the libgnutls library. */ #undef SONAME_LIBGNUTLS +/* Define to the soname of the libgsm library. */ +#undef SONAME_LIBGSM + /* Define to the soname of the libhal library. */ #undef SONAME_LIBHAL diff --git a/tools/wine.inf.in b/tools/wine.inf.in index d0906d69035..7639cd4ddd2 100644 --- a/tools/wine.inf.in +++ b/tools/wine.inf.in @@ -2481,6 +2481,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,mapi32.dll 11,,msadp32.acm 11,,msg711.acm +11,,msgsm32.acm 11,,mshtml.dll 11,,msi.dll 11,,msiexec.exe @@ -2543,6 +2544,7 @@ system.ini, drivers32,,"msacm.imaadpcm=imaadp32.acm" system.ini, drivers32,,"msacm.msadpcm=msadp32.acm" system.ini, drivers32,,"msacm.msg711=msg711.acm" system.ini, drivers32,,"msacm.winemp3=winemp3.acm" +system.ini, drivers32,,"msacm.msgsm610=msgsm32.acm" system.ini, drivers32,,"vidc.mrle=msrle32.dll" system.ini, drivers32,,"vidc.msvc=msvidc32.dll" system.ini, drivers32,,"vidc.cvid=iccvid.dll"