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.

194 lines
4.4 KiB

  1. /////////////////////////////////////////////////////////////////////
  2. //
  3. // Module: rdpsndp.h
  4. //
  5. // Purpose: Sound redirection protocol description
  6. //
  7. // Copyright(C) Microsoft Corporation 2000
  8. //
  9. // History: 4-10-2000 vladimis [created]
  10. //
  11. /////////////////////////////////////////////////////////////////////
  12. #ifndef _VCSND_H
  13. #define _VCSND_H
  14. #ifdef _WIN32
  15. #include <pshpack1.h>
  16. #else
  17. #ifndef RC_INVOKED
  18. #pragma pack(1)
  19. #endif
  20. #endif
  21. #define RDPSND_PROTOCOL_VERSION 0x0005
  22. //
  23. // Redefining the version number, this is in order to split the
  24. // dependency between the client and the server part of audio redirection
  25. //
  26. #define RDPSND_SRVPROTOCOL_VERSION 0x0002
  27. #define _SNDVC_NAME "RDPSND"
  28. #define DEFAULT_VC_TIMEOUT 30000
  29. // Device capabilities
  30. //
  31. #define TSSNDCAPS_ALIVE 1
  32. #define TSSNDCAPS_VOLUME 2
  33. #define TSSNDCAPS_PITCH 4
  34. #define TSSNDCAPS_TERMINATED 0x80000000
  35. // the block size must be bigger than the biggest
  36. // aligned block after acm conversion
  37. // for example, Mobile Voice (WAVE_FORMAT_CU_CODEC) format
  38. // requres more than 4096
  39. // samples per block
  40. //
  41. #define TSSND_BLOCKSIZE ( 8192 * TSSND_NATIVE_BLOCKALIGN )
  42. #define TSSND_BLOCKSONTHENET 4
  43. #define TSSND_NATIVE_BITSPERSAMPLE 16
  44. #define TSSND_NATIVE_CHANNELS 2
  45. #define TSSND_NATIVE_SAMPLERATE 22050
  46. #define TSSND_NATIVE_BLOCKALIGN ((TSSND_NATIVE_BITSPERSAMPLE * \
  47. TSSND_NATIVE_CHANNELS) / 8)
  48. #define TSSND_NATIVE_AVGBYTESPERSEC (TSSND_NATIVE_BLOCKALIGN * \
  49. TSSND_NATIVE_SAMPLERATE)
  50. #define RANDOM_KEY_LENGTH 32
  51. #define RDPSND_SIGNATURE_SIZE 8
  52. #define IsDGramWaveSigned( _version_ ) ( _version_ >= 3 )
  53. #define CanUDPFragment( _version_ ) ( _version_ >= 4 )
  54. #define IsDGramWaveAudioSigned( _version_ ) ( _version_ >= 5 )
  55. // Commands/Responses
  56. //
  57. enum {
  58. SNDC_NONE,
  59. SNDC_CLOSE,
  60. SNDC_WAVE,
  61. SNDC_SETVOLUME,
  62. SNDC_SETPITCH,
  63. SNDC_WAVECONFIRM,
  64. SNDC_TRAINING,
  65. SNDC_FORMATS,
  66. SNDC_CRYPTKEY,
  67. SNDC_WAVEENCRYPT,
  68. SNDC_UDPWAVE,
  69. SNDC_UDPWAVELAST
  70. };
  71. typedef struct {
  72. BYTE Type;
  73. BYTE bPad;
  74. UINT16 BodySize;
  75. // BYTE Body[0];
  76. } SNDPROLOG, *PSNDPROLOG;
  77. typedef struct {
  78. SNDPROLOG Prolog;
  79. UINT32 dwVolume;
  80. } SNDSETVOLUME, *PSNDSETVOLUME;
  81. typedef struct {
  82. SNDPROLOG Prolog;
  83. UINT32 dwPitch;
  84. } SNDSETPITCH, *PSNDSETPITCH;
  85. typedef struct {
  86. SNDPROLOG Prolog;
  87. UINT16 wTimeStamp;
  88. UINT16 wFormatNo;
  89. union {
  90. BYTE cBlockNo;
  91. DWORD dwBlockNo;
  92. };
  93. // BYTE Wave[0];
  94. } SNDWAVE, *PSNDWAVE;
  95. #define RDPSND_FRAGNO_EXT 0x80
  96. #define RDPSND_MIN_FRAG_SIZE 0x80
  97. typedef struct {
  98. BYTE Type;
  99. BYTE cBlockNo;
  100. BYTE cFragNo;
  101. //
  102. // if RDPSND_FRAGNO_EXT is set
  103. // there will be another byte for the low bits of the frag no
  104. // BYTE Wave[0];
  105. } SNDUDPWAVE, *PSNDUDPWAVE;
  106. typedef struct {
  107. BYTE Type;
  108. UINT16 wTotalSize;
  109. UINT16 wTimeStamp;
  110. UINT16 wFormatNo;
  111. union {
  112. BYTE cBlockNo;
  113. DWORD dwBlockNo;
  114. };
  115. // BYTE Wave[0];
  116. } SNDUDPWAVELAST, *PSNDUDPWAVELAST;
  117. typedef struct {
  118. SNDPROLOG Prolog;
  119. UINT16 wTimeStamp;
  120. BYTE cConfirmedBlockNo;
  121. BYTE bPad;
  122. } SNDWAVECONFIRM, *PSNDWAVECONFIRM;
  123. typedef struct {
  124. SNDPROLOG Prolog;
  125. UINT16 wTimeStamp;
  126. UINT16 wPackSize;
  127. } SNDTRAINING, *PSNDTRAINING;
  128. typedef struct {
  129. SNDPROLOG Prolog;
  130. UINT16 wTimeStamp;
  131. UINT16 wVersion;
  132. } SNDVERSION, *PSNDVERSION;
  133. typedef struct {
  134. UINT16 wFormatTag;
  135. UINT16 nChannels;
  136. UINT32 nSamplesPerSec;
  137. UINT32 nAvgBytesPerSec;
  138. UINT16 nBlockAlign;
  139. UINT16 wBitsPerSample;
  140. UINT16 cbSize;
  141. //
  142. // extra fomat info
  143. //
  144. } SNDFORMATITEM, *PSNDFORMATITEM;
  145. typedef struct {
  146. SNDPROLOG Prolog;
  147. UINT32 dwFlags;
  148. UINT32 dwVolume;
  149. UINT32 dwPitch;
  150. UINT16 wDGramPort;
  151. UINT16 wNumberOfFormats;
  152. BYTE cLastBlockConfirmed;
  153. UINT16 wVersion;
  154. BYTE bPad;
  155. // SNDFORMATITEM pSndFmt[0];
  156. } SNDFORMATMSG, *PSNDFORMATMSG;
  157. typedef struct {
  158. SNDPROLOG Prolog;
  159. DWORD Reserved;
  160. BYTE Seed[RANDOM_KEY_LENGTH];
  161. } SNDCRYPTKEY, *PSNDCRYPTKEY;
  162. #ifdef _WIN32
  163. #include <poppack.h>
  164. #else
  165. #ifndef RC_INVOKED
  166. #pragma pack()
  167. #endif
  168. #endif
  169. #endif // !_VCSND_H