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.

292 lines
8.9 KiB

  1. // $Header: G:/SwDev/WDM/Video/bt848/rcs/Xbar.h 1.8 1998/04/29 22:43:42 tomz Exp $
  2. #ifndef __XBAR_H
  3. #define __XBAR_H
  4. //
  5. // This file defines interconnections between components via Mediums
  6. //
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. #ifdef BT848_MEDIUMS
  11. #define MEDIUM_DECL
  12. #else
  13. #define MEDIUM_DECL extern
  14. #endif
  15. /* -----------------------------------------------------------
  16. Topology of all devices:
  17. PinDir FilterPin# M_GUID#
  18. TVTuner
  19. TVTunerVideo out 0 0
  20. TVTunerAudio out 1 1
  21. TVAudio
  22. TVTunerAudio in 0 1
  23. TVAudio out 1 3
  24. Crossbar
  25. TVTunerVideo in 0 0
  26. TVAudio in 3 3
  27. AnalogVideoOut out 4 4
  28. AnalogAudioOut out 5 NULL
  29. Capture
  30. AnalogVideoIn in 0 4
  31. All other pins are marked as promiscuous connections via GUID_NULL
  32. ------------------------------------------------------------------ */
  33. // Define the GUIDs which will be used to create the Mediums
  34. #define M_GUID0 0xa19dc0e0, 0x3b39, 0x11d1, 0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba
  35. #define M_GUID1 0xa19dc0e1, 0x3b39, 0x11d1, 0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba
  36. #define M_GUID2 0xa19dc0e2, 0x3b39, 0x11d1, 0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba
  37. #define M_GUID3 0xa19dc0e3, 0x3b39, 0x11d1, 0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba
  38. #define M_GUID4 0xa19dc0e4, 0x3b39, 0x11d1, 0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba
  39. #define M_GUID5 0xa19dc0e5, 0x3b39, 0x11d1, 0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba
  40. #define M_GUID6 0xa19dc0e6, 0x3b39, 0x11d1, 0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba
  41. #define M_GUID7 0xa19dc0e7, 0x3b39, 0x11d1, 0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba
  42. #define M_GUID8 0xa19dc0e8, 0x3b39, 0x11d1, 0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba
  43. #define M_GUID9 0xa19dc0e9, 0x3b39, 0x11d1, 0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba
  44. // Note: To allow multiple instances of the same piece of hardware,
  45. // set the first ULONG after the GUID in the Medium to a unique value.
  46. // ---------------------------------------------------------------
  47. MEDIUM_DECL KSPIN_MEDIUM TVTunerMediums[2]
  48. #ifdef BT848_MEDIUMS
  49. = {
  50. {M_GUID0, 0, 0}, // Pin 0
  51. {M_GUID1, 0, 0}, // Pin 1
  52. }
  53. #endif
  54. ;
  55. MEDIUM_DECL BOOL TVTunerPinDirection [2]
  56. #ifdef BT848_MEDIUMS
  57. = {
  58. TRUE, // Output Pin 0
  59. TRUE, // Output Pin 1
  60. }
  61. #endif
  62. ;
  63. // -----------------------------------------------
  64. MEDIUM_DECL KSPIN_MEDIUM TVAudioMediums[2]
  65. #ifdef BT848_MEDIUMS
  66. = {
  67. {M_GUID1, 0, 0}, // Pin 0
  68. {M_GUID3, 0, 0}, // Pin 1
  69. }
  70. #endif
  71. ;
  72. MEDIUM_DECL BOOL TVAudioPinDirection [2]
  73. #ifdef BT848_MEDIUMS
  74. = {
  75. FALSE, // Input Pin 0
  76. TRUE, // Output Pin 1
  77. }
  78. #endif
  79. ;
  80. // ---------------------------------------------------------------
  81. MEDIUM_DECL KSPIN_MEDIUM CrossbarMediums[6]
  82. #ifdef BT848_MEDIUMS
  83. = {
  84. {STATIC_GUID_NULL, 0, 0}, // Input Pin 0 - SVideoIn
  85. {M_GUID0, 0, 0}, // Input Pin 2, KS_PhysConn_Video_Tuner,
  86. {STATIC_GUID_NULL, 0, 0}, // Input Pin 1 - VideoCompositeIn
  87. {M_GUID3, 0, 0}, // Input Pin 3 KS_PhysConn_Audio_Tuner,
  88. {M_GUID4, 0, 0}, // Output Pin 4 - VideoDecoderOut
  89. {STATIC_GUID_NULL, 0, 0}, // Output Pin 5 KS_PhysConn_Audio_AudioDecoder,
  90. }
  91. #endif
  92. ;
  93. MEDIUM_DECL BOOL CrossbarPinDirection [6]
  94. #ifdef BT848_MEDIUMS
  95. = {
  96. FALSE, // Input Pin 0
  97. FALSE, // Input Pin 1
  98. FALSE, // Input Pin 2
  99. FALSE, // Input Pin 3
  100. TRUE, // Output Pin 4
  101. TRUE, // Output Pin 5
  102. }
  103. #endif
  104. ;
  105. // ---------------------------------------------------------------
  106. MEDIUM_DECL KSPIN_MEDIUM CaptureMediums[4]
  107. #ifdef BT848_MEDIUMS
  108. = {
  109. // should change STATIC_KSMEDIUMSETID_Standard to
  110. // STATIC_GUID_NULL when it works
  111. {STATIC_KSMEDIUMSETID_Standard, 0, 0}, // Pin 0 Capture
  112. {STATIC_KSMEDIUMSETID_Standard, 0, 0}, // Pin 1 Preview
  113. {STATIC_KSMEDIUMSETID_Standard, 0, 0}, // Pin 2 VBI
  114. {M_GUID4, 0, 0}, // Pin 3 Analog Video In
  115. }
  116. #endif
  117. ;
  118. MEDIUM_DECL BOOL CapturePinDirection [4]
  119. #ifdef BT848_MEDIUMS
  120. = {
  121. TRUE, // Output Pin 0
  122. TRUE, // Output Pin 1
  123. TRUE, // Output Pin 2
  124. FALSE, // Input Pin 3
  125. }
  126. #endif
  127. ;
  128. MEDIUM_DECL GUID CaptureCategories [4]
  129. #ifdef BT848_MEDIUMS
  130. = {
  131. STATIC_PINNAME_VIDEO_CAPTURE, // Pin 0
  132. STATIC_PINNAME_VIDEO_PREVIEW, // Pin 1
  133. STATIC_PINNAME_VIDEO_VBI, // Pin 2
  134. STATIC_PINNAME_VIDEO_ANALOGVIDEOIN, // Pin 3
  135. }
  136. #endif
  137. ;
  138. #ifdef __cplusplus
  139. }
  140. #endif
  141. // ---------------------------------------------------------------
  142. struct _XBAR_PIN_DESCRIPTION {
  143. ULONG PinType;
  144. ULONG RelatedPinIndex;
  145. ULONG IsRoutedTo; // Index of input pin in use
  146. ULONG PinNo; // pin number as hard-wired; i.e. mux input 1; to be used in calls
  147. // into the decoder to select a mux input
  148. const KSPIN_MEDIUM *Medium;
  149. _XBAR_PIN_DESCRIPTION( ULONG type, ULONG no, ULONG rel, const KSPIN_MEDIUM *);
  150. _XBAR_PIN_DESCRIPTION(){}
  151. };
  152. inline _XBAR_PIN_DESCRIPTION::_XBAR_PIN_DESCRIPTION( ULONG type, ULONG no,
  153. ULONG rel, const KSPIN_MEDIUM *Medium ) : PinType( type ),
  154. RelatedPinIndex( rel ), IsRoutedTo( 0 ), PinNo( no ), Medium (Medium)
  155. {
  156. }
  157. const int MaxOutPins = 2;
  158. const int MaxInpPins = 4;
  159. class CrossBar
  160. {
  161. // it is possible to make these into the pointers and allocate dynamically
  162. // based on info from registry; but this seems like a lot of work - just allocate
  163. // the maximum possible number and construct each based on the registry settings
  164. _XBAR_PIN_DESCRIPTION OutputPins [MaxOutPins];
  165. _XBAR_PIN_DESCRIPTION InputPins [MaxInpPins];
  166. int InPinsNo_;
  167. public:
  168. int GetNoInputs();
  169. int GetNoOutputs();
  170. bool TestRoute( int InPin, int OutPin );
  171. ULONG GetPinInfo( int dir, int idx, ULONG &related,
  172. KSPIN_MEDIUM * Medium);
  173. ULONG GetPinNo( int no );
  174. void Route( int OutPin, int InPin );
  175. bool GoodPins( int InPin, int OutPin );
  176. int GetRoute( int OutPin );
  177. CrossBar() : InPinsNo_( 0 ) {};
  178. CrossBar( LONG *types );
  179. };
  180. inline CrossBar::CrossBar( LONG *types ) : InPinsNo_( 0 )
  181. {
  182. OutputPins [0] = _XBAR_PIN_DESCRIPTION( KS_PhysConn_Video_VideoDecoder,
  183. 0, 1, &CrossbarMediums[4]);
  184. // [!!!] The following should be moved into the _XBAR_PIN_DESCRIPTION
  185. // constructor as another parameter
  186. Route( 0 /*Video OutPin*/, 1 /*Video InPin*/ );
  187. OutputPins [1] = _XBAR_PIN_DESCRIPTION( KS_PhysConn_Audio_AudioDecoder,
  188. 0, 1, &CrossbarMediums[5]);
  189. // [!!!] The following should be moved into the _XBAR_PIN_DESCRIPTION
  190. // constructor as another parameter
  191. Route( 1 /*Audio OutPin*/, 3 /*Audio InPin*/ );
  192. for ( int i = 0; i < MaxInpPins; i++ ) {
  193. if ( types [i] != -1 ) {
  194. InputPins [InPinsNo_] = _XBAR_PIN_DESCRIPTION( types [i], i, (DWORD) -1, &CrossbarMediums[i] );
  195. InPinsNo_++;
  196. }
  197. }
  198. }
  199. inline int CrossBar::GetNoInputs()
  200. {
  201. return InPinsNo_;
  202. }
  203. inline int CrossBar::GetNoOutputs()
  204. {
  205. return MaxOutPins;
  206. }
  207. inline bool CrossBar::GoodPins( int InPin, int OutPin )
  208. {
  209. return InPinsNo_ &&
  210. bool( InPin >= -1 && InPin < InPinsNo_ && OutPin >= 0 && OutPin < MaxOutPins ); // JBC 4/1/98 Don't allow negative pin numbers
  211. }
  212. inline void CrossBar::Route( int OutPin, int InPin )
  213. {
  214. OutputPins [OutPin].IsRoutedTo = InPin;
  215. }
  216. inline int CrossBar::GetRoute( int OutPin )
  217. {
  218. return OutputPins [OutPin].IsRoutedTo;
  219. }
  220. // should be called for input pins only !
  221. inline ULONG CrossBar::GetPinNo( int no )
  222. {
  223. return InputPins [no].PinNo;
  224. }
  225. inline ULONG CrossBar::GetPinInfo( int dir, int idx, ULONG &related,
  226. KSPIN_MEDIUM * Medium )
  227. {
  228. _XBAR_PIN_DESCRIPTION *pPinDesc;
  229. if ( dir == KSPIN_DATAFLOW_IN ) {
  230. pPinDesc = InputPins;
  231. ASSERT( idx < InPinsNo_ );
  232. } else {
  233. pPinDesc = OutputPins;
  234. ASSERT( idx < MaxOutPins );
  235. }
  236. related = pPinDesc [idx].RelatedPinIndex;
  237. *Medium = *pPinDesc[idx].Medium;
  238. return pPinDesc [idx].PinType;
  239. }
  240. #endif