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.

180 lines
4.5 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 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //
  11. // History:
  12. // 17-Nov-97 TKB Created Initial Interface Version
  13. //
  14. //==========================================================================;
  15. #include <nabtsfec.h>
  16. #pragma warning(disable:4355)
  17. //////////////////////////////////////////////////////////////
  18. // Stream Format FEC-corrected NABTS bundles
  19. //////////////////////////////////////////////////////////////
  20. #define NABTS_OUTPUT_PIN 1
  21. KSDATARANGE StreamFormatNabtsFEC =
  22. {
  23. // Definition of the stream (MUST match the output pin of the decoder)
  24. {
  25. sizeof (KSDATARANGE), // FormatSize
  26. 0, // Flags
  27. sizeof (NABTSFEC_BUFFER), // SampleSize
  28. 0, // Reserved
  29. { STATIC_KSDATAFORMAT_TYPE_NABTS },
  30. { STATIC_KSDATAFORMAT_SUBTYPE_NABTS_FEC },
  31. { STATIC_KSDATAFORMAT_SPECIFIER_NONE }
  32. }
  33. };
  34. //////////////////////////////////////////////////////////////
  35. // INabtsFECOutputPin
  36. //////////////////////////////////////////////////////////////
  37. INabtsFECOutputPin::~INabtsFECOutputPin()
  38. {
  39. }
  40. //////////////////////////////////////////////////////////////
  41. // INabtsFEC:: ctors & dtors
  42. //////////////////////////////////////////////////////////////
  43. INabtsFEC::INabtsFEC() :
  44. IVBICodec("NABTS/FEC VBI Codec", sizeof(VBICODECFILTERING_NABTS_SUBSTREAMS) ),
  45. m_Statistics(*this, KSPROPERTY_VBICODECFILTERING_STATISTICS, sizeof(VBICODECFILTERING_STATISTICS_NABTS)),
  46. m_OutputPin(*this, NABTS_OUTPUT_PIN, &StreamFormatNabtsFEC)
  47. {
  48. }
  49. INabtsFEC::~INabtsFEC()
  50. {
  51. }
  52. //////////////////////////////////////////////////////////////
  53. // INabtsFEC Group routines
  54. //////////////////////////////////////////////////////////////
  55. int
  56. INabtsFEC::AddRequestedGroup(int nGroup)
  57. {
  58. int nStatus = -1;
  59. VBICODECFILTERING_NABTS_SUBSTREAMS GroupBitArray;
  60. if ( m_OutputPin.m_SubstreamsRequested.GetValue(&GroupBitArray) )
  61. {
  62. DWORD nBitsPerElement = sizeof(GroupBitArray.SubstreamMask[0])*8;
  63. // Note, fields numbers start with number 1, this is mapped to bit number 0.
  64. GroupBitArray.SubstreamMask[nGroup/nBitsPerElement] |= 1L << (nGroup % nBitsPerElement);
  65. if ( m_OutputPin.m_SubstreamsRequested.SetValue(&GroupBitArray) )
  66. nStatus = 0;
  67. }
  68. return nStatus;
  69. }
  70. int
  71. INabtsFEC::ClearRequestedGroups()
  72. {
  73. int nStatus = -1;
  74. VBICODECFILTERING_NABTS_SUBSTREAMS GroupBitArray;
  75. ZeroMemory(&GroupBitArray,sizeof(GroupBitArray));
  76. if ( m_OutputPin.m_SubstreamsRequested.SetValue(&GroupBitArray) )
  77. nStatus = 0;
  78. return nStatus;
  79. }
  80. int
  81. INabtsFEC::GetDiscoveredGroups(VBICODECFILTERING_NABTS_SUBSTREAMS &GroupBitArray)
  82. {
  83. int nStatus = -1;
  84. if ( m_OutputPin.m_SubstreamsDiscovered.GetValue(&GroupBitArray) )
  85. {
  86. nStatus = 0;
  87. }
  88. return nStatus;
  89. }
  90. //////////////////////////////////////////////////////////////
  91. // Global Statistics Property Control
  92. //////////////////////////////////////////////////////////////
  93. int
  94. INabtsFEC::GetCodecStatistics(VBICODECFILTERING_STATISTICS_NABTS &CodecStatistics)
  95. {
  96. int nStatus = -1;
  97. if ( m_Statistics.GetValue( &CodecStatistics ) )
  98. {
  99. nStatus = 0;
  100. }
  101. return nStatus;
  102. }
  103. int
  104. INabtsFEC::SetCodecStatistics(VBICODECFILTERING_STATISTICS_NABTS &CodecStatistics)
  105. {
  106. int nStatus = -1;
  107. if ( m_Statistics.SetValue( &CodecStatistics ) )
  108. {
  109. nStatus = 0;
  110. }
  111. return nStatus;
  112. }
  113. int
  114. INabtsFEC::GetPinStatistics(VBICODECFILTERING_STATISTICS_NABTS_PIN &PinStatistics)
  115. {
  116. int nStatus = -1;
  117. if ( m_OutputPin.m_Statistics.GetValue( &PinStatistics ) )
  118. {
  119. nStatus = 0;
  120. }
  121. return nStatus;
  122. }
  123. int
  124. INabtsFEC::SetPinStatistics(VBICODECFILTERING_STATISTICS_NABTS_PIN &PinStatistics)
  125. {
  126. int nStatus = -1;
  127. if ( m_OutputPin.m_Statistics.SetValue( &PinStatistics ) )
  128. {
  129. nStatus = 0;
  130. }
  131. return nStatus;
  132. }
  133. //////////////////////////////////////////////////////////////
  134. // Embedded class tests
  135. //////////////////////////////////////////////////////////////
  136. #if defined(_CLASSTESTS)
  137. INabtsFEC NabtsFEC();
  138. #endif
  139. #pragma warning(default:4355)
  140. /*EOF*/