Source code of Windows XP (NT5)
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.

372 lines
12 KiB

  1. /****************************************************************************
  2. *
  3. * $Archive: S:\sturgeon\src\include\vcs\apimsp.h_v $
  4. *
  5. * INTEL Corporation Prorietary Information
  6. *
  7. * This listing is supplied under the terms of a license agreement
  8. * with INTEL Corporation and may not be copied nor disclosed except
  9. * in accordance with the terms of that agreement.
  10. *
  11. * Copyright (c) 1993-1994 Intel Corporation.
  12. *
  13. * $Revision: 1.21 $
  14. * $Date: 15 Apr 1996 10:33:10 $
  15. * $Author: LCARROLL $
  16. *
  17. * Deliverable:
  18. *
  19. * Abstract:
  20. *
  21. * Notes:
  22. *
  23. ***************************************************************************/
  24. #ifndef APIMSP_H
  25. #define APIMSP_H
  26. #include <apierror.h>
  27. #ifdef __cplusplus
  28. extern "C" { // Assume C declarations for C++.
  29. #endif // __cplusplus
  30. #ifndef DllImport
  31. #define DllImport __declspec( dllimport )
  32. #endif // DllImport
  33. #ifndef DllExport
  34. #define DllExport __declspec( dllexport )
  35. #endif // DllExport
  36. // Define for MSP return indicating no error
  37. #define MSPE_OK 0
  38. // Type identifies MSPs.
  39. //
  40. // Guideline for MSPTYPE strings
  41. // CompanyProductServiceSubtypeVersionDirection\0
  42. // 10 + 10 + 10 + 10 + 6 + 3 + 1 = 50 chars
  43. //
  44. // e.g. #define "IntelIPhoneAudioG7231.0Src"
  45. //
  46. #define MAX_MSPTYPE_LENGTH 50
  47. typedef char MSPTYPE[MAX_MSPTYPE_LENGTH], *LPMSPTYPE;
  48. // Control structures are passed to the MSP by MSM. These handles identify
  49. // internal MSM control structures and should not be manipulated by the MSP.
  50. // The MSP should return these handles in the appropriate MSM callbacks.
  51. typedef DWORD HMSPCTRL;
  52. typedef DWORD HPORTCTRL;
  53. typedef DWORD HBUFFERCTRL;
  54. // Tokens are passed to MSM from MSPs. MSM passes these tokens back to the
  55. // MSP to identify particular instances or objects in later calls.
  56. typedef DWORD MSPTOKEN, *LPMSPTOKEN;
  57. typedef DWORD PORTTOKEN, *LPPORTTOKEN;
  58. typedef DWORD BUFFERTOKEN, *LPBUFFERTOKEN;
  59. // Definitions for media synchronization
  60. //
  61. typedef DWORD MSYNCSTAMP, *LPMSYNCSTAMP; // Sync stamp for an MSP.
  62. typedef int MSYNCDELTA, *LPMSYNCDELTA; // Difference between two sync stamps.
  63. typedef DWORD MSYNCSTATE, *LPMSYNCSTATE; // State of sync (wait, play, drop, etc.).
  64. #define MSYNC_WAIT 0 // Frame should be played later (early).
  65. #define MSYNC_PLAY 1 // Frame should be played now.
  66. #define MSYNC_HURRY 2 // MSP should hurry to catch up.
  67. #define MSYNC_DROP 3 // Frame should be dropped (late).
  68. #define MSYNC_ERROR 4 // There is an error in the sync process.
  69. // Registry defines
  70. //
  71. #define MSP_REG_DLLNAME "DllName"
  72. #define MSP_REG_ERRORPATH "ErrorPath"
  73. #define MSP_REG_DIRECTION "Direction"
  74. #define MSP_REG_LONGNAME "LongName"
  75. #define MSP_REG_SHORTNAME "ShortName"
  76. #define MSP_REG_PRODUCTCOUNT "ProductCount"
  77. #define MSP_REG_ENABLESYNC "EnableSync" // Whether to use sync manager.
  78. #define MSP_REG_DEF_ENABLESYNC 1
  79. #define MSP_REG_EARLYLIMIT "SyncEarlyLimit" // Later than this is an error.
  80. #define MSP_REG_DEF_EARLYLIMIT -1500
  81. #define MSP_REG_EARLYPLAYLIMIT "SyncEarlyPlayLimit"// Earlier than this must wait.
  82. #define MSP_REG_DEF_EARLYPLAYLIMIT -226
  83. #define MSP_REG_LATEPLAYLIMIT "SyncLatePlayLimit" // Later than this must catch up.
  84. #define MSP_REG_DEF_LATEPLAYLIMIT -200
  85. #define MSP_REG_LATELIMIT "SyncLateLimit" // Later than this must hurry.
  86. #define MSP_REG_DEF_LATELIMIT -100
  87. #define MSP_REG_KEY_DEFAULT 0x00000000
  88. #define MSP_REG_KEY_USER 0x00000001
  89. #define MSP_REG_KEY_PRODUCT 0x00000002
  90. #define MSP_REG_KEY_RMS 0x00000003
  91. #define MSP_REG_KEY_OTHER 0x00000004
  92. #define MSP_REG_KEY_TRYALL 0x00000005
  93. // Typedefs for MSM entry points accessed by MSPs
  94. //
  95. typedef HRESULT (*SENDAPPCOMMAND) (HMSPCTRL, HPORTCTRL, WPARAM, LPARAM, LPARAM);
  96. typedef HRESULT (*MSP2MSMSEND) (HPORTCTRL, BUFFERTOKEN, LPWSABUF, UINT);
  97. typedef HRESULT (*MSM2MSPSENDCOMPLETE) (HPORTCTRL, HBUFFERCTRL);
  98. typedef HRESULT (*MSP2MSMFLUSHBUFFERS) (HPORTCTRL);
  99. typedef HRESULT (*ERRORNOTIFY) (HMSPCTRL, HPORTCTRL, HRESULT);
  100. typedef HRESULT (*GETREGDWORDVALUE) (HMSPCTRL, LPSTR, LPSTR, LPDWORD, DWORD, DWORD);
  101. typedef HRESULT (*SETREGDWORDVALUE) (HMSPCTRL, LPSTR, LPSTR, DWORD, DWORD);
  102. typedef HRESULT (*GETREGSTRINGVALUE) (HMSPCTRL, LPSTR, LPSTR, LPSTR, LPSTR, DWORD, DWORD);
  103. typedef HRESULT (*SETREGSTRINGVALUE) (HMSPCTRL, LPSTR, LPSTR, LPSTR, LPSTR, DWORD);
  104. typedef HRESULT (*NEWSYNCSTAMP) (LPMSYNCSTAMP);
  105. typedef HRESULT (*SETSYNCCLOCK) (HPORTCTRL, MSYNCSTAMP, DWORD);
  106. typedef HRESULT (*STARTSYNCCLOCK) (HPORTCTRL);
  107. typedef HRESULT (*STOPSYNCCLOCK) (HPORTCTRL);
  108. typedef HRESULT (*TESTSYNCSTATE) (HPORTCTRL, MSYNCSTAMP, LPMSYNCSTATE, LPMSYNCDELTA, DWORD);
  109. // struct used to export MSM entry points accessed by MSPs
  110. //
  111. typedef struct _MSMSPI
  112. {
  113. SENDAPPCOMMAND SendAppCommand;
  114. MSP2MSMSEND MSP2MSMSend;
  115. MSM2MSPSENDCOMPLETE MSM2MSPSendComplete;
  116. MSP2MSMFLUSHBUFFERS MSP2MSMFlushBuffers;
  117. ERRORNOTIFY ErrorNotify;
  118. GETREGDWORDVALUE GetRegDwordValue;
  119. SETREGDWORDVALUE SetRegDwordValue;
  120. GETREGSTRINGVALUE GetRegStringValue;
  121. SETREGSTRINGVALUE SetRegStringValue;
  122. NEWSYNCSTAMP NewSyncStamp;
  123. SETSYNCCLOCK SetSyncClock;
  124. STARTSYNCCLOCK StartSyncClock;
  125. STOPSYNCCLOCK StopSyncClock;
  126. TESTSYNCSTATE TestSyncState;
  127. }
  128. MSMSPI, *LPMSMSPI;
  129. // Typedefs for MSP entry points accessed by MSM
  130. //
  131. typedef HRESULT (*OPENSERVICE) (LPMSPTYPE, HMSPCTRL, const LPMSMSPI, LPARAM, LPARAM, LPMSPTOKEN);
  132. typedef HRESULT (*CLOSESERVICE) (MSPTOKEN);
  133. typedef HRESULT (*OPENPORT) (MSPTOKEN, HPORTCTRL, LPARAM, LPARAM, LPPORTTOKEN);
  134. typedef HRESULT (*CLOSEPORT) (MSPTOKEN, PORTTOKEN);
  135. typedef HRESULT (*SERVICECMDPROC) (MSPTOKEN, PORTTOKEN, WPARAM, LPARAM, LPARAM);
  136. typedef HRESULT (*MSM2MSPSEND) (MSPTOKEN, PORTTOKEN, HBUFFERCTRL, LPWSABUF, UINT);
  137. typedef HRESULT (*MSP2MSMSENDCOMPLETE) (MSPTOKEN, PORTTOKEN, BUFFERTOKEN, LPWSABUF);
  138. typedef HRESULT (*MSM2MSPFLUSHBUFFERS) (MSPTOKEN, PORTTOKEN);
  139. // MSP API
  140. //
  141. typedef struct _MSPAPI
  142. {
  143. OPENSERVICE OpenService;
  144. CLOSESERVICE CloseService;
  145. OPENPORT OpenPort;
  146. CLOSEPORT ClosePort;
  147. SERVICECMDPROC ServiceCmdProc;
  148. MSM2MSPSEND MSM2MSPSend;
  149. MSP2MSMSENDCOMPLETE MSP2MSMSendComplete;
  150. MSM2MSPFLUSHBUFFERS MSM2MSPFlushBuffers;
  151. }
  152. MSPAPI, *LPMSPAPI;
  153. // Prototypes for MSP entry points accessed by MSM
  154. //
  155. extern DllExport HRESULT MSP_OpenService
  156. (
  157. LPMSPTYPE pMSPType, // Pointer to unique MSP identifier
  158. HMSPCTRL hMSPCtrl, // MSM's instance handle for MSP
  159. const LPMSMSPI pMSMSPI, // Pointer to MSM entry points called be an MSP
  160. LPARAM lParamIn, // Long parameter in
  161. LPARAM lParamOut, // Long parameter out
  162. LPMSPTOKEN pMSPToken // Pointer to token returned by the MSP
  163. );
  164. extern DllExport HRESULT MSP_CloseService
  165. (
  166. MSPTOKEN MSPToken // MSP token for instance data
  167. );
  168. extern DllExport HRESULT MSP_OpenPort
  169. (
  170. MSPTOKEN MSPToken, // MSP token for instance data
  171. HPORTCTRL hPortCtrl, // MSM's instance handle for port
  172. LPARAM lParamIn, // Long parameter in
  173. LPARAM lParamOut, // Long parameter out
  174. LPPORTTOKEN pPortToken // Pointer to port token returned by the MSP
  175. );
  176. extern DllExport HRESULT MSP_ClosePort
  177. (
  178. MSPTOKEN MSPToken, // MSP's token for instance data
  179. PORTTOKEN PortToken // MSP's token for port instance data
  180. );
  181. extern DllExport HRESULT MSP_ServiceCmdProc
  182. (
  183. MSPTOKEN MSPToken, // MSP's token for instance data
  184. PORTTOKEN PortToken, // MSP's token for port instance data
  185. WPARAM wParam, // Word parameter in
  186. LPARAM lParamIn, // Long parameter in
  187. LPARAM lParamOut // Long parameter out
  188. );
  189. extern DllExport HRESULT MSP_MSM2MSPSend
  190. (
  191. MSPTOKEN MSPToken, // MSP's token for instance data
  192. PORTTOKEN PortToken, // MSP's token for port instance data
  193. HBUFFERCTRL hBufferCtrl,// MSM's handle to buffer instance data
  194. LPWSABUF pWSABuf, // Pointer to WSA buffer array
  195. UINT uWSABufCount// Count of WSA buffers in buffer array
  196. );
  197. extern DllExport HRESULT MSP_MSP2MSMSendComplete
  198. (
  199. MSPTOKEN MSPToken, // MSP's token for instance data
  200. PORTTOKEN PortToken, // MSP's token for port instance data
  201. BUFFERTOKEN BufferToken,// MSP's token for buffer instance data
  202. LPWSABUF pWSABuf // Pointer to WSA buffer array
  203. );
  204. extern DllExport HRESULT MSP_MSM2MSPFlushBuffers
  205. (
  206. MSPTOKEN MSPToken, // MSP's token for instance data
  207. PORTTOKEN PortToken // MSP's token for port instance data
  208. );
  209. // Prototypes for MSM entry points accessed by MSPs
  210. //
  211. extern DllExport HRESULT MSM_SendAppCommand
  212. (
  213. HMSPCTRL hMSPCtrl, // MSM's instance handle for MSP
  214. HPORTCTRL hPortCtrl, // MSM's instance handle for port
  215. WPARAM wParam, // Word parameter in
  216. LPARAM lParamIn, // Long parameter in
  217. LPARAM lParamOut // Long parameter out
  218. );
  219. extern DllExport HRESULT MSM_MSP2MSMSend
  220. (
  221. HPORTCTRL hPortCtrl, // MSM's instance handle for port
  222. BUFFERTOKEN BufferToken,// MSP's token for buffer instance data
  223. LPWSABUF pWSABuf, // Pointer to WSA buffer array
  224. UINT uWSABufCount// Count of WSA buffers in buffer array
  225. );
  226. extern DllExport HRESULT MSM_MSM2MSPSendComplete
  227. (
  228. HPORTCTRL hPortCtrl, // MSM's instance handle for port
  229. HBUFFERCTRL hBufferCtrl // MSM's handle to buffer instance data
  230. );
  231. extern DllExport HRESULT MSM_ErrorNotify
  232. (
  233. HMSPCTRL hMSPCtrl, // MSM's instance handle for MSP
  234. HPORTCTRL hPortCtrl, // MSM's instance handle for port
  235. HRESULT hResult // Error to report
  236. );
  237. extern DllExport HRESULT MSM_MSP2MSMFlushBuffers
  238. (
  239. HPORTCTRL hPortCtrl // MSM's instance handle for port
  240. );
  241. extern DllExport HRESULT MSM_GetRegDwordValue
  242. (
  243. HMSPCTRL hMSPCtrl, // MSM's instance handle for MSP
  244. LPSTR pstrKey, // Pointer to optional string for subkeys
  245. LPSTR pstrValue, // pointer to string of value to get
  246. LPDWORD pdValueData,// Pointer to location to place value
  247. DWORD dDefault, // Default if no settings exists
  248. DWORD dFlags // Flags to indicate where to look for value (Default (0) = TRYALL)
  249. );
  250. extern DllExport HRESULT MSM_SetRegDwordValue
  251. (
  252. HMSPCTRL hMSPCtrl, // MSM's instance handle for MSP
  253. LPSTR pstrKey, // Pointer to optional string for subkeys
  254. LPSTR pstrValue, // Pointer to string of value to set
  255. DWORD dValueData, // Data to set
  256. DWORD dFlags // Flags to indicate where to set value (Default (0) = RMS)
  257. );
  258. extern DllExport HRESULT MSM_GetRegStringValue
  259. (
  260. HMSPCTRL hMSPCtrl, // MSM's instance handle for MSP
  261. LPSTR pstrKey, // Pointer to optional string for subkeys
  262. LPSTR pstrValue, // Pointer to string of value to get
  263. LPSTR pstrValueData,// Pointer to string to receive value data
  264. LPSTR pstrDefault,// Pointer to default string if no settings exists
  265. LPDWORD pdSize, // Pointer to the size of the return buffer
  266. DWORD dFlags // Flags to indicate where to look for value (Default (0) = TRYALL)
  267. );
  268. extern DllExport HRESULT MSM_SetRegStringValue
  269. (
  270. HMSPCTRL hMSPCtrl, // MSM's instance handle for MSP
  271. LPSTR pstrKey, // Pointer to optional string for subkeys
  272. LPSTR pstrValue, // Pointer to string of value to set
  273. LPSTR pstrValueData,// Pointer to string data to set
  274. DWORD dFlags // Flags to indicate where to set value (Default (0) = RMS)
  275. );
  276. extern DllExport HRESULT MSM_NewSyncStamp
  277. (
  278. LPMSYNCSTAMP pStamp
  279. );
  280. extern DllExport HRESULT MSM_SetSyncClock
  281. (
  282. HPORTCTRL hPortCtrl, // MSM's instance handle for port
  283. MSYNCSTAMP tDataStamp, // New time stamp
  284. DWORD dLatency // Latency in milliseconds until timstamp is valid
  285. );
  286. extern DllExport HRESULT MSM_StartSyncClock
  287. (
  288. HPORTCTRL hPortCtrl // MSM's instance handle for port
  289. );
  290. extern DllExport HRESULT MSM_StopSyncClock
  291. (
  292. HPORTCTRL hPortCtrl // MSM's instance handle for port
  293. );
  294. extern DllExport HRESULT MSM_TestSyncState
  295. (
  296. HPORTCTRL hPortCtrl, // MSM's instance handle for port
  297. MSYNCSTAMP tDataStamp,
  298. LPMSYNCSTATE pState,
  299. LPMSYNCDELTA pDelta,
  300. DWORD dLatency // Latency to playback client's packet
  301. );
  302. #ifdef __cplusplus
  303. } // End of extern "C" {
  304. #endif // __cplusplus
  305. #endif // APIMSP_H