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.

236 lines
5.3 KiB

  1. /*++
  2. Copyright (c) 1995-1996 Microsoft Corporation
  3. Module Name:
  4. audpackt.h
  5. Abstract:
  6. Contains prototypes for the AudioPacket class, which encapsulates a sound buffer in
  7. its various states: recorded/encoded/network/decoded/playing etc.
  8. --*/
  9. #ifndef _MEDIAPKT_H_
  10. #define _MEDIAPKT_H_
  11. #include <pshpack8.h> /* Assume 8 byte packing throughout */
  12. class MediaControl;
  13. class FilterManager;
  14. class DataPump;
  15. typedef struct tagNetBuf
  16. {
  17. // first part looks like a Winsock WSABUF struct
  18. ULONG length;
  19. UCHAR *data;
  20. class BufferPool *pool;
  21. struct tagNetBuf *next;
  22. }
  23. NETBUF;
  24. typedef struct tagMediaPacketInit
  25. {
  26. // flags
  27. DWORD dwFlags;
  28. // if set then MediaPacket doesnt allocate NETBUFs for RawData
  29. BOOL fDontAllocRawBufs;
  30. // stream of conversion
  31. DPHANDLE hStrmConv;
  32. PVOID pStrmConvSrcFmt;
  33. PVOID pStrmConvDstFmt;
  34. // device of mm io
  35. // DPHANDLE hDevAudio;
  36. PVOID pDevFmt;
  37. // dev buffer
  38. // PVOID pDevData;
  39. ULONG cbSizeDevData;
  40. ULONG cbOffsetDevData;
  41. // wave buffer
  42. // PVOID pWaveData;
  43. ULONG cbSizeRawData;
  44. ULONG cbOffsetRawData;
  45. // net buffer
  46. ULONG cbSizeNetData;
  47. ULONG cbOffsetNetData;
  48. ULONG cbPayloadHeaderSize;
  49. int index;
  50. BYTE payload;
  51. }
  52. MEDIAPACKETINIT;
  53. /////////////////////////////////////////////
  54. //
  55. // AudioPacket
  56. //
  57. #define DP_MASK_STATE 0x000000FFUL
  58. class MediaPacket
  59. {
  60. protected:
  61. // stream of conversion
  62. DPHANDLE m_hStrmConv;
  63. PVOID m_pStrmConvHdr;
  64. PVOID m_pStrmConvSrcFmt;
  65. PVOID m_pStrmConvDstFmt;
  66. // device of mm io
  67. DPHANDLE m_hDev;
  68. PVOID m_pDevHdr;
  69. PVOID m_pDevFmt;
  70. // dev related buffer and info
  71. NETBUF *m_pDevData;
  72. // wave related buffer and info
  73. NETBUF *m_pRawData;
  74. UINT m_cbValidRawData; // audio only - size of decode results
  75. // network related buffer and info
  76. NETBUF *m_pNetData;
  77. UINT m_cbMaxNetData; // size of allocated net buffer
  78. // public properties accessible
  79. DWORD m_dwState;
  80. BOOL m_fBusy; // set if not owned by rx/txstream
  81. UINT m_seq; // RTP seq num
  82. UINT m_index; // position in queue
  83. // internal properties
  84. BOOL m_fInitialized;
  85. BOOL m_fDevPrepared;
  86. BOOL m_fStrmPrepared;
  87. private:
  88. void _Construct ( void );
  89. void _Destruct ( void );
  90. public:
  91. BOOL m_fRendering;
  92. UINT m_fMark; // RTP mark bit
  93. DWORD m_timestamp;// RTP timestamp
  94. BYTE m_payload; // RTP payload
  95. MediaPacket ( void );
  96. ~MediaPacket ( void );
  97. virtual HRESULT Initialize ( MEDIAPACKETINIT * p );
  98. virtual HRESULT Receive (NETBUF *pNetBuf, DWORD timestamp, UINT seq, UINT fMark);
  99. virtual HRESULT Play ( MMIODEST *pmmioDest, UINT uDataType ) = 0;
  100. virtual HRESULT Record ( void ) = 0;
  101. virtual HRESULT GetProp ( DWORD dwPropId, PDWORD_PTR pdwPropVal );
  102. virtual HRESULT SetProp ( DWORD dwPropId, DWORD_PTR dwPropVal );
  103. virtual HRESULT Interpolate ( MediaPacket * pPrev, MediaPacket * pNext) = 0;
  104. virtual HRESULT Release ( void );
  105. virtual HRESULT Recycle ( void );
  106. virtual HRESULT Open ( UINT uType, DPHANDLE hdl ) = 0; // called by RxStream or TxStream
  107. virtual HRESULT Close ( UINT uType ) = 0; // called by RxStream or TxStream
  108. virtual BOOL IsBufferDone ( void ) = 0;
  109. virtual BOOL IsSameMediaFormat(PVOID fmt1,PVOID fmt2) = 0;
  110. virtual void WriteToFile (MMIODEST *pmmioDest) = 0;
  111. virtual void ReadFromFile (MMIOSRC *pmmioSrc ) = 0;
  112. virtual HRESULT GetSignalStrength ( PDWORD pdwMaxStrength ) = 0;
  113. virtual HRESULT MakeSilence ( void ) = 0;
  114. BOOL SetDecodeBuffer(NETBUF *pNetBuf);
  115. BOOL Busy(void) { return m_fBusy;}
  116. void Busy(BOOL fBusy) { m_fBusy = fBusy;}
  117. UINT GetSeqNum(void) { return m_seq;}
  118. DWORD GetTimestamp(void) { return m_timestamp;}
  119. BYTE GetPayload(void) { return m_payload;}
  120. VOID SetPayload(BYTE bPayload) { m_payload = bPayload;}
  121. UINT GetIndex(void) {return m_index;}
  122. UINT GetState(void) { return (m_dwState & DP_MASK_STATE); }
  123. void SetState(DWORD s) { m_dwState = (m_dwState & ~DP_MASK_STATE) | (s & DP_MASK_STATE); }
  124. void* GetConversionHeader() {return m_pStrmConvHdr;}
  125. HRESULT GetDevData(PVOID *ppData, PUINT pcbData) ;
  126. HRESULT GetNetData(PVOID *ppData, PUINT pcbData);
  127. HRESULT SetNetLength(UINT uLength);
  128. virtual DWORD GetDevDataSamples() = 0;
  129. inline DWORD GetFrameSize() {return ((DWORD)m_pNetData->length);}
  130. inline void SetRawActual(UINT uRawValid) {m_cbValidRawData = uRawValid;}
  131. };
  132. enum
  133. {
  134. MP_STATE_RESET,
  135. MP_STATE_RECORDING,
  136. MP_STATE_RECORDED,
  137. MP_STATE_ENCODED,
  138. MP_STATE_NET_OUT_STREAM,
  139. MP_STATE_NET_IN_STREAM,
  140. MP_STATE_DECODED,
  141. MP_STATE_PLAYING_BACK,
  142. MP_STATE_PLAYING_SILENCE,
  143. MP_STATE_PLAYED_BACK,
  144. MP_STATE_RECYCLED,
  145. MP_STATE_NumOfStates
  146. };
  147. enum
  148. {
  149. MP_DATATYPE_FROMWIRE,
  150. MP_DATATYPE_SILENCE,
  151. MP_DATATYPE_INTERPOLATED,
  152. MP_DATATYPE_NumOfDataTypes
  153. };
  154. // types for Open()/Close()
  155. enum
  156. {
  157. MP_TYPE_RECVSTRMCONV,
  158. MP_TYPE_STREAMCONV,
  159. MP_TYPE_DEV,
  160. MP_TYPE_NumOfTypes
  161. };
  162. enum
  163. {
  164. MP_PROP_STATE,
  165. MP_PROP_PLATFORM,
  166. MP_PROP_DEV_MEDIA_FORMAT,
  167. MP_PROP_DEV_DATA,
  168. MP_PROP_DEV_HANDLE,
  169. MP_PROP_DEV_MEDIA_HDR,
  170. MP_PROP_IN_STREAM_FORMAT,
  171. MP_PROP_OUT_STREAM_FORMAT,
  172. MP_PROP_TIMESTAMP,
  173. MP_PROP_INDEX,
  174. MP_PROP_PREAMBLE,
  175. MP_PROP_SEQNUM,
  176. MP_PROP_FILTER_HEADER,
  177. MP_PROP_MAX_NET_LENGTH,
  178. MP_PROP_NumOfProps
  179. };
  180. #include <poppack.h> /* End byte packing */
  181. #endif
  182.