4 * Copyright 1998 Patrik Stridvall
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msacm
);
39 struct MSACM_FillFormatData
{
41 #define WINE_ACMFF_TAG 0
42 #define WINE_ACMFF_FORMAT 1
43 #define WINE_ACMFF_WFX 2
45 WCHAR szFormatTag
[ACMFORMATTAGDETAILS_FORMATTAG_CHARS
];
46 PACMFORMATCHOOSEW afc
;
50 static BOOL CALLBACK
MSACM_FillFormatTagsCB(HACMDRIVERID hadid
,
51 PACMFORMATTAGDETAILSW paftd
,
55 struct MSACM_FillFormatData
* affd
= (struct MSACM_FillFormatData
*)dwInstance
;
59 if (paftd
->cStandardFormats
> 0)
61 if (SendDlgItemMessageW(affd
->hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG
,
62 CB_FINDSTRINGEXACT
, -1,
63 (LPARAM
)paftd
->szFormatTag
) == CB_ERR
)
65 int index
= SendDlgItemMessageW(affd
->hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG
,
66 CB_ADDSTRING
, 0, (LPARAM
)paftd
->szFormatTag
);
67 if (((affd
->afc
->fdwStyle
& ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT
) &&
68 (paftd
->dwFormatTag
== affd
->afc
->pwfx
->wFormatTag
)) ||
69 (!(affd
->afc
->fdwStyle
& ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT
) &&
70 (paftd
->dwFormatTag
== WAVE_FORMAT_PCM
)))
71 SendDlgItemMessageW(affd
->hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG
,
72 CB_SETCURSEL
, index
, 0);
76 case WINE_ACMFF_FORMAT
:
77 if (lstrcmpW(affd
->szFormatTag
, paftd
->szFormatTag
) == 0) {
80 if (acmDriverOpen(&had
, hadid
, 0) == MMSYSERR_NOERROR
) {
81 ACMFORMATDETAILSW afd
= {0};
84 WCHAR buffer
[ACMFORMATDETAILS_FORMAT_CHARS
+16];
86 afd
.cbStruct
= sizeof(afd
);
87 afd
.dwFormatTag
= paftd
->dwFormatTag
;
88 afd
.pwfx
= HeapAlloc(MSACM_hHeap
, 0, paftd
->cbFormatSize
);
89 if (!afd
.pwfx
) return FALSE
;
90 afd
.pwfx
->wFormatTag
= paftd
->dwFormatTag
;
91 if (paftd
->dwFormatTag
!= WAVE_FORMAT_PCM
)
92 afd
.pwfx
->cbSize
= paftd
->cbFormatSize
- sizeof(WAVEFORMATEX
);
93 afd
.cbwfx
= paftd
->cbFormatSize
;
95 for (i
= 0; i
< paftd
->cStandardFormats
; i
++) {
96 static const WCHAR fmtW
[] = {'%','d',' ','K','o','/','s','\0'};
99 afd
.dwFormatIndex
= i
;
101 mmr
= acmFormatDetailsW(had
, &afd
, ACM_FORMATDETAILSF_INDEX
);
102 if (mmr
== MMSYSERR_NOERROR
) {
103 lstrcpynW(buffer
, afd
.szFormat
, ACMFORMATTAGDETAILS_FORMATTAG_CHARS
+ 1);
104 len
= lstrlenW(buffer
);
105 for (j
= len
; j
< ACMFORMATTAGDETAILS_FORMATTAG_CHARS
; j
++)
107 wsprintfW(buffer
+ ACMFORMATTAGDETAILS_FORMATTAG_CHARS
,
108 fmtW
, (afd
.pwfx
->nAvgBytesPerSec
+ 512) / 1024);
109 index
= SendDlgItemMessageW(affd
->hWnd
,
110 IDD_ACMFORMATCHOOSE_CMB_FORMAT
,
111 CB_ADDSTRING
, 0, (LPARAM
)buffer
);
112 if ((affd
->afc
->fdwStyle
& ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT
) &&
113 affd
->afc
->cbwfx
>= paftd
->cbFormatSize
&&
114 !memcmp(afd
.pwfx
, affd
->afc
->pwfx
, paftd
->cbFormatSize
))
115 SendDlgItemMessageW(affd
->hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMAT
,
116 CB_SETCURSEL
, index
, 0);
119 acmDriverClose(had
, 0);
120 HeapFree(MSACM_hHeap
, 0, afd
.pwfx
);
125 if (lstrcmpW(affd
->szFormatTag
, paftd
->szFormatTag
) == 0) {
128 if (acmDriverOpen(&had
, hadid
, 0) == MMSYSERR_NOERROR
) {
129 ACMFORMATDETAILSW afd
= {0};
131 afd
.cbStruct
= sizeof(afd
);
132 afd
.dwFormatTag
= paftd
->dwFormatTag
;
133 afd
.pwfx
= affd
->afc
->pwfx
;
134 afd
.cbwfx
= affd
->afc
->cbwfx
;
136 afd
.dwFormatIndex
= SendDlgItemMessageW(affd
->hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMAT
,
138 affd
->ret
= acmFormatDetailsW(had
, &afd
, ACM_FORMATDETAILSF_INDEX
);
139 acmDriverClose(had
, 0);
145 FIXME("Unknown mode (%d)\n", affd
->mode
);
151 static BOOL
MSACM_FillFormatTags(HWND hWnd
, PACMFORMATCHOOSEW afc
)
153 ACMFORMATTAGDETAILSW aftd
;
154 struct MSACM_FillFormatData affd
;
156 memset(&aftd
, 0, sizeof(aftd
));
157 aftd
.cbStruct
= sizeof(aftd
);
160 affd
.mode
= WINE_ACMFF_TAG
;
163 acmFormatTagEnumW(NULL
, &aftd
, MSACM_FillFormatTagsCB
, (DWORD_PTR
)&affd
, 0);
164 if (SendDlgItemMessageW(hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG
, CB_GETCURSEL
, 0, 0) == CB_ERR
)
165 SendDlgItemMessageW(hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG
, CB_SETCURSEL
, 0, 0);
169 static BOOL
MSACM_FillFormat(HWND hWnd
, PACMFORMATCHOOSEW afc
)
171 ACMFORMATTAGDETAILSW aftd
;
172 struct MSACM_FillFormatData affd
;
174 SendDlgItemMessageW(hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMAT
, CB_RESETCONTENT
, 0, 0);
176 memset(&aftd
, 0, sizeof(aftd
));
177 aftd
.cbStruct
= sizeof(aftd
);
180 affd
.mode
= WINE_ACMFF_FORMAT
;
182 SendDlgItemMessageW(hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG
,
184 SendDlgItemMessageW(hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG
,
186 (LPARAM
)affd
.szFormatTag
);
188 acmFormatTagEnumW(NULL
, &aftd
, MSACM_FillFormatTagsCB
, (DWORD_PTR
)&affd
, 0);
189 if (SendDlgItemMessageW(hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMAT
, CB_GETCURSEL
, 0, 0) == CB_ERR
)
190 SendDlgItemMessageW(hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMAT
, CB_SETCURSEL
, 0, 0);
194 static MMRESULT
MSACM_GetWFX(HWND hWnd
, PACMFORMATCHOOSEW afc
)
196 ACMFORMATTAGDETAILSW aftd
;
197 struct MSACM_FillFormatData affd
;
199 memset(&aftd
, 0, sizeof(aftd
));
200 aftd
.cbStruct
= sizeof(aftd
);
203 affd
.mode
= WINE_ACMFF_WFX
;
205 affd
.ret
= MMSYSERR_NOERROR
;
206 SendDlgItemMessageW(hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG
,
208 SendDlgItemMessageW(hWnd
, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG
,
210 (LPARAM
)affd
.szFormatTag
);
212 acmFormatTagEnumW(NULL
, &aftd
, MSACM_FillFormatTagsCB
, (DWORD_PTR
)&affd
, 0);
216 static const WCHAR fmt_prop
[] = {'a','c','m','p','r','o','p','\0'};
218 static INT_PTR CALLBACK
FormatChooseDlgProc(HWND hWnd
, UINT msg
,
219 WPARAM wParam
, LPARAM lParam
)
221 PACMFORMATCHOOSEW afc
= (PACMFORMATCHOOSEW
)GetPropW(hWnd
, fmt_prop
);
223 TRACE("hwnd=%p msg=%i 0x%08lx 0x%08lx\n", hWnd
, msg
, wParam
, lParam
);
227 afc
= (PACMFORMATCHOOSEW
)lParam
;
228 SetPropW(hWnd
, fmt_prop
, (HANDLE
)afc
);
229 MSACM_FillFormatTags(hWnd
, afc
);
230 MSACM_FillFormat(hWnd
, afc
);
231 if ((afc
->fdwStyle
& ~(ACMFORMATCHOOSE_STYLEF_CONTEXTHELP
|
232 ACMFORMATCHOOSE_STYLEF_SHOWHELP
|
233 ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT
|
234 ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE
|
235 ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE
)) != 0)
236 FIXME("Unsupported style %08x\n", afc
->fdwStyle
);
237 if (!(afc
->fdwStyle
& ACMFORMATCHOOSE_STYLEF_SHOWHELP
))
238 ShowWindow(GetDlgItem(hWnd
, IDD_ACMFORMATCHOOSE_BTN_HELP
), SW_HIDE
);
242 switch (LOWORD(wParam
)) {
244 EndDialog(hWnd
, MSACM_GetWFX(hWnd
, afc
));
247 EndDialog(hWnd
, ACMERR_CANCELED
);
249 case IDD_ACMFORMATCHOOSE_CMB_FORMATTAG
:
250 switch (HIWORD(wParam
)) {
252 MSACM_FillFormat(hWnd
, afc
);
255 TRACE("Dropped dlgNotif (fmtTag): 0x%08x 0x%08lx\n",
256 HIWORD(wParam
), lParam
);
260 case IDD_ACMFORMATCHOOSE_BTN_HELP
:
261 if (afc
->fdwStyle
& ACMFORMATCHOOSE_STYLEF_SHOWHELP
)
262 SendMessageW(afc
->hwndOwner
,
263 RegisterWindowMessageW(ACMHELPMSGSTRINGW
), 0L, 0L);
267 TRACE("Dropped dlgCmd: ctl=%d ntf=0x%04x 0x%08lx\n",
268 LOWORD(wParam
), HIWORD(wParam
), lParam
);
273 if (afc
->fdwStyle
& ACMFORMATCHOOSE_STYLEF_CONTEXTHELP
)
274 SendMessageW(afc
->hwndOwner
,
275 RegisterWindowMessageW(ACMHELPMSGCONTEXTMENUW
),
278 #if defined(WM_CONTEXTHELP)
280 if (afc
->fdwStyle
& ACMFORMATCHOOSE_STYLEF_CONTEXTHELP
)
281 SendMessageW(afc
->hwndOwner
,
282 RegisterWindowMessageW(ACMHELPMSGCONTEXTHELPW
),
287 TRACE("Dropped dlgMsg: hwnd=%p msg=%i 0x%08lx 0x%08lx\n",
288 hWnd
, msg
, wParam
, lParam
);
294 /***********************************************************************
295 * acmFormatChooseA (MSACM32.@)
297 MMRESULT WINAPI
acmFormatChooseA(PACMFORMATCHOOSEA pafmtc
)
299 ACMFORMATCHOOSEW afcw
;
306 if (pafmtc
->cbStruct
< sizeof(ACMFORMATCHOOSEA
))
307 return MMSYSERR_INVALPARAM
;
309 afcw
.cbStruct
= sizeof(afcw
);
310 afcw
.fdwStyle
= pafmtc
->fdwStyle
;
311 afcw
.hwndOwner
= pafmtc
->hwndOwner
;
312 afcw
.pwfx
= pafmtc
->pwfx
;
313 afcw
.cbwfx
= pafmtc
->cbwfx
;
314 if (pafmtc
->pszTitle
)
316 sz
= MultiByteToWideChar(CP_ACP
, 0, pafmtc
->pszTitle
, -1, NULL
, 0);
317 if (!(title
= HeapAlloc(GetProcessHeap(), 0, sz
* sizeof(WCHAR
))))
319 ret
= MMSYSERR_NOMEM
;
322 MultiByteToWideChar(CP_ACP
, 0, pafmtc
->pszTitle
, -1, title
, sz
);
324 afcw
.pszTitle
= title
;
327 sz
= MultiByteToWideChar(CP_ACP
, 0, pafmtc
->pszName
, -1, NULL
, 0);
328 if (!(name
= HeapAlloc(GetProcessHeap(), 0, sz
* sizeof(WCHAR
))))
330 ret
= MMSYSERR_NOMEM
;
333 MultiByteToWideChar(CP_ACP
, 0, pafmtc
->pszName
, -1, name
, sz
);
336 afcw
.cchName
= pafmtc
->cchName
;
337 afcw
.fdwEnum
= pafmtc
->fdwEnum
;
338 afcw
.pwfxEnum
= pafmtc
->pwfxEnum
;
339 afcw
.hInstance
= pafmtc
->hInstance
;
340 if (pafmtc
->pszTemplateName
)
342 sz
= MultiByteToWideChar(CP_ACP
, 0, pafmtc
->pszTemplateName
, -1, NULL
, 0);
343 if (!(templ
= HeapAlloc(GetProcessHeap(), 0, sz
* sizeof(WCHAR
))))
345 ret
= MMSYSERR_NOMEM
;
348 MultiByteToWideChar(CP_ACP
, 0, pafmtc
->pszTemplateName
, -1, templ
, sz
);
350 afcw
.pszTemplateName
= templ
;
351 /* FIXME: hook procs not supported yet */
354 FIXME("Unsupported hook procs\n");
355 ret
= MMSYSERR_NOTSUPPORTED
;
358 ret
= acmFormatChooseW(&afcw
);
359 if (ret
== MMSYSERR_NOERROR
)
361 WideCharToMultiByte(CP_ACP
, 0, afcw
.szFormatTag
, -1, pafmtc
->szFormatTag
, sizeof(pafmtc
->szFormatTag
),
363 WideCharToMultiByte(CP_ACP
, 0, afcw
.szFormat
, -1, pafmtc
->szFormat
, sizeof(pafmtc
->szFormat
),
366 WideCharToMultiByte(CP_ACP
, 0, afcw
.pszName
, -1, pafmtc
->pszName
, pafmtc
->cchName
, NULL
, NULL
);
369 HeapFree(GetProcessHeap(), 0, title
);
370 HeapFree(GetProcessHeap(), 0, name
);
371 HeapFree(GetProcessHeap(), 0, templ
);
375 /***********************************************************************
376 * acmFormatChooseW (MSACM32.@)
378 MMRESULT WINAPI
acmFormatChooseW(PACMFORMATCHOOSEW pafmtc
)
380 if (pafmtc
->cbStruct
< sizeof(ACMFORMATCHOOSEW
))
381 return MMSYSERR_INVALPARAM
;
384 return MMSYSERR_INVALPARAM
;
386 if (pafmtc
->fdwStyle
& ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE
)
387 return DialogBoxIndirectParamW(MSACM_hInstance32
, (LPCDLGTEMPLATEW
)pafmtc
->hInstance
,
388 pafmtc
->hwndOwner
, FormatChooseDlgProc
, (LPARAM
)pafmtc
);
390 if (pafmtc
->fdwStyle
& ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE
)
391 return DialogBoxParamW(pafmtc
->hInstance
, pafmtc
->pszTemplateName
,
392 pafmtc
->hwndOwner
, FormatChooseDlgProc
, (LPARAM
)pafmtc
);
394 return DialogBoxParamW(MSACM_hInstance32
, MAKEINTRESOURCEW(DLG_ACMFORMATCHOOSE_ID
),
395 pafmtc
->hwndOwner
, FormatChooseDlgProc
, (LPARAM
)pafmtc
);
398 /***********************************************************************
399 * acmFormatDetailsA (MSACM32.@)
401 MMRESULT WINAPI
acmFormatDetailsA(HACMDRIVER had
, PACMFORMATDETAILSA pafd
,
404 ACMFORMATDETAILSW afdw
;
408 return MMSYSERR_INVALPARAM
;
410 memset(&afdw
, 0, sizeof(afdw
));
411 afdw
.cbStruct
= sizeof(afdw
);
412 afdw
.dwFormatIndex
= pafd
->dwFormatIndex
;
413 afdw
.dwFormatTag
= pafd
->dwFormatTag
;
414 afdw
.fdwSupport
= pafd
->fdwSupport
;
415 afdw
.pwfx
= pafd
->pwfx
;
416 afdw
.cbwfx
= pafd
->cbwfx
;
418 mmr
= acmFormatDetailsW(had
, &afdw
, fdwDetails
);
419 if (mmr
== MMSYSERR_NOERROR
) {
420 pafd
->dwFormatTag
= afdw
.dwFormatTag
;
421 pafd
->fdwSupport
= afdw
.fdwSupport
;
422 WideCharToMultiByte( CP_ACP
, 0, afdw
.szFormat
, -1,
423 pafd
->szFormat
, sizeof(pafd
->szFormat
), NULL
, NULL
);
428 /***********************************************************************
429 * acmFormatDetailsW (MSACM32.@)
431 MMRESULT WINAPI
acmFormatDetailsW(HACMDRIVER had
, PACMFORMATDETAILSW pafd
, DWORD fdwDetails
)
434 static const WCHAR fmt1
[] = {'%','d',' ','H','z',0};
435 static const WCHAR fmt2
[] = {';',' ','%','d',' ','b','i','t','s',0};
436 ACMFORMATTAGDETAILSW aftd
= {0};
438 TRACE("(%p, %p, %d)\n", had
, pafd
, fdwDetails
);
441 return MMSYSERR_INVALPARAM
;
443 if (pafd
->cbStruct
< sizeof(*pafd
)) return MMSYSERR_INVALPARAM
;
446 return MMSYSERR_INVALPARAM
;
448 if (pafd
->cbwfx
< sizeof(PCMWAVEFORMAT
))
449 return MMSYSERR_INVALPARAM
;
451 if (pafd
->fdwSupport
)
452 return MMSYSERR_INVALPARAM
;
454 if (pafd
->dwFormatTag
== WAVE_FORMAT_UNKNOWN
)
455 return MMSYSERR_INVALPARAM
;
457 switch (fdwDetails
) {
458 case ACM_FORMATDETAILSF_FORMAT
:
459 if (pafd
->dwFormatTag
!= pafd
->pwfx
->wFormatTag
) {
460 mmr
= MMSYSERR_INVALPARAM
;
464 PWINE_ACMDRIVERID padid
;
466 mmr
= ACMERR_NOTPOSSIBLE
;
467 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
) {
468 /* should check for codec only */
469 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
470 acmDriverOpen(&had
, (HACMDRIVERID
)padid
, 0) == 0) {
471 mmr
= MSACM_Message(had
, ACMDM_FORMAT_DETAILS
, (LPARAM
)pafd
, fdwDetails
);
472 acmDriverClose(had
, 0);
473 if (mmr
== MMSYSERR_NOERROR
) break;
477 mmr
= MSACM_Message(had
, ACMDM_FORMAT_DETAILS
, (LPARAM
)pafd
, fdwDetails
);
480 case ACM_FORMATDETAILSF_INDEX
:
481 aftd
.cbStruct
= sizeof(aftd
);
482 aftd
.dwFormatTag
= pafd
->dwFormatTag
;
483 mmr
= acmFormatTagDetailsW(had
, &aftd
, ACM_FORMATTAGDETAILSF_FORMATTAG
);
484 if (mmr
!= MMSYSERR_NOERROR
)
486 if (pafd
->dwFormatIndex
>= aftd
.cStandardFormats
)
488 mmr
= MMSYSERR_INVALPARAM
;
491 mmr
= MSACM_Message(had
, ACMDM_FORMAT_DETAILS
, (LPARAM
)pafd
, fdwDetails
);
494 WARN("Unknown fdwDetails %08x\n", fdwDetails
);
495 mmr
= MMSYSERR_INVALFLAG
;
499 if (mmr
== MMSYSERR_NOERROR
&& pafd
->szFormat
[0] == 0) {
500 wsprintfW(pafd
->szFormat
, fmt1
, pafd
->pwfx
->nSamplesPerSec
);
501 if (pafd
->pwfx
->wBitsPerSample
) {
502 wsprintfW(pafd
->szFormat
+ lstrlenW(pafd
->szFormat
), fmt2
,
503 pafd
->pwfx
->wBitsPerSample
);
505 MultiByteToWideChar(CP_ACP
, 0, (pafd
->pwfx
->nChannels
== 1) ? "; Mono" : "; Stereo", -1,
506 pafd
->szFormat
+ lstrlenW(pafd
->szFormat
),
507 ARRAY_SIZE(pafd
->szFormat
) - lstrlenW(pafd
->szFormat
));
510 TRACE("=> %d\n", mmr
);
514 struct MSACM_FormatEnumWtoA_Instance
{
515 PACMFORMATDETAILSA pafda
;
516 DWORD_PTR dwInstance
;
517 ACMFORMATENUMCBA fnCallback
;
520 static BOOL CALLBACK
MSACM_FormatEnumCallbackWtoA(HACMDRIVERID hadid
,
521 PACMFORMATDETAILSW pafdw
,
522 DWORD_PTR dwInstance
,
525 struct MSACM_FormatEnumWtoA_Instance
* pafei
;
527 pafei
= (struct MSACM_FormatEnumWtoA_Instance
*)dwInstance
;
529 pafei
->pafda
->dwFormatIndex
= pafdw
->dwFormatIndex
;
530 pafei
->pafda
->dwFormatTag
= pafdw
->dwFormatTag
;
531 pafei
->pafda
->fdwSupport
= pafdw
->fdwSupport
;
532 WideCharToMultiByte( CP_ACP
, 0, pafdw
->szFormat
, -1,
533 pafei
->pafda
->szFormat
, sizeof(pafei
->pafda
->szFormat
), NULL
, NULL
);
535 return (pafei
->fnCallback
)(hadid
, pafei
->pafda
,
536 pafei
->dwInstance
, fdwSupport
);
539 /***********************************************************************
540 * acmFormatEnumA (MSACM32.@)
542 MMRESULT WINAPI
acmFormatEnumA(HACMDRIVER had
, PACMFORMATDETAILSA pafda
,
543 ACMFORMATENUMCBA fnCallback
,
544 DWORD_PTR dwInstance
, DWORD fdwEnum
)
546 ACMFORMATDETAILSW afdw
;
547 struct MSACM_FormatEnumWtoA_Instance afei
;
550 return MMSYSERR_INVALPARAM
;
553 return MMSYSERR_INVALPARAM
;
555 if (pafda
->cbStruct
< sizeof(*pafda
))
556 return MMSYSERR_INVALPARAM
;
558 memset(&afdw
, 0, sizeof(afdw
));
559 afdw
.cbStruct
= sizeof(afdw
);
560 afdw
.dwFormatIndex
= pafda
->dwFormatIndex
;
561 afdw
.dwFormatTag
= pafda
->dwFormatTag
;
562 afdw
.fdwSupport
= pafda
->fdwSupport
;
563 afdw
.pwfx
= pafda
->pwfx
;
564 afdw
.cbwfx
= pafda
->cbwfx
;
567 afei
.dwInstance
= dwInstance
;
568 afei
.fnCallback
= fnCallback
;
570 return acmFormatEnumW(had
, &afdw
, MSACM_FormatEnumCallbackWtoA
,
571 (DWORD_PTR
)&afei
, fdwEnum
);
574 /***********************************************************************
575 * acmFormatEnumW (MSACM32.@)
577 static BOOL
MSACM_FormatEnumHelper(PWINE_ACMDRIVERID padid
, HACMDRIVER had
,
578 PACMFORMATDETAILSW pafd
, PWAVEFORMATEX pwfxRef
,
579 ACMFORMATENUMCBW fnCallback
,
580 DWORD_PTR dwInstance
, DWORD fdwEnum
)
582 ACMFORMATTAGDETAILSW aftd
;
585 if (fdwEnum
& ACM_FORMATENUMF_SUGGEST
) {
587 ACMDRVFORMATSUGGEST adfs
;
588 pafd
->dwFormatIndex
= 0;
589 memset(&aftd
, 0, sizeof(aftd
));
590 aftd
.cbStruct
= sizeof(aftd
);
591 memset(&adfs
, 0, sizeof(adfs
));
592 adfs
.cbStruct
= sizeof(adfs
);
594 for (i
= 0; i
< padid
->cFormatTags
; i
++) {
595 aftd
.dwFormatTag
= i
;
596 pafd
->dwFormatTag
= aftd
.dwFormatTag
;
597 pafd
->pwfx
->wFormatTag
= pafd
->dwFormatTag
;
599 if (acmFormatTagDetailsW(had
, &aftd
, ACM_FORMATTAGDETAILSF_INDEX
) != MMSYSERR_NOERROR
)
602 adfs
.cbwfxSrc
= aftd
.cbFormatSize
;
603 adfs
.cbwfxDst
= aftd
.cbFormatSize
;
604 adfs
.pwfxSrc
= pwfxRef
;
605 adfs
.pwfxDst
= pafd
->pwfx
;
606 pafd
->fdwSupport
= padid
->fdwSupport
;
608 if ((fdwEnum
& ACM_FORMATENUMF_WFORMATTAG
) &&
609 aftd
.dwFormatTag
!= pwfxRef
->wFormatTag
)
612 if ((fdwEnum
& ACM_FORMATENUMF_HARDWARE
) &&
613 !(pafd
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_HARDWARE
))
616 hdrvr
= OpenDriver(padid
->pszFileName
,0,0);
617 SendDriverMessage(hdrvr
,ACMDM_FORMAT_SUGGEST
,(LPARAM
)&adfs
,(fdwEnum
& 0x000000FFL
));
619 if (acmFormatDetailsW(had
, pafd
, ACM_FORMATDETAILSF_FORMAT
) != MMSYSERR_NOERROR
)
622 pafd
->cbwfx
= sizeof(*(pafd
->pwfx
));
624 if (!(fnCallback
)((HACMDRIVERID
)padid
, pafd
, dwInstance
, padid
->fdwSupport
))
628 for (i
= 0; i
< padid
->cFormatTags
; i
++) {
629 memset(&aftd
, 0, sizeof(aftd
));
630 aftd
.cbStruct
= sizeof(aftd
);
631 aftd
.dwFormatTagIndex
= i
;
632 if (acmFormatTagDetailsW(had
, &aftd
, ACM_FORMATTAGDETAILSF_INDEX
) != MMSYSERR_NOERROR
)
635 if ((fdwEnum
& ACM_FORMATENUMF_WFORMATTAG
) && aftd
.dwFormatTag
!= pwfxRef
->wFormatTag
)
638 for (j
= 0; j
< aftd
.cStandardFormats
; j
++) {
639 pafd
->dwFormatIndex
= j
;
640 pafd
->dwFormatTag
= aftd
.dwFormatTag
;
641 pafd
->fdwSupport
= 0;
642 if (acmFormatDetailsW(had
, pafd
, ACM_FORMATDETAILSF_INDEX
) != MMSYSERR_NOERROR
)
645 if ((fdwEnum
& ACM_FORMATENUMF_NCHANNELS
) &&
646 pafd
->pwfx
->nChannels
!= pwfxRef
->nChannels
)
648 if ((fdwEnum
& ACM_FORMATENUMF_NSAMPLESPERSEC
) &&
649 pafd
->pwfx
->nSamplesPerSec
!= pwfxRef
->nSamplesPerSec
)
651 if ((fdwEnum
& ACM_FORMATENUMF_WBITSPERSAMPLE
) &&
652 pafd
->pwfx
->wBitsPerSample
!= pwfxRef
->wBitsPerSample
)
654 if ((fdwEnum
& ACM_FORMATENUMF_HARDWARE
) &&
655 !(pafd
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_HARDWARE
))
658 /* more checks to be done on fdwEnum */
660 if (!(fnCallback
)((HACMDRIVERID
)padid
, pafd
, dwInstance
, padid
->fdwSupport
))
663 /* the "formats" used by the filters are also reported */
669 /**********************************************************************/
671 MMRESULT WINAPI
acmFormatEnumW(HACMDRIVER had
, PACMFORMATDETAILSW pafd
,
672 ACMFORMATENUMCBW fnCallback
,
673 DWORD_PTR dwInstance
, DWORD fdwEnum
)
675 PWINE_ACMDRIVERID padid
;
681 TRACE("(%p, %p, %p, %ld, %d)\n",
682 had
, pafd
, fnCallback
, dwInstance
, fdwEnum
);
685 return MMSYSERR_INVALPARAM
;
688 return MMSYSERR_INVALPARAM
;
690 if (pafd
->cbStruct
< sizeof(*pafd
))
691 return MMSYSERR_INVALPARAM
;
693 if (pafd
->fdwSupport
)
694 return MMSYSERR_INVALPARAM
;
697 return MMSYSERR_INVALPARAM
;
699 if (fdwEnum
& (ACM_FORMATENUMF_WFORMATTAG
|ACM_FORMATENUMF_NCHANNELS
|
700 ACM_FORMATENUMF_NSAMPLESPERSEC
|ACM_FORMATENUMF_WBITSPERSAMPLE
|
701 ACM_FORMATENUMF_CONVERT
|ACM_FORMATENUMF_SUGGEST
))
702 wfxRef
= *pafd
->pwfx
;
704 if ((fdwEnum
& ACM_FORMATENUMF_HARDWARE
) &&
705 !(fdwEnum
& (ACM_FORMATENUMF_INPUT
|ACM_FORMATENUMF_OUTPUT
)))
706 return MMSYSERR_INVALPARAM
;
708 if ((fdwEnum
& ACM_FORMATENUMF_WFORMATTAG
) &&
709 (pafd
->dwFormatTag
!= pafd
->pwfx
->wFormatTag
))
710 return MMSYSERR_INVALPARAM
;
712 if (fdwEnum
& (ACM_FORMATENUMF_CONVERT
|ACM_FORMATENUMF_INPUT
|ACM_FORMATENUMF_OUTPUT
))
713 FIXME("Unsupported fdwEnum values %08x\n", fdwEnum
);
715 mmr
= acmMetrics((HACMOBJ
)had
, ACM_METRIC_MAX_SIZE_FORMAT
, &cbwfxMax
);
716 if (mmr
!= MMSYSERR_NOERROR
)
718 if (pafd
->cbwfx
< cbwfxMax
)
719 return MMSYSERR_INVALPARAM
;
724 if (acmDriverID((HACMOBJ
)had
, &hadid
, 0) != MMSYSERR_NOERROR
)
725 return MMSYSERR_INVALHANDLE
;
726 MSACM_FormatEnumHelper(MSACM_GetDriverID(hadid
), had
, pafd
, &wfxRef
,
727 fnCallback
, dwInstance
, fdwEnum
);
728 return MMSYSERR_NOERROR
;
730 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
) {
731 /* should check for codec only */
732 if ((padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) ||
733 acmDriverOpen(&had
, (HACMDRIVERID
)padid
, 0) != MMSYSERR_NOERROR
)
735 ret
= MSACM_FormatEnumHelper(padid
, had
, pafd
, &wfxRef
,
736 fnCallback
, dwInstance
, fdwEnum
);
737 acmDriverClose(had
, 0);
740 return MMSYSERR_NOERROR
;
743 /***********************************************************************
744 * acmFormatSuggest (MSACM32.@)
746 MMRESULT WINAPI
acmFormatSuggest(HACMDRIVER had
, PWAVEFORMATEX pwfxSrc
,
747 PWAVEFORMATEX pwfxDst
, DWORD cbwfxDst
, DWORD fdwSuggest
)
749 ACMFORMATTAGDETAILSW aftd
= {0};
750 ACMDRVFORMATSUGGEST adfg
;
753 TRACE("(%p, %p, %p, %d, %d)\n",
754 had
, pwfxSrc
, pwfxDst
, cbwfxDst
, fdwSuggest
);
756 if (!pwfxSrc
|| !pwfxDst
)
757 return MMSYSERR_INVALPARAM
;
759 if (fdwSuggest
& ~(ACM_FORMATSUGGESTF_NCHANNELS
|ACM_FORMATSUGGESTF_NSAMPLESPERSEC
|
760 ACM_FORMATSUGGESTF_WBITSPERSAMPLE
|ACM_FORMATSUGGESTF_WFORMATTAG
))
761 return MMSYSERR_INVALFLAG
;
763 /* if we were given PCM, try to convert to PCM */
764 if (pwfxSrc
->wFormatTag
== WAVE_FORMAT_PCM
&& !had
&&
765 !(fdwSuggest
& ACM_FORMATSUGGESTF_WFORMATTAG
))
767 ACMFORMATDETAILSW afd
= {0};
768 afd
.cbStruct
= sizeof(afd
);
769 afd
.dwFormatTag
= WAVE_FORMAT_PCM
;
771 afd
.cbwfx
= sizeof(PCMWAVEFORMAT
);
772 if (!acmFormatDetailsW(had
, &afd
, ACM_FORMATDETAILSF_FORMAT
))
774 memcpy(pwfxDst
, pwfxSrc
, sizeof(PCMWAVEFORMAT
));
775 return MMSYSERR_NOERROR
;
779 aftd
.cbStruct
= sizeof(aftd
);
780 if (fdwSuggest
& ACM_FORMATSUGGESTF_WFORMATTAG
)
781 aftd
.dwFormatTag
= pwfxDst
->wFormatTag
;
782 mmr
= acmFormatTagDetailsW(had
, &aftd
, ACM_FORMATTAGDETAILSF_LARGESTSIZE
);
783 if ((fdwSuggest
& ACM_FORMATSUGGESTF_WFORMATTAG
) && mmr
== ACMERR_NOTPOSSIBLE
)
784 return ACMERR_NOTPOSSIBLE
;
786 if (cbwfxDst
< aftd
.cbFormatSize
)
787 return MMSYSERR_INVALPARAM
;
789 adfg
.cbStruct
= sizeof(adfg
);
790 adfg
.fdwSuggest
= fdwSuggest
;
791 adfg
.pwfxSrc
= pwfxSrc
;
792 adfg
.cbwfxSrc
= (pwfxSrc
->wFormatTag
== WAVE_FORMAT_PCM
) ?
793 sizeof(WAVEFORMATEX
) : (sizeof(WAVEFORMATEX
) + pwfxSrc
->cbSize
);
794 adfg
.pwfxDst
= pwfxDst
;
795 adfg
.cbwfxDst
= cbwfxDst
;
798 PWINE_ACMDRIVERID padid
;
800 /* MS doc says: ACM finds the best suggestion.
801 * Well, first found will be the "best"
803 mmr
= ACMERR_NOTPOSSIBLE
;
804 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
) {
805 /* should check for codec only */
806 if ((padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) ||
807 acmDriverOpen(&had
, (HACMDRIVERID
)padid
, 0) != MMSYSERR_NOERROR
)
810 if (MSACM_Message(had
, ACMDM_FORMAT_SUGGEST
, (LPARAM
)&adfg
, 0L) == MMSYSERR_NOERROR
) {
811 mmr
= MMSYSERR_NOERROR
;
814 acmDriverClose(had
, 0);
817 mmr
= MSACM_Message(had
, ACMDM_FORMAT_SUGGEST
, (LPARAM
)&adfg
, 0L);
822 /***********************************************************************
823 * acmFormatTagDetailsA (MSACM32.@)
825 MMRESULT WINAPI
acmFormatTagDetailsA(HACMDRIVER had
, PACMFORMATTAGDETAILSA paftda
,
828 ACMFORMATTAGDETAILSW aftdw
;
831 memset(&aftdw
, 0, sizeof(aftdw
));
832 aftdw
.cbStruct
= sizeof(aftdw
);
833 aftdw
.dwFormatTagIndex
= paftda
->dwFormatTagIndex
;
834 aftdw
.dwFormatTag
= paftda
->dwFormatTag
;
836 mmr
= acmFormatTagDetailsW(had
, &aftdw
, fdwDetails
);
837 if (mmr
== MMSYSERR_NOERROR
) {
838 paftda
->dwFormatTag
= aftdw
.dwFormatTag
;
839 paftda
->dwFormatTagIndex
= aftdw
.dwFormatTagIndex
;
840 paftda
->cbFormatSize
= aftdw
.cbFormatSize
;
841 paftda
->fdwSupport
= aftdw
.fdwSupport
;
842 paftda
->cStandardFormats
= aftdw
.cStandardFormats
;
843 WideCharToMultiByte( CP_ACP
, 0, aftdw
.szFormatTag
, -1, paftda
->szFormatTag
,
844 sizeof(paftda
->szFormatTag
), NULL
, NULL
);
849 /***********************************************************************
850 * acmFormatTagDetailsW (MSACM32.@)
852 MMRESULT WINAPI
acmFormatTagDetailsW(HACMDRIVER had
, PACMFORMATTAGDETAILSW paftd
,
855 PWINE_ACMDRIVERID padid
;
856 MMRESULT mmr
= ACMERR_NOTPOSSIBLE
;
858 TRACE("(%p, %p, %d)\n", had
, paftd
, fdwDetails
);
860 if (fdwDetails
& ~(ACM_FORMATTAGDETAILSF_FORMATTAG
|ACM_FORMATTAGDETAILSF_INDEX
|
861 ACM_FORMATTAGDETAILSF_LARGESTSIZE
))
862 return MMSYSERR_INVALFLAG
;
864 switch (fdwDetails
) {
865 case ACM_FORMATTAGDETAILSF_FORMATTAG
:
867 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
) {
868 /* should check for codec only */
869 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
870 MSACM_FindFormatTagInCache(padid
, paftd
->dwFormatTag
, NULL
) &&
871 acmDriverOpen(&had
, (HACMDRIVERID
)padid
, 0) == 0) {
872 mmr
= MSACM_Message(had
, ACMDM_FORMATTAG_DETAILS
, (LPARAM
)paftd
, fdwDetails
);
873 acmDriverClose(had
, 0);
874 if (mmr
== MMSYSERR_NOERROR
) break;
878 PWINE_ACMDRIVER pad
= MSACM_GetDriver(had
);
880 if (pad
&& MSACM_FindFormatTagInCache(pad
->obj
.pACMDriverID
, paftd
->dwFormatTag
, NULL
))
881 mmr
= MSACM_Message(had
, ACMDM_FORMATTAG_DETAILS
, (LPARAM
)paftd
, fdwDetails
);
885 case ACM_FORMATTAGDETAILSF_INDEX
:
887 PWINE_ACMDRIVER pad
= MSACM_GetDriver(had
);
889 if (pad
&& paftd
->dwFormatTagIndex
< pad
->obj
.pACMDriverID
->cFormatTags
)
890 mmr
= MSACM_Message(had
, ACMDM_FORMATTAG_DETAILS
, (LPARAM
)paftd
, fdwDetails
);
894 case ACM_FORMATTAGDETAILSF_LARGESTSIZE
:
896 ACMFORMATTAGDETAILSW tmp
;
897 DWORD ft
= paftd
->dwFormatTag
;
899 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
) {
900 /* should check for codec only */
901 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
902 acmDriverOpen(&had
, (HACMDRIVERID
)padid
, 0) == 0) {
904 memset(&tmp
, 0, sizeof(tmp
));
905 tmp
.cbStruct
= sizeof(tmp
);
906 tmp
.dwFormatTag
= ft
;
908 if (MSACM_Message(had
, ACMDM_FORMATTAG_DETAILS
,
909 (LPARAM
)&tmp
, fdwDetails
) == MMSYSERR_NOERROR
) {
910 if (mmr
== ACMERR_NOTPOSSIBLE
||
911 paftd
->cbFormatSize
< tmp
.cbFormatSize
) {
913 mmr
= MMSYSERR_NOERROR
;
916 acmDriverClose(had
, 0);
920 mmr
= MSACM_Message(had
, ACMDM_FORMATTAG_DETAILS
, (LPARAM
)paftd
, fdwDetails
);
925 WARN("Unsupported fdwDetails=%08x\n", fdwDetails
);
926 mmr
= MMSYSERR_ERROR
;
929 if (mmr
== MMSYSERR_NOERROR
&&
930 paftd
->dwFormatTag
== WAVE_FORMAT_PCM
&& paftd
->szFormatTag
[0] == 0)
931 MultiByteToWideChar(CP_ACP
, 0, "PCM", -1, paftd
->szFormatTag
,
932 ARRAY_SIZE(paftd
->szFormatTag
));
937 struct MSACM_FormatTagEnumWtoA_Instance
{
938 PACMFORMATTAGDETAILSA paftda
;
939 DWORD_PTR dwInstance
;
940 ACMFORMATTAGENUMCBA fnCallback
;
943 static BOOL CALLBACK
MSACM_FormatTagEnumCallbackWtoA(HACMDRIVERID hadid
,
944 PACMFORMATTAGDETAILSW paftdw
,
945 DWORD_PTR dwInstance
,
948 struct MSACM_FormatTagEnumWtoA_Instance
* paftei
;
950 paftei
= (struct MSACM_FormatTagEnumWtoA_Instance
*)dwInstance
;
952 paftei
->paftda
->dwFormatTagIndex
= paftdw
->dwFormatTagIndex
;
953 paftei
->paftda
->dwFormatTag
= paftdw
->dwFormatTag
;
954 paftei
->paftda
->cbFormatSize
= paftdw
->cbFormatSize
;
955 paftei
->paftda
->fdwSupport
= paftdw
->fdwSupport
;
956 paftei
->paftda
->cStandardFormats
= paftdw
->cStandardFormats
;
957 WideCharToMultiByte( CP_ACP
, 0, paftdw
->szFormatTag
, -1, paftei
->paftda
->szFormatTag
,
958 sizeof(paftei
->paftda
->szFormatTag
), NULL
, NULL
);
960 return (paftei
->fnCallback
)(hadid
, paftei
->paftda
,
961 paftei
->dwInstance
, fdwSupport
);
964 /***********************************************************************
965 * acmFormatTagEnumA (MSACM32.@)
967 MMRESULT WINAPI
acmFormatTagEnumA(HACMDRIVER had
, PACMFORMATTAGDETAILSA paftda
,
968 ACMFORMATTAGENUMCBA fnCallback
,
969 DWORD_PTR dwInstance
, DWORD fdwEnum
)
971 ACMFORMATTAGDETAILSW aftdw
;
972 struct MSACM_FormatTagEnumWtoA_Instance aftei
;
975 return MMSYSERR_INVALPARAM
;
977 if (paftda
->cbStruct
< sizeof(*paftda
))
978 return MMSYSERR_INVALPARAM
;
981 return MMSYSERR_INVALFLAG
;
983 memset(&aftdw
, 0, sizeof(aftdw
));
984 aftdw
.cbStruct
= sizeof(aftdw
);
985 aftdw
.dwFormatTagIndex
= paftda
->dwFormatTagIndex
;
986 aftdw
.dwFormatTag
= paftda
->dwFormatTag
;
988 aftei
.paftda
= paftda
;
989 aftei
.dwInstance
= dwInstance
;
990 aftei
.fnCallback
= fnCallback
;
992 return acmFormatTagEnumW(had
, &aftdw
, MSACM_FormatTagEnumCallbackWtoA
,
993 (DWORD_PTR
)&aftei
, fdwEnum
);
996 /***********************************************************************
997 * acmFormatTagEnumW (MSACM32.@)
999 MMRESULT WINAPI
acmFormatTagEnumW(HACMDRIVER had
, PACMFORMATTAGDETAILSW paftd
,
1000 ACMFORMATTAGENUMCBW fnCallback
,
1001 DWORD_PTR dwInstance
, DWORD fdwEnum
)
1003 PWINE_ACMDRIVERID padid
;
1005 BOOL bPcmDone
= FALSE
;
1007 TRACE("(%p, %p, %p, %ld, %d)\n",
1008 had
, paftd
, fnCallback
, dwInstance
, fdwEnum
);
1011 return MMSYSERR_INVALPARAM
;
1013 if (paftd
->cbStruct
< sizeof(*paftd
))
1014 return MMSYSERR_INVALPARAM
;
1017 return MMSYSERR_INVALFLAG
;
1019 /* (WS) MSDN info page says that if had != 0, then we should find
1020 * the specific driver to get its tags from. Therefore I'm removing
1021 * the FIXME call and adding a search block below. It also seems
1022 * that the lack of this functionality was the responsible for
1023 * codecs to be multiply and incorrectly listed.
1026 /* if (had) FIXME("had != NULL, not supported\n"); */
1029 if (acmDriverID((HACMOBJ
)had
, (HACMDRIVERID
*)&padid
, 0) != MMSYSERR_NOERROR
)
1030 return MMSYSERR_INVALHANDLE
;
1032 for (i
= 0; i
< padid
->cFormatTags
; i
++) {
1033 paftd
->dwFormatTagIndex
= i
;
1034 if (MSACM_Message(had
, ACMDM_FORMATTAG_DETAILS
,
1035 (LPARAM
)paftd
, ACM_FORMATTAGDETAILSF_INDEX
) == MMSYSERR_NOERROR
) {
1036 if (paftd
->dwFormatTag
== WAVE_FORMAT_PCM
) {
1037 if (paftd
->szFormatTag
[0] == 0)
1038 MultiByteToWideChar(CP_ACP
, 0, "PCM", -1, paftd
->szFormatTag
,
1039 ARRAY_SIZE(paftd
->szFormatTag
));
1040 /* (WS) I'm preserving this PCM hack since it seems to be
1041 * correct. Please notice this block was borrowed from
1044 if (bPcmDone
) continue;
1047 if (!(fnCallback
)((HACMDRIVERID
)padid
, paftd
, dwInstance
, padid
->fdwSupport
))
1048 return MMSYSERR_NOERROR
;
1052 /* if had==0 then search for the first suitable driver */
1054 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
) {
1055 /* should check for codec only */
1056 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
1057 acmDriverOpen(&had
, (HACMDRIVERID
)padid
, 0) == MMSYSERR_NOERROR
) {
1058 for (i
= 0; i
< padid
->cFormatTags
; i
++) {
1059 paftd
->dwFormatTagIndex
= i
;
1060 if (MSACM_Message(had
, ACMDM_FORMATTAG_DETAILS
,
1061 (LPARAM
)paftd
, ACM_FORMATTAGDETAILSF_INDEX
) == MMSYSERR_NOERROR
) {
1062 if (paftd
->dwFormatTag
== WAVE_FORMAT_PCM
) {
1063 if (paftd
->szFormatTag
[0] == 0)
1064 MultiByteToWideChar(CP_ACP
, 0, "PCM", -1, paftd
->szFormatTag
,
1065 ARRAY_SIZE(paftd
->szFormatTag
));
1066 /* FIXME (EPP): I'm not sure this is the correct
1067 * algorithm (should make more sense to apply the same
1068 * for all already loaded formats, but this will do
1071 if (bPcmDone
) continue;
1074 if (!(fnCallback
)((HACMDRIVERID
)padid
, paftd
, dwInstance
, padid
->fdwSupport
)) {
1075 acmDriverClose(had
, 0);
1076 return MMSYSERR_NOERROR
;
1080 acmDriverClose(had
, 0);
1084 return MMSYSERR_NOERROR
;