ReactOS  0.4.14-dev-599-g2d4d3f5
msacm32_main.c
Go to the documentation of this file.
1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
2 
3 /*
4  * MSACM32 library
5  *
6  * Copyright 1998 Patrik Stridvall
7  * 1999 Eric Pouech
8  *
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.
13  *
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.
18  *
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
22  */
23 
24 #include <stdarg.h>
25 
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wine/debug.h"
29 #include "mmsystem.h"
30 #define NOBITMAP
31 #include "mmreg.h"
32 #include "msacm.h"
33 #include "msacmdrv.h"
34 #include "wineacm.h"
35 
37 
38 /**********************************************************************/
39 
41 
42 /***********************************************************************
43  * DllMain (MSACM32.init)
44  */
46 {
47  TRACE("%p 0x%x %p\n", hInstDLL, fdwReason, lpvReserved);
48 
49  switch (fdwReason) {
50  case DLL_PROCESS_ATTACH:
51  DisableThreadLibraryCalls(hInstDLL);
52  MSACM_hHeap = HeapCreate(0, 0x10000, 0);
53  MSACM_hInstance32 = hInstDLL;
55  break;
56  case DLL_PROCESS_DETACH:
58  if (lpvReserved) break;
60  break;
61  default:
62  break;
63  }
64  return TRUE;
65 }
66 
67 /***********************************************************************
68  * XRegThunkEntry (MSACM32.1)
69  * FIXME
70  * No documentation found.
71  */
72 
73 /***********************************************************************
74  * acmGetVersion (MSACM32.@)
75  */
77 {
79 
80  version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
81  if (!GetVersionExA( &version ))
82  return 0x04030000;
83 
84  switch (version.dwPlatformId) {
86  return 0x04000565; /* 4.0.1381 */
88  return 0x02010000; /* 2.1 */
89  default:
90  FIXME("%x not supported\n", version.dwPlatformId);
91  /* fall through */
93  return 0x04030000; /* 4.3.0 */
94  }
95 }
96 
97 /***********************************************************************
98  * acmMessage32 (MSACM32.35)
99  * FIXME
100  * No documentation found.
101  */
102 
103 /***********************************************************************
104  * acmMetrics (MSACM32.@)
105  */
106 MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
107 {
109  BOOL bLocal = TRUE;
110  PWINE_ACMDRIVERID padid;
111  DWORD val = 0;
112  unsigned int i;
114 
115  TRACE("(%p, %d, %p);\n", hao, uMetric, pMetric);
116 
117 #define CheckLocal(padid) (!bLocal || ((padid)->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL))
118 
119  switch (uMetric) {
121  bLocal = FALSE;
122  /* fall through */
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))
128  val++;
129  *(LPDWORD)pMetric = val;
130  break;
131 
133  bLocal = FALSE;
134  /* fall through */
136  if (hao) return MMSYSERR_INVALHANDLE;
137  if (!pMetric) return MMSYSERR_INVALPARAM;
138  for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
141  CheckLocal(padid))
142  val++;
143  *(LPDWORD)pMetric = val;
144  break;
145 
147  bLocal = FALSE;
148  /* fall through */
150  if (hao) return MMSYSERR_INVALHANDLE;
151  if (!pMetric) return MMSYSERR_INVALPARAM;
152  for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
155  CheckLocal(padid))
156  val++;
157  *(LPDWORD)pMetric = val;
158  break;
159 
161  bLocal = FALSE;
162  /* fall through */
164  if (hao) return MMSYSERR_INVALHANDLE;
165  if (!pMetric) return MMSYSERR_INVALPARAM;
166  for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
169  CheckLocal(padid))
170  val++;
171  *(LPDWORD)pMetric = val;
172  break;
173 
175  bLocal = FALSE;
176  /* fall through */
178  if (hao) return MMSYSERR_INVALHANDLE;
179  if (!pMetric) return MMSYSERR_INVALPARAM;
180  for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
182  val++;
183  *(LPDWORD)pMetric = val;
184  break;
185 
187  if (hao == NULL) {
188  for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
190  for (i = 0; i < padid->cFormatTags; i++) {
191  if (val < padid->aFormatTag[i].cbwfx)
192  val = padid->aFormatTag[i].cbwfx;
193  }
194  }
195  }
196  } else if (pao != NULL) {
197  switch (pao->dwType) {
198  case WINE_ACMOBJ_DRIVER:
200  padid = pao->pACMDriverID;
201  break;
202  default:
203  return MMSYSERR_INVALHANDLE;
204  }
206  for (i = 0; i < padid->cFormatTags; i++) {
207  if (val < padid->aFormatTag[i].cbwfx)
208  val = padid->aFormatTag[i].cbwfx;
209  }
210  }
211  } else {
212  return MMSYSERR_INVALHANDLE;
213  }
214  if (!pMetric) return MMSYSERR_INVALPARAM;
215  *(LPDWORD)pMetric = val;
216  break;
217 
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");
223  break;
224 
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) {
231  if (pMetric) {
232  *(LPDWORD)pMetric = i;
233  mmr = MMSYSERR_NOERROR;
234  } else {
235  mmr = MMSYSERR_INVALPARAM;
236  }
237  break;
238  }
239  }
240  break;
241 
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) {
248  if (pMetric) {
249  *(LPDWORD)pMetric = padid->fdwSupport;
250  mmr = MMSYSERR_NOERROR;
251  } else {
252  mmr = MMSYSERR_INVALPARAM;
253  }
254  break;
255  }
256  }
257  break;
258 
262  default:
263  FIXME("(%p, %d, %p): stub\n", hao, uMetric, pMetric);
264  mmr = MMSYSERR_NOTSUPPORTED;
265  }
266  return mmr;
267 }
#define ACM_METRIC_COUNT_HARDWARE
Definition: msacm.h:192
DWORD fdwSupport
Definition: wineacm.h:98
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:236
#define TRUE
Definition: types.h:120
#define ACM_METRIC_DRIVER_SUPPORT
Definition: msacm.h:202
#define CheckLocal(padid)
#define ACM_METRIC_COUNT_DRIVERS
Definition: msacm.h:187
HANDLE WINAPI HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
Definition: heapmem.c:45
#define ACM_METRIC_COUNT_LOCAL_CODECS
Definition: msacm.h:194
#define ACM_METRIC_HARDWARE_WAVE_INPUT
Definition: msacm.h:198
#define ACMDRIVERDETAILS_SUPPORTF_CODEC
Definition: msacm.h:61
PWINE_ACMDRIVERID pACMDriverID
Definition: wineacm.h:45
DWORD cFormatTags
Definition: wineacm.h:97
DWORD dwType
Definition: wineacm.h:44
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
UINT MMRESULT
Definition: mmsystem.h:962
#define WINE_ACMOBJ_DRIVERID
Definition: wineacm.h:36
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define ACM_METRIC_COUNT_LOCAL_FILTERS
Definition: msacm.h:196
#define MMSYSERR_INVALHANDLE
Definition: mmsystem.h:101
static IN DWORD IN LPVOID lpvReserved
#define ACM_METRIC_COUNT_CONVERTERS
Definition: msacm.h:189
#define VER_PLATFORM_WIN32s
Definition: rtltypes.h:234
BOOL WINAPI HeapDestroy(HANDLE hHeap)
Definition: heapmem.c:85
#define ACM_METRIC_COUNT_LOCAL_DRIVERS
Definition: msacm.h:193
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ACMDRIVERDETAILS_SUPPORTF_FILTER
Definition: msacm.h:63
#define FIXME(fmt,...)
Definition: debug.h:110
#define ACM_METRIC_HARDWARE_WAVE_OUTPUT
Definition: msacm.h:199
struct _WINE_ACMDRIVERID::@462 * aFormatTag
HANDLE MSACM_hHeap
Definition: internal.c:47
MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
Definition: msacm32_main.c:106
#define ACM_METRIC_COUNT_DISABLED
Definition: msacm.h:191
PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type)
Definition: internal.c:823
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:66
#define ACM_METRIC_DRIVER_PRIORITY
Definition: msacm.h:203
#define ACM_METRIC_COUNT_FILTERS
Definition: msacm.h:190
BOOL WINAPI GetVersionExA(IN LPOSVERSIONINFOA lpVersionInformation)
Definition: version.c:69
#define ACM_METRIC_COUNT_LOCAL_DISABLED
Definition: msacm.h:197
PWINE_ACMDRIVERID pNextACMDriverID
Definition: wineacm.h:93
#define DLL_PROCESS_DETACH
Definition: compat.h:119
GLuint GLfloat * val
Definition: glext.h:7180
#define TRACE(s)
Definition: solgame.cpp:4
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
DWORD WINAPI acmGetVersion(void)
Definition: msacm32_main.c:76
void MSACM_RegisterAllDrivers(void)
Definition: internal.c:354
#define WINAPI
Definition: msvc.h:6
#define ACM_METRIC_COUNT_LOCAL_CONVERTERS
Definition: msacm.h:195
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WINE_ACMOBJ_DONTCARE
Definition: wineacm.h:35
#define ACMDRIVERDETAILS_SUPPORTF_CONVERTER
Definition: msacm.h:62
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
void MSACM_UnregisterAllDrivers(void)
Definition: internal.c:805
#define LPDWORD
Definition: nt_native.h:46
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
Definition: msacm32_main.c:45
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:48
#define ACM_METRIC_MAX_SIZE_FILTER
Definition: msacm.h:201
struct _OSVERSIONINFOA OSVERSIONINFOA
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
unsigned int UINT
Definition: ndis.h:50
#define ACM_METRIC_COUNT_CODECS
Definition: msacm.h:188
#define VER_PLATFORM_WIN32_WINDOWS
Definition: rtltypes.h:235
#define ACMDRIVERDETAILS_SUPPORTF_DISABLED
Definition: msacm.h:67
#define WINE_ACMOBJ_DRIVER
Definition: wineacm.h:37
HINSTANCE MSACM_hInstance32
Definition: msacm32_main.c:40
#define ACM_METRIC_MAX_SIZE_FORMAT
Definition: msacm.h:200
WINE_DEFAULT_DEBUG_CHANNEL(msacm)