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 */
88 FIXME("%x not supported\n", version
.dwPlatformId
);
90 case VER_PLATFORM_WIN32_WINDOWS
:
91 return 0x04030000; /* 4.3.0 */
95 /***********************************************************************
96 * acmMessage32 (MSACM32.35)
98 * No documentation found.
101 /***********************************************************************
102 * acmMetrics (MSACM32.@)
104 MMRESULT WINAPI
acmMetrics(HACMOBJ hao
, UINT uMetric
, LPVOID pMetric
)
106 PWINE_ACMOBJ pao
= MSACM_GetObj(hao
, WINE_ACMOBJ_DONTCARE
);
108 PWINE_ACMDRIVERID padid
;
111 MMRESULT mmr
= MMSYSERR_NOERROR
;
113 TRACE("(%p, %d, %p);\n", hao
, uMetric
, pMetric
);
115 #define CheckLocal(padid) (!bLocal || ((padid)->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL))
118 case ACM_METRIC_COUNT_DRIVERS
:
121 case ACM_METRIC_COUNT_LOCAL_DRIVERS
:
122 if (hao
) return MMSYSERR_INVALHANDLE
;
123 if (!pMetric
) return MMSYSERR_INVALPARAM
;
124 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
125 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) && CheckLocal(padid
))
127 *(LPDWORD
)pMetric
= val
;
130 case ACM_METRIC_COUNT_CODECS
:
133 case ACM_METRIC_COUNT_LOCAL_CODECS
:
134 if (hao
) return MMSYSERR_INVALHANDLE
;
135 if (!pMetric
) return MMSYSERR_INVALPARAM
;
136 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
137 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
138 (padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_CODEC
) &&
141 *(LPDWORD
)pMetric
= val
;
144 case ACM_METRIC_COUNT_CONVERTERS
:
147 case ACM_METRIC_COUNT_LOCAL_CONVERTERS
:
148 if (hao
) return MMSYSERR_INVALHANDLE
;
149 if (!pMetric
) return MMSYSERR_INVALPARAM
;
150 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
151 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
152 (padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_CONVERTER
) &&
155 *(LPDWORD
)pMetric
= val
;
158 case ACM_METRIC_COUNT_FILTERS
:
161 case ACM_METRIC_COUNT_LOCAL_FILTERS
:
162 if (hao
) return MMSYSERR_INVALHANDLE
;
163 if (!pMetric
) return MMSYSERR_INVALPARAM
;
164 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
165 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
166 (padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_FILTER
) &&
169 *(LPDWORD
)pMetric
= val
;
172 case ACM_METRIC_COUNT_DISABLED
:
175 case ACM_METRIC_COUNT_LOCAL_DISABLED
:
176 if (hao
) return MMSYSERR_INVALHANDLE
;
177 if (!pMetric
) return MMSYSERR_INVALPARAM
;
178 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
179 if ((padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) && CheckLocal(padid
))
181 *(LPDWORD
)pMetric
= val
;
184 case ACM_METRIC_MAX_SIZE_FORMAT
:
186 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
) {
187 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
)) {
188 for (i
= 0; i
< padid
->cFormatTags
; i
++) {
189 if (val
< padid
->aFormatTag
[i
].cbwfx
)
190 val
= padid
->aFormatTag
[i
].cbwfx
;
194 } else if (pao
!= NULL
) {
195 switch (pao
->dwType
) {
196 case WINE_ACMOBJ_DRIVER
:
197 case WINE_ACMOBJ_DRIVERID
:
198 padid
= pao
->pACMDriverID
;
201 return MMSYSERR_INVALHANDLE
;
203 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
)) {
204 for (i
= 0; i
< padid
->cFormatTags
; i
++) {
205 if (val
< padid
->aFormatTag
[i
].cbwfx
)
206 val
= padid
->aFormatTag
[i
].cbwfx
;
210 return MMSYSERR_INVALHANDLE
;
212 if (!pMetric
) return MMSYSERR_INVALPARAM
;
213 *(LPDWORD
)pMetric
= val
;
216 case ACM_METRIC_COUNT_HARDWARE
:
217 if (hao
) return MMSYSERR_INVALHANDLE
;
218 if (!pMetric
) return MMSYSERR_INVALPARAM
;
219 *(LPDWORD
)pMetric
= 0;
220 FIXME("ACM_METRIC_COUNT_HARDWARE not implemented\n");
223 case ACM_METRIC_DRIVER_PRIORITY
:
224 /* Return current list position of driver */
225 if (!hao
) return MMSYSERR_INVALHANDLE
;
226 mmr
= MMSYSERR_INVALHANDLE
;
227 for (i
= 1, padid
= MSACM_pFirstACMDriverID
; padid
; i
++, padid
= padid
->pNextACMDriverID
) {
228 if (padid
== (PWINE_ACMDRIVERID
)hao
) {
230 *(LPDWORD
)pMetric
= i
;
231 mmr
= MMSYSERR_NOERROR
;
233 mmr
= MMSYSERR_INVALPARAM
;
240 case ACM_METRIC_DRIVER_SUPPORT
:
241 /* Return fdwSupport for driver */
242 if (!hao
) return MMSYSERR_INVALHANDLE
;
243 mmr
= MMSYSERR_INVALHANDLE
;
244 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
) {
245 if (padid
== (PWINE_ACMDRIVERID
)hao
) {
247 *(LPDWORD
)pMetric
= padid
->fdwSupport
;
248 mmr
= MMSYSERR_NOERROR
;
250 mmr
= MMSYSERR_INVALPARAM
;
257 case ACM_METRIC_HARDWARE_WAVE_INPUT
:
258 case ACM_METRIC_HARDWARE_WAVE_OUTPUT
:
259 case ACM_METRIC_MAX_SIZE_FILTER
:
261 FIXME("(%p, %d, %p): stub\n", hao
, uMetric
, pMetric
);
262 mmr
= MMSYSERR_NOTSUPPORTED
;