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 HeapDestroy(MSACM_hHeap
);
60 MSACM_hInstance32
= NULL
;
68 /***********************************************************************
69 * XRegThunkEntry (MSACM32.1)
71 * No documentation found.
74 /***********************************************************************
75 * acmGetVersion (MSACM32.@)
77 DWORD WINAPI
acmGetVersion(void)
79 OSVERSIONINFOA version
;
81 version
.dwOSVersionInfoSize
= sizeof(OSVERSIONINFOA
);
82 if (!GetVersionExA( &version
))
85 switch (version
.dwPlatformId
) {
86 case VER_PLATFORM_WIN32_NT
:
87 return 0x04000565; /* 4.0.1381 */
89 FIXME("%x not supported\n", version
.dwPlatformId
);
91 case VER_PLATFORM_WIN32_WINDOWS
:
92 return 0x04030000; /* 4.3.0 */
96 /***********************************************************************
97 * acmMessage32 (MSACM32.35)
99 * No documentation found.
102 /***********************************************************************
103 * acmMetrics (MSACM32.@)
105 MMRESULT WINAPI
acmMetrics(HACMOBJ hao
, UINT uMetric
, LPVOID pMetric
)
107 PWINE_ACMOBJ pao
= MSACM_GetObj(hao
, WINE_ACMOBJ_DONTCARE
);
109 PWINE_ACMDRIVERID padid
;
112 MMRESULT mmr
= MMSYSERR_NOERROR
;
114 TRACE("(%p, %d, %p);\n", hao
, uMetric
, pMetric
);
116 #define CheckLocal(padid) (!bLocal || ((padid)->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL))
119 case ACM_METRIC_COUNT_DRIVERS
:
122 case ACM_METRIC_COUNT_LOCAL_DRIVERS
:
123 if (hao
) return MMSYSERR_INVALHANDLE
;
124 if (!pMetric
) return MMSYSERR_INVALPARAM
;
125 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
126 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) && CheckLocal(padid
))
128 *(LPDWORD
)pMetric
= val
;
131 case ACM_METRIC_COUNT_CODECS
:
134 case ACM_METRIC_COUNT_LOCAL_CODECS
:
135 if (hao
) return MMSYSERR_INVALHANDLE
;
136 if (!pMetric
) return MMSYSERR_INVALPARAM
;
137 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
138 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
139 (padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_CODEC
) &&
142 *(LPDWORD
)pMetric
= val
;
145 case ACM_METRIC_COUNT_CONVERTERS
:
148 case ACM_METRIC_COUNT_LOCAL_CONVERTERS
:
149 if (hao
) return MMSYSERR_INVALHANDLE
;
150 if (!pMetric
) return MMSYSERR_INVALPARAM
;
151 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
152 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
153 (padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_CONVERTER
) &&
156 *(LPDWORD
)pMetric
= val
;
159 case ACM_METRIC_COUNT_FILTERS
:
162 case ACM_METRIC_COUNT_LOCAL_FILTERS
:
163 if (hao
) return MMSYSERR_INVALHANDLE
;
164 if (!pMetric
) return MMSYSERR_INVALPARAM
;
165 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
166 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) &&
167 (padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_FILTER
) &&
170 *(LPDWORD
)pMetric
= val
;
173 case ACM_METRIC_COUNT_DISABLED
:
176 case ACM_METRIC_COUNT_LOCAL_DISABLED
:
177 if (hao
) return MMSYSERR_INVALHANDLE
;
178 if (!pMetric
) return MMSYSERR_INVALPARAM
;
179 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
)
180 if ((padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
) && CheckLocal(padid
))
182 *(LPDWORD
)pMetric
= val
;
185 case ACM_METRIC_MAX_SIZE_FORMAT
:
187 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
) {
188 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
)) {
189 for (i
= 0; i
< padid
->cFormatTags
; i
++) {
190 if (val
< padid
->aFormatTag
[i
].cbwfx
)
191 val
= padid
->aFormatTag
[i
].cbwfx
;
195 } else if (pao
!= NULL
) {
196 switch (pao
->dwType
) {
197 case WINE_ACMOBJ_DRIVER
:
198 case WINE_ACMOBJ_DRIVERID
:
199 padid
= pao
->pACMDriverID
;
202 return MMSYSERR_INVALHANDLE
;
204 if (!(padid
->fdwSupport
& ACMDRIVERDETAILS_SUPPORTF_DISABLED
)) {
205 for (i
= 0; i
< padid
->cFormatTags
; i
++) {
206 if (val
< padid
->aFormatTag
[i
].cbwfx
)
207 val
= padid
->aFormatTag
[i
].cbwfx
;
211 return MMSYSERR_INVALHANDLE
;
213 if (!pMetric
) return MMSYSERR_INVALPARAM
;
214 *(LPDWORD
)pMetric
= val
;
217 case ACM_METRIC_COUNT_HARDWARE
:
218 if (hao
) return MMSYSERR_INVALHANDLE
;
219 if (!pMetric
) return MMSYSERR_INVALPARAM
;
220 *(LPDWORD
)pMetric
= 0;
221 FIXME("ACM_METRIC_COUNT_HARDWARE not implemented\n");
224 case ACM_METRIC_DRIVER_PRIORITY
:
225 /* Return current list position of driver */
226 if (!hao
) return MMSYSERR_INVALHANDLE
;
227 mmr
= MMSYSERR_INVALHANDLE
;
228 for (i
= 1, padid
= MSACM_pFirstACMDriverID
; padid
; i
++, padid
= padid
->pNextACMDriverID
) {
229 if (padid
== (PWINE_ACMDRIVERID
)hao
) {
231 *(LPDWORD
)pMetric
= i
;
232 mmr
= MMSYSERR_NOERROR
;
234 mmr
= MMSYSERR_INVALPARAM
;
241 case ACM_METRIC_DRIVER_SUPPORT
:
242 /* Return fdwSupport for driver */
243 if (!hao
) return MMSYSERR_INVALHANDLE
;
244 mmr
= MMSYSERR_INVALHANDLE
;
245 for (padid
= MSACM_pFirstACMDriverID
; padid
; padid
= padid
->pNextACMDriverID
) {
246 if (padid
== (PWINE_ACMDRIVERID
)hao
) {
248 *(LPDWORD
)pMetric
= padid
->fdwSupport
;
249 mmr
= MMSYSERR_NOERROR
;
251 mmr
= MMSYSERR_INVALPARAM
;
258 case ACM_METRIC_HARDWARE_WAVE_INPUT
:
259 case ACM_METRIC_HARDWARE_WAVE_OUTPUT
:
260 case ACM_METRIC_MAX_SIZE_FILTER
:
262 FIXME("(%p, %d, %p): stub\n", hao
, uMetric
, pMetric
);
263 mmr
= MMSYSERR_NOTSUPPORTED
;