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.

228 lines
6.0 KiB

  1. //==========================================================================;
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. // PURPOSE.
  7. //
  8. // Copyright (c) 1997-1998 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //
  11. // History:
  12. // 20-Feb-98 TKB Initial Interface Version
  13. //
  14. //==========================================================================;
  15. #include <igemstar.h>
  16. #pragma warning(disable:4355)
  17. //////////////////////////////////////////////////////////////
  18. // Gemstar KSDATAFORMAT definitions
  19. //////////////////////////////////////////////////////////////
  20. #define GEMSTAR_FORMAT_PIN_NUMBER 1
  21. KSDATARANGE StreamFormatGEMSTAR =
  22. {
  23. // Definition of the GEMSTAR stream (MUST match the output pin of the decoder)
  24. {
  25. sizeof (KSDATARANGE), // FormatSize
  26. 0, // Flags
  27. sizeof(GEMSTAR_BUFFER), // SampleSize
  28. 0, // Reserved
  29. { STATIC_KSDATAFORMAT_TYPE_AUXLine21Data }, // MajorFormat
  30. { STATIC_KSDATAFORMAT_SUBTYPE_Gemstar }, // Subtype
  31. { STATIC_KSDATAFORMAT_SPECIFIER_NONE },
  32. }
  33. };
  34. //////////////////////////////////////////////////////////////
  35. // IGemstarOutputPin
  36. //////////////////////////////////////////////////////////////
  37. IGemstarOutputPin::~IGemstarOutputPin()
  38. {
  39. }
  40. //////////////////////////////////////////////////////////////
  41. // IGemstarDecode:: ctors & dtors
  42. //////////////////////////////////////////////////////////////
  43. IGemstarDecode::IGemstarDecode() :
  44. IVBICodec("Gemstar Decoder", sizeof(VBICODECFILTERING_GEMSTAR_SUBSTREAMS) ),
  45. m_Statistics(*this, KSPROPERTY_VBICODECFILTERING_STATISTICS, sizeof(VBICODECFILTERING_STATISTICS_GEMSTAR)),
  46. m_OutputPin(*this, GEMSTAR_FORMAT_PIN_NUMBER, &StreamFormatGEMSTAR )
  47. {
  48. }
  49. IGemstarDecode::~IGemstarDecode()
  50. {
  51. }
  52. //////////////////////////////////////////////////////////////
  53. // IGemstarDecode Scanline routines
  54. //////////////////////////////////////////////////////////////
  55. int
  56. IGemstarDecode::AddRequestedScanline(int nScanline)
  57. {
  58. int nStatus = -1;
  59. VBICODECFILTERING_SCANLINES ScanlineBitArray;
  60. if ( m_OutputPin.m_ScanlinesRequested.GetValue(&ScanlineBitArray) )
  61. {
  62. DWORD nBitsPerElement = sizeof(*ScanlineBitArray.DwordBitArray)*8;
  63. ScanlineBitArray.DwordBitArray[ nScanline / nBitsPerElement ]
  64. |= 1L << (nScanline % nBitsPerElement);
  65. if ( m_OutputPin.m_ScanlinesRequested.SetValue(&ScanlineBitArray) )
  66. nStatus = 0;
  67. }
  68. return nStatus;
  69. }
  70. int
  71. IGemstarDecode::ClearRequestedScanlines()
  72. {
  73. int nStatus = -1;
  74. VBICODECFILTERING_SCANLINES ScanlineBitArray;
  75. ZeroMemory(&ScanlineBitArray,sizeof(ScanlineBitArray));
  76. if ( m_OutputPin.m_ScanlinesRequested.SetValue(&ScanlineBitArray) )
  77. nStatus = 0;
  78. return nStatus;
  79. }
  80. int
  81. IGemstarDecode::GetDiscoveredScanlines(VBICODECFILTERING_SCANLINES &ScanlineBitArray )
  82. {
  83. int nStatus = -1;
  84. if ( m_OutputPin.m_ScanlinesDiscovered.GetValue(&ScanlineBitArray) )
  85. {
  86. nStatus = 0;
  87. }
  88. return nStatus;
  89. }
  90. //////////////////////////////////////////////////////////////
  91. // IGemstarDecode VideoField routines
  92. //////////////////////////////////////////////////////////////
  93. int
  94. IGemstarDecode::AddRequestedVideoField(int nField)
  95. {
  96. int nStatus = -1;
  97. VBICODECFILTERING_GEMSTAR_SUBSTREAMS FieldBitArray;
  98. if ( m_OutputPin.m_SubstreamsRequested.GetValue(&FieldBitArray) )
  99. {
  100. DWORD nBitsPerElement = sizeof(FieldBitArray.SubstreamMask)*8;
  101. // Note, fields numbers start with number 1, this is mapped to bit number 0.
  102. FieldBitArray.SubstreamMask |= 1L << ((nField-1) % nBitsPerElement);
  103. if ( m_OutputPin.m_SubstreamsRequested.SetValue(&FieldBitArray) )
  104. nStatus = 0;
  105. }
  106. return nStatus;
  107. }
  108. int
  109. IGemstarDecode::ClearRequestedVideoFields()
  110. {
  111. int nStatus = -1;
  112. VBICODECFILTERING_GEMSTAR_SUBSTREAMS FieldBitArray;
  113. ZeroMemory(&FieldBitArray,sizeof(FieldBitArray));
  114. if ( m_OutputPin.m_SubstreamsRequested.SetValue(&FieldBitArray) )
  115. nStatus = 0;
  116. return nStatus;
  117. }
  118. int
  119. IGemstarDecode::GetDiscoveredVideoFields(VBICODECFILTERING_GEMSTAR_SUBSTREAMS &bitArray)
  120. {
  121. int nStatus = -1;
  122. if ( m_OutputPin.m_SubstreamsDiscovered.GetValue(&bitArray) )
  123. {
  124. nStatus = 0;
  125. }
  126. return nStatus;
  127. }
  128. //////////////////////////////////////////////////////////////
  129. // Global Statistics Property Control
  130. //////////////////////////////////////////////////////////////
  131. int
  132. IGemstarDecode::GetCodecStatistics(VBICODECFILTERING_STATISTICS_GEMSTAR &CodecStatistics)
  133. {
  134. int nStatus = -1;
  135. if ( m_Statistics.GetValue( &CodecStatistics ) )
  136. {
  137. nStatus = 0;
  138. }
  139. return nStatus;
  140. }
  141. int
  142. IGemstarDecode::SetCodecStatistics(VBICODECFILTERING_STATISTICS_GEMSTAR &CodecStatistics)
  143. {
  144. int nStatus = -1;
  145. if ( m_Statistics.SetValue( &CodecStatistics ) )
  146. {
  147. nStatus = 0;
  148. }
  149. return nStatus;
  150. }
  151. int
  152. IGemstarDecode::GetPinStatistics(VBICODECFILTERING_STATISTICS_GEMSTAR_PIN &PinStatistics)
  153. {
  154. int nStatus = -1;
  155. if ( m_OutputPin.m_Statistics.GetValue( &PinStatistics ) )
  156. {
  157. nStatus = 0;
  158. }
  159. return nStatus;
  160. }
  161. int
  162. IGemstarDecode::SetPinStatistics(VBICODECFILTERING_STATISTICS_GEMSTAR_PIN &PinStatistics)
  163. {
  164. int nStatus = -1;
  165. if ( m_OutputPin.m_Statistics.SetValue( &PinStatistics ) )
  166. {
  167. nStatus = 0;
  168. }
  169. return nStatus;
  170. }
  171. //////////////////////////////////////////////////////////////
  172. // Embedded class tests
  173. //////////////////////////////////////////////////////////////
  174. #if defined(_CLASSTESTS)
  175. IGemstarDecode GemstarDecode();
  176. #endif
  177. #pragma warning(default:4355)
  178. /*EOF*/