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.

279 lines
7.9 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) 1992-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. // History:
  20. // 11/16/92 cjp [curtisp]
  21. //
  22. //==========================================================================;
  23. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  24. //
  25. // ACM Driver Version:
  26. //
  27. // the version is a 32 bit number that is broken into three parts as
  28. // follows:
  29. //
  30. // bits 24 - 31: 8 bit _major_ version number
  31. // bits 16 - 23: 8 bit _minor_ version number
  32. // bits 0 - 15: 16 bit build number
  33. //
  34. // this is then displayed as follows (in decimal form):
  35. //
  36. // bMajor = (BYTE)(dwVersion >> 24)
  37. // bMinor = (BYTE)(dwVersion >> 16) &
  38. // wBuild = LOWORD(dwVersion)
  39. //
  40. // VERSION_CODEC is the version of this driver.
  41. // VERSION_MSACM is the version of the ACM that this driver
  42. // was designed for (requires).
  43. //
  44. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  45. #ifdef WIN32
  46. //
  47. // 32-bit versions
  48. //
  49. #if (WINVER >= 0x0400)
  50. #define VERSION_CODEC MAKE_ACM_VERSION(4, 0, 0)
  51. #else
  52. #define VERSION_CODEC MAKE_ACM_VERSION(3, 51, 0)
  53. #endif
  54. #define VERSION_MSACM MAKE_ACM_VERSION(3, 50, 0)
  55. #else
  56. //
  57. // 16-bit versions
  58. //
  59. #define VERSION_CODEC MAKE_ACM_VERSION(2, 1, 0)
  60. #define VERSION_MSACM MAKE_ACM_VERSION(2, 1, 0)
  61. #endif
  62. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  63. //
  64. // Win 16/32 portability stuff...
  65. //
  66. //
  67. //
  68. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  69. #ifndef WIN32
  70. #ifndef FNLOCAL
  71. #define FNLOCAL NEAR PASCAL
  72. #define FNCLOCAL NEAR _cdecl
  73. #define FNGLOBAL FAR PASCAL
  74. #define FNCGLOBAL FAR _cdecl
  75. #ifdef _WINDLL
  76. #define FNWCALLBACK FAR PASCAL _loadds
  77. #define FNEXPORT FAR PASCAL _export
  78. #else
  79. #define FNWCALLBACK FAR PASCAL
  80. #define FNEXPORT FAR PASCAL _export
  81. #endif
  82. #endif
  83. //
  84. //
  85. //
  86. //
  87. #ifndef FIELD_OFFSET
  88. #define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field))
  89. #endif
  90. //
  91. // based code makes since only in win 16 (to try and keep stuff out of
  92. // our fixed data segment...
  93. //
  94. #define BCODE _based(_segname("_CODE"))
  95. #define HUGE _huge
  96. //
  97. // stuff for Unicode in Win 32--make it a noop in Win 16
  98. //
  99. #ifndef _TCHAR_DEFINED
  100. #define _TCHAR_DEFINED
  101. typedef char TCHAR, *PTCHAR;
  102. typedef unsigned char TBYTE, *PTUCHAR;
  103. typedef PSTR PTSTR, PTCH;
  104. typedef LPSTR LPTSTR, LPTCH;
  105. typedef LPCSTR LPCTSTR;
  106. #endif
  107. #define TEXT(a) a
  108. #define SIZEOF(x) sizeof(x)
  109. #define SIZEOFACMSTR(x) sizeof(x)
  110. #else
  111. #ifndef FNLOCAL
  112. #define FNLOCAL _stdcall
  113. #define FNCLOCAL _stdcall
  114. #define FNGLOBAL _stdcall
  115. #define FNCGLOBAL _stdcall
  116. #define FNWCALLBACK CALLBACK
  117. #define FNEXPORT CALLBACK
  118. #endif
  119. #ifndef try
  120. #define try __try
  121. #define leave __leave
  122. #define except __except
  123. #define finally __finally
  124. #endif
  125. //
  126. // there is no reason to have based stuff in win 32
  127. //
  128. #define BCODE
  129. #define HUGE
  130. #define HTASK HANDLE
  131. #define SELECTOROF(a) (a)
  132. //
  133. // for compiling Unicode
  134. //
  135. #ifdef UNICODE
  136. #define SIZEOF(x) (sizeof(x)/sizeof(WCHAR))
  137. #else
  138. #define SIZEOF(x) sizeof(x)
  139. #endif
  140. #define SIZEOFACMSTR(x) (sizeof(x)/sizeof(WCHAR))
  141. #endif
  142. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  143. //
  144. // misc defines for misc sizes and things...
  145. //
  146. //
  147. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  148. //
  149. // bilingual. this allows the same identifier to be used in resource files
  150. // and code without having to decorate the id in your code.
  151. //
  152. #ifdef RC_INVOKED
  153. #define RCID(id) id
  154. #else
  155. #define RCID(id) MAKEINTRESOURCE(id)
  156. #endif
  157. //
  158. // macros to compute block alignment and convert between samples and bytes
  159. // of PCM data. note that these macros assume:
  160. //
  161. // wBitsPerSample = 8 or 16
  162. // nChannels = 1 or 2
  163. //
  164. // the pwf argument is a pointer to a WAVEFORMATEX structure.
  165. //
  166. #define PCM_BLOCKALIGNMENT(pwfx) (UINT)(((pwfx)->wBitsPerSample >> 3) << ((pwfx)->nChannels >> 1))
  167. #define PCM_AVGBYTESPERSEC(pwfx) (DWORD)((pwfx)->nSamplesPerSec * (pwfx)->nBlockAlign)
  168. #define PCM_BYTESTOSAMPLES(pwfx, cb) (DWORD)(cb / PCM_BLOCKALIGNMENT(pwfx))
  169. #define PCM_SAMPLESTOBYTES(pwfx, dw) (DWORD)(dw * PCM_BLOCKALIGNMENT(pwfx))
  170. //
  171. //
  172. //
  173. #define MAX_ERR_STRING 250 // used in various places for errors
  174. //
  175. //
  176. //
  177. //
  178. typedef struct tCODECINST
  179. {
  180. //
  181. // although not required, it is suggested that the first two members
  182. // of this structure remain as fccType and DriverProc _in this order_.
  183. // the reason for this is that the codec will be easier to combine
  184. // with other types of codecs (defined by AVI) in the future.
  185. //
  186. FOURCC fccType; // type of codec: 'audc'
  187. DRIVERPROC DriverProc; // driver proc for the instance
  188. //
  189. // the remaining members of this structure are entirely open to what
  190. // your codec requires.
  191. //
  192. HDRVR hdrvr; // driver handle we were opened with
  193. HINSTANCE hinst; // DLL module handle.
  194. DWORD vdwACM; // current version of ACM opening you
  195. DWORD dwFlags; // flags from open description
  196. } CODECINST, *PCODECINST, FAR *LPCODECINST;
  197. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  198. //
  199. // typedefs
  200. //
  201. //
  202. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  203. //
  204. // This define deals with unaligned data for Win32, and huge data for Win16.
  205. // Basically, any time you cast an HPBYTE to a non-byte variable (ie long or
  206. // short), you should cast it to ( {short,long} HUGE_T *). This will cast
  207. // it to _huge for Win16, and make sure that there are no alignment problems
  208. // for Win32 on MIPS and Alpha machines.
  209. //
  210. typedef BYTE HUGE *HPBYTE;
  211. #ifdef WIN32
  212. #define HUGE_T UNALIGNED
  213. #else
  214. #define HUGE_T _huge
  215. #endif
  216. typedef DWORD (FNGLOBAL *CONVERTPROC_ASM)(LPWAVEFORMATEX, LPBYTE, LPWAVEFORMATEX, LPBYTE, DWORD);
  217. typedef DWORD (FNGLOBAL *CONVERTPROC_C)
  218. (
  219. HPBYTE pbSrc,
  220. DWORD cbSrcLength,
  221. HPBYTE pbDst,
  222. UINT nBlockAlignment,
  223. UINT cSamplesPerBlock,
  224. UINT nNumCoef,
  225. LPADPCMCOEFSET lpCoefSet
  226. );
  227. //
  228. // resource id's
  229. //
  230. //
  231. #define ICON_CODEC RCID(10)
  232. #define IDS_CODEC_SHORTNAME (1) // ACMCONVINFO.szShortName
  233. #define IDS_CODEC_LONGNAME (2) // ACMCONVINFO.szLongName
  234. #define IDS_CODEC_COPYRIGHT (3) // ACMCONVINFO.szCopyright
  235. #define IDS_CODEC_LICENSING (4) // ACMCONVINFO.szLicensing
  236. #define IDS_CODEC_FEATURES (5) // ACMCONVINFO.szFeatures
  237. #define IDS_CODEC_NAME (10)