msgsm32.acm: Use the bundled gsm codec and build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-10-20 11:46:12 +02:00
parent 116ea9cec4
commit 0e7fd41af9
5 changed files with 16 additions and 193 deletions

78
configure vendored
View File

@ -864,7 +864,6 @@ with_gettext
with_gettextpo
with_gphoto
with_gnutls
with_gsm
with_gssapi
with_gstreamer
with_hal
@ -2653,7 +2652,6 @@ Optional Packages:
--with-gettextpo use the GetTextPO library to rebuild po files
--without-gphoto do not use gphoto (Digital Camera support)
--without-gnutls do not use GnuTLS (schannel support)
--without-gsm do not use libgsm (GSM 06.10 codec support)
--without-gssapi do not use GSSAPI (Kerberos SSP support)
--without-gstreamer do not use GStreamer (codecs support)
--without-hal do not use HAL (dynamic device support)
@ -4078,12 +4076,6 @@ if test "${with_gnutls+set}" = set; then :
fi
# Check whether --with-gsm was given.
if test "${with_gsm+set}" = set; then :
withval=$with_gsm; if test "x$withval" = "xno"; then ac_cv_header_gsm_h=no; ac_cv_header_gsm_gsm_h=no; fi
fi
# Check whether --with-gssapi was given.
if test "${with_gssapi+set}" = set; then :
withval=$with_gssapi;
@ -7482,8 +7474,6 @@ for ac_header in \
elf.h \
float.h \
gettext-po.h \
gsm.h \
gsm/gsm.h \
ieeefp.h \
libproc.h \
link.h \
@ -15083,74 +15073,6 @@ esac
fi
if test "$ac_cv_header_gsm_h" = "yes" -o "$ac_cv_header_gsm_gsm_h" = "yes"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lgsm" >&5
$as_echo_n "checking for -lgsm... " >&6; }
if ${ac_cv_lib_soname_gsm+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_soname_save_LIBS=$LIBS
LIBS="-lgsm $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 gsm_create ();
int
main ()
{
return gsm_create ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
case "$LIBEXT" in
dll) ac_cv_lib_soname_gsm=`$ac_cv_path_LDD conftest.exe | grep "gsm" | sed -e "s/dll.*/dll/"';2,$d'` ;;
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=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libgsm\\.$LIBEXT" | sed -e "s/^.*\\[\\(libgsm\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
if ${ac_cv_lib_soname_gsm:+false} :; then :
ac_cv_lib_soname_gsm=`$LDD conftest$ac_exeext | grep "libgsm\\.$LIBEXT" | sed -e "s/^.*\(libgsm\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
fi ;;
esac
else
ac_cv_lib_soname_gsm=
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_gsm:+false} :; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$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_gsm" in
x) as_fn_append wine_notices "|libgsm ${notice_platform}development files not found, gsm 06.10 codec won't be supported." ;;
xno) ;;
*) as_fn_error $? "libgsm ${notice_platform}development files not found, gsm 06.10 codec won't be supported.
This is an error since --with-gsm was requested." "$LINENO" 5 ;;
esac
fi
if test "x$with_krb5" != "xno"
then
if ${KRB5_CFLAGS:+false} :; then :

View File

@ -51,8 +51,6 @@ AC_ARG_WITH(gettextpo, AS_HELP_STRING([--with-gettextpo],[use the GetTextPO libr
[if test "x$withval" = "xno"; then ac_cv_header_gettext_po_h=no; fi])
AC_ARG_WITH(gphoto, AS_HELP_STRING([--without-gphoto],[do not use gphoto (Digital Camera support)]))
AC_ARG_WITH(gnutls, AS_HELP_STRING([--without-gnutls],[do not use GnuTLS (schannel support)]))
AC_ARG_WITH(gsm, AS_HELP_STRING([--without-gsm],[do not use libgsm (GSM 06.10 codec support)]),
[if test "x$withval" = "xno"; then ac_cv_header_gsm_h=no; ac_cv_header_gsm_gsm_h=no; fi])
AC_ARG_WITH(gssapi, AS_HELP_STRING([--without-gssapi],[do not use GSSAPI (Kerberos SSP support)]))
AC_ARG_WITH(gstreamer, AS_HELP_STRING([--without-gstreamer],[do not use GStreamer (codecs support)]))
AC_ARG_WITH(hal, AS_HELP_STRING([--without-hal],[do not use HAL (dynamic device support)]))
@ -444,8 +442,6 @@ AC_CHECK_HEADERS(\
elf.h \
float.h \
gettext-po.h \
gsm.h \
gsm/gsm.h \
ieeefp.h \
libproc.h \
link.h \
@ -1675,14 +1671,6 @@ fi
WINE_NOTICE_WITH(fontconfig,[test "x$ac_cv_lib_soname_fontconfig" = "x"],
[fontconfig ${notice_platform}development files not found, fontconfig won't be supported.])
dnl **** Check for gsm codec ****
if test "$ac_cv_header_gsm_h" = "yes" -o "$ac_cv_header_gsm_gsm_h" = "yes"
then
WINE_CHECK_SONAME(gsm,gsm_create)
fi
WINE_NOTICE_WITH(gsm,[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 krb5 ****
if test "x$with_krb5" != "xno"
then

View File

@ -1,6 +1,5 @@
MODULE = msgsm32.acm
IMPORTS = winmm user32
EXTRADLLFLAGS = -mcygwin
IMPORTS = $(GSM_PE_LIBS) winmm user32
EXTRAINCL = $(GSM_PE_CFLAGS)
C_SRCS = msgsm32.c

View File

@ -20,18 +20,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <wine/port.h>
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#ifdef HAVE_GSM_GSM_H
#include <gsm/gsm.h>
#elif defined(HAVE_GSM_H)
#include <gsm.h>
#endif
#include "windef.h"
#include "winbase.h"
@ -46,63 +39,6 @@
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 = dlsym(libgsm_handle, #f)) == NULL) { \
dlclose(libgsm_handle); \
libgsm_handle = NULL; \
return FALSE; \
}
/***********************************************************************
* GSM_drvLoad
*/
static BOOL GSM_drvLoad(void)
{
libgsm_handle = dlopen(SONAME_LIBGSM, RTLD_NOW);
if (libgsm_handle)
{
LOAD_FUNCPTR(gsm_create);
LOAD_FUNCPTR(gsm_destroy);
LOAD_FUNCPTR(gsm_option);
LOAD_FUNCPTR(gsm_encode);
LOAD_FUNCPTR(gsm_decode);
return TRUE;
}
else
{
ERR("Couldn't load " SONAME_LIBGSM ": %s\n", dlerror());
return FALSE;
}
}
/***********************************************************************
* GSM_drvFree
*/
static LRESULT GSM_drvFree(void)
{
if (libgsm_handle)
dlclose(libgsm_handle);
return 1;
}
#else
static LRESULT GSM_drvFree(void)
{
return 1;
}
#endif
/***********************************************************************
* GSM_DriverDetails
@ -355,7 +291,6 @@ static LRESULT GSM_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
return MMSYSERR_NOERROR;
}
#ifdef SONAME_LIBGSM
/***********************************************************************
* GSM_StreamOpen
*
@ -373,16 +308,14 @@ static LRESULT GSM_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
if (adsi->pwfxSrc->nSamplesPerSec != adsi->pwfxDst->nSamplesPerSec)
return MMSYSERR_NOTSUPPORTED;
if (!GSM_drvLoad()) return MMSYSERR_NOTSUPPORTED;
r = pgsm_create();
r = gsm_create();
if (!r)
return MMSYSERR_NOMEM;
if (pgsm_option(r, GSM_OPT_WAV49, &used) < 0)
if (gsm_option(r, GSM_OPT_WAV49, &used) < 0)
{
FIXME("Your libgsm library doesn't support GSM_OPT_WAV49\n");
FIXME("Please recompile libgsm with WAV49 support\n");
pgsm_destroy(r);
gsm_destroy(r);
return MMSYSERR_NOTSUPPORTED;
}
adsi->dwDriver = (DWORD_PTR)r;
@ -395,7 +328,7 @@ static LRESULT GSM_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
*/
static LRESULT GSM_StreamClose(PACMDRVSTREAMINSTANCE adsi)
{
pgsm_destroy((gsm)adsi->dwDriver);
gsm_destroy((gsm)adsi->dwDriver);
return MMSYSERR_NOERROR;
}
@ -469,7 +402,7 @@ static LRESULT GSM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER
}
/* Reset the index to 0, just to be sure */
pgsm_option(r, GSM_OPT_FRAME_INDEX, &odd);
gsm_option(r, GSM_OPT_FRAME_INDEX, &odd);
/* The native ms codec writes 65 bytes, and this requires 2 libgsm calls.
* First 32 bytes are written, or 33 bytes read
@ -487,12 +420,12 @@ static LRESULT GSM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER
while (nsrc + 65 <= adsh->cbSrcLength)
{
/* Decode data */
if (pgsm_decode(r, src + nsrc, (gsm_signal*)(dst + ndst)) < 0)
if (gsm_decode(r, src + nsrc, (gsm_signal*)(dst + ndst)) < 0)
FIXME("Couldn't decode data\n");
ndst += 320;
nsrc += 33;
if (pgsm_decode(r, src + nsrc, (gsm_signal*)(dst + ndst)) < 0)
if (gsm_decode(r, src + nsrc, (gsm_signal*)(dst + ndst)) < 0)
FIXME("Couldn't decode data\n");
ndst += 320;
nsrc += 32;
@ -516,10 +449,10 @@ static LRESULT GSM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER
while (nsrc + 640 <= adsh->cbSrcLength)
{
/* Encode data */
pgsm_encode(r, (gsm_signal*)(src+nsrc), dst+ndst);
gsm_encode(r, (gsm_signal*)(src+nsrc), dst+ndst);
nsrc += 320;
ndst += 32;
pgsm_encode(r, (gsm_signal*)(src+nsrc), dst+ndst);
gsm_encode(r, (gsm_signal*)(src+nsrc), dst+ndst);
nsrc += 320;
ndst += 33;
}
@ -533,25 +466,25 @@ static LRESULT GSM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER
if (todo > 320)
{
pgsm_encode(r, (gsm_signal*)(src+nsrc), dst+ndst);
gsm_encode(r, (gsm_signal*)(src+nsrc), dst+ndst);
ndst += 32;
todo -= 320;
nsrc += 320;
memcpy(emptiness, src+nsrc, todo);
memset(emptiness + todo, 0, 320 - todo);
pgsm_encode(r, (gsm_signal*)emptiness, dst+ndst);
gsm_encode(r, (gsm_signal*)emptiness, dst+ndst);
ndst += 33;
}
else
{
memcpy(emptiness, src+nsrc, todo);
memset(emptiness + todo, 0, 320 - todo);
pgsm_encode(r, (gsm_signal*)emptiness, dst+ndst);
gsm_encode(r, (gsm_signal*)emptiness, dst+ndst);
ndst += 32;
memset(emptiness, 0, todo);
pgsm_encode(r, (gsm_signal*)emptiness, dst+ndst);
gsm_encode(r, (gsm_signal*)emptiness, dst+ndst);
ndst += 33;
}
nsrc = adsh->cbSrcLength;
@ -564,8 +497,6 @@ static LRESULT GSM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER
return MMSYSERR_NOERROR;
}
#endif
/**************************************************************************
* GSM_DriverProc [exported]
*/
@ -578,7 +509,7 @@ LRESULT CALLBACK GSM_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
switch (wMsg)
{
case DRV_LOAD: return 1;
case DRV_FREE: return GSM_drvFree();
case DRV_FREE: return 1;
case DRV_OPEN: return 1;
case DRV_CLOSE: return 1;
case DRV_ENABLE: return 1;
@ -604,7 +535,6 @@ LRESULT CALLBACK GSM_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
case ACMDM_FORMAT_SUGGEST:
return GSM_FormatSuggest((PACMDRVFORMATSUGGEST)dwParam1);
#ifdef SONAME_LIBGSM
case ACMDM_STREAM_OPEN:
return GSM_StreamOpen((PACMDRVSTREAMINSTANCE)dwParam1);
@ -616,13 +546,6 @@ LRESULT CALLBACK GSM_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
case ACMDM_STREAM_CONVERT:
return GSM_StreamConvert((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMHEADER)dwParam2);
#else
case ACMDM_STREAM_OPEN: WARN("libgsm support not compiled in!\n");
case ACMDM_STREAM_CLOSE:
case ACMDM_STREAM_SIZE:
case ACMDM_STREAM_CONVERT:
return MMSYSERR_NOTSUPPORTED;
#endif
case ACMDM_HARDWARE_WAVE_CAPS_INPUT:
case ACMDM_HARDWARE_WAVE_CAPS_OUTPUT:

View File

@ -141,12 +141,6 @@
/* Define if we have the libgphoto2_port development environment */
#undef HAVE_GPHOTO2_PORT
/* Define to 1 if you have the <gsm/gsm.h> header file. */
#undef HAVE_GSM_GSM_H
/* Define to 1 if you have the <gsm.h> header file. */
#undef HAVE_GSM_H
/* Define to 1 if you have the <gssapi/gssapi_ext.h> header file. */
#undef HAVE_GSSAPI_GSSAPI_EXT_H
@ -944,9 +938,6 @@
/* 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 libgssapi_krb5 library. */
#undef SONAME_LIBGSSAPI_KRB5