1998-10-11 19:00:29 +02:00
|
|
|
/*
|
|
|
|
* MSACM32 library
|
|
|
|
*
|
|
|
|
* Copyright 1998 Patrik Stridvall
|
2000-08-26 06:33:00 +02:00
|
|
|
* 2000 Eric Pouech
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2001-01-26 21:43:40 +01:00
|
|
|
#include <string.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
1999-02-17 14:51:06 +01:00
|
|
|
#include "winbase.h"
|
2000-11-28 23:40:56 +01:00
|
|
|
#include "winnls.h"
|
1998-10-11 19:00:29 +02:00
|
|
|
#include "winerror.h"
|
2000-08-26 06:33:00 +02:00
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
2000-11-28 23:40:56 +01:00
|
|
|
#include "wine/unicode.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1998-10-11 19:00:29 +02:00
|
|
|
#include "mmsystem.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "mmreg.h"
|
1998-10-11 19:00:29 +02:00
|
|
|
#include "msacm.h"
|
|
|
|
#include "msacmdrv.h"
|
2000-08-26 06:33:00 +02:00
|
|
|
#include "wineacm.h"
|
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msacm);
|
2000-08-26 06:33:00 +02:00
|
|
|
|
|
|
|
struct MSACM_FillFormatData {
|
|
|
|
HWND hWnd;
|
|
|
|
#define WINE_ACMFF_TAG 0
|
|
|
|
#define WINE_ACMFF_FORMAT 1
|
|
|
|
#define WINE_ACMFF_WFX 2
|
|
|
|
int mode;
|
2012-08-12 10:03:41 +02:00
|
|
|
WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
|
|
|
|
PACMFORMATCHOOSEW afc;
|
2000-08-26 06:33:00 +02:00
|
|
|
DWORD ret;
|
|
|
|
};
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
|
2012-08-12 10:03:41 +02:00
|
|
|
PACMFORMATTAGDETAILSW paftd,
|
2009-02-05 09:52:31 +01:00
|
|
|
DWORD_PTR dwInstance,
|
|
|
|
DWORD fdwSupport)
|
2000-08-26 06:33:00 +02:00
|
|
|
{
|
|
|
|
struct MSACM_FillFormatData* affd = (struct MSACM_FillFormatData*)dwInstance;
|
|
|
|
|
|
|
|
switch (affd->mode) {
|
|
|
|
case WINE_ACMFF_TAG:
|
2012-08-12 10:03:41 +02:00
|
|
|
if (SendDlgItemMessageW(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
|
2009-02-17 22:36:06 +01:00
|
|
|
CB_FINDSTRINGEXACT, -1,
|
|
|
|
(LPARAM)paftd->szFormatTag) == CB_ERR)
|
2012-08-12 10:03:41 +02:00
|
|
|
SendDlgItemMessageW(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
|
2009-02-17 22:36:06 +01:00
|
|
|
CB_ADDSTRING, 0, (LPARAM)paftd->szFormatTag);
|
2000-08-26 06:33:00 +02:00
|
|
|
break;
|
|
|
|
case WINE_ACMFF_FORMAT:
|
2012-08-12 10:03:41 +02:00
|
|
|
if (strcmpW(affd->szFormatTag, paftd->szFormatTag) == 0) {
|
2000-08-26 06:33:00 +02:00
|
|
|
HACMDRIVER had;
|
1998-10-11 19:00:29 +02:00
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) {
|
2012-08-12 10:03:41 +02:00
|
|
|
ACMFORMATDETAILSW afd;
|
|
|
|
unsigned int i, len;
|
2000-08-26 06:33:00 +02:00
|
|
|
MMRESULT mmr;
|
2012-08-12 10:03:41 +02:00
|
|
|
WCHAR buffer[ACMFORMATDETAILS_FORMAT_CHARS+16];
|
2000-08-26 06:33:00 +02:00
|
|
|
|
|
|
|
afd.cbStruct = sizeof(afd);
|
|
|
|
afd.dwFormatTag = paftd->dwFormatTag;
|
2001-04-23 20:14:41 +02:00
|
|
|
afd.pwfx = HeapAlloc(MSACM_hHeap, 0, paftd->cbFormatSize);
|
|
|
|
if (!afd.pwfx) return FALSE;
|
2000-08-26 06:33:00 +02:00
|
|
|
afd.pwfx->wFormatTag = paftd->dwFormatTag;
|
|
|
|
afd.pwfx->cbSize = paftd->cbFormatSize;
|
|
|
|
afd.cbwfx = paftd->cbFormatSize;
|
|
|
|
|
|
|
|
for (i = 0; i < paftd->cStandardFormats; i++) {
|
2012-08-12 10:03:41 +02:00
|
|
|
static const WCHAR fmtW[] = {'%','d',' ','K','o','/','s','\0'};
|
|
|
|
int j;
|
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
afd.dwFormatIndex = i;
|
2012-08-12 10:03:41 +02:00
|
|
|
mmr = acmFormatDetailsW(had, &afd, ACM_FORMATDETAILSF_INDEX);
|
2000-08-26 06:33:00 +02:00
|
|
|
if (mmr == MMSYSERR_NOERROR) {
|
2012-08-12 10:03:41 +02:00
|
|
|
lstrcpynW(buffer, afd.szFormat, ACMFORMATTAGDETAILS_FORMATTAG_CHARS + 1);
|
|
|
|
len = strlenW(buffer);
|
|
|
|
for (j = len; j < ACMFORMATTAGDETAILS_FORMATTAG_CHARS; j++)
|
|
|
|
buffer[j] = ' ';
|
|
|
|
wsprintfW(buffer + ACMFORMATTAGDETAILS_FORMATTAG_CHARS,
|
|
|
|
fmtW, (afd.pwfx->nAvgBytesPerSec + 512) / 1024);
|
|
|
|
SendDlgItemMessageW(affd->hWnd,
|
|
|
|
IDD_ACMFORMATCHOOSE_CMB_FORMAT,
|
|
|
|
CB_ADDSTRING, 0, (LPARAM)buffer);
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
acmDriverClose(had, 0);
|
2012-08-12 10:03:41 +02:00
|
|
|
SendDlgItemMessageW(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT,
|
2000-08-26 06:33:00 +02:00
|
|
|
CB_SETCURSEL, 0, 0);
|
2001-04-23 20:14:41 +02:00
|
|
|
HeapFree(MSACM_hHeap, 0, afd.pwfx);
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WINE_ACMFF_WFX:
|
2012-08-12 10:03:41 +02:00
|
|
|
if (strcmpW(affd->szFormatTag, paftd->szFormatTag) == 0) {
|
2000-08-26 06:33:00 +02:00
|
|
|
HACMDRIVER had;
|
|
|
|
|
|
|
|
if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) {
|
2012-08-12 10:03:41 +02:00
|
|
|
ACMFORMATDETAILSW afd;
|
2000-08-26 06:33:00 +02:00
|
|
|
|
|
|
|
afd.cbStruct = sizeof(afd);
|
|
|
|
afd.dwFormatTag = paftd->dwFormatTag;
|
|
|
|
afd.pwfx = affd->afc->pwfx;
|
|
|
|
afd.cbwfx = affd->afc->cbwfx;
|
|
|
|
|
2012-08-12 10:03:41 +02:00
|
|
|
afd.dwFormatIndex = SendDlgItemMessageW(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT,
|
2002-06-01 01:06:46 +02:00
|
|
|
CB_GETCURSEL, 0, 0);
|
2012-08-12 10:03:41 +02:00
|
|
|
affd->ret = acmFormatDetailsW(had, &afd, ACM_FORMATDETAILSF_INDEX);
|
2000-08-26 06:33:00 +02:00
|
|
|
acmDriverClose(had, 0);
|
|
|
|
return TRUE;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("Unknown mode (%d)\n", affd->mode);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL MSACM_FillFormatTags(HWND hWnd)
|
|
|
|
{
|
2012-08-12 10:03:41 +02:00
|
|
|
ACMFORMATTAGDETAILSW aftd;
|
2000-08-26 06:33:00 +02:00
|
|
|
struct MSACM_FillFormatData affd;
|
|
|
|
|
|
|
|
memset(&aftd, 0, sizeof(aftd));
|
|
|
|
aftd.cbStruct = sizeof(aftd);
|
|
|
|
|
|
|
|
affd.hWnd = hWnd;
|
|
|
|
affd.mode = WINE_ACMFF_TAG;
|
|
|
|
|
2012-08-12 10:03:41 +02:00
|
|
|
acmFormatTagEnumW(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD_PTR)&affd, 0);
|
|
|
|
SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, CB_SETCURSEL, 0, 0);
|
2000-08-26 06:33:00 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL MSACM_FillFormat(HWND hWnd)
|
|
|
|
{
|
2012-08-12 10:03:41 +02:00
|
|
|
ACMFORMATTAGDETAILSW aftd;
|
2000-08-26 06:33:00 +02:00
|
|
|
struct MSACM_FillFormatData affd;
|
|
|
|
|
2012-08-12 10:03:41 +02:00
|
|
|
SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_RESETCONTENT, 0, 0);
|
2000-08-26 06:33:00 +02:00
|
|
|
|
|
|
|
memset(&aftd, 0, sizeof(aftd));
|
|
|
|
aftd.cbStruct = sizeof(aftd);
|
|
|
|
|
|
|
|
affd.hWnd = hWnd;
|
|
|
|
affd.mode = WINE_ACMFF_FORMAT;
|
2012-08-12 10:03:41 +02:00
|
|
|
SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
|
2000-08-26 06:33:00 +02:00
|
|
|
CB_GETLBTEXT,
|
2012-08-12 10:03:41 +02:00
|
|
|
SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
|
2000-08-26 06:33:00 +02:00
|
|
|
CB_GETCURSEL, 0, 0),
|
2009-02-17 22:36:06 +01:00
|
|
|
(LPARAM)affd.szFormatTag);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2012-08-12 10:03:41 +02:00
|
|
|
acmFormatTagEnumW(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD_PTR)&affd, 0);
|
|
|
|
SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_SETCURSEL, 0, 0);
|
2000-08-26 06:33:00 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-08-12 10:03:41 +02:00
|
|
|
static MMRESULT MSACM_GetWFX(HWND hWnd, PACMFORMATCHOOSEW afc)
|
2000-08-26 06:33:00 +02:00
|
|
|
{
|
2012-08-12 10:03:41 +02:00
|
|
|
ACMFORMATTAGDETAILSW aftd;
|
2000-08-26 06:33:00 +02:00
|
|
|
struct MSACM_FillFormatData affd;
|
|
|
|
|
|
|
|
memset(&aftd, 0, sizeof(aftd));
|
|
|
|
aftd.cbStruct = sizeof(aftd);
|
|
|
|
|
|
|
|
affd.hWnd = hWnd;
|
|
|
|
affd.mode = WINE_ACMFF_WFX;
|
|
|
|
affd.afc = afc;
|
|
|
|
affd.ret = MMSYSERR_NOERROR;
|
2012-08-12 10:03:41 +02:00
|
|
|
SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
|
2001-12-04 20:39:54 +01:00
|
|
|
CB_GETLBTEXT,
|
2012-08-12 10:03:41 +02:00
|
|
|
SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
|
2001-12-04 20:39:54 +01:00
|
|
|
CB_GETCURSEL, 0, 0),
|
2009-02-17 22:36:06 +01:00
|
|
|
(LPARAM)affd.szFormatTag);
|
2000-08-26 06:33:00 +02:00
|
|
|
|
2012-08-12 10:03:41 +02:00
|
|
|
acmFormatTagEnumW(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD_PTR)&affd, 0);
|
2000-08-26 06:33:00 +02:00
|
|
|
return affd.ret;
|
|
|
|
}
|
|
|
|
|
2012-08-12 10:03:41 +02:00
|
|
|
static const WCHAR fmt_prop[] = {'a','c','m','p','r','o','p','\0'};
|
2012-08-12 10:03:35 +02:00
|
|
|
|
2002-10-31 02:04:39 +01:00
|
|
|
static INT_PTR CALLBACK FormatChooseDlgProc(HWND hWnd, UINT msg,
|
2012-08-12 10:03:35 +02:00
|
|
|
WPARAM wParam, LPARAM lParam)
|
2000-08-26 06:33:00 +02:00
|
|
|
{
|
2012-08-12 10:03:41 +02:00
|
|
|
PACMFORMATCHOOSEW afc = (PACMFORMATCHOOSEW)GetPropW(hWnd, fmt_prop);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2012-08-12 10:03:41 +02:00
|
|
|
TRACE("hwnd=%p msg=%i 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
switch (msg) {
|
|
|
|
case WM_INITDIALOG:
|
2012-08-12 10:03:41 +02:00
|
|
|
afc = (PACMFORMATCHOOSEW)lParam;
|
|
|
|
SetPropW(hWnd, fmt_prop, (HANDLE)afc);
|
2000-08-26 06:33:00 +02:00
|
|
|
MSACM_FillFormatTags(hWnd);
|
|
|
|
MSACM_FillFormat(hWnd);
|
|
|
|
if ((afc->fdwStyle & ~(ACMFORMATCHOOSE_STYLEF_CONTEXTHELP|
|
2012-08-12 10:03:46 +02:00
|
|
|
ACMFORMATCHOOSE_STYLEF_SHOWHELP|
|
|
|
|
ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE|
|
|
|
|
ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE)) != 0)
|
2012-08-12 10:03:35 +02:00
|
|
|
FIXME("Unsupported style %08x\n", afc->fdwStyle);
|
2000-08-26 06:33:00 +02:00
|
|
|
if (!(afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP))
|
|
|
|
ShowWindow(GetDlgItem(hWnd, IDD_ACMFORMATCHOOSE_BTN_HELP), SW_HIDE);
|
|
|
|
return TRUE;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wParam)) {
|
|
|
|
case IDOK:
|
|
|
|
EndDialog(hWnd, MSACM_GetWFX(hWnd, afc));
|
|
|
|
return TRUE;
|
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog(hWnd, ACMERR_CANCELED);
|
|
|
|
return TRUE;
|
|
|
|
case IDD_ACMFORMATCHOOSE_CMB_FORMATTAG:
|
|
|
|
switch (HIWORD(wParam)) {
|
|
|
|
case CBN_SELCHANGE:
|
|
|
|
MSACM_FillFormat(hWnd);
|
|
|
|
break;
|
|
|
|
default:
|
2002-06-01 01:06:46 +02:00
|
|
|
TRACE("Dropped dlgNotif (fmtTag): 0x%08x 0x%08lx\n",
|
2000-08-26 06:33:00 +02:00
|
|
|
HIWORD(wParam), lParam);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDD_ACMFORMATCHOOSE_BTN_HELP:
|
|
|
|
if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP)
|
2012-08-12 10:03:41 +02:00
|
|
|
SendMessageW(afc->hwndOwner,
|
|
|
|
RegisterWindowMessageW(ACMHELPMSGSTRINGW), 0L, 0L);
|
2000-08-26 06:33:00 +02:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
default:
|
2002-06-01 01:06:46 +02:00
|
|
|
TRACE("Dropped dlgCmd: ctl=%d ntf=0x%04x 0x%08lx\n",
|
2000-08-26 06:33:00 +02:00
|
|
|
LOWORD(wParam), HIWORD(wParam), lParam);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_CONTEXTMENU:
|
|
|
|
if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_CONTEXTHELP)
|
2012-08-12 10:03:41 +02:00
|
|
|
SendMessageW(afc->hwndOwner,
|
|
|
|
RegisterWindowMessageW(ACMHELPMSGCONTEXTMENUW),
|
2000-08-26 06:33:00 +02:00
|
|
|
wParam, lParam);
|
|
|
|
break;
|
|
|
|
#if defined(WM_CONTEXTHELP)
|
|
|
|
case WM_CONTEXTHELP:
|
|
|
|
if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_CONTEXTHELP)
|
2012-08-12 10:03:41 +02:00
|
|
|
SendMessageW(afc->hwndOwner,
|
|
|
|
RegisterWindowMessageW(ACMHELPMSGCONTEXTHELPW),
|
2000-08-26 06:33:00 +02:00
|
|
|
wParam, lParam);
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
#endif
|
2000-08-26 06:33:00 +02:00
|
|
|
default:
|
2007-05-24 16:41:17 +02:00
|
|
|
TRACE("Dropped dlgMsg: hwnd=%p msg=%i 0x%08lx 0x%08lx\n",
|
2000-08-26 06:33:00 +02:00
|
|
|
hWnd, msg, wParam, lParam );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
1999-04-19 16:56:29 +02:00
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmFormatChooseA (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2000-08-26 06:33:00 +02:00
|
|
|
MMRESULT WINAPI acmFormatChooseA(PACMFORMATCHOOSEA pafmtc)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2012-08-12 10:03:41 +02:00
|
|
|
ACMFORMATCHOOSEW afcw;
|
|
|
|
MMRESULT ret;
|
|
|
|
LPWSTR title = NULL;
|
|
|
|
LPWSTR name = NULL;
|
|
|
|
LPWSTR templ = NULL;
|
|
|
|
DWORD sz;
|
|
|
|
|
|
|
|
afcw.cbStruct = sizeof(afcw);
|
|
|
|
afcw.fdwStyle = pafmtc->fdwStyle;
|
|
|
|
afcw.hwndOwner = pafmtc->hwndOwner;
|
|
|
|
afcw.pwfx = pafmtc->pwfx;
|
|
|
|
afcw.cbwfx = pafmtc->cbwfx;
|
|
|
|
if (pafmtc->pszTitle)
|
|
|
|
{
|
|
|
|
sz = MultiByteToWideChar(CP_ACP, 0, pafmtc->pszTitle, -1, NULL, 0);
|
|
|
|
if (!(title = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
|
|
|
|
{
|
|
|
|
ret = MMSYSERR_NOMEM;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, pafmtc->pszTitle, -1, title, sz);
|
|
|
|
}
|
|
|
|
afcw.pszTitle = title;
|
|
|
|
if (pafmtc->pszName)
|
|
|
|
{
|
|
|
|
sz = MultiByteToWideChar(CP_ACP, 0, pafmtc->pszName, -1, NULL, 0);
|
|
|
|
if (!(name = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
|
|
|
|
{
|
|
|
|
ret = MMSYSERR_NOMEM;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, pafmtc->pszName, -1, name, sz);
|
|
|
|
}
|
|
|
|
afcw.pszName = name;
|
|
|
|
afcw.cchName = pafmtc->cchName;
|
|
|
|
afcw.fdwEnum = pafmtc->fdwEnum;
|
|
|
|
afcw.pwfxEnum = pafmtc->pwfxEnum;
|
|
|
|
afcw.hInstance = pafmtc->hInstance;
|
|
|
|
if (pafmtc->pszTemplateName)
|
|
|
|
{
|
|
|
|
sz = MultiByteToWideChar(CP_ACP, 0, pafmtc->pszTemplateName, -1, NULL, 0);
|
|
|
|
if (!(templ = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
|
|
|
|
{
|
|
|
|
ret = MMSYSERR_NOMEM;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, pafmtc->pszTemplateName, -1, templ, sz);
|
|
|
|
}
|
|
|
|
afcw.pszTemplateName = templ;
|
|
|
|
/* FIXME: hook procs not supported yet */
|
|
|
|
if (pafmtc->pfnHook)
|
|
|
|
{
|
|
|
|
FIXME("Unsupported hook procs\n");
|
|
|
|
ret = MMSYSERR_NOTSUPPORTED;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
ret = acmFormatChooseW(&afcw);
|
|
|
|
if (ret == MMSYSERR_NOERROR)
|
|
|
|
{
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, afcw.szFormatTag, -1, pafmtc->szFormatTag, sizeof(pafmtc->szFormatTag),
|
|
|
|
NULL, NULL);
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, afcw.szFormat, -1, pafmtc->szFormat, sizeof(pafmtc->szFormat),
|
|
|
|
NULL, NULL);
|
|
|
|
if (pafmtc->pszName)
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, afcw.pszName, -1, pafmtc->pszName, pafmtc->cchName, NULL, NULL);
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
HeapFree(GetProcessHeap(), 0, title);
|
|
|
|
HeapFree(GetProcessHeap(), 0, name);
|
|
|
|
HeapFree(GetProcessHeap(), 0, templ);
|
|
|
|
return ret;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmFormatChooseW (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2000-08-26 06:33:00 +02:00
|
|
|
MMRESULT WINAPI acmFormatChooseW(PACMFORMATCHOOSEW pafmtc)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2012-08-12 10:03:46 +02:00
|
|
|
if (pafmtc->fdwStyle & ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE)
|
|
|
|
return DialogBoxIndirectParamW(MSACM_hInstance32, (LPCDLGTEMPLATEW)pafmtc->hInstance,
|
|
|
|
pafmtc->hwndOwner, FormatChooseDlgProc, (LPARAM)pafmtc);
|
|
|
|
|
|
|
|
if (pafmtc->fdwStyle & ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE)
|
|
|
|
return DialogBoxParamW(pafmtc->hInstance, pafmtc->pszTemplateName,
|
|
|
|
pafmtc->hwndOwner, FormatChooseDlgProc, (LPARAM)pafmtc);
|
|
|
|
|
2012-08-12 10:03:41 +02:00
|
|
|
return DialogBoxParamW(MSACM_hInstance32, MAKEINTRESOURCEW(DLG_ACMFORMATCHOOSE_ID),
|
|
|
|
pafmtc->hwndOwner, FormatChooseDlgProc, (LPARAM)pafmtc);
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmFormatDetailsA (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
MMRESULT WINAPI acmFormatDetailsA(HACMDRIVER had, PACMFORMATDETAILSA pafd,
|
2000-08-26 06:33:00 +02:00
|
|
|
DWORD fdwDetails)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-26 06:33:00 +02:00
|
|
|
ACMFORMATDETAILSW afdw;
|
|
|
|
MMRESULT mmr;
|
1998-10-11 19:00:29 +02:00
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
memset(&afdw, 0, sizeof(afdw));
|
|
|
|
afdw.cbStruct = sizeof(afdw);
|
|
|
|
afdw.dwFormatIndex = pafd->dwFormatIndex;
|
2002-06-01 01:06:46 +02:00
|
|
|
afdw.dwFormatTag = pafd->dwFormatTag;
|
|
|
|
afdw.pwfx = pafd->pwfx;
|
|
|
|
afdw.cbwfx = pafd->cbwfx;
|
2000-08-26 06:33:00 +02:00
|
|
|
|
|
|
|
mmr = acmFormatDetailsW(had, &afdw, fdwDetails);
|
|
|
|
if (mmr == MMSYSERR_NOERROR) {
|
2002-06-01 01:06:46 +02:00
|
|
|
pafd->dwFormatTag = afdw.dwFormatTag;
|
|
|
|
pafd->fdwSupport = afdw.fdwSupport;
|
2000-11-28 23:40:56 +01:00
|
|
|
WideCharToMultiByte( CP_ACP, 0, afdw.szFormat, -1,
|
|
|
|
pafd->szFormat, sizeof(pafd->szFormat), NULL, NULL );
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
return mmr;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmFormatDetailsW (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2001-04-23 20:14:41 +02:00
|
|
|
MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails)
|
2000-08-26 06:33:00 +02:00
|
|
|
{
|
|
|
|
MMRESULT mmr;
|
2004-04-20 02:34:52 +02:00
|
|
|
static const WCHAR fmt1[] = {'%','d',' ','H','z',0};
|
|
|
|
static const WCHAR fmt2[] = {';',' ','%','d',' ','b','i','t','s',0};
|
2000-08-26 06:33:00 +02:00
|
|
|
ACMFORMATTAGDETAILSA aftd;
|
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %p, %d)\n", had, pafd, fdwDetails);
|
2000-08-26 06:33:00 +02:00
|
|
|
|
|
|
|
memset(&aftd, 0, sizeof(aftd));
|
|
|
|
aftd.cbStruct = sizeof(aftd);
|
|
|
|
|
|
|
|
if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
switch (fdwDetails) {
|
|
|
|
case ACM_FORMATDETAILSF_FORMAT:
|
2000-09-09 22:32:10 +02:00
|
|
|
if (pafd->dwFormatTag != pafd->pwfx->wFormatTag) {
|
2000-08-26 06:33:00 +02:00
|
|
|
mmr = MMSYSERR_INVALPARAM;
|
2000-09-09 22:32:10 +02:00
|
|
|
break;
|
|
|
|
}
|
2002-12-02 19:10:57 +01:00
|
|
|
if (had == NULL) {
|
2000-08-26 06:33:00 +02:00
|
|
|
PWINE_ACMDRIVERID padid;
|
|
|
|
|
|
|
|
mmr = ACMERR_NOTPOSSIBLE;
|
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
|
|
|
/* should check for codec only */
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
2000-08-26 06:33:00 +02:00
|
|
|
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
|
2001-04-23 20:14:41 +02:00
|
|
|
mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails);
|
2000-08-26 06:33:00 +02:00
|
|
|
acmDriverClose(had, 0);
|
|
|
|
if (mmr == MMSYSERR_NOERROR) break;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-08-26 06:33:00 +02:00
|
|
|
} else {
|
2001-04-23 20:14:41 +02:00
|
|
|
mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails);
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ACM_FORMATDETAILSF_INDEX:
|
|
|
|
/* should check pafd->dwFormatIndex < aftd->cStandardFormats */
|
2001-04-23 20:14:41 +02:00
|
|
|
mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails);
|
2000-08-26 06:33:00 +02:00
|
|
|
break;
|
|
|
|
default:
|
2006-10-12 21:35:06 +02:00
|
|
|
WARN("Unknown fdwDetails %08x\n", fdwDetails);
|
2000-08-26 06:33:00 +02:00
|
|
|
mmr = MMSYSERR_INVALFLAG;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-12-08 09:26:47 +01:00
|
|
|
if (mmr == MMSYSERR_NOERROR && pafd->szFormat[0] == 0) {
|
2000-08-26 06:33:00 +02:00
|
|
|
wsprintfW(pafd->szFormat, fmt1, pafd->pwfx->nSamplesPerSec);
|
|
|
|
if (pafd->pwfx->wBitsPerSample) {
|
2002-06-01 01:06:46 +02:00
|
|
|
wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), fmt2,
|
2000-08-26 06:33:00 +02:00
|
|
|
pafd->pwfx->wBitsPerSample);
|
|
|
|
}
|
2000-11-28 23:40:56 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo", -1,
|
|
|
|
pafd->szFormat + strlenW(pafd->szFormat),
|
|
|
|
sizeof(pafd->szFormat)/sizeof(WCHAR) - strlenW(pafd->szFormat) );
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("=> %d\n", mmr);
|
|
|
|
return mmr;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct MSACM_FormatEnumWtoA_Instance {
|
2009-02-17 22:36:06 +01:00
|
|
|
PACMFORMATDETAILSA pafda;
|
|
|
|
DWORD_PTR dwInstance;
|
|
|
|
ACMFORMATENUMCBA fnCallback;
|
2000-08-26 06:33:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static BOOL CALLBACK MSACM_FormatEnumCallbackWtoA(HACMDRIVERID hadid,
|
2002-06-01 01:06:46 +02:00
|
|
|
PACMFORMATDETAILSW pafdw,
|
2009-02-05 09:52:31 +01:00
|
|
|
DWORD_PTR dwInstance,
|
2000-08-26 06:33:00 +02:00
|
|
|
DWORD fdwSupport)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-26 06:33:00 +02:00
|
|
|
struct MSACM_FormatEnumWtoA_Instance* pafei;
|
|
|
|
|
|
|
|
pafei = (struct MSACM_FormatEnumWtoA_Instance*)dwInstance;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
pafei->pafda->dwFormatIndex = pafdw->dwFormatIndex;
|
|
|
|
pafei->pafda->dwFormatTag = pafdw->dwFormatTag;
|
|
|
|
pafei->pafda->fdwSupport = pafdw->fdwSupport;
|
2000-11-28 23:40:56 +01:00
|
|
|
WideCharToMultiByte( CP_ACP, 0, pafdw->szFormat, -1,
|
|
|
|
pafei->pafda->szFormat, sizeof(pafei->pafda->szFormat), NULL, NULL );
|
2000-08-26 06:33:00 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
return (pafei->fnCallback)(hadid, pafei->pafda,
|
2000-08-26 06:33:00 +02:00
|
|
|
pafei->dwInstance, fdwSupport);
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmFormatEnumA (MSACM32.@)
|
2000-12-02 00:58:28 +01:00
|
|
|
*/
|
2000-08-26 06:33:00 +02:00
|
|
|
MMRESULT WINAPI acmFormatEnumA(HACMDRIVER had, PACMFORMATDETAILSA pafda,
|
2009-02-05 09:52:31 +01:00
|
|
|
ACMFORMATENUMCBA fnCallback,
|
|
|
|
DWORD_PTR dwInstance, DWORD fdwEnum)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-26 06:33:00 +02:00
|
|
|
ACMFORMATDETAILSW afdw;
|
|
|
|
struct MSACM_FormatEnumWtoA_Instance afei;
|
|
|
|
|
2004-05-03 22:09:42 +02:00
|
|
|
if (!pafda)
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
|
|
|
|
if (pafda->cbStruct < sizeof(*pafda))
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
memset(&afdw, 0, sizeof(afdw));
|
|
|
|
afdw.cbStruct = sizeof(afdw);
|
|
|
|
afdw.dwFormatIndex = pafda->dwFormatIndex;
|
|
|
|
afdw.dwFormatTag = pafda->dwFormatTag;
|
|
|
|
afdw.pwfx = pafda->pwfx;
|
|
|
|
afdw.cbwfx = pafda->cbwfx;
|
|
|
|
|
|
|
|
afei.pafda = pafda;
|
|
|
|
afei.dwInstance = dwInstance;
|
|
|
|
afei.fnCallback = fnCallback;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
return acmFormatEnumW(had, &afdw, MSACM_FormatEnumCallbackWtoA,
|
2009-02-17 22:36:06 +01:00
|
|
|
(DWORD_PTR)&afei, fdwEnum);
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmFormatEnumW (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static BOOL MSACM_FormatEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had,
|
|
|
|
PACMFORMATDETAILSW pafd, PWAVEFORMATEX pwfxRef,
|
2009-02-17 22:36:06 +01:00
|
|
|
ACMFORMATENUMCBW fnCallback,
|
|
|
|
DWORD_PTR dwInstance, DWORD fdwEnum)
|
2000-08-26 06:33:00 +02:00
|
|
|
{
|
|
|
|
ACMFORMATTAGDETAILSW aftd;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int i, j;
|
2000-08-26 06:33:00 +02:00
|
|
|
|
2009-03-10 16:41:19 +01:00
|
|
|
if (fdwEnum & ACM_FORMATENUMF_SUGGEST) {
|
|
|
|
HDRVR hdrvr;
|
|
|
|
ACMDRVFORMATSUGGEST adfs;
|
|
|
|
pafd->dwFormatIndex = 0;
|
|
|
|
memset(&aftd, 0, sizeof(aftd));
|
|
|
|
aftd.cbStruct = sizeof(aftd);
|
|
|
|
memset(&adfs, 0, sizeof(adfs));
|
|
|
|
adfs.cbStruct = sizeof(adfs);
|
|
|
|
|
|
|
|
for (i = 0; i < padid->cFormatTags; i++) {
|
|
|
|
aftd.dwFormatTag = i;
|
|
|
|
pafd->dwFormatTag = aftd.dwFormatTag;
|
|
|
|
pafd->pwfx->wFormatTag = pafd->dwFormatTag;
|
|
|
|
|
|
|
|
if (acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
adfs.cbwfxSrc = aftd.cbFormatSize;
|
|
|
|
adfs.cbwfxDst = aftd.cbFormatSize;
|
|
|
|
adfs.pwfxSrc = pwfxRef;
|
|
|
|
adfs.pwfxDst = pafd->pwfx;
|
|
|
|
pafd->fdwSupport = padid->fdwSupport;
|
|
|
|
|
|
|
|
if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) &&
|
|
|
|
aftd.dwFormatTag != pwfxRef->wFormatTag)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) &&
|
|
|
|
!(pafd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_HARDWARE))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
hdrvr = OpenDriver(padid->pszFileName,0,0);
|
2009-05-28 15:25:04 +02:00
|
|
|
SendDriverMessage(hdrvr,ACMDM_FORMAT_SUGGEST,(LPARAM)&adfs,(fdwEnum & 0x000000FFL));
|
2009-03-10 16:41:19 +01:00
|
|
|
|
|
|
|
if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_FORMAT) != MMSYSERR_NOERROR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
pafd->cbwfx = sizeof(*(pafd->pwfx));
|
|
|
|
|
|
|
|
if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < padid->cFormatTags; i++) {
|
|
|
|
memset(&aftd, 0, sizeof(aftd));
|
|
|
|
aftd.cbStruct = sizeof(aftd);
|
|
|
|
aftd.dwFormatTagIndex = i;
|
|
|
|
if (acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && aftd.dwFormatTag != pwfxRef->wFormatTag)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
for (j = 0; j < aftd.cStandardFormats; j++) {
|
|
|
|
pafd->dwFormatIndex = j;
|
|
|
|
pafd->dwFormatTag = aftd.dwFormatTag;
|
|
|
|
if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_INDEX) != MMSYSERR_NOERROR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((fdwEnum & ACM_FORMATENUMF_NCHANNELS) &&
|
|
|
|
pafd->pwfx->nChannels != pwfxRef->nChannels)
|
|
|
|
continue;
|
|
|
|
if ((fdwEnum & ACM_FORMATENUMF_NSAMPLESPERSEC) &&
|
|
|
|
pafd->pwfx->nSamplesPerSec != pwfxRef->nSamplesPerSec)
|
|
|
|
continue;
|
|
|
|
if ((fdwEnum & ACM_FORMATENUMF_WBITSPERSAMPLE) &&
|
|
|
|
pafd->pwfx->wBitsPerSample != pwfxRef->wBitsPerSample)
|
|
|
|
continue;
|
|
|
|
if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) &&
|
|
|
|
!(pafd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_HARDWARE))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* more checks to be done on fdwEnum */
|
|
|
|
|
|
|
|
if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
/* the "formats" used by the filters are also reported */
|
|
|
|
}
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-12-02 00:58:28 +01:00
|
|
|
/**********************************************************************/
|
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd,
|
2009-02-05 09:52:31 +01:00
|
|
|
ACMFORMATENUMCBW fnCallback,
|
|
|
|
DWORD_PTR dwInstance, DWORD fdwEnum)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-26 06:33:00 +02:00
|
|
|
PWINE_ACMDRIVERID padid;
|
|
|
|
WAVEFORMATEX wfxRef;
|
|
|
|
BOOL ret;
|
|
|
|
|
2009-02-05 09:52:31 +01:00
|
|
|
TRACE("(%p, %p, %p, %ld, %d)\n",
|
2000-08-26 06:33:00 +02:00
|
|
|
had, pafd, fnCallback, dwInstance, fdwEnum);
|
|
|
|
|
2004-05-03 22:09:42 +02:00
|
|
|
if (!pafd)
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
|
|
|
|
if (pafd->cbStruct < sizeof(*pafd))
|
|
|
|
return MMSYSERR_INVALPARAM;
|
2000-08-26 06:33:00 +02:00
|
|
|
|
|
|
|
if (fdwEnum & (ACM_FORMATENUMF_WFORMATTAG|ACM_FORMATENUMF_NCHANNELS|
|
|
|
|
ACM_FORMATENUMF_NSAMPLESPERSEC|ACM_FORMATENUMF_WBITSPERSAMPLE|
|
|
|
|
ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_SUGGEST))
|
|
|
|
wfxRef = *pafd->pwfx;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) &&
|
2000-08-26 06:33:00 +02:00
|
|
|
!(fdwEnum & (ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT)))
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
|
|
|
|
if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) &&
|
|
|
|
(pafd->dwFormatTag != pafd->pwfx->wFormatTag))
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
|
2009-03-10 16:41:19 +01:00
|
|
|
if (fdwEnum & (ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT))
|
2006-10-12 21:35:06 +02:00
|
|
|
FIXME("Unsupported fdwEnum values %08x\n", fdwEnum);
|
2000-08-26 06:33:00 +02:00
|
|
|
|
|
|
|
if (had) {
|
|
|
|
HACMDRIVERID hadid;
|
|
|
|
|
2002-03-26 20:48:42 +01:00
|
|
|
if (acmDriverID((HACMOBJ)had, &hadid, 0) != MMSYSERR_NOERROR)
|
2000-08-26 06:33:00 +02:00
|
|
|
return MMSYSERR_INVALHANDLE;
|
2002-06-01 01:06:46 +02:00
|
|
|
MSACM_FormatEnumHelper(MSACM_GetDriverID(hadid), had, pafd, &wfxRef,
|
2001-02-12 02:28:12 +01:00
|
|
|
fnCallback, dwInstance, fdwEnum);
|
|
|
|
return MMSYSERR_NOERROR;
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
|
|
|
/* should check for codec only */
|
2002-06-01 01:06:46 +02:00
|
|
|
if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ||
|
2001-05-22 21:21:16 +02:00
|
|
|
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
|
2000-08-26 06:33:00 +02:00
|
|
|
continue;
|
2002-06-01 01:06:46 +02:00
|
|
|
ret = MSACM_FormatEnumHelper(padid, had, pafd, &wfxRef,
|
2000-08-26 06:33:00 +02:00
|
|
|
fnCallback, dwInstance, fdwEnum);
|
|
|
|
acmDriverClose(had, 0);
|
|
|
|
if (!ret) break;
|
|
|
|
}
|
|
|
|
return MMSYSERR_NOERROR;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmFormatSuggest (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
MMRESULT WINAPI acmFormatSuggest(HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
|
2000-08-26 06:33:00 +02:00
|
|
|
PWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-26 06:33:00 +02:00
|
|
|
ACMDRVFORMATSUGGEST adfg;
|
|
|
|
MMRESULT mmr;
|
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %p, %p, %d, %d)\n",
|
2000-08-26 06:33:00 +02:00
|
|
|
had, pwfxSrc, pwfxDst, cbwfxDst, fdwSuggest);
|
|
|
|
|
|
|
|
if (fdwSuggest & ~(ACM_FORMATSUGGESTF_NCHANNELS|ACM_FORMATSUGGESTF_NSAMPLESPERSEC|
|
|
|
|
ACM_FORMATSUGGESTF_WBITSPERSAMPLE|ACM_FORMATSUGGESTF_WFORMATTAG))
|
|
|
|
return MMSYSERR_INVALFLAG;
|
|
|
|
|
|
|
|
adfg.cbStruct = sizeof(adfg);
|
|
|
|
adfg.fdwSuggest = fdwSuggest;
|
|
|
|
adfg.pwfxSrc = pwfxSrc;
|
|
|
|
adfg.cbwfxSrc = (pwfxSrc->wFormatTag == WAVE_FORMAT_PCM) ?
|
2004-01-17 00:03:08 +01:00
|
|
|
sizeof(WAVEFORMATEX) : (sizeof(WAVEFORMATEX) + pwfxSrc->cbSize);
|
2000-08-26 06:33:00 +02:00
|
|
|
adfg.pwfxDst = pwfxDst;
|
|
|
|
adfg.cbwfxDst = cbwfxDst;
|
|
|
|
|
2002-12-02 19:10:57 +01:00
|
|
|
if (had == NULL) {
|
2000-08-26 06:33:00 +02:00
|
|
|
PWINE_ACMDRIVERID padid;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
/* MS doc says: ACM finds the best suggestion.
|
2000-08-26 06:33:00 +02:00
|
|
|
* Well, first found will be the "best"
|
|
|
|
*/
|
|
|
|
mmr = ACMERR_NOTPOSSIBLE;
|
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
|
|
|
/* should check for codec only */
|
2001-05-22 21:21:16 +02:00
|
|
|
if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ||
|
2000-08-26 06:33:00 +02:00
|
|
|
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
|
|
|
|
continue;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-23 20:14:41 +02:00
|
|
|
if (MSACM_Message(had, ACMDM_FORMAT_SUGGEST, (LPARAM)&adfg, 0L) == MMSYSERR_NOERROR) {
|
2000-08-26 06:33:00 +02:00
|
|
|
mmr = MMSYSERR_NOERROR;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
acmDriverClose(had, 0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mmr = MSACM_Message(had, ACMDM_FORMAT_SUGGEST, (LPARAM)&adfg, 0L);
|
|
|
|
}
|
|
|
|
return mmr;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmFormatTagDetailsA (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
MMRESULT WINAPI acmFormatTagDetailsA(HACMDRIVER had, PACMFORMATTAGDETAILSA paftda,
|
2000-08-26 06:33:00 +02:00
|
|
|
DWORD fdwDetails)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-26 06:33:00 +02:00
|
|
|
ACMFORMATTAGDETAILSW aftdw;
|
|
|
|
MMRESULT mmr;
|
1998-10-11 19:00:29 +02:00
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
memset(&aftdw, 0, sizeof(aftdw));
|
|
|
|
aftdw.cbStruct = sizeof(aftdw);
|
|
|
|
aftdw.dwFormatTagIndex = paftda->dwFormatTagIndex;
|
|
|
|
aftdw.dwFormatTag = paftda->dwFormatTag;
|
|
|
|
|
|
|
|
mmr = acmFormatTagDetailsW(had, &aftdw, fdwDetails);
|
|
|
|
if (mmr == MMSYSERR_NOERROR) {
|
2002-06-01 01:06:46 +02:00
|
|
|
paftda->dwFormatTag = aftdw.dwFormatTag;
|
2000-08-26 06:33:00 +02:00
|
|
|
paftda->dwFormatTagIndex = aftdw.dwFormatTagIndex;
|
2002-06-01 01:06:46 +02:00
|
|
|
paftda->cbFormatSize = aftdw.cbFormatSize;
|
|
|
|
paftda->fdwSupport = aftdw.fdwSupport;
|
|
|
|
paftda->cStandardFormats = aftdw.cStandardFormats;
|
2000-11-28 23:40:56 +01:00
|
|
|
WideCharToMultiByte( CP_ACP, 0, aftdw.szFormatTag, -1, paftda->szFormatTag,
|
|
|
|
sizeof(paftda->szFormatTag), NULL, NULL );
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
return mmr;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmFormatTagDetailsW (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
|
2000-08-26 06:33:00 +02:00
|
|
|
DWORD fdwDetails)
|
|
|
|
{
|
|
|
|
PWINE_ACMDRIVERID padid;
|
2001-04-23 20:14:41 +02:00
|
|
|
MMRESULT mmr = ACMERR_NOTPOSSIBLE;
|
2000-08-26 06:33:00 +02:00
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %p, %d)\n", had, paftd, fdwDetails);
|
2000-08-26 06:33:00 +02:00
|
|
|
|
|
|
|
if (fdwDetails & ~(ACM_FORMATTAGDETAILSF_FORMATTAG|ACM_FORMATTAGDETAILSF_INDEX|
|
|
|
|
ACM_FORMATTAGDETAILSF_LARGESTSIZE))
|
|
|
|
return MMSYSERR_INVALFLAG;
|
|
|
|
|
|
|
|
switch (fdwDetails) {
|
|
|
|
case ACM_FORMATTAGDETAILSF_FORMATTAG:
|
2002-12-02 19:10:57 +01:00
|
|
|
if (had == NULL) {
|
2000-08-26 06:33:00 +02:00
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
|
|
|
/* should check for codec only */
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
2001-04-23 20:14:41 +02:00
|
|
|
MSACM_FindFormatTagInCache(padid, paftd->dwFormatTag, NULL) &&
|
|
|
|
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
|
|
|
|
mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
|
2000-08-26 06:33:00 +02:00
|
|
|
acmDriverClose(had, 0);
|
|
|
|
if (mmr == MMSYSERR_NOERROR) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2001-04-23 20:14:41 +02:00
|
|
|
PWINE_ACMDRIVER pad = MSACM_GetDriver(had);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-23 20:14:41 +02:00
|
|
|
if (pad && MSACM_FindFormatTagInCache(pad->obj.pACMDriverID, paftd->dwFormatTag, NULL))
|
|
|
|
mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACM_FORMATTAGDETAILSF_INDEX:
|
2002-12-02 19:10:57 +01:00
|
|
|
if (had != NULL) {
|
2001-04-23 20:14:41 +02:00
|
|
|
PWINE_ACMDRIVER pad = MSACM_GetDriver(had);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-23 20:14:41 +02:00
|
|
|
if (pad && paftd->dwFormatTagIndex < pad->obj.pACMDriverID->cFormatTags)
|
|
|
|
mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-08-26 06:33:00 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACM_FORMATTAGDETAILSF_LARGESTSIZE:
|
2002-12-02 19:10:57 +01:00
|
|
|
if (had == NULL) {
|
2000-08-26 06:33:00 +02:00
|
|
|
ACMFORMATTAGDETAILSW tmp;
|
|
|
|
DWORD ft = paftd->dwFormatTag;
|
|
|
|
|
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
|
|
|
/* should check for codec only */
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
2000-08-26 06:33:00 +02:00
|
|
|
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
|
|
|
|
|
|
|
|
memset(&tmp, 0, sizeof(tmp));
|
|
|
|
tmp.cbStruct = sizeof(tmp);
|
|
|
|
tmp.dwFormatTag = ft;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,
|
2001-04-23 20:14:41 +02:00
|
|
|
(LPARAM)&tmp, fdwDetails) == MMSYSERR_NOERROR) {
|
2000-08-26 06:33:00 +02:00
|
|
|
if (mmr == ACMERR_NOTPOSSIBLE ||
|
|
|
|
paftd->cbFormatSize < tmp.cbFormatSize) {
|
|
|
|
*paftd = tmp;
|
|
|
|
mmr = MMSYSERR_NOERROR;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
acmDriverClose(had, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2001-04-23 20:14:41 +02:00
|
|
|
mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2006-10-12 21:35:06 +02:00
|
|
|
WARN("Unsupported fdwDetails=%08x\n", fdwDetails);
|
2000-08-26 06:33:00 +02:00
|
|
|
mmr = MMSYSERR_ERROR;
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if (mmr == MMSYSERR_NOERROR &&
|
2000-08-26 06:33:00 +02:00
|
|
|
paftd->dwFormatTag == WAVE_FORMAT_PCM && paftd->szFormatTag[0] == 0)
|
2000-11-28 23:40:56 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
|
|
|
|
sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
|
2000-08-26 06:33:00 +02:00
|
|
|
|
|
|
|
return mmr;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct MSACM_FormatTagEnumWtoA_Instance {
|
2009-02-17 22:36:06 +01:00
|
|
|
PACMFORMATTAGDETAILSA paftda;
|
|
|
|
DWORD_PTR dwInstance;
|
|
|
|
ACMFORMATTAGENUMCBA fnCallback;
|
2000-08-26 06:33:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static BOOL CALLBACK MSACM_FormatTagEnumCallbackWtoA(HACMDRIVERID hadid,
|
2002-06-01 01:06:46 +02:00
|
|
|
PACMFORMATTAGDETAILSW paftdw,
|
2009-02-05 09:52:31 +01:00
|
|
|
DWORD_PTR dwInstance,
|
2000-08-26 06:33:00 +02:00
|
|
|
DWORD fdwSupport)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-26 06:33:00 +02:00
|
|
|
struct MSACM_FormatTagEnumWtoA_Instance* paftei;
|
|
|
|
|
|
|
|
paftei = (struct MSACM_FormatTagEnumWtoA_Instance*)dwInstance;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
paftei->paftda->dwFormatTagIndex = paftdw->dwFormatTagIndex;
|
|
|
|
paftei->paftda->dwFormatTag = paftdw->dwFormatTag;
|
|
|
|
paftei->paftda->cbFormatSize = paftdw->cbFormatSize;
|
|
|
|
paftei->paftda->fdwSupport = paftdw->fdwSupport;
|
|
|
|
paftei->paftda->cStandardFormats = paftdw->cStandardFormats;
|
2000-11-28 23:40:56 +01:00
|
|
|
WideCharToMultiByte( CP_ACP, 0, paftdw->szFormatTag, -1, paftei->paftda->szFormatTag,
|
|
|
|
sizeof(paftei->paftda->szFormatTag), NULL, NULL );
|
2000-08-26 06:33:00 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
return (paftei->fnCallback)(hadid, paftei->paftda,
|
2000-08-26 06:33:00 +02:00
|
|
|
paftei->dwInstance, fdwSupport);
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmFormatTagEnumA (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2000-08-26 06:33:00 +02:00
|
|
|
MMRESULT WINAPI acmFormatTagEnumA(HACMDRIVER had, PACMFORMATTAGDETAILSA paftda,
|
2009-02-05 09:52:31 +01:00
|
|
|
ACMFORMATTAGENUMCBA fnCallback,
|
|
|
|
DWORD_PTR dwInstance, DWORD fdwEnum)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-26 06:33:00 +02:00
|
|
|
ACMFORMATTAGDETAILSW aftdw;
|
|
|
|
struct MSACM_FormatTagEnumWtoA_Instance aftei;
|
|
|
|
|
2004-05-10 21:56:53 +02:00
|
|
|
if (!paftda)
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
|
|
|
|
if (paftda->cbStruct < sizeof(*paftda))
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
|
|
|
|
if (fdwEnum != 0)
|
|
|
|
return MMSYSERR_INVALFLAG;
|
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
memset(&aftdw, 0, sizeof(aftdw));
|
|
|
|
aftdw.cbStruct = sizeof(aftdw);
|
|
|
|
aftdw.dwFormatTagIndex = paftda->dwFormatTagIndex;
|
|
|
|
aftdw.dwFormatTag = paftda->dwFormatTag;
|
|
|
|
|
|
|
|
aftei.paftda = paftda;
|
|
|
|
aftei.dwInstance = dwInstance;
|
|
|
|
aftei.fnCallback = fnCallback;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
return acmFormatTagEnumW(had, &aftdw, MSACM_FormatTagEnumCallbackWtoA,
|
2009-02-17 22:36:06 +01:00
|
|
|
(DWORD_PTR)&aftei, fdwEnum);
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmFormatTagEnumW (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2000-08-26 06:33:00 +02:00
|
|
|
MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
|
2009-02-05 09:52:31 +01:00
|
|
|
ACMFORMATTAGENUMCBW fnCallback,
|
|
|
|
DWORD_PTR dwInstance, DWORD fdwEnum)
|
2000-08-26 06:33:00 +02:00
|
|
|
{
|
|
|
|
PWINE_ACMDRIVERID padid;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int i;
|
2000-08-26 06:33:00 +02:00
|
|
|
BOOL bPcmDone = FALSE;
|
|
|
|
|
2009-02-05 09:52:31 +01:00
|
|
|
TRACE("(%p, %p, %p, %ld, %d)\n",
|
2002-06-01 01:06:46 +02:00
|
|
|
had, paftd, fnCallback, dwInstance, fdwEnum);
|
2000-08-26 06:33:00 +02:00
|
|
|
|
2004-05-10 21:56:53 +02:00
|
|
|
if (!paftd)
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
|
|
|
|
if (paftd->cbStruct < sizeof(*paftd))
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
|
|
|
|
if (fdwEnum != 0)
|
|
|
|
return MMSYSERR_INVALFLAG;
|
2000-08-26 06:33:00 +02:00
|
|
|
|
2003-01-23 22:21:33 +01:00
|
|
|
/* (WS) MSDN info page says that if had != 0, then we should find
|
|
|
|
* the specific driver to get its tags from. Therefore I'm removing
|
|
|
|
* the FIXME call and adding a search block below. It also seems
|
|
|
|
* that the lack of this functionality was the responsible for
|
|
|
|
* codecs to be multiply and incorrectly listed.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2003-01-23 22:21:33 +01:00
|
|
|
/* if (had) FIXME("had != NULL, not supported\n"); */
|
|
|
|
|
|
|
|
if (had) {
|
|
|
|
|
|
|
|
if (acmDriverID((HACMOBJ)had, (HACMDRIVERID *)&padid, 0) != MMSYSERR_NOERROR)
|
|
|
|
return MMSYSERR_INVALHANDLE;
|
|
|
|
|
|
|
|
for (i = 0; i < padid->cFormatTags; i++) {
|
|
|
|
paftd->dwFormatTagIndex = i;
|
|
|
|
if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,
|
|
|
|
(LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
|
|
|
|
if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
|
|
|
|
if (paftd->szFormatTag[0] == 0)
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
|
|
|
|
sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
|
|
|
|
/* (WS) I'm preserving this PCM hack since it seems to be
|
|
|
|
* correct. Please notice this block was borrowed from
|
|
|
|
* below.
|
|
|
|
*/
|
|
|
|
if (bPcmDone) continue;
|
|
|
|
bPcmDone = TRUE;
|
|
|
|
}
|
|
|
|
if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport))
|
|
|
|
return MMSYSERR_NOERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if had==0 then search for the first suitable driver */
|
|
|
|
else {
|
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
|
|
|
/* should check for codec only */
|
|
|
|
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
|
|
|
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) {
|
|
|
|
for (i = 0; i < padid->cFormatTags; i++) {
|
|
|
|
paftd->dwFormatTagIndex = i;
|
|
|
|
if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,
|
|
|
|
(LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
|
|
|
|
if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
|
|
|
|
if (paftd->szFormatTag[0] == 0)
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
|
|
|
|
sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
|
|
|
|
/* FIXME (EPP): I'm not sure this is the correct
|
|
|
|
* algorithm (should make more sense to apply the same
|
|
|
|
* for all already loaded formats, but this will do
|
|
|
|
* for now
|
|
|
|
*/
|
|
|
|
if (bPcmDone) continue;
|
|
|
|
bPcmDone = TRUE;
|
|
|
|
}
|
|
|
|
if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport)) {
|
|
|
|
acmDriverClose(had, 0);
|
|
|
|
return MMSYSERR_NOERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-04-04 22:37:10 +02:00
|
|
|
acmDriverClose(had, 0);
|
2003-01-23 22:21:33 +01:00
|
|
|
}
|
|
|
|
}
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
return MMSYSERR_NOERROR;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|