1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
6 * Copyright 1998 Patrik Stridvall
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(msacm
);
38 /**********************************************************************/
40 HINSTANCE MSACM_hInstance32
= 0;
42 /***********************************************************************
43 * DllMain (MSACM32.init)
45 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
47 TRACE("%p 0x%x %p\n", hInstDLL
, fdwReason
, lpvReserved
);
50 case DLL_PROCESS_ATTACH
:
51 DisableThreadLibraryCalls(hInstDLL
);
52 MSACM_hHeap
= HeapCreate(0, 0x10000, 0);
53 MSACM_hInstance32
= hInstDLL
;
54 MSACM_RegisterAllDrivers();
56 case DLL_PROCESS_DETACH
:
57 MSACM_UnregisterAllDrivers();
58 if (lpvReserved
) break;
59 HeapDestroy(MSACM_hHeap
);
67 /***********************************************************************
68 * XRegThunkEntry (MSACM32.1)
70 * No documentation found.
73 /***********************************************************************
74 * acmGetVersion (MSACM32.@)
76 DWORD WINAPI
acmGetVersion(void)
78 OSVERSIONINFOA version
;
80 version
.dwOSVersionInfoSize
= sizeof(OSVERSIONINFOA
);
81 if (!GetVersionExA( &version
))
84 switch (version
.dwPlatformId
) {
85 case VER_PLATFORM_WIN32_NT
:
86 return 0x04000565; /* 4.0.1381 */
87 case VER_PLATFORM_WIN32s
:
88 return 0x02010000; /* 2.1 */
90 FIXME("%x not supported\n", version
.dwPlatformId
);
92 case VER_PLATFORM_WIN32_WINDOWS
:
93 return 0x04030000; /* 4.3.0 */
97 /***********************************************************************
98 * acmMessage32 (MSACM32.35)
100 * No documentation found.
103 /***********************************************************************
104 * acmMetrics (MSACM32.@)
106 MMRESULT WINAPI
acmMetrics(HACMOBJ hao
, UINT uMetric
, LPVOID pMetric
)
108 PWINE_ACMOBJ pao
= MSACM_GetObj(hao
, WINE_ACMOBJ_DONTCARE
);
110 PWINE_ACMDRIVERID padid
;
113 MMRESULT mmr
= MMSYSERR_NOERROR
;
115 TRACE("(%p, %d, %p);\n", hao
, uMetric
, pMetric
);
117 #define CheckLocal(padid) (!bLocal || ((padid)->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL))
120 case ACM_METRIC_COUNT_DRIVERS
:
123 case ACM_METRIC_COUNT_LOCAL_DRIVERS
:
124 if (hao
) return MMSYSERR_INVALHANDLE
;
125 if (!pMetric
) return MMSYSERR_INVALPARAM
;
126 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
127 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) && CheckLocal(padid
))
129 *(LPDWORD
)pMetric
= val
;
132 case ACM_METRIC_COUNT_CODECS
:
135 case ACM_METRIC_COUNT_LOCAL_CODECS
:
136 if (hao
) return MMSYSERR_INVALHANDLE
;
137 if (!pMetric
) return MMSYSERR_INVALPARAM
;
138 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
139 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
140 (padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_CODEC
) &&
143 *(LPDWORD
)pMetric
= val
;
146 case ACM_METRIC_COUNT_CONVERTERS
:
149 case ACM_METRIC_COUNT_LOCAL_CONVERTERS
:
150 if (hao
) return MMSYSERR_INVALHANDLE
;
151 if (!pMetric
) return MMSYSERR_INVALPARAM
;
152 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
153 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
154 (padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_CONVERTER
) &&
157 *(LPDWORD
)pMetric
= val
;
160 case ACM_METRIC_COUNT_FILTERS
:
163 case ACM_METRIC_COUNT_LOCAL_FILTERS
:
164 if (hao
) return MMSYSERR_INVALHANDLE
;
165 if (!pMetric
) return MMSYSERR_INVALPARAM
;
166 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
167 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
168 (padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_FILTER
) &&
171 *(LPDWORD
)pMetric
= val
;
174 case ACM_METRIC_COUNT_DISABLED
:
177 case ACM_METRIC_COUNT_LOCAL_DISABLED
:
178 if (hao
) return MMSYSERR_INVALHANDLE
;
179 if (!pMetric
) return MMSYSERR_INVALPARAM
;
180 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
181 if ((padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) && CheckLocal(padid
))
183 *(LPDWORD
)pMetric
= val
;
186 case ACM_METRIC_MAX_SIZE_FORMAT
:
188 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
) {
189 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
)) {
190 for (i
= 0; i
< padid
->cFormatTags
; i
++) {
191 if (val
< padid
->aFormatTag
[i
].cbwfx
)
192 val
= padid
->aFormatTag
[i
].cbwfx
;
196 } else if (pao
!= NULL
) {
197 switch (pao
->dwType
) {
198 case WINE_ACMOBJ_DRIVER
:
199 case WINE_ACMOBJ_DRIVERID
:
200 padid
= pao
->pACMDriverID
;
203 return MMSYSERR_INVALHANDLE
;
205 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
)) {
206 for (i
= 0; i
< padid
->cFormatTags
; i
++) {
207 if (val
< padid
->aFormatTag
[i
].cbwfx
)
208 val
= padid
->aFormatTag
[i
].cbwfx
;
212 return MMSYSERR_INVALHANDLE
;
214 if (!pMetric
) return MMSYSERR_INVALPARAM
;
215 *(LPDWORD
)pMetric
= val
;
218 case ACM_METRIC_COUNT_HARDWARE
:
219 if (hao
) return MMSYSERR_INVALHANDLE
;
220 if (!pMetric
) return MMSYSERR_INVALPARAM
;
221 *(LPDWORD
)pMetric
= 0;
222 FIXME("ACM_METRIC_COUNT_HARDWARE not implemented\n");
225 case ACM_METRIC_DRIVER_PRIORITY
:
226 /* Return current list position of driver */
227 if (!hao
) return MMSYSERR_INVALHANDLE
;
228 mmr
= MMSYSERR_INVALHANDLE
;
229 for (i
= 1, padid
= MSACM_pFirstACMDriverID
; padid
; i
++, padid
= padid
->pNextACMDriverID
) {
230 if (padid
== (PWINE_ACMDRIVERID
)hao
) {
232 *(LPDWORD
)pMetric
= i
;
233 mmr
= MMSYSERR_NOERROR
;
235 mmr
= MMSYSERR_INVALPARAM
;
242 case ACM_METRIC_DRIVER_SUPPORT
:
243 /* Return fdwSupport for driver */
244 if (!hao
) return MMSYSERR_INVALHANDLE
;
245 mmr
= MMSYSERR_INVALHANDLE
;
246 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
) {
247 if (padid
== (PWINE_ACMDRIVERID
)hao
) {
249 *(LPDWORD
)pMetric
= padid
->fdwSupport
;
250 mmr
= MMSYSERR_NOERROR
;
252 mmr
= MMSYSERR_INVALPARAM
;
259 case ACM_METRIC_HARDWARE_WAVE_INPUT
:
260 case ACM_METRIC_HARDWARE_WAVE_OUTPUT
:
261 case ACM_METRIC_MAX_SIZE_FILTER
:
263 FIXME("(%p, %d, %p): stub\n", hao
, uMetric
, pMetric
);
264 mmr
= MMSYSERR_NOTSUPPORTED
;