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.

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