acm: Port to MinGW

Fixes bug #573595.
This commit is contained in:
Руслан Ижбулатов 2009-03-26 11:37:28 +01:00 committed by Sebastian Dröge
parent f5b298e3d7
commit 7ff9bdb456
5 changed files with 26 additions and 17 deletions

View file

@ -1365,7 +1365,10 @@ translit(dnm, m, l) AM_CONDITIONAL(USE_ACM, true)
AG_GST_CHECK_FEATURE(ACM, [Windows ACM library], acm, [
AC_MSG_CHECKING([Checking for ACM support])
AC_CHECK_HEADERS([windows.h msacm.h],
[HAVE_ACM="yes"], [HAVE_ACM="no"])
[HAVE_ACM="yes"
AC_SUBST(ACMENC_CFLAGS)
AC_SUBST(ACMMP3DEC_CFLAGS)
], [HAVE_ACM="no"])
])
else

View file

@ -2,7 +2,7 @@ plugin_LTLIBRARIES = libgstacmencsink.la
libgstacmencsink_la_SOURCES = acmenc.c
libgstacmencsink_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS)
$(GST_PLUGINS_BASE_CFLAGS) $(ACMENC_CFLAGS)
libgstacmencsink_la_LIBADD = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) \
-lgstriff-$(GST_MAJORMINOR) -lmsacm32
libgstacmencsink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)

View file

@ -231,7 +231,7 @@ acmenc_setup (ACMEnc * enc)
enc->header.dwSrcUser = 0;
/* Ask what buffer size we need to use for our output */
acmStreamSize (enc->stream, ACM_BUFFER_SIZE, &destBufferSize,
acmStreamSize (enc->stream, ACM_BUFFER_SIZE, (LPDWORD) & destBufferSize,
ACM_STREAMSIZEF_SOURCE);
enc->header.pbDst = (BYTE *) g_malloc (destBufferSize);
enc->header.cbDstLength = destBufferSize;
@ -484,8 +484,12 @@ acmenc_base_init (ACMEncClass * klass)
if (res) {
GST_WARNING ("Could not get driver details: %d", res);
}
shortname = g_utf16_to_utf8 (driverdetails.szShortName, -1, NULL, NULL, NULL);
longname = g_utf16_to_utf8 (driverdetails.szLongName, -1, NULL, NULL, NULL);
shortname =
g_utf16_to_utf8 ((gunichar2 *) driverdetails.szShortName, -1, NULL, NULL,
NULL);
longname =
g_utf16_to_utf8 ((gunichar2 *) driverdetails.szLongName, -1, NULL, NULL,
NULL);
details.longname = g_strdup_printf ("ACM Encoder: %s", (shortname
&& *shortname) ? shortname : params->name);
details.klass = "Codec/Encoder/Audio";
@ -503,13 +507,12 @@ acmenc_base_init (ACMEncClass * klass)
static ACMEncParams *
acmenc_open_driver (wchar_t * filename)
{
HACMDRIVER driver = NULL;
HACMDRIVERID driverid = NULL;
HMODULE mod = NULL;
FARPROC func;
MMRESULT res;
ACMEncParams *params;
mod = LoadLibrary (filename);
mod = LoadLibraryW (filename);
if (!mod) {
GST_WARNING ("Failed to load ACM");
goto done;
@ -581,22 +584,24 @@ acmenc_register (GstPlugin * plugin)
{
int res;
wchar_t dirname[1024];
WIN32_FIND_DATA filedata;
WIN32_FIND_DATAW filedata;
HANDLE find;
res = GetSystemDirectory (dirname, sizeof (dirname) / sizeof (wchar_t));
res = GetSystemDirectoryW (dirname, sizeof (dirname) / sizeof (wchar_t));
if (!res || res > 1000) {
GST_WARNING ("Couldn't get system directory");
return FALSE;
}
wcscat (dirname, L"\\*.acm");
find = FindFirstFile (dirname, &filedata);
find = FindFirstFileW (dirname, &filedata);
if (find == INVALID_HANDLE_VALUE) {
GST_WARNING ("Failed to find ACM files: %x", GetLastError ());
return FALSE;
}
do {
char *filename = g_utf16_to_utf8 (filedata.cFileName, -1, NULL, NULL, NULL);
char *filename =
g_utf16_to_utf8 ((gunichar2 *) filedata.cFileName, -1, NULL, NULL,
NULL);
GST_INFO ("Registering ACM filter from file %s", filename);
if (acmenc_register_file (plugin, filedata.cFileName))
GST_INFO ("Loading filter from ACM '%s' succeeded", filename);
@ -604,7 +609,7 @@ acmenc_register (GstPlugin * plugin)
else
GST_WARNING ("Loading filter from ACM '%s' failed", filename);
g_free (filename);
} while (FindNextFile (find, &filedata));
} while (FindNextFileW (find, &filedata));
FindClose (find);
return TRUE;
}

View file

@ -2,7 +2,7 @@ plugin_LTLIBRARIES = libgstacmmp3dec.la
libgstacmmp3dec_la_SOURCES = acmmp3dec.c
libgstacmmp3dec_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS)
$(GST_PLUGINS_BASE_CFLAGS) $(ACMMP3DEC_CFLAGS)
libgstacmmp3dec_la_LIBADD = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) \
-lgstriff-$(GST_MAJORMINOR) -lmsacm32
libgstacmmp3dec_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(DIRECTSOUND_LDFLAGS)

View file

@ -153,8 +153,9 @@ acmmp3dec_setup (ACMMP3Dec * dec)
acmmp3dec_set_input_format (dec);
acmmp3dec_set_output_format (dec);
res = acmStreamOpen (&dec->stream, NULL, &dec->infmt, &dec->outfmt,
0, 0, 0, 0);
res =
acmStreamOpen (&dec->stream, NULL, (LPWAVEFORMATEX) & dec->infmt,
&dec->outfmt, 0, 0, 0, 0);
if (res) {
GST_WARNING_OBJECT (dec, "Failed to open ACM stream: %d", res);
return FALSE;
@ -171,7 +172,7 @@ acmmp3dec_setup (ACMMP3Dec * dec)
/* Ask what buffer size we need to use for our output */
acmStreamSize (dec->stream, ACM_BUFFER_SIZE,
&destBufferSize, ACM_STREAMSIZEF_SOURCE);
(LPDWORD) & destBufferSize, ACM_STREAMSIZEF_SOURCE);
dec->header.pbDst = (BYTE *) g_malloc (destBufferSize);
dec->header.cbDstLength = destBufferSize;
@ -404,7 +405,7 @@ acmmp3dec_class_init (ACMMP3DecClass * klass)
}
static void
acmmp3dec_base_init (ACMMP3DecClass * klass)
acmmp3dec_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);