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.

203 lines
6.9 KiB

  1. //==========================================================================
  2. //
  3. // lhacm.h
  4. //
  5. // Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
  6. //
  7. //==========================================================================
  8. #ifndef _LHACM_H_
  9. #define _LHACM_H_
  10. #define _T(s) __TEXT (s)
  11. #define TRACE_FUN
  12. #ifdef DEBUG
  13. #ifndef _DEBUG
  14. #define _DEBUG
  15. #endif
  16. #endif
  17. #ifdef _DEBUG
  18. #include <assert.h>
  19. #ifdef TRACE_FUN
  20. #define FUNCTION_ENTRY(s) \
  21. static TCHAR _szFunName_[] = _T ("LH::") _T (s); \
  22. MyDbgPrintf (_T ("%s\r\n"), (LPTSTR) _szFunName_);
  23. #else
  24. #define FUNCTION_ENTRY(s) \
  25. static TCHAR _szFunName_[] = _T (s);
  26. #endif
  27. #define SZFN ((LPTSTR) _szFunName_)
  28. #define DBGMSG(z,s) ((z) ? (MyDbgPrintf s) : 0);
  29. #else
  30. #define FUNCTION_ENTRY(s)
  31. #define SZFN
  32. #define DBGMSG(z,s)
  33. #endif
  34. #define SIZEOFACMSTR(x) (sizeof(x)/sizeof(WCHAR))
  35. void FAR CDECL MyDbgPrintf ( LPTSTR lpszFormat, ... );
  36. //==========================================================================;
  37. //
  38. // Version info
  39. //
  40. //==========================================================================;
  41. // !!! Need to assign a WAVE_FORMAT tag to the codec
  42. #include "temp.h" // from common\h\temp.h
  43. //Use CELP on _x86_ but not Alpha
  44. #ifndef _ALPHA_
  45. #define CELP4800
  46. #endif
  47. #define VERSION_ACM_DRIVER MAKE_ACM_VERSION(1, 0, 1)
  48. #define VERSION_MSACM MAKE_ACM_VERSION(2, 1, 0)
  49. // !!! Need to assign valid MID and PID
  50. #define MM_ACM_MID_LH MM_MICROSOFT
  51. #define MM_ACM_PID_LH 90
  52. // !!! need to assign IDs
  53. #define MM_LERNOUTHAUSPIE_ACM_CELP 0x70
  54. #define MM_LERNOUTHAUSPIE_ACM_SB8 0x71
  55. #define MM_LERNOUTHAUSPIE_ACM_SB12 0x72
  56. #define MM_LERNOUTHAUSPIE_ACM_SB16 0x73
  57. //==========================================================================;
  58. //
  59. // Helper routines
  60. //
  61. //==========================================================================;
  62. #define SIZEOF_ARRAY(ar) (sizeof(ar)/sizeof((ar)[0]))
  63. #define PCM_BLOCKALIGNMENT(pwfx) (UINT)(((pwfx)->wBitsPerSample >> 3) << ((pwfx)->nChannels >> 1))
  64. #define PCM_AVGBYTESPERSEC(pwfx) (DWORD)((pwfx)->nSamplesPerSec * (pwfx)->nBlockAlign)
  65. #define PCM_BYTESTOSAMPLES(pwfx, cb) (DWORD)(cb / PCM_BLOCKALIGNMENT(pwfx))
  66. #define PCM_SAMPLESTOBYTES(pwfx, dw) (DWORD)(dw * PCM_BLOCKALIGNMENT(pwfx))
  67. // !!! need defines for all four l&h codecs
  68. #define LH_BITSPERSAMPLE 16
  69. #define LH_SAMPLESPERSEC 8000
  70. #define LH_PCM_SAMPLESPERSEC LH_SAMPLESPERSEC
  71. #define LH_PCM_BITSPERSAMPLE LH_BITSPERSAMPLE
  72. #ifdef CELP4800
  73. #define LH_CELP_SAMPLESPERSEC LH_SAMPLESPERSEC
  74. #define LH_CELP_BITSPERSAMPLE LH_BITSPERSAMPLE
  75. #define LH_CELP_BLOCKALIGNMENT 2
  76. #endif
  77. #define LH_SB8_SAMPLESPERSEC LH_SAMPLESPERSEC
  78. #define LH_SB8_BITSPERSAMPLE LH_BITSPERSAMPLE
  79. #define LH_SB8_BLOCKALIGNMENT 2
  80. #define LH_SB12_SAMPLESPERSEC LH_SAMPLESPERSEC
  81. #define LH_SB12_BITSPERSAMPLE LH_BITSPERSAMPLE
  82. #define LH_SB12_BLOCKALIGNMENT 2
  83. #define LH_SB16_SAMPLESPERSEC LH_SAMPLESPERSEC
  84. #define LH_SB16_BITSPERSAMPLE LH_BITSPERSAMPLE
  85. #define LH_SB16_BLOCKALIGNMENT 2
  86. // !!! l&h probably does not need an extended header...tbd
  87. // lonchanc: we don't need an extended header
  88. // because we will use separate wave format tags for
  89. // different coding techniques.
  90. //==========================================================================;
  91. //
  92. // Supported configurations
  93. //
  94. //==========================================================================;
  95. #define LH_MAX_CHANNELS 1
  96. //==========================================================================;
  97. //
  98. // Global storage and defs
  99. //
  100. //==========================================================================;
  101. typedef HANDLE (LH_SUFFIX * PFN_OPEN) ( void );
  102. typedef LH_ERRCODE (LH_SUFFIX * PFN_CONVERT) ( HANDLE, LPBYTE, LPWORD, LPBYTE, LPWORD );
  103. typedef LH_ERRCODE (LH_SUFFIX * PFN_CLOSE) ( HANDLE );
  104. typedef struct tagCODECDATA
  105. {
  106. DWORD wFormatTag;
  107. CODECINFO CodecInfo;
  108. }
  109. CODECDATA, *PCODECDATA;
  110. typedef struct tagSTREAMINSTANCEDATA
  111. {
  112. BOOL fInit; // TRUE if this stream has been initialized
  113. BOOL fCompress; // TRUE if we're compressing
  114. HANDLE hAccess;
  115. PCODECDATA pCodecData; // shortcut to instance data's celp, sb8, sb12, or sb16.
  116. PFN_CONVERT pfnConvert; // pointer to the encoder/decoder function
  117. PFN_CLOSE pfnClose; // pointer to the close function
  118. DWORD dwMaxBitRate; // bit rate of the codec
  119. WORD cbData; // valid data
  120. BYTE Data[2]; // max size is wCodedBufferSize
  121. }
  122. STREAMINSTANCEDATA, FAR *PSTREAMINSTANCEDATA;
  123. typedef struct tagINSTANCEDATA
  124. {
  125. WORD cbStruct;
  126. BOOL fInit;
  127. HINSTANCE hInst;
  128. CODECDATA CELP;
  129. CODECDATA SB8;
  130. CODECDATA SB12;
  131. CODECDATA SB16;
  132. WORD wPacketData;// packet by packet audio data (decoding only)
  133. }
  134. INSTANCEDATA, *PINSTANCEDATA;
  135. //==========================================================================;
  136. //
  137. // Function prototypes
  138. //
  139. //==========================================================================;
  140. BOOL pcmIsValidFormat( LPWAVEFORMATEX pwfx );
  141. BOOL lhacmIsValidFormat( LPWAVEFORMATEX pwfx, PINSTANCEDATA pid );
  142. BOOL CALLBACK DlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  143. LRESULT FAR PASCAL acmdDriverOpen( HDRVR hdrvr, LPACMDRVOPENDESC paod );
  144. LRESULT FAR PASCAL acmdDriverClose( PINSTANCEDATA pid );
  145. LRESULT FAR PASCAL acmdDriverConfigure( PINSTANCEDATA pid, HWND hwnd, LPDRVCONFIGINFO pdci );
  146. LRESULT FAR PASCAL acmdDriverDetails( PINSTANCEDATA pid, LPACMDRIVERDETAILS padd );
  147. LRESULT FAR PASCAL acmdDriverAbout( PINSTANCEDATA pid, HWND hwnd );
  148. LRESULT FAR PASCAL acmdFormatSuggest( PINSTANCEDATA pid, LPACMDRVFORMATSUGGEST padfs );
  149. LRESULT FAR PASCAL acmdFormatTagDetails( PINSTANCEDATA pid, LPACMFORMATTAGDETAILS padft, DWORD fdwDetails );
  150. LRESULT FAR PASCAL acmdFormatDetails( PINSTANCEDATA pid, LPACMFORMATDETAILS padf, DWORD fdwDetails );
  151. LRESULT FAR PASCAL acmdStreamOpen( PINSTANCEDATA pid, LPACMDRVSTREAMINSTANCE padsi );
  152. LRESULT FAR PASCAL acmdStreamClose( PINSTANCEDATA pid, LPACMDRVSTREAMINSTANCE padsi );
  153. LRESULT FAR PASCAL acmdStreamSize( LPACMDRVSTREAMINSTANCE padsi, LPACMDRVSTREAMSIZE padss );
  154. LRESULT FAR PASCAL acmdStreamConvert( PINSTANCEDATA pid, LPACMDRVSTREAMINSTANCE padsi, LPACMDRVSTREAMHEADER padsh );
  155. LRESULT CALLBACK DriverProc(DWORD_PTR dwId, HDRVR hdrvr, UINT uMsg, LPARAM lParam1, LPARAM lParam2 );
  156. #endif // _LHACM_H_
  157.