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.

196 lines
7.7 KiB

  1. #ifndef _CAPIF_H
  2. #define _CAPIF_H
  3. #define AUDIO_PACKET_DURATION_SHORT 32
  4. #define AUDIO_PACKET_DURATION_MEDIUM 64
  5. #define AUDIO_PACKET_DURATION_LONG 90
  6. extern UINT g_AudioPacketDurationMs;
  7. extern BOOL g_fRegAudioPacketDuration;
  8. #ifdef DEBUG
  9. extern VOID DumpChannelParameters(PCC_TERMCAP pChanCap1, PCC_TERMCAP pChanCap2);
  10. extern VOID DumpNonstdParameters(PCC_TERMCAP pChanCap1, PCC_TERMCAP pChanCap2);
  11. #else
  12. #define DumpNonstdParameters(a, b)
  13. #define DumpChannelParameters(a, b)
  14. #endif
  15. #define NUM_SIMCAP_SETS 6 //Nuber of default pTermcapDescriptorArray Elements to allocate (AddCombinedEntry (...) )
  16. #ifdef __cplusplus
  17. // RES_PAIR_LIST represents viable local and remote capability IDs for one
  18. // media channel. e.g. a list of resolved audio formats or a list of resolved
  19. // video formats. Each RES_PAIR_LIST is one column in a permutation table.
  20. typedef struct res_pair_list
  21. {
  22. LPIH323MediaCap pMediaResolver; // interface pointer of the resolver that handles
  23. // this media type
  24. UINT uSize; // number of RES_PAIR in pResolvedPairs
  25. UINT uCurrentIndex; // index into pResolvedPairs[]
  26. RES_PAIR *pResolvedPairs; // pointer to array of RES_PAIR
  27. }RES_PAIR_LIST, *PRES_PAIR_LIST;
  28. // RES_CONTEXT represents a permutation table (A list of RES_PAIR_LISTs)
  29. // This used internally by a combination generator
  30. typedef struct res_context {
  31. UINT uColumns; // number of RES_PAIR_LIST in ppPairLists
  32. RES_PAIR_LIST **ppPairLists; // ptr to array of RES_PAIR_LIST pointers
  33. H245_CAPID_T *pIDScratch; // scratch area big enough to contain uColumns * sizeof(H245_CAPID_T)
  34. PCC_TERMCAPDESCRIPTORS pTermCapsLocal;
  35. PCC_TERMCAPDESCRIPTORS pTermCapsRemote;
  36. }RES_CONTEXT, *PRES_CONTEXT;
  37. // IH323PubCap is used by H323 call control
  38. class IH323PubCap
  39. {
  40. public:
  41. STDMETHOD_(ULONG, AddRef()) =0;
  42. STDMETHOD_(ULONG, Release())=0;
  43. STDMETHOD_(BOOL, Init())=0;
  44. STDMETHOD(AddRemoteDecodeCaps(PCC_TERMCAPLIST pTermCapList, PCC_TERMCAPDESCRIPTORS
  45. pTermCapDescriptors, PCC_VENDORINFO pVendorInfo))=0;
  46. // H.245 parameter grabbing functions
  47. // Get public version of channel parameters for a specific decode capability
  48. STDMETHOD(GetPublicDecodeParams(LPVOID pBufOut, UINT uBufSize, MEDIA_FORMAT_ID id))=0;
  49. // Get local and remote channel parameters for a specific encode capability
  50. STDMETHOD( GetEncodeParams(LPVOID pBufOut, UINT uBufSize, LPVOID pLocalParams,
  51. UINT uLocalSize,MEDIA_FORMAT_ID idRemote,MEDIA_FORMAT_ID idLocal))=0;
  52. // get local version of channel parameters for a specific decode capability
  53. STDMETHOD(GetDecodeParams(PCC_RX_CHANNEL_REQUEST_CALLBACK_PARAMS pChannelParams,
  54. MEDIA_FORMAT_ID * pFormatID, LPVOID lpvBuf, UINT uBufSize))=0;
  55. STDMETHOD( EnableMediaType(BOOL bEnable, LPGUID pGuid))=0;
  56. STDMETHOD_(UINT, GetLocalSendParamSize(MEDIA_FORMAT_ID dwID))=0;
  57. STDMETHOD_(UINT, GetLocalRecvParamSize(PCC_TERMCAP pCapability))=0;
  58. // The following is an interim solution, definitely must revisit this for the next release.
  59. // The data pump requires access to local parameters that results from capability
  60. // negotiation. In the absence of a separate interface that the data pump can use,
  61. // the following are stuck onto this interface.
  62. STDMETHOD(GetDecodeFormatDetails(MEDIA_FORMAT_ID FormatID, VOID **ppFormat, UINT *puSize))=0;
  63. STDMETHOD(GetEncodeFormatDetails(MEDIA_FORMAT_ID FormatID, VOID **ppFormat, UINT *puSize))=0;
  64. STDMETHOD ( ComputeCapabilitySets (DWORD dwBandwidth))=0;
  65. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
  66. STDMETHOD_ (VOID, EnableTXCaps(BOOL bSetting))PURE;
  67. STDMETHOD_ (VOID, EnableRemoteTSTradeoff(BOOL bSetting))PURE;
  68. STDMETHOD (ResolveToLocalFormat(MEDIA_FORMAT_ID FormatIDLocal,
  69. MEDIA_FORMAT_ID * pFormatIDRemote))PURE;
  70. STDMETHOD ( ResolveFormats (LPGUID pMediaGuidArray, UINT uNumMedia,
  71. PRES_PAIR pResOutput))PURE;
  72. STDMETHOD (ReInitialize())PURE;
  73. };
  74. typedef IH323PubCap *LPIH323PubCap;
  75. class CapsCtl : public IH323PubCap, public IDualPubCap {
  76. protected:
  77. PCC_TERMCAPLIST m_pAudTermCaps;
  78. PCC_TERMCAPLIST m_pVidTermCaps;
  79. // internal utility functions
  80. UINT GetCapDescBufSize (BOOL bRxCaps);
  81. HRESULT GetCombinedBufSize(BOOL bRXCaps, UINT *puBufsize, UINT *puCapsCount);
  82. UINT GetSimCapBufSize (BOOL bRxCaps);
  83. BOOL TestSimultaneousCaps(H245_CAPID_T* pIDArray, UINT uIDArraySize,
  84. PCC_TERMCAPDESCRIPTORS pTermCaps);
  85. BOOL ResolvePermutations(PRES_CONTEXT pResContext, UINT uNumFixedColumns);
  86. BOOL AreSimCaps(H245_CAPID_T* pIDArray, UINT uIDArraySize,
  87. H245_SIMCAP_T **ppAltCapArray,UINT uAltCapArraySize);
  88. public:
  89. CapsCtl();
  90. ~CapsCtl();
  91. STDMETHOD_(ULONG, AddRef());
  92. STDMETHOD_(ULONG, Release());
  93. STDMETHOD_(BOOL, Init());
  94. STDMETHOD( AddRemoteDecodeCaps(PCC_TERMCAPLIST pTermCapList,PCC_TERMCAPDESCRIPTORS pTermCapDescriptors,PCC_VENDORINFO pVendorInfo));
  95. STDMETHOD( CreateCapList(PCC_TERMCAPLIST *ppCapBuf, PCC_TERMCAPDESCRIPTORS *ppCombinations));
  96. STDMETHOD( DeleteCapList(PCC_TERMCAPLIST pCapBuf, PCC_TERMCAPDESCRIPTORS pCombinations));
  97. STDMETHOD( GetEncodeParams(LPVOID pBufOut, UINT uBufSize, LPVOID pLocalParams, UINT uLocalSize,MEDIA_FORMAT_ID idRemote,MEDIA_FORMAT_ID idLocal));
  98. STDMETHOD( GetPublicDecodeParams(LPVOID pBufOut, UINT uBufSize, VIDEO_FORMAT_ID id));
  99. STDMETHOD(GetDecodeParams(PCC_RX_CHANNEL_REQUEST_CALLBACK_PARAMS pChannelParams,DWORD * pFormatID, LPVOID lpvBuf, UINT uBufSize));
  100. STDMETHOD_(UINT, GetNumCaps(BOOL bRXCaps));
  101. STDMETHOD( EnableMediaType(BOOL bEnable, LPGUID pGuid));
  102. STDMETHOD_(UINT, GetLocalSendParamSize(MEDIA_FORMAT_ID dwID));
  103. STDMETHOD_(UINT, GetLocalRecvParamSize(PCC_TERMCAP pCapability));
  104. //
  105. // methods provided to the Data pump, common to H.323 and MSICCP
  106. STDMETHOD(GetDecodeFormatDetails(MEDIA_FORMAT_ID FormatID, VOID **ppFormat, UINT *puSize));
  107. STDMETHOD(GetEncodeFormatDetails(MEDIA_FORMAT_ID FormatID, VOID **ppFormat, UINT *puSize));
  108. //
  109. //
  110. LPIH323MediaCap FindHostForID(MEDIA_FORMAT_ID id);
  111. LPIH323MediaCap FindHostForMediaType(PCC_TERMCAP pCapability);
  112. LPIH323MediaCap FindHostForMediaGuid(LPGUID pMediaGuid);
  113. STDMETHOD ( AddCombinedEntry (MEDIA_FORMAT_ID *puAudioFormatList,UINT uAudNumEntries,MEDIA_FORMAT_ID *puVideoFormatList, UINT uVidNumEntries,PDWORD pIDOut));
  114. STDMETHOD ( RemoveCombinedEntry (DWORD ID));
  115. STDMETHOD ( ResetCombinedEntries());
  116. STDMETHOD ( ComputeCapabilitySets (DWORD dwBandwidth));
  117. STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR * ppvObj);
  118. STDMETHODIMP ReInitialize();
  119. STDMETHOD_ (VOID, EnableTXCaps(BOOL bSetting)
  120. {
  121. if (pAudCaps)
  122. pAudCaps->EnableTXCaps(bSetting);
  123. if (pVidCaps)
  124. pVidCaps->EnableTXCaps(bSetting);
  125. };);
  126. STDMETHOD_ (VOID, EnableRemoteTSTradeoff(BOOL bSetting)
  127. {
  128. if (pAudCaps)
  129. pAudCaps->EnableRemoteTSTradeoff(bSetting);
  130. if (pVidCaps)
  131. pVidCaps->EnableRemoteTSTradeoff(bSetting);
  132. };);
  133. STDMETHOD (ResolveToLocalFormat(MEDIA_FORMAT_ID FormatIDLocal,
  134. MEDIA_FORMAT_ID * pFormatIDRemote));
  135. STDMETHOD ( ResolveFormats (LPGUID pMediaGuidArray, UINT uNumMedia,
  136. PRES_PAIR pResOutput));
  137. protected:
  138. UINT uRef;
  139. static UINT uAdvertizedSize;
  140. BOOL bAudioPublicize, bVideoPublicize, bT120Publicize;
  141. MEDIA_FORMAT_ID m_localT120cap;
  142. MEDIA_FORMAT_ID m_remoteT120cap;
  143. DWORD m_remoteT120bitrate;
  144. LPIH323MediaCap pAudCaps;
  145. LPIH323MediaCap pVidCaps;
  146. PCC_TERMCAPLIST pACapsBuf,pVCapsBuf;
  147. static PCC_TERMCAPDESCRIPTORS pAdvertisedSets;
  148. static UINT uStaticGlobalRefCount;
  149. PCC_TERMCAPDESCRIPTORS pRemAdvSets;
  150. DWORD dwNumInUse; // # of active TERMCAPDESCRIPTORS in use
  151. DWORD *pSetIDs; //Id's of the active PCC_TERMCAPDESCRIPTORS
  152. BOOL m_fNM20; // set to TRUE if we're talking to NM 2.0
  153. static DWORD dwConSpeed;
  154. };
  155. LPIH323PubCap CreateCapabilityObject();
  156. #endif // __cplusplus
  157. #endif //#ifndef _CAPIF_H