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.9 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Module: ci.cpp
  4. //
  5. // Description:
  6. //
  7. // Connect Info Class
  8. //
  9. //@@BEGIN_MSINTERNAL
  10. // Development Team:
  11. // Mike McLaughlin
  12. //
  13. // History: Date Author Comment
  14. //
  15. // To Do: Date Author Comment
  16. //
  17. //@@END_MSINTERNAL
  18. //
  19. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  20. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  21. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  22. // PURPOSE.
  23. //
  24. // Copyright (c) 1996-1999 Microsoft Corporation. All Rights Reserved.
  25. //
  26. //---------------------------------------------------------------------------
  27. #include "common.h"
  28. //---------------------------------------------------------------------------
  29. //---------------------------------------------------------------------------
  30. NTSTATUS
  31. CConnectInfo::Create(
  32. PCONNECT_NODE pConnectNode,
  33. PLOGICAL_FILTER_NODE pLogicalFilterNode,
  34. PCONNECT_INFO pConnectInfoNext,
  35. PGRAPH_PIN_INFO pGraphPinInfo,
  36. ULONG ulFlagsCurrent,
  37. PGRAPH_NODE pGraphNode
  38. )
  39. {
  40. NTSTATUS Status = STATUS_SUCCESS;
  41. PCONNECT_INFO pConnectInfo;
  42. Assert(pGraphNode);
  43. Assert(pConnectNode);
  44. FOR_EACH_LIST_ITEM(&pGraphNode->lstConnectInfo, pConnectInfo) {
  45. if(pConnectInfo->pPinInfoSource ==
  46. pConnectNode->pPinNodeSource->pPinInfo &&
  47. pConnectInfo->pPinInfoSink ==
  48. pConnectNode->pPinNodeSink->pPinInfo) {
  49. if(pConnectInfo->pConnectInfoNext->IsSameGraph(pConnectInfoNext)) {
  50. pConnectInfo->AddRef();
  51. ASSERT(NT_SUCCESS(Status));
  52. goto exit;
  53. }
  54. }
  55. } END_EACH_LIST_ITEM
  56. pConnectInfo = new CONNECT_INFO(
  57. pConnectNode,
  58. pConnectInfoNext,
  59. pGraphPinInfo,
  60. pGraphNode);
  61. if(pConnectInfo == NULL) {
  62. Status = STATUS_INSUFFICIENT_RESOURCES;
  63. goto exit;
  64. }
  65. if(ulFlagsCurrent & LFN_FLAGS_CONNECT_NORMAL_TOPOLOGY) {
  66. BOOL fReserve = FALSE;
  67. if(pLogicalFilterNode->GetOrder() <= ORDER_MIXER) {
  68. pConnectInfo->ulFlags |= CI_FLAGS_LIMIT_FORMAT;
  69. }
  70. else {
  71. pConnectInfo->ulFlags |= CI_FLAGS_CONNECT_TOP_DOWN;
  72. }
  73. //
  74. // Reserve pins for the filters below the mixer or splitter (if one)
  75. //
  76. if(ulFlagsCurrent & LFN_FLAGS_CONNECT_CAPTURE) {
  77. if(pLogicalFilterNode->GetOrder() <= ORDER_SPLITTER) {
  78. pConnectInfo->ulFlags |= CI_FLAGS_REUSE_FILTER_INSTANCE;
  79. if(gcSplitters > 0) {
  80. fReserve = TRUE;
  81. }
  82. }
  83. }
  84. if(ulFlagsCurrent & LFN_FLAGS_CONNECT_RENDER) {
  85. if(pLogicalFilterNode->GetOrder() <= ORDER_MIXER) {
  86. pConnectInfo->ulFlags |= CI_FLAGS_REUSE_FILTER_INSTANCE;
  87. if(gcMixers > 0) {
  88. fReserve = TRUE;
  89. }
  90. }
  91. }
  92. if(fReserve) {
  93. Status = pConnectInfo->ReservePinInstance(pGraphNode);
  94. if(!NT_SUCCESS(Status)) {
  95. Trap();
  96. goto exit;
  97. }
  98. }
  99. }
  100. DPF2(80, "CConnectInfo::Create %08x GN %08x", pConnectInfo, pGraphNode);
  101. exit:
  102. pConnectNode->pConnectInfo = pConnectInfo;
  103. return(Status);
  104. }
  105. CConnectInfo::CConnectInfo(
  106. PCONNECT_NODE pConnectNode,
  107. PCONNECT_INFO pConnectInfoNext,
  108. PGRAPH_PIN_INFO pGraphPinInfo,
  109. PGRAPH_NODE pGraphNode
  110. )
  111. {
  112. Assert(pGraphNode);
  113. Assert(pConnectNode);
  114. this->pPinInfoSource = pConnectNode->pPinNodeSource->pPinInfo;
  115. this->pPinInfoSink = pConnectNode->pPinNodeSink->pPinInfo;
  116. this->pGraphPinInfo = pGraphPinInfo;
  117. pGraphPinInfo->AddRef();
  118. this->pConnectInfoNext = pConnectInfoNext;
  119. pConnectInfoNext->AddRef();
  120. AddList(&pGraphNode->lstConnectInfo);
  121. AddRef();
  122. DPF2(80, "CConnectInfo: %08x GN %08x", this, pGraphNode);
  123. }
  124. CConnectInfo::~CConnectInfo(
  125. )
  126. {
  127. DPF1(80, "~CConnectInfo: %08x", this);
  128. Assert(this);
  129. RemoveList();
  130. pGraphPinInfo->Destroy();
  131. pConnectInfoNext->Destroy();
  132. }
  133. //---------------------------------------------------------------------------
  134. #ifdef DEBUG
  135. ENUMFUNC
  136. CConnectInfo::Dump(
  137. )
  138. {
  139. // .sgv or .so
  140. if(ulDebugFlags & (DEBUG_FLAGS_VERBOSE | DEBUG_FLAGS_OBJECT)) {
  141. dprintf("CI: %08x cRef %08x CNI %08x%s%s%s%s\n",
  142. this,
  143. cReference,
  144. pConnectNodeInstance,
  145. IsTopDown() ? " TOP_DOWN" : "",
  146. IsLimitFormat() ? " LIMIT" : "",
  147. IsReuseFilterInstance() ? " REUSE" : "",
  148. IsPinInstanceReserved() ? " RESERVED" : "");
  149. }
  150. // .sg
  151. else {
  152. dprintf("CI: %08x CNI %08x P%-2d C%-d%s%s%s%s\n",
  153. this,
  154. pConnectNodeInstance,
  155. GetPinInstances()->PossibleCount,
  156. GetPinInstances()->CurrentCount,
  157. IsTopDown() ? " TOP_DOWN" : "",
  158. IsLimitFormat() ? " LIMIT" : "",
  159. IsReuseFilterInstance() ? " REUSE" : "",
  160. IsPinInstanceReserved() ? " RESERVED" : "");
  161. }
  162. dprintf(" Source: %08x #%d %s\n",
  163. pPinInfoSource,
  164. pPinInfoSource->PinId,
  165. pPinInfoSource->pFilterNode->DumpName());
  166. dprintf(" Sink: %08x #%d %s\n",
  167. pPinInfoSink,
  168. pPinInfoSink->PinId,
  169. pPinInfoSink->pFilterNode->DumpName());
  170. if(ulDebugFlags & (DEBUG_FLAGS_VERBOSE | DEBUG_FLAGS_OBJECT)) {
  171. pGraphPinInfo->Dump();
  172. }
  173. return(STATUS_CONTINUE);
  174. }
  175. #endif