Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

434 lines
12 KiB

  1. //==========================================================================;
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. // PURPOSE.
  7. //
  8. // Copyright (c) 1993-1998 Microsoft Corporation
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. // codec.h
  13. //
  14. // Description:
  15. // This file contains codec definitions, Win16/Win32 compatibility
  16. // definitions, and instance structure definitions.
  17. //
  18. //
  19. //==========================================================================;
  20. #ifndef _INC_CODEC
  21. #define _INC_CODEC // #defined if codec.h has been included
  22. #ifndef RC_INVOKED
  23. #pragma pack(1) // assume byte packing throughout
  24. #endif
  25. #ifndef EXTERN_C
  26. #ifdef __cplusplus
  27. #define EXTERN_C extern "C"
  28. #else
  29. #define EXTERN_C extern
  30. #endif
  31. #endif
  32. #ifdef __cplusplus
  33. extern "C" // assume C declarations for C++
  34. {
  35. #endif
  36. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  37. //
  38. // ACM Driver Version:
  39. //
  40. // the version is a 32 bit number that is broken into three parts as
  41. // follows:
  42. //
  43. // bits 24 - 31: 8 bit _major_ version number
  44. // bits 16 - 23: 8 bit _minor_ version number
  45. // bits 0 - 15: 16 bit build number
  46. //
  47. // this is then displayed as follows (in decimal form):
  48. //
  49. // bMajor = (BYTE)(dwVersion >> 24)
  50. // bMinor = (BYTE)(dwVersion >> 16) &
  51. // wBuild = LOWORD(dwVersion)
  52. //
  53. // VERSION_ACM_DRIVER is the version of this driver.
  54. // VERSION_MSACM is the version of the ACM that this driver
  55. // was designed for (requires).
  56. //
  57. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  58. #ifdef WIN32
  59. //
  60. // 32-bit versions
  61. //
  62. #if (WINVER >= 0x0400)
  63. #define VERSION_ACM_DRIVER MAKE_ACM_VERSION(4, 0, 0)
  64. #else
  65. #define VERSION_ACM_DRIVER MAKE_ACM_VERSION(3, 51, 0)
  66. #endif
  67. #define VERSION_MSACM MAKE_ACM_VERSION(3, 50, 0)
  68. #else
  69. //
  70. // 16-bit versions
  71. //
  72. #define VERSION_ACM_DRIVER MAKE_ACM_VERSION(1, 0, 0)
  73. #define VERSION_MSACM MAKE_ACM_VERSION(2, 1, 0)
  74. #endif
  75. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  76. //
  77. // Win 16/32 portability stuff...
  78. //
  79. //
  80. //
  81. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  82. #ifndef WIN32
  83. #ifndef FNLOCAL
  84. #define FNLOCAL NEAR PASCAL
  85. #define FNCLOCAL NEAR _cdecl
  86. #define FNGLOBAL FAR PASCAL
  87. #define FNCGLOBAL FAR _cdecl
  88. #ifdef _WINDLL
  89. #define FNWCALLBACK FAR PASCAL _loadds
  90. #define FNEXPORT FAR PASCAL _export
  91. #else
  92. #define FNWCALLBACK FAR PASCAL
  93. #define FNEXPORT FAR PASCAL _export
  94. #endif
  95. #endif
  96. //
  97. //
  98. //
  99. //
  100. #ifndef FIELD_OFFSET
  101. #define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field))
  102. #endif
  103. //
  104. // based code makes since only in win 16 (to try and keep stuff out of
  105. // our fixed data segment...
  106. //
  107. #define BCODE _based(_segname("_CODE"))
  108. #define HUGE _huge
  109. //
  110. // stuff for Unicode in Win 32--make it a noop in Win 16
  111. //
  112. #ifndef _TCHAR_DEFINED
  113. #define _TCHAR_DEFINED
  114. typedef char TCHAR, *PTCHAR;
  115. typedef unsigned char TBYTE, *PTUCHAR;
  116. typedef PSTR PTSTR, PTCH;
  117. typedef LPSTR LPTSTR, LPTCH;
  118. typedef LPCSTR LPCTSTR;
  119. #endif
  120. #define TEXT(a) a
  121. #define SIZEOF(x) sizeof(x)
  122. #define SIZEOFACMSTR(x) sizeof(x)
  123. #else
  124. #ifndef FNLOCAL
  125. #define FNLOCAL _stdcall
  126. #define FNCLOCAL _stdcall
  127. #define FNGLOBAL _stdcall
  128. #define FNCGLOBAL _stdcall
  129. #define FNWCALLBACK CALLBACK
  130. #define FNEXPORT CALLBACK
  131. #endif
  132. #ifndef try
  133. #define try __try
  134. #define leave __leave
  135. #define except __except
  136. #define finally __finally
  137. #endif
  138. //
  139. // there is no reason to have based stuff in win 32
  140. //
  141. #define BCODE
  142. #define HUGE
  143. #define HTASK HANDLE
  144. #define SELECTOROF(a) (a)
  145. //
  146. // for compiling Unicode
  147. //
  148. #ifdef UNICODE
  149. #define SIZEOF(x) (sizeof(x)/sizeof(WCHAR))
  150. #else
  151. #define SIZEOF(x) sizeof(x)
  152. #endif
  153. #define SIZEOFACMSTR(x) (sizeof(x)/sizeof(WCHAR))
  154. #endif
  155. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  156. //
  157. // misc defines for misc sizes and things...
  158. //
  159. //
  160. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  161. //
  162. // bilingual. this allows the same identifier to be used in resource files
  163. // and code without having to decorate the id in your code.
  164. //
  165. #ifdef RC_INVOKED
  166. #define RCID(id) id
  167. #else
  168. #define RCID(id) MAKEINTRESOURCE(id)
  169. #endif
  170. //
  171. //
  172. //
  173. #define SIZEOF_ARRAY(ar) (sizeof(ar)/sizeof((ar)[0]))
  174. //
  175. //
  176. //
  177. typedef BOOL FAR* LPBOOL;
  178. #ifndef INLINE
  179. #define INLINE __inline
  180. #endif
  181. //
  182. // macros to compute block alignment and convert between samples and bytes
  183. // of PCM data. note that these macros assume:
  184. //
  185. // wBitsPerSample = 8 or 16
  186. // nChannels = 1 or 2
  187. //
  188. // the pwf argument is a pointer to a PCMWAVEFORMAT structure.
  189. //
  190. #define PCM_BLOCKALIGNMENT(pwf) (UINT)(((pwf)->wBitsPerSample >> 3) << ((pwf)->wf.nChannels >> 1))
  191. #define PCM_AVGBYTESPERSEC(pwf) (DWORD)((pwf)->wf.nSamplesPerSec * (pwf)->wf.nBlockAlign)
  192. #define PCM_BYTESTOSAMPLES(pwf, dw) (DWORD)(dw / PCM_BLOCKALIGNMENT(pwf))
  193. #define PCM_SAMPLESTOBYTES(pwf, dw) (DWORD)(dw * PCM_BLOCKALIGNMENT(pwf))
  194. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  195. //
  196. //
  197. //
  198. //
  199. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  200. typedef struct tDRIVERINSTANCE
  201. {
  202. //
  203. // although not required, it is suggested that the first two members
  204. // of this structure remain as fccType and DriverProc _in this order_.
  205. // the reason for this is that the driver will be easier to combine
  206. // with other types of drivers (defined by AVI) in the future.
  207. //
  208. FOURCC fccType; // type of driver: 'audc'
  209. DRIVERPROC fnDriverProc; // driver proc for the instance
  210. //
  211. // the remaining members of this structure are entirely open to what
  212. // your driver requires.
  213. //
  214. HDRVR hdrvr; // driver handle we were opened with
  215. HINSTANCE hinst; // DLL module handle.
  216. DWORD vdwACM; // current version of ACM opening you
  217. DWORD fdwOpen; // flags from open description
  218. LPDRVCONFIGINFO pdci;
  219. DWORD fdwConfig; // stream instance configuration flags
  220. HKEY hkey;
  221. UINT nConfigMaxRTEncodeSetting;
  222. UINT nConfigMaxRTDecodeSetting;
  223. UINT nConfigPercentCPU;
  224. BOOL fHelpRunning; // Used by config DlgProc only.
  225. #ifdef WIN4
  226. HBRUSH hbrDialog; // Used by config DlgProc only.
  227. #endif
  228. } DRIVERINSTANCE, *PDRIVERINSTANCE, FAR *LPDRIVERINSTANCE;
  229. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  230. //
  231. //
  232. //
  233. //
  234. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  235. //
  236. // Structure used for storing configuration setting.
  237. // See codec.c for a description of this structure and its use.
  238. //
  239. typedef struct tRATELISTFORMAT
  240. {
  241. UINT uFormatType;
  242. UINT idsFormat;
  243. DWORD dwMonoRate;
  244. } RATELISTFORMAT;
  245. typedef RATELISTFORMAT *PRATELISTFORMAT;
  246. #define CONFIG_RLF_NONUMBER 1
  247. #define CONFIG_RLF_MONOONLY 2
  248. #define CONFIG_RLF_STEREOONLY 3
  249. #define CONFIG_RLF_MONOSTEREO 4
  250. //
  251. //
  252. //
  253. //
  254. typedef LRESULT (FNGLOBAL *STREAMCONVERTPROC)
  255. (
  256. LPACMDRVSTREAMINSTANCE padsi,
  257. LPACMDRVSTREAMHEADER padsh
  258. );
  259. //
  260. //
  261. //
  262. //
  263. typedef struct tSTREAMINSTANCE
  264. {
  265. STREAMCONVERTPROC fnConvert; // stream instance conversion proc
  266. DWORD fdwConfig; // stream instance configuration flags
  267. //
  268. // This GSM610 codec requires the following parameters
  269. // per stream instance. These parameters are used by
  270. // the encode and decode routines.
  271. //
  272. SHORT dp[120];
  273. SHORT drp[160];
  274. SHORT z1;
  275. LONG l_z2;
  276. SHORT mp;
  277. SHORT OldLARpp[9];
  278. SHORT u[8];
  279. SHORT nrp;
  280. SHORT OldLARrpp[9];
  281. SHORT msr;
  282. SHORT v[9];
  283. } STREAMINSTANCE, *PSTREAMINSTANCE, FAR *LPSTREAMINSTANCE;
  284. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  285. //
  286. // resource id's
  287. //
  288. //
  289. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  290. #define IDS_ACM_DRIVER_SHORTNAME (1) // ACMDRIVERDETAILS.szShortName
  291. #define IDS_ACM_DRIVER_LONGNAME (2) // ACMDRIVERDETAILS.szLongName
  292. #define IDS_ACM_DRIVER_COPYRIGHT (3) // ACMDRIVERDETAILS.szCopyright
  293. #define IDS_ACM_DRIVER_LICENSING (4) // ACMDRIVERDETAILS.szLicensing
  294. #define IDS_ACM_DRIVER_FEATURES (5) // ACMDRIVERDETAILS.szFeatures
  295. #define IDS_ACM_DRIVER_TAG_NAME (20) // ACMFORMATTAGDETAILS.szFormatTag
  296. #define IDS_ERROR (30)
  297. #define IDS_ERROR_NOMEM (31)
  298. #define IDS_CONFIG_NORATES (32)
  299. #define IDS_CONFIG_ALLRATES (33)
  300. #define IDS_CONFIG_MONOONLY (34)
  301. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  302. //
  303. // resource id's for gsm 610 configuration dialog box
  304. //
  305. //
  306. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  307. #define IDD_CONFIG RCID(100)
  308. #define IDC_BTN_AUTOCONFIG 1001
  309. #define IDC_BTN_HELP 1002
  310. #define IDC_COMBO_MAXRTENCODE 1003
  311. #define IDC_COMBO_MAXRTDECODE 1004
  312. #define IDC_STATIC_COMPRESS 1005
  313. #define IDC_STATIC_DECOMPRESS 1006
  314. #define IDC_STATIC -1
  315. #define MSGSM610_CONFIG_DEFAULT_MAXRTENCODESETTING 0
  316. #define MSGSM610_CONFIG_DEFAULT_MAXRTDECODESETTING 1
  317. #define MSGSM610_CONFIG_UNCONFIGURED 0x0999
  318. #define MSGSM610_CONFIG_DEFAULT_PERCENTCPU 50
  319. #define MSGSM610_CONFIG_DEFAULTKEY HKEY_CURRENT_USER
  320. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  321. //
  322. // global variables, etc...
  323. //
  324. //
  325. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  326. extern const UINT gauFormatIndexToSampleRate[];
  327. extern const UINT ACM_DRIVER_MAX_SAMPLE_RATES;
  328. extern const RATELISTFORMAT gaRateListFormat[];
  329. extern const UINT MSGSM610_CONFIG_NUMSETTINGS;
  330. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  331. //
  332. // function prototypes
  333. //
  334. //
  335. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  336. BOOL FNGLOBAL acmdDriverConfigInit
  337. (
  338. PDRIVERINSTANCE pdi,
  339. LPCTSTR pszAliasName
  340. );
  341. INT_PTR FNWCALLBACK acmdDlgProcConfigure
  342. (
  343. HWND hwnd,
  344. UINT uMsg,
  345. WPARAM wParam,
  346. LPARAM lParam
  347. );
  348. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  349. //
  350. //
  351. //
  352. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  353. #ifndef RC_INVOKED
  354. #pragma pack() // revert to default packing
  355. #endif
  356. #ifdef __cplusplus
  357. } // end of extern "C" {
  358. #endif
  359. #endif // _INC_CODEC