ReactOS 0.4.15-dev-7681-g776c3a3
format.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winerror.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
Include dependency graph for format.c:

Go to the source code of this file.

Classes

struct  MSACM_FillFormatData
 
struct  MSACM_FormatEnumWtoA_Instance
 
struct  MSACM_FormatTagEnumWtoA_Instance
 

Macros

#define WINE_ACMFF_TAG   0
 
#define WINE_ACMFF_FORMAT   1
 
#define WINE_ACMFF_WFX   2
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msacm)
 
static BOOL CALLBACK MSACM_FillFormatTagsCB (HACMDRIVERID hadid, PACMFORMATTAGDETAILSW paftd, DWORD_PTR dwInstance, DWORD fdwSupport)
 
static BOOL MSACM_FillFormatTags (HWND hWnd, PACMFORMATCHOOSEW afc)
 
static BOOL MSACM_FillFormat (HWND hWnd, PACMFORMATCHOOSEW afc)
 
static MMRESULT MSACM_GetWFX (HWND hWnd, PACMFORMATCHOOSEW afc)
 
static INT_PTR CALLBACK FormatChooseDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
MMRESULT WINAPI acmFormatChooseA (PACMFORMATCHOOSEA pafmtc)
 
MMRESULT WINAPI acmFormatChooseW (PACMFORMATCHOOSEW pafmtc)
 
MMRESULT WINAPI acmFormatDetailsA (HACMDRIVER had, PACMFORMATDETAILSA pafd, DWORD fdwDetails)
 
MMRESULT WINAPI acmFormatDetailsW (HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails)
 
static BOOL CALLBACK MSACM_FormatEnumCallbackWtoA (HACMDRIVERID hadid, PACMFORMATDETAILSW pafdw, DWORD_PTR dwInstance, DWORD fdwSupport)
 
MMRESULT WINAPI acmFormatEnumA (HACMDRIVER had, PACMFORMATDETAILSA pafda, ACMFORMATENUMCBA fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum)
 
static BOOL MSACM_FormatEnumHelper (PWINE_ACMDRIVERID padid, HACMDRIVER had, PACMFORMATDETAILSW pafd, PWAVEFORMATEX pwfxRef, ACMFORMATENUMCBW fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum)
 
MMRESULT WINAPI acmFormatEnumW (HACMDRIVER had, PACMFORMATDETAILSW pafd, ACMFORMATENUMCBW fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum)
 
MMRESULT WINAPI acmFormatSuggest (HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest)
 
MMRESULT WINAPI acmFormatTagDetailsA (HACMDRIVER had, PACMFORMATTAGDETAILSA paftda, DWORD fdwDetails)
 
MMRESULT WINAPI acmFormatTagDetailsW (HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, DWORD fdwDetails)
 
static BOOL CALLBACK MSACM_FormatTagEnumCallbackWtoA (HACMDRIVERID hadid, PACMFORMATTAGDETAILSW paftdw, DWORD_PTR dwInstance, DWORD fdwSupport)
 
MMRESULT WINAPI acmFormatTagEnumA (HACMDRIVER had, PACMFORMATTAGDETAILSA paftda, ACMFORMATTAGENUMCBA fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum)
 
MMRESULT WINAPI acmFormatTagEnumW (HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, ACMFORMATTAGENUMCBW fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum)
 

Variables

static const WCHAR fmt_prop [] = {'a','c','m','p','r','o','p','\0'}
 

Macro Definition Documentation

◆ WINE_ACMFF_FORMAT

#define WINE_ACMFF_FORMAT   1

Definition at line 42 of file format.c.

◆ WINE_ACMFF_TAG

#define WINE_ACMFF_TAG   0

Definition at line 41 of file format.c.

◆ WINE_ACMFF_WFX

#define WINE_ACMFF_WFX   2

Definition at line 43 of file format.c.

Function Documentation

◆ acmFormatChooseA()

MMRESULT WINAPI acmFormatChooseA ( PACMFORMATCHOOSEA  pafmtc)

Definition at line 297 of file format.c.

298{
299 ACMFORMATCHOOSEW afcw;
301 LPWSTR title = NULL;
302 LPWSTR name = NULL;
303 LPWSTR templ = NULL;
304 DWORD sz;
305
306 if (pafmtc->cbStruct < sizeof(ACMFORMATCHOOSEA))
307 return MMSYSERR_INVALPARAM;
308
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)
315 {
316 sz = MultiByteToWideChar(CP_ACP, 0, pafmtc->pszTitle, -1, NULL, 0);
317 if (!(title = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
318 {
320 goto done;
321 }
322 MultiByteToWideChar(CP_ACP, 0, pafmtc->pszTitle, -1, title, sz);
323 }
324 afcw.pszTitle = title;
325 if (pafmtc->pszName)
326 {
327 sz = MultiByteToWideChar(CP_ACP, 0, pafmtc->pszName, -1, NULL, 0);
328 if (!(name = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
329 {
331 goto done;
332 }
333 MultiByteToWideChar(CP_ACP, 0, pafmtc->pszName, -1, name, sz);
334 }
335 afcw.pszName = name;
336 afcw.cchName = pafmtc->cchName;
337 afcw.fdwEnum = pafmtc->fdwEnum;
338 afcw.pwfxEnum = pafmtc->pwfxEnum;
339 afcw.hInstance = pafmtc->hInstance;
340 if (pafmtc->pszTemplateName)
341 {
342 sz = MultiByteToWideChar(CP_ACP, 0, pafmtc->pszTemplateName, -1, NULL, 0);
343 if (!(templ = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
344 {
346 goto done;
347 }
348 MultiByteToWideChar(CP_ACP, 0, pafmtc->pszTemplateName, -1, templ, sz);
349 }
350 afcw.pszTemplateName = templ;
351 /* FIXME: hook procs not supported yet */
352 if (pafmtc->pfnHook)
353 {
354 FIXME("Unsupported hook procs\n");
356 goto done;
357 }
358 ret = acmFormatChooseW(&afcw);
359 if (ret == MMSYSERR_NOERROR)
360 {
361 WideCharToMultiByte(CP_ACP, 0, afcw.szFormatTag, -1, pafmtc->szFormatTag, sizeof(pafmtc->szFormatTag),
362 NULL, NULL);
363 WideCharToMultiByte(CP_ACP, 0, afcw.szFormat, -1, pafmtc->szFormat, sizeof(pafmtc->szFormat),
364 NULL, NULL);
365 if (pafmtc->pszName)
366 WideCharToMultiByte(CP_ACP, 0, afcw.pszName, -1, pafmtc->pszName, pafmtc->cchName, NULL, NULL);
367 }
368done:
371 HeapFree(GetProcessHeap(), 0, templ);
372 return ret;
373}
#define FIXME(fmt,...)
Definition: debug.h:111
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
MMRESULT WINAPI acmFormatChooseW(PACMFORMATCHOOSEW pafmtc)
Definition: format.c:378
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
UINT MMRESULT
Definition: mmsystem.h:962
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
static char title[]
Definition: ps.c:92
PWAVEFORMATEX pwfx
Definition: msacm.h:441
HINSTANCE hInstance
Definition: msacm.h:454
CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]
Definition: msacm.h:445
LPCSTR pszTitle
Definition: msacm.h:443
DWORD cchName
Definition: msacm.h:449
LPSTR pszName
Definition: msacm.h:448
LPCSTR pszTemplateName
Definition: msacm.h:455
PWAVEFORMATEX pwfxEnum
Definition: msacm.h:452
CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]
Definition: msacm.h:446
DWORD fdwEnum
Definition: msacm.h:451
DWORD cbStruct
Definition: msacm.h:436
ACMFORMATCHOOSEHOOKPROCA pfnHook
Definition: msacm.h:457
DWORD fdwStyle
Definition: msacm.h:437
HWND hwndOwner
Definition: msacm.h:439
DWORD cchName
Definition: msacm.h:475
HWND hwndOwner
Definition: msacm.h:465
LPCWSTR pszTemplateName
Definition: msacm.h:481
DWORD fdwEnum
Definition: msacm.h:477
WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]
Definition: msacm.h:471
DWORD cbStruct
Definition: msacm.h:462
LPWAVEFORMATEX pwfxEnum
Definition: msacm.h:478
LPCWSTR pszTitle
Definition: msacm.h:469
WCHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]
Definition: msacm.h:472
LPWSTR pszName
Definition: msacm.h:474
DWORD fdwStyle
Definition: msacm.h:463
HINSTANCE hInstance
Definition: msacm.h:480
PWAVEFORMATEX pwfx
Definition: msacm.h:467
Definition: name.c:39
int ret
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ acmFormatChooseW()

MMRESULT WINAPI acmFormatChooseW ( PACMFORMATCHOOSEW  pafmtc)

Definition at line 378 of file format.c.

379{
380 if (pafmtc->cbStruct < sizeof(ACMFORMATCHOOSEW))
381 return MMSYSERR_INVALPARAM;
382
383 if (!pafmtc->pwfx)
384 return MMSYSERR_INVALPARAM;
385
388 pafmtc->hwndOwner, FormatChooseDlgProc, (LPARAM)pafmtc);
389
391 return DialogBoxParamW(pafmtc->hInstance, pafmtc->pszTemplateName,
392 pafmtc->hwndOwner, FormatChooseDlgProc, (LPARAM)pafmtc);
393
395 pafmtc->hwndOwner, FormatChooseDlgProc, (LPARAM)pafmtc);
396}
static INT_PTR CALLBACK FormatChooseDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: format.c:218
HINSTANCE MSACM_hInstance32
Definition: msacm32_main.c:40
#define ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE
Definition: msacm.h:153
#define ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE
Definition: msacm.h:154
#define DLG_ACMFORMATCHOOSE_ID
Definition: msacmdlg.h:23
LONG_PTR LPARAM
Definition: windef.h:208
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by acmFormatChooseA(), AVISaveOptionsFmtChoose(), and test_acmFormatChoose().

◆ acmFormatDetailsA()

MMRESULT WINAPI acmFormatDetailsA ( HACMDRIVER  had,
PACMFORMATDETAILSA  pafd,
DWORD  fdwDetails 
)

Definition at line 401 of file format.c.

403{
405 MMRESULT mmr;
406
407 if (!pafd)
408 return MMSYSERR_INVALPARAM;
409
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;
417
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 );
424 }
425 return mmr;
426}
MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails)
Definition: format.c:431
#define memset(x, y, z)
Definition: compat.h:39
CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]
Definition: msacm.h:498
DWORD dwFormatIndex
Definition: msacm.h:493
PWAVEFORMATEX pwfx
Definition: msacm.h:496
DWORD dwFormatTag
Definition: msacm.h:494
DWORD fdwSupport
Definition: msacm.h:495
WCHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]
Definition: msacm.h:509
DWORD dwFormatTag
Definition: msacm.h:505
DWORD dwFormatIndex
Definition: msacm.h:504
DWORD fdwSupport
Definition: msacm.h:506
PWAVEFORMATEX pwfx
Definition: msacm.h:507
DWORD cbStruct
Definition: msacm.h:503

Referenced by DriverEnumProc(), and FormatTagEnumProc().

◆ acmFormatDetailsW()

MMRESULT WINAPI acmFormatDetailsW ( HACMDRIVER  had,
PACMFORMATDETAILSW  pafd,
DWORD  fdwDetails 
)

Definition at line 431 of file format.c.

432{
433 MMRESULT mmr;
434 static const WCHAR fmt1[] = {'%','d',' ','H','z',0};
435 static const WCHAR fmt2[] = {';',' ','%','d',' ','b','i','t','s',0};
436 ACMFORMATTAGDETAILSW aftd = {0};
437
438 TRACE("(%p, %p, %d)\n", had, pafd, fdwDetails);
439
440 if (!pafd)
441 return MMSYSERR_INVALPARAM;
442
443 if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM;
444
445 if (!pafd->pwfx)
446 return MMSYSERR_INVALPARAM;
447
448 if (pafd->cbwfx < sizeof(PCMWAVEFORMAT))
449 return MMSYSERR_INVALPARAM;
450
451 if (pafd->fdwSupport)
452 return MMSYSERR_INVALPARAM;
453
454 if (pafd->dwFormatTag == WAVE_FORMAT_UNKNOWN)
455 return MMSYSERR_INVALPARAM;
456
457 switch (fdwDetails) {
459 if (pafd->dwFormatTag != pafd->pwfx->wFormatTag) {
461 break;
462 }
463 if (had == NULL) {
464 PWINE_ACMDRIVERID padid;
465
466 mmr = ACMERR_NOTPOSSIBLE;
467 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
468 /* should check for codec only */
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;
474 }
475 }
476 } else {
477 mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails);
478 }
479 break;
481 aftd.cbStruct = sizeof(aftd);
482 aftd.dwFormatTag = pafd->dwFormatTag;
484 if (mmr != MMSYSERR_NOERROR)
485 break;
486 if (pafd->dwFormatIndex >= aftd.cStandardFormats)
487 {
489 break;
490 }
491 mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails);
492 break;
493 default:
494 WARN("Unknown fdwDetails %08x\n", fdwDetails);
495 mmr = MMSYSERR_INVALFLAG;
496 break;
497 }
498
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);
504 }
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));
508 }
509
510 TRACE("=> %d\n", mmr);
511 return mmr;
512}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define WARN(fmt,...)
Definition: debug.h:112
#define lstrlenW
Definition: compat.h:750
MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen)
Definition: driver.c:491
MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
Definition: driver.c:179
MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, DWORD fdwDetails)
Definition: format.c:852
MMRESULT MSACM_Message(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
Definition: internal.c:872
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:48
#define WAVE_FORMAT_UNKNOWN
Definition: mmreg.h:95
#define MMSYSERR_INVALFLAG
Definition: mmsystem.h:106
#define ACM_FORMATTAGDETAILSF_FORMATTAG
Definition: msacm.h:183
#define ACMERR_NOTPOSSIBLE
Definition: msacm.h:36
#define ACM_FORMATDETAILSF_FORMAT
Definition: msacm.h:161
#define ACMDRIVERDETAILS_SUPPORTF_DISABLED
Definition: msacm.h:67
#define ACM_FORMATDETAILSF_INDEX
Definition: msacm.h:160
#define ACMDM_FORMAT_DETAILS
Definition: msacmdrv.h:52
#define TRACE(s)
Definition: solgame.cpp:4
DWORD cStandardFormats
Definition: msacm.h:534
DWORD nSamplesPerSec
Definition: mmreg.h:80
WORD nChannels
Definition: mmreg.h:79
WORD wFormatTag
Definition: mmreg.h:78
WORD wBitsPerSample
Definition: mmreg.h:83
DWORD fdwSupport
Definition: wineacm.h:98
PWINE_ACMDRIVERID pNextACMDriverID
Definition: wineacm.h:93
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)

Referenced by acmFormatDetailsA(), acmFormatSuggest(), AVISaveOptionsUpdate(), MSACM_FillFormatTagsCB(), and MSACM_FormatEnumHelper().

◆ acmFormatEnumA()

MMRESULT WINAPI acmFormatEnumA ( HACMDRIVER  had,
PACMFORMATDETAILSA  pafda,
ACMFORMATENUMCBA  fnCallback,
DWORD_PTR  dwInstance,
DWORD  fdwEnum 
)

Definition at line 542 of file format.c.

545{
548
549 if (!pafda)
550 return MMSYSERR_INVALPARAM;
551
552 if (!fnCallback)
553 return MMSYSERR_INVALPARAM;
554
555 if (pafda->cbStruct < sizeof(*pafda))
556 return MMSYSERR_INVALPARAM;
557
558 memset(&afdw, 0, sizeof(afdw));
559 afdw.cbStruct = sizeof(afdw);
563 afdw.pwfx = pafda->pwfx;
564 afdw.cbwfx = pafda->cbwfx;
565
566 afei.pafda = pafda;
567 afei.dwInstance = dwInstance;
568 afei.fnCallback = fnCallback;
569
571 (DWORD_PTR)&afei, fdwEnum);
572}
MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd, ACMFORMATENUMCBW fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum)
Definition: format.c:671
static BOOL CALLBACK MSACM_FormatEnumCallbackWtoA(HACMDRIVERID hadid, PACMFORMATDETAILSW pafdw, DWORD_PTR dwInstance, DWORD fdwSupport)
Definition: format.c:520
ACMFORMATENUMCBA fnCallback
Definition: format.c:517
PACMFORMATDETAILSA pafda
Definition: format.c:515
DWORD cbStruct
Definition: msacm.h:492
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by DriverEnumProc().

◆ acmFormatEnumW()

MMRESULT WINAPI acmFormatEnumW ( HACMDRIVER  had,
PACMFORMATDETAILSW  pafd,
ACMFORMATENUMCBW  fnCallback,
DWORD_PTR  dwInstance,
DWORD  fdwEnum 
)

Definition at line 671 of file format.c.

674{
675 PWINE_ACMDRIVERID padid;
676 WAVEFORMATEX wfxRef;
677 BOOL ret;
678 DWORD cbwfxMax;
679 MMRESULT mmr;
680
681 TRACE("(%p, %p, %p, %ld, %d)\n",
682 had, pafd, fnCallback, dwInstance, fdwEnum);
683
684 if (!pafd)
685 return MMSYSERR_INVALPARAM;
686
687 if (!fnCallback)
688 return MMSYSERR_INVALPARAM;
689
690 if (pafd->cbStruct < sizeof(*pafd))
691 return MMSYSERR_INVALPARAM;
692
693 if (pafd->fdwSupport)
694 return MMSYSERR_INVALPARAM;
695
696 if (!pafd->pwfx)
697 return MMSYSERR_INVALPARAM;
698
702 wfxRef = *pafd->pwfx;
703
704 if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) &&
706 return MMSYSERR_INVALPARAM;
707
708 if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) &&
709 (pafd->dwFormatTag != pafd->pwfx->wFormatTag))
710 return MMSYSERR_INVALPARAM;
711
713 FIXME("Unsupported fdwEnum values %08x\n", fdwEnum);
714
715 mmr = acmMetrics((HACMOBJ)had, ACM_METRIC_MAX_SIZE_FORMAT, &cbwfxMax);
716 if (mmr != MMSYSERR_NOERROR)
717 return mmr;
718 if (pafd->cbwfx < cbwfxMax)
719 return MMSYSERR_INVALPARAM;
720
721 if (had) {
722 HACMDRIVERID hadid;
723
724 if (acmDriverID((HACMOBJ)had, &hadid, 0) != MMSYSERR_NOERROR)
726 MSACM_FormatEnumHelper(MSACM_GetDriverID(hadid), had, pafd, &wfxRef,
727 fnCallback, dwInstance, fdwEnum);
728 return MMSYSERR_NOERROR;
729 }
730 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
731 /* should check for codec only */
733 acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
734 continue;
735 ret = MSACM_FormatEnumHelper(padid, had, pafd, &wfxRef,
736 fnCallback, dwInstance, fdwEnum);
737 acmDriverClose(had, 0);
738 if (!ret) break;
739 }
740 return MMSYSERR_NOERROR;
741}
MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID)
Definition: driver.c:352
static BOOL MSACM_FormatEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had, PACMFORMATDETAILSW pafd, PWAVEFORMATEX pwfxRef, ACMFORMATENUMCBW fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum)
Definition: format.c:577
PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID)
Definition: internal.c:836
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MMSYSERR_INVALHANDLE
Definition: mmsystem.h:101
MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
Definition: msacm32_main.c:106
#define ACM_FORMATENUMF_CONVERT
Definition: msacm.h:168
#define ACM_METRIC_MAX_SIZE_FORMAT
Definition: msacm.h:200
#define ACM_FORMATENUMF_SUGGEST
Definition: msacm.h:169
#define ACM_FORMATENUMF_NCHANNELS
Definition: msacm.h:165
#define ACM_FORMATENUMF_NSAMPLESPERSEC
Definition: msacm.h:166
#define ACM_FORMATENUMF_HARDWARE
Definition: msacm.h:170
#define ACM_FORMATENUMF_WFORMATTAG
Definition: msacm.h:164
#define ACM_FORMATENUMF_WBITSPERSAMPLE
Definition: msacm.h:167
#define ACM_FORMATENUMF_OUTPUT
Definition: msacm.h:172
#define ACM_FORMATENUMF_INPUT
Definition: msacm.h:171

Referenced by acmFormatEnumA().

◆ acmFormatSuggest()

MMRESULT WINAPI acmFormatSuggest ( HACMDRIVER  had,
PWAVEFORMATEX  pwfxSrc,
PWAVEFORMATEX  pwfxDst,
DWORD  cbwfxDst,
DWORD  fdwSuggest 
)

Definition at line 746 of file format.c.

748{
749 ACMFORMATTAGDETAILSW aftd = {0};
751 MMRESULT mmr;
752
753 TRACE("(%p, %p, %p, %d, %d)\n",
754 had, pwfxSrc, pwfxDst, cbwfxDst, fdwSuggest);
755
756 if (!pwfxSrc || !pwfxDst)
757 return MMSYSERR_INVALPARAM;
758
761 return MMSYSERR_INVALFLAG;
762
763 /* if we were given PCM, try to convert to PCM */
764 if (pwfxSrc->wFormatTag == WAVE_FORMAT_PCM && !had &&
765 !(fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG))
766 {
767 ACMFORMATDETAILSW afd = {0};
768 afd.cbStruct = sizeof(afd);
770 afd.pwfx = pwfxSrc;
771 afd.cbwfx = sizeof(PCMWAVEFORMAT);
773 {
774 memcpy(pwfxDst, pwfxSrc, sizeof(PCMWAVEFORMAT));
775 return MMSYSERR_NOERROR;
776 }
777 }
778
779 aftd.cbStruct = sizeof(aftd);
780 if (fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG)
781 aftd.dwFormatTag = pwfxDst->wFormatTag;
783 if ((fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG) && mmr == ACMERR_NOTPOSSIBLE)
784 return ACMERR_NOTPOSSIBLE;
785
786 if (cbwfxDst < aftd.cbFormatSize)
787 return MMSYSERR_INVALPARAM;
788
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;
796
797 if (had == NULL) {
798 PWINE_ACMDRIVERID padid;
799
800 /* MS doc says: ACM finds the best suggestion.
801 * Well, first found will be the "best"
802 */
803 mmr = ACMERR_NOTPOSSIBLE;
804 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
805 /* should check for codec only */
807 acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
808 continue;
809
811 mmr = MMSYSERR_NOERROR;
812 break;
813 }
814 acmDriverClose(had, 0);
815 }
816 } else {
817 mmr = MSACM_Message(had, ACMDM_FORMAT_SUGGEST, (LPARAM)&adfg, 0L);
818 }
819 return mmr;
820}
#define WAVE_FORMAT_PCM
Definition: constants.h:425
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct pcmwaveformat_tag PCMWAVEFORMAT
#define ACM_FORMATSUGGESTF_WFORMATTAG
Definition: msacm.h:174
#define ACM_FORMATSUGGESTF_NCHANNELS
Definition: msacm.h:175
#define ACM_FORMATTAGDETAILSF_LARGESTSIZE
Definition: msacm.h:184
#define ACM_FORMATSUGGESTF_WBITSPERSAMPLE
Definition: msacm.h:177
#define ACM_FORMATSUGGESTF_NSAMPLESPERSEC
Definition: msacm.h:176
#define ACMDM_FORMAT_SUGGEST
Definition: msacmdrv.h:53
#define L(x)
Definition: ntvdm.h:50
PWAVEFORMATEX pwfxSrc
Definition: msacmdrv.h:151
PWAVEFORMATEX pwfxDst
Definition: msacmdrv.h:153
WORD cbSize
Definition: mmreg.h:84

Referenced by AVIFILE_OpenCompressor(), AVIFILE_SaveFile(), FormatEnumProc(), FormatTagEnumProc(), and test_acmFormatSuggest().

◆ acmFormatTagDetailsA()

MMRESULT WINAPI acmFormatTagDetailsA ( HACMDRIVER  had,
PACMFORMATTAGDETAILSA  paftda,
DWORD  fdwDetails 
)

Definition at line 825 of file format.c.

827{
829 MMRESULT mmr;
830
831 memset(&aftdw, 0, sizeof(aftdw));
832 aftdw.cbStruct = sizeof(aftdw);
833 aftdw.dwFormatTagIndex = paftda->dwFormatTagIndex;
834 aftdw.dwFormatTag = paftda->dwFormatTag;
835
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 );
845 }
846 return mmr;
847}
CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]
Definition: msacm.h:524
DWORD dwFormatTagIndex
Definition: msacm.h:519
DWORD cStandardFormats
Definition: msacm.h:523
WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]
Definition: msacm.h:535
DWORD dwFormatTagIndex
Definition: msacm.h:530

Referenced by FormatTagEnumProc().

◆ acmFormatTagDetailsW()

MMRESULT WINAPI acmFormatTagDetailsW ( HACMDRIVER  had,
PACMFORMATTAGDETAILSW  paftd,
DWORD  fdwDetails 
)

Definition at line 852 of file format.c.

854{
855 PWINE_ACMDRIVERID padid;
857
858 TRACE("(%p, %p, %d)\n", had, paftd, fdwDetails);
859
862 return MMSYSERR_INVALFLAG;
863
864 switch (fdwDetails) {
866 if (had == NULL) {
867 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
868 /* should check for codec only */
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;
875 }
876 }
877 } else {
879
881 mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
882 }
883 break;
884
886 if (had != NULL) {
888
889 if (pad && paftd->dwFormatTagIndex < pad->obj.pACMDriverID->cFormatTags)
890 mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
891 }
892 break;
893
895 if (had == NULL) {
897 DWORD ft = paftd->dwFormatTag;
898
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) {
903
904 memset(&tmp, 0, sizeof(tmp));
905 tmp.cbStruct = sizeof(tmp);
906 tmp.dwFormatTag = ft;
907
909 (LPARAM)&tmp, fdwDetails) == MMSYSERR_NOERROR) {
910 if (mmr == ACMERR_NOTPOSSIBLE ||
911 paftd->cbFormatSize < tmp.cbFormatSize) {
912 *paftd = tmp;
913 mmr = MMSYSERR_NOERROR;
914 }
915 }
916 acmDriverClose(had, 0);
917 }
918 }
919 } else {
920 mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
921 }
922 break;
923
924 default:
925 WARN("Unsupported fdwDetails=%08x\n", fdwDetails);
926 mmr = MMSYSERR_ERROR;
927 }
928
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));
933
934 return mmr;
935}
BOOL MSACM_FindFormatTagInCache(const WINE_ACMDRIVERID *padid, DWORD fmtTag, LPDWORD idx)
Definition: internal.c:118
PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver)
Definition: internal.c:844
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
#define ACM_FORMATTAGDETAILSF_INDEX
Definition: msacm.h:182
#define ACMDM_FORMATTAG_DETAILS
Definition: msacmdrv.h:51
DWORD cFormatTags
Definition: wineacm.h:97
WINE_ACMOBJ obj
Definition: wineacm.h:71
PWINE_ACMDRIVERID pACMDriverID
Definition: wineacm.h:45

Referenced by acmFormatDetailsW(), acmFormatSuggest(), acmFormatTagDetailsA(), AVISaveOptionsUpdate(), MSACM_FormatEnumHelper(), and test_acmFormatTagDetails().

◆ acmFormatTagEnumA()

MMRESULT WINAPI acmFormatTagEnumA ( HACMDRIVER  had,
PACMFORMATTAGDETAILSA  paftda,
ACMFORMATTAGENUMCBA  fnCallback,
DWORD_PTR  dwInstance,
DWORD  fdwEnum 
)

Definition at line 967 of file format.c.

970{
973
974 if (!paftda)
975 return MMSYSERR_INVALPARAM;
976
977 if (paftda->cbStruct < sizeof(*paftda))
978 return MMSYSERR_INVALPARAM;
979
980 if (fdwEnum != 0)
981 return MMSYSERR_INVALFLAG;
982
983 memset(&aftdw, 0, sizeof(aftdw));
984 aftdw.cbStruct = sizeof(aftdw);
987
988 aftei.paftda = paftda;
989 aftei.dwInstance = dwInstance;
990 aftei.fnCallback = fnCallback;
991
993 (DWORD_PTR)&aftei, fdwEnum);
994}
MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, ACMFORMATTAGENUMCBW fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum)
Definition: format.c:999
static BOOL CALLBACK MSACM_FormatTagEnumCallbackWtoA(HACMDRIVERID hadid, PACMFORMATTAGDETAILSW paftdw, DWORD_PTR dwInstance, DWORD fdwSupport)
Definition: format.c:943
PACMFORMATTAGDETAILSA paftda
Definition: format.c:938
ACMFORMATTAGENUMCBA fnCallback
Definition: format.c:940

Referenced by DriverEnumProc().

◆ acmFormatTagEnumW()

MMRESULT WINAPI acmFormatTagEnumW ( HACMDRIVER  had,
PACMFORMATTAGDETAILSW  paftd,
ACMFORMATTAGENUMCBW  fnCallback,
DWORD_PTR  dwInstance,
DWORD  fdwEnum 
)

Definition at line 999 of file format.c.

1002{
1003 PWINE_ACMDRIVERID padid;
1004 unsigned int i;
1005 BOOL bPcmDone = FALSE;
1006
1007 TRACE("(%p, %p, %p, %ld, %d)\n",
1008 had, paftd, fnCallback, dwInstance, fdwEnum);
1009
1010 if (!paftd)
1011 return MMSYSERR_INVALPARAM;
1012
1013 if (paftd->cbStruct < sizeof(*paftd))
1014 return MMSYSERR_INVALPARAM;
1015
1016 if (fdwEnum != 0)
1017 return MMSYSERR_INVALFLAG;
1018
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.
1024 */
1025
1026 /* if (had) FIXME("had != NULL, not supported\n"); */
1027
1028 if (had) {
1029 if (acmDriverID((HACMOBJ)had, (HACMDRIVERID *)&padid, 0) != MMSYSERR_NOERROR)
1030 return MMSYSERR_INVALHANDLE;
1031
1032 for (i = 0; i < padid->cFormatTags; i++) {
1033 paftd->dwFormatTagIndex = i;
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
1042 * below.
1043 */
1044 if (bPcmDone) continue;
1045 bPcmDone = TRUE;
1046 }
1047 if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport))
1048 return MMSYSERR_NOERROR;
1049 }
1050 }
1051 }
1052 /* if had==0 then search for the first suitable driver */
1053 else {
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;
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
1069 * for now
1070 */
1071 if (bPcmDone) continue;
1072 bPcmDone = TRUE;
1073 }
1074 if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport)) {
1075 acmDriverClose(had, 0);
1076 return MMSYSERR_NOERROR;
1077 }
1078 }
1079 }
1080 acmDriverClose(had, 0);
1081 }
1082 }
1083 }
1084 return MMSYSERR_NOERROR;
1085}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by acmFormatTagEnumA(), MSACM_FillFormat(), MSACM_FillFormatTags(), and MSACM_GetWFX().

◆ FormatChooseDlgProc()

static INT_PTR CALLBACK FormatChooseDlgProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 218 of file format.c.

220{
222
223 TRACE("hwnd=%p msg=%i 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam);
224
225 switch (msg) {
226 case WM_INITDIALOG:
236 FIXME("Unsupported style %08x\n", afc->fdwStyle);
239 return TRUE;
240
241 case WM_COMMAND:
242 switch (LOWORD(wParam)) {
243 case IDOK:
245 return TRUE;
246 case IDCANCEL:
248 return TRUE;
250 switch (HIWORD(wParam)) {
251 case CBN_SELCHANGE:
253 break;
254 default:
255 TRACE("Dropped dlgNotif (fmtTag): 0x%08x 0x%08lx\n",
257 break;
258 }
259 break;
264 break;
265
266 default:
267 TRACE("Dropped dlgCmd: ctl=%d ntf=0x%04x 0x%08lx\n",
269 break;
270 }
271 break;
272 case WM_CONTEXTMENU:
276 wParam, lParam);
277 break;
278#if defined(WM_CONTEXTHELP)
279 case WM_CONTEXTHELP:
283 wParam, lParam);
284 break;
285#endif
286 default:
287 TRACE("Dropped dlgMsg: hwnd=%p msg=%i 0x%08lx 0x%08lx\n",
288 hWnd, msg, wParam, lParam );
289 break;
290 }
291 return FALSE;
292}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static BOOL MSACM_FillFormatTags(HWND hWnd, PACMFORMATCHOOSEW afc)
Definition: format.c:151
static BOOL MSACM_FillFormat(HWND hWnd, PACMFORMATCHOOSEW afc)
Definition: format.c:169
static const WCHAR fmt_prop[]
Definition: format.c:216
static MMRESULT MSACM_GetWFX(HWND hWnd, PACMFORMATCHOOSEW afc)
Definition: format.c:194
static const WCHAR ACMHELPMSGCONTEXTHELPW[]
Definition: msacm.h:139
#define ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT
Definition: msacm.h:155
#define ACMFORMATCHOOSE_STYLEF_CONTEXTHELP
Definition: msacm.h:156
#define ACMFORMATCHOOSE_STYLEF_SHOWHELP
Definition: msacm.h:151
static const WCHAR ACMHELPMSGSTRINGW[]
Definition: msacm.h:115
static const WCHAR ACMHELPMSGCONTEXTMENUW[]
Definition: msacm.h:127
#define ACMERR_CANCELED
Definition: msacm.h:39
struct _ACMFORMATCHOOSEW * PACMFORMATCHOOSEW
#define IDD_ACMFORMATCHOOSE_CMB_FORMATTAG
Definition: msacmdlg.h:26
#define IDD_ACMFORMATCHOOSE_BTN_HELP
Definition: msacmdlg.h:24
#define LOWORD(l)
Definition: pedump.c:82
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define HIWORD(l)
Definition: typedefs.h:247
#define SW_HIDE
Definition: winuser.h:767
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:830
#define WM_COMMAND
Definition: winuser.h:1739
#define WM_INITDIALOG
Definition: winuser.h:1738
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:829
#define CBN_SELCHANGE
Definition: winuser.h:1978
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by acmFormatChooseW().

◆ MSACM_FillFormat()

static BOOL MSACM_FillFormat ( HWND  hWnd,
PACMFORMATCHOOSEW  afc 
)
static

Definition at line 169 of file format.c.

170{
172 struct MSACM_FillFormatData affd;
173
175
176 memset(&aftd, 0, sizeof(aftd));
177 aftd.cbStruct = sizeof(aftd);
178
179 affd.hWnd = hWnd;
180 affd.mode = WINE_ACMFF_FORMAT;
181 affd.afc = afc;
185 CB_GETCURSEL, 0, 0),
186 (LPARAM)affd.szFormatTag);
187
191 return TRUE;
192}
static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid, PACMFORMATTAGDETAILSW paftd, DWORD_PTR dwInstance, DWORD fdwSupport)
Definition: format.c:50
#define WINE_ACMFF_FORMAT
Definition: format.c:42
#define IDD_ACMFORMATCHOOSE_CMB_FORMAT
Definition: msacmdlg.h:27
PACMFORMATCHOOSEW afc
Definition: format.c:46
#define CB_GETLBTEXT
Definition: winuser.h:1951
#define CB_ERR
Definition: winuser.h:2434
#define CB_SETCURSEL
Definition: winuser.h:1960
#define CB_RESETCONTENT
Definition: winuser.h:1958
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCURSEL
Definition: winuser.h:1942

Referenced by FormatChooseDlgProc().

◆ MSACM_FillFormatTags()

static BOOL MSACM_FillFormatTags ( HWND  hWnd,
PACMFORMATCHOOSEW  afc 
)
static

Definition at line 151 of file format.c.

152{
154 struct MSACM_FillFormatData affd;
155
156 memset(&aftd, 0, sizeof(aftd));
157 aftd.cbStruct = sizeof(aftd);
158
159 affd.hWnd = hWnd;
160 affd.mode = WINE_ACMFF_TAG;
161 affd.afc = afc;
162
166 return TRUE;
167}
#define WINE_ACMFF_TAG
Definition: format.c:41

Referenced by FormatChooseDlgProc().

◆ MSACM_FillFormatTagsCB()

static BOOL CALLBACK MSACM_FillFormatTagsCB ( HACMDRIVERID  hadid,
PACMFORMATTAGDETAILSW  paftd,
DWORD_PTR  dwInstance,
DWORD  fdwSupport 
)
static

Definition at line 50 of file format.c.

54{
55 struct MSACM_FillFormatData* affd = (struct MSACM_FillFormatData*)dwInstance;
56
57 switch (affd->mode) {
58 case WINE_ACMFF_TAG:
59 if (paftd->cStandardFormats > 0)
60 {
63 (LPARAM)paftd->szFormatTag) == CB_ERR)
64 {
66 CB_ADDSTRING, 0, (LPARAM)paftd->szFormatTag);
68 (paftd->dwFormatTag == affd->afc->pwfx->wFormatTag)) ||
70 (paftd->dwFormatTag == WAVE_FORMAT_PCM)))
73 }
74 }
75 break;
77 if (lstrcmpW(affd->szFormatTag, paftd->szFormatTag) == 0) {
78 HACMDRIVER had;
79
80 if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) {
81 ACMFORMATDETAILSW afd = {0};
82 unsigned int i, len;
83 MMRESULT mmr;
85
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;
94
95 for (i = 0; i < paftd->cStandardFormats; i++) {
96 static const WCHAR fmtW[] = {'%','d',' ','K','o','/','s','\0'};
97 int j, index;
98
99 afd.dwFormatIndex = i;
100 afd.fdwSupport = 0;
102 if (mmr == MMSYSERR_NOERROR) {
106 buffer[j] = ' ';
108 fmtW, (afd.pwfx->nAvgBytesPerSec + 512) / 1024);
113 affd->afc->cbwfx >= paftd->cbFormatSize &&
114 !memcmp(afd.pwfx, affd->afc->pwfx, paftd->cbFormatSize))
116 CB_SETCURSEL, index, 0);
117 }
118 }
119 acmDriverClose(had, 0);
120 HeapFree(MSACM_hHeap, 0, afd.pwfx);
121 }
122 }
123 break;
124 case WINE_ACMFF_WFX:
125 if (lstrcmpW(affd->szFormatTag, paftd->szFormatTag) == 0) {
126 HACMDRIVER had;
127
128 if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) {
129 ACMFORMATDETAILSW afd = {0};
130
131 afd.cbStruct = sizeof(afd);
132 afd.dwFormatTag = paftd->dwFormatTag;
133 afd.pwfx = affd->afc->pwfx;
134 afd.cbwfx = affd->afc->cbwfx;
135
137 CB_GETCURSEL, 0, 0);
139 acmDriverClose(had, 0);
140 return TRUE;
141 }
142 }
143 break;
144 default:
145 FIXME("Unknown mode (%d)\n", affd->mode);
146 break;
147 }
148 return TRUE;
149}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define index(s, c)
Definition: various.h:29
#define lstrcpynW
Definition: compat.h:738
#define WINE_ACMFF_WFX
Definition: format.c:43
HANDLE MSACM_hHeap
Definition: internal.c:47
GLuint buffer
Definition: glext.h:5915
GLuint index
Definition: glext.h:6031
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define ACMFORMATTAGDETAILS_FORMATTAG_CHARS
Definition: msacm.h:180
#define ACMFORMATDETAILS_FORMAT_CHARS
Definition: msacm.h:158
WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]
Definition: format.c:45
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1939
#define CB_ADDSTRING
Definition: winuser.h:1935

Referenced by MSACM_FillFormat(), MSACM_FillFormatTags(), and MSACM_GetWFX().

◆ MSACM_FormatEnumCallbackWtoA()

static BOOL CALLBACK MSACM_FormatEnumCallbackWtoA ( HACMDRIVERID  hadid,
PACMFORMATDETAILSW  pafdw,
DWORD_PTR  dwInstance,
DWORD  fdwSupport 
)
static

Definition at line 520 of file format.c.

524{
525 struct MSACM_FormatEnumWtoA_Instance* pafei;
526
528
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 );
534
535 return (pafei->fnCallback)(hadid, pafei->pafda,
536 pafei->dwInstance, fdwSupport);
537}

Referenced by acmFormatEnumA().

◆ MSACM_FormatEnumHelper()

static BOOL MSACM_FormatEnumHelper ( PWINE_ACMDRIVERID  padid,
HACMDRIVER  had,
PACMFORMATDETAILSW  pafd,
PWAVEFORMATEX  pwfxRef,
ACMFORMATENUMCBW  fnCallback,
DWORD_PTR  dwInstance,
DWORD  fdwEnum 
)
static

Definition at line 577 of file format.c.

581{
583 unsigned int i, j;
584
585 if (fdwEnum & ACM_FORMATENUMF_SUGGEST) {
586 HDRVR hdrvr;
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);
593
594 for (i = 0; i < padid->cFormatTags; i++) {
595 aftd.dwFormatTag = i;
596 pafd->dwFormatTag = aftd.dwFormatTag;
597 pafd->pwfx->wFormatTag = pafd->dwFormatTag;
598
600 continue;
601
602 adfs.cbwfxSrc = aftd.cbFormatSize;
603 adfs.cbwfxDst = aftd.cbFormatSize;
604 adfs.pwfxSrc = pwfxRef;
605 adfs.pwfxDst = pafd->pwfx;
606 pafd->fdwSupport = padid->fdwSupport;
607
608 if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) &&
609 aftd.dwFormatTag != pwfxRef->wFormatTag)
610 continue;
611
612 if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) &&
614 continue;
615
616 hdrvr = OpenDriver(padid->pszFileName,0,0);
617 SendDriverMessage(hdrvr,ACMDM_FORMAT_SUGGEST,(LPARAM)&adfs,(fdwEnum & 0x000000FFL));
618
620 continue;
621
622 pafd->cbwfx = sizeof(*(pafd->pwfx));
623
624 if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport))
625 return FALSE;
626 }
627 } else {
628 for (i = 0; i < padid->cFormatTags; i++) {
629 memset(&aftd, 0, sizeof(aftd));
630 aftd.cbStruct = sizeof(aftd);
631 aftd.dwFormatTagIndex = i;
633 continue;
634
635 if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && aftd.dwFormatTag != pwfxRef->wFormatTag)
636 continue;
637
638 for (j = 0; j < aftd.cStandardFormats; j++) {
639 pafd->dwFormatIndex = j;
640 pafd->dwFormatTag = aftd.dwFormatTag;
641 pafd->fdwSupport = 0;
643 continue;
644
645 if ((fdwEnum & ACM_FORMATENUMF_NCHANNELS) &&
646 pafd->pwfx->nChannels != pwfxRef->nChannels)
647 continue;
648 if ((fdwEnum & ACM_FORMATENUMF_NSAMPLESPERSEC) &&
649 pafd->pwfx->nSamplesPerSec != pwfxRef->nSamplesPerSec)
650 continue;
651 if ((fdwEnum & ACM_FORMATENUMF_WBITSPERSAMPLE) &&
652 pafd->pwfx->wBitsPerSample != pwfxRef->wBitsPerSample)
653 continue;
654 if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) &&
656 continue;
657
658 /* more checks to be done on fdwEnum */
659
660 if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport))
661 return FALSE;
662 }
663 /* the "formats" used by the filters are also reported */
664 }
665 }
666 return TRUE;
667}
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT msg, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:131
HDRVR WINAPI OpenDriver(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lParam)
Definition: driver.c:400
#define ACMDRIVERDETAILS_SUPPORTF_HARDWARE
Definition: msacm.h:64
LPWSTR pszFileName
Definition: wineacm.h:90

Referenced by acmFormatEnumW().

◆ MSACM_FormatTagEnumCallbackWtoA()

static BOOL CALLBACK MSACM_FormatTagEnumCallbackWtoA ( HACMDRIVERID  hadid,
PACMFORMATTAGDETAILSW  paftdw,
DWORD_PTR  dwInstance,
DWORD  fdwSupport 
)
static

Definition at line 943 of file format.c.

947{
949
951
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 );
959
960 return (paftei->fnCallback)(hadid, paftei->paftda,
961 paftei->dwInstance, fdwSupport);
962}

Referenced by acmFormatTagEnumA().

◆ MSACM_GetWFX()

static MMRESULT MSACM_GetWFX ( HWND  hWnd,
PACMFORMATCHOOSEW  afc 
)
static

Definition at line 194 of file format.c.

195{
197 struct MSACM_FillFormatData affd;
198
199 memset(&aftd, 0, sizeof(aftd));
200 aftd.cbStruct = sizeof(aftd);
201
202 affd.hWnd = hWnd;
203 affd.mode = WINE_ACMFF_WFX;
204 affd.afc = afc;
205 affd.ret = MMSYSERR_NOERROR;
209 CB_GETCURSEL, 0, 0),
210 (LPARAM)affd.szFormatTag);
211
213 return affd.ret;
214}

Referenced by FormatChooseDlgProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msacm  )

Variable Documentation

◆ fmt_prop

const WCHAR fmt_prop[] = {'a','c','m','p','r','o','p','\0'}
static

Definition at line 216 of file format.c.

Referenced by FormatChooseDlgProc().