Fixed typo.
[wine.git] / dlls / msacm / msacm32_main.c
blob6ca97e9e3be26d75dd46aa73db0ef3b98f801bfb
1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
3 /*
4 * MSACM32 library
6 * Copyright 1998 Patrik Stridvall
7 * 1999 Eric Pouech
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winerror.h"
29 #include "wine/debug.h"
30 #include "mmsystem.h"
31 #include "mmreg.h"
32 #include "msacm.h"
33 #include "msacmdrv.h"
34 #include "wineacm.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%lx %p\n", hInstDLL, fdwReason, lpvReserved);
49 switch (fdwReason) {
50 case DLL_PROCESS_ATTACH:
51 DisableThreadLibraryCalls(hInstDLL);
52 MSACM_hHeap = HeapCreate(0, 0x10000, 0);
53 MSACM_hInstance32 = hInstDLL;
54 MSACM_RegisterAllDrivers();
55 break;
56 case DLL_PROCESS_DETACH:
57 MSACM_UnregisterAllDrivers();
58 HeapDestroy(MSACM_hHeap);
59 MSACM_hHeap = NULL;
60 MSACM_hInstance32 = NULL;
61 break;
62 default:
63 break;
65 return TRUE;
68 /***********************************************************************
69 * XRegThunkEntry (MSACM32.1)
70 * FIXME
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 ))
83 return 0x04030000;
85 switch (version.dwPlatformId) {
86 case VER_PLATFORM_WIN32_NT:
87 return 0x04000565; /* 4.0.1381 */
88 default:
89 FIXME("%lx not supported\n", version.dwPlatformId);
90 case VER_PLATFORM_WIN32_WINDOWS:
91 return 0x04030000; /* 4.3.0 */
95 /***********************************************************************
96 * acmMessage32 (MSACM32.35)
97 * FIXME
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);
107 BOOL bLocal = TRUE;
108 PWINE_ACMDRIVERID padid;
109 DWORD val = 0;
110 int i;
111 MMRESULT mmr = MMSYSERR_NOERROR;
113 TRACE("(%p, %d, %p);\n", hao, uMetric, pMetric);
115 #define CheckLocal(padid) (!bLocal || ((padid)->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL))
117 switch (uMetric) {
118 case ACM_METRIC_COUNT_DRIVERS:
119 bLocal = FALSE;
120 /* fall through */
121 case ACM_METRIC_COUNT_LOCAL_DRIVERS:
122 if (hao) return MMSYSERR_INVALHANDLE;
123 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
124 if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
125 val++;
126 *(LPDWORD)pMetric = val;
127 break;
129 case ACM_METRIC_COUNT_CODECS:
130 bLocal = FALSE;
131 /* fall through */
132 case ACM_METRIC_COUNT_LOCAL_CODECS:
133 if (hao) return MMSYSERR_INVALHANDLE;
134 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
135 if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
136 (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC) &&
137 CheckLocal(padid))
138 val++;
139 *(LPDWORD)pMetric = val;
140 break;
142 case ACM_METRIC_COUNT_CONVERTERS:
143 bLocal = FALSE;
144 /* fall through */
145 case ACM_METRIC_COUNT_LOCAL_CONVERTERS:
146 if (hao) return MMSYSERR_INVALHANDLE;
147 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
148 if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
149 (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CONVERTER) &&
150 CheckLocal(padid))
151 val++;
152 *(LPDWORD)pMetric = val;
153 break;
155 case ACM_METRIC_COUNT_FILTERS:
156 bLocal = FALSE;
157 /* fall through */
158 case ACM_METRIC_COUNT_LOCAL_FILTERS:
159 if (hao) return MMSYSERR_INVALHANDLE;
160 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
161 if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
162 (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_FILTER) &&
163 CheckLocal(padid))
164 val++;
165 *(LPDWORD)pMetric = val;
166 break;
168 case ACM_METRIC_COUNT_DISABLED:
169 bLocal = FALSE;
170 /* fall through */
171 case ACM_METRIC_COUNT_LOCAL_DISABLED:
172 if (hao) return MMSYSERR_INVALHANDLE;
173 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
174 if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
175 val++;
176 *(LPDWORD)pMetric = val;
177 break;
179 case ACM_METRIC_MAX_SIZE_FORMAT:
180 if (hao == NULL) {
181 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
182 if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
183 for (i = 0; i < padid->cFormatTags; i++) {
184 if (val < padid->aFormatTag[i].cbwfx)
185 val = padid->aFormatTag[i].cbwfx;
189 } else if (pao != NULL) {
190 switch (pao->dwType) {
191 case WINE_ACMOBJ_DRIVER:
192 case WINE_ACMOBJ_DRIVERID:
193 padid = pao->pACMDriverID;
194 break;
195 default:
196 return MMSYSERR_INVALHANDLE;
198 if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
199 for (i = 0; i < padid->cFormatTags; i++) {
200 if (val < padid->aFormatTag[i].cbwfx)
201 val = padid->aFormatTag[i].cbwfx;
204 } else {
205 return MMSYSERR_INVALHANDLE;
207 *(LPDWORD)pMetric = val;
208 break;
210 case ACM_METRIC_COUNT_HARDWARE:
211 case ACM_METRIC_HARDWARE_WAVE_INPUT:
212 case ACM_METRIC_HARDWARE_WAVE_OUTPUT:
213 case ACM_METRIC_MAX_SIZE_FILTER:
214 case ACM_METRIC_DRIVER_SUPPORT:
215 case ACM_METRIC_DRIVER_PRIORITY:
216 default:
217 FIXME("(%p, %d, %p): stub\n", hao, uMetric, pMetric);
218 mmr = MMSYSERR_NOTSUPPORTED;
220 return mmr;