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.

319 lines
11 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) 1992 - 1998 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //==========================================================================;
  11. //
  12. // This file handles all codec property sets
  13. //
  14. #include <strmini.h>
  15. #include <ksmedia.h>
  16. #include "codmain.h"
  17. #include "coddebug.h"
  18. //#define SETDISCOVERED
  19. // CodecFiltering Property Set functions
  20. // -------------------------------------------------------------------
  21. /*
  22. ** CodecSetCodecGlobalProperty ()
  23. **
  24. ** Handles Set operations on the Global Codec property set.
  25. **
  26. ** Arguments:
  27. **
  28. ** pSRB -
  29. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  30. **
  31. ** Returns:
  32. **
  33. ** Side Effects: none
  34. */
  35. VOID
  36. CodecSetCodecGlobalProperty(
  37. PHW_STREAM_REQUEST_BLOCK pSrb
  38. )
  39. {
  40. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  41. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  42. ULONG Id = pSPD->Property->Id; // index of the property
  43. LONG nBytes = pSPD->PropertyOutputSize - sizeof(KSPROPERTY); // size of data supplied
  44. ASSERT (nBytes >= sizeof (LONG));
  45. switch (Id)
  46. {
  47. case KSPROPERTY_VBICODECFILTERING_SCANLINES_REQUESTED_BIT_ARRAY:
  48. {
  49. PKSPROPERTY_VBICODECFILTERING_SCANLINES_S Property =
  50. (PKSPROPERTY_VBICODECFILTERING_SCANLINES_S) pSPD->PropertyInfo;
  51. CDebugPrint(DebugLevelVerbose,
  52. ( CODECNAME ": CodecSetCodecGlobalProperty : KSPROPERTY_VBICODECFILTERING_SCANLINES_REQUESTED_BIT_ARRAY\n"));
  53. nBytes = min( nBytes, sizeof(pHwDevExt->ScanlinesRequested ) );
  54. RtlCopyMemory( &pHwDevExt->ScanlinesRequested, &Property->Scanlines, nBytes );
  55. pSrb->ActualBytesTransferred = nBytes + sizeof(KSPROPERTY);
  56. break;
  57. }
  58. #ifdef SETDISCOVERED
  59. case KSPROPERTY_VBICODECFILTERING_SCANLINES_DISCOVERED_BIT_ARRAY:
  60. {
  61. PKSPROPERTY_VBICODECFILTERING_SCANLINES_S Property =
  62. (PKSPROPERTY_VBICODECFILTERING_SCANLINES_S) pSPD->PropertyInfo;
  63. CDebugPrint(DebugLevelVerbose,
  64. ( CODECNAME ": CodecSetCodecGlobalProperty : KSPROPERTY_VBICODECFILTERING_SCANLINES_DISCOVERED_BIT_ARRAY\n"));
  65. nBytes = min( nBytes, sizeof(pHwDevExt->ScanlinesDiscovered ) );
  66. RtlCopyMemory( &pHwDevExt->ScanlinesDiscovered, &Property->Scanlines, nBytes );
  67. pSrb->ActualBytesTransferred = nBytes + sizeof(KSPROPERTY);
  68. break;
  69. }
  70. #endif // SETDISCOVERED
  71. case KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_REQUESTED_BIT_ARRAY:
  72. {
  73. PKSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S Property =
  74. (PKSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S) pSPD->PropertyInfo;
  75. CDebugPrint(DebugLevelVerbose,
  76. ( CODECNAME ": CodecSetCodecGlobalProperty : KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_REQUESTED_BIT_ARRAY\n"));
  77. nBytes = min( nBytes, sizeof(pHwDevExt->SubstreamsRequested ) );
  78. RtlCopyMemory( &pHwDevExt->SubstreamsRequested, &Property->Substreams, nBytes );
  79. pSrb->ActualBytesTransferred = nBytes + sizeof(KSPROPERTY);
  80. break;
  81. }
  82. #ifdef SETDISCOVERED
  83. case KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_DISCOVERED_BIT_ARRAY:
  84. {
  85. PKSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S Property =
  86. (PKSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S) pSPD->PropertyInfo;
  87. CDebugPrint(DebugLevelVerbose,
  88. ( CODECNAME ": CodecSetCodecGlobalProperty : KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_DISCOVERED_BIT_ARRAY\n"));
  89. nBytes = min( nBytes, sizeof(pHwDevExt->SubstreamsDiscovered ) );
  90. RtlCopyMemory( &pHwDevExt->SubstreamsDiscovered, &Property->Substreams, nBytes );
  91. pSrb->ActualBytesTransferred = nBytes + sizeof(KSPROPERTY);
  92. break;
  93. }
  94. #endif // SETDISCOVERED
  95. case KSPROPERTY_VBICODECFILTERING_STATISTICS:
  96. {
  97. PKSPROPERTY_VBICODECFILTERING_STATISTICS_CC_S Property =
  98. (PKSPROPERTY_VBICODECFILTERING_STATISTICS_CC_S) pSPD->PropertyInfo;
  99. CDebugPrint(DebugLevelVerbose,
  100. ( CODECNAME ": CodecSetCodecGlobalProperty : KSPROPERTY_VBICODECFILTERING_STATISTICS\n"));
  101. nBytes = min( nBytes, sizeof(pHwDevExt->Statistics ) );
  102. RtlCopyMemory( &pHwDevExt->Statistics, &Property->Statistics, nBytes );
  103. pSrb->ActualBytesTransferred = nBytes + sizeof(KSPROPERTY);
  104. break;
  105. }
  106. default:
  107. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  108. CDebugPrint(DebugLevelVerbose,
  109. ( CODECNAME ": CodecSetCodecGlobalProperty : Unknown Property Id=%d\n", Id));
  110. CDEBUG_BREAK();
  111. break;
  112. }
  113. }
  114. /*
  115. ** CodecGetCodecGlobalProperty ()
  116. **
  117. ** Handles Get operations on the Global Codec property set.
  118. **
  119. ** Arguments:
  120. **
  121. ** pSRB -
  122. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  123. **
  124. ** Returns:
  125. **
  126. ** Side Effects: none
  127. */
  128. VOID
  129. CodecGetCodecGlobalProperty(
  130. PHW_STREAM_REQUEST_BLOCK pSrb
  131. )
  132. {
  133. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  134. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  135. ULONG Id = pSPD->Property->Id; // index of the property
  136. LONG nBytes = pSPD->PropertyOutputSize - sizeof(KSPROPERTY); // size of data supplied
  137. ASSERT (nBytes >= sizeof (LONG));
  138. switch (Id)
  139. {
  140. case KSPROPERTY_VBICODECFILTERING_SCANLINES_REQUESTED_BIT_ARRAY:
  141. {
  142. PKSPROPERTY_VBICODECFILTERING_SCANLINES_S Property =
  143. (PKSPROPERTY_VBICODECFILTERING_SCANLINES_S) pSPD->PropertyInfo;
  144. CDebugPrint(DebugLevelVerbose,
  145. ( CODECNAME ": CodecGetCodecGlobalProperty : KSPROPERTY_VBICODECFILTERING_SCANLINES_REQUESTED_BIT_ARRAY\n"));
  146. nBytes = min( nBytes, sizeof(pHwDevExt->ScanlinesRequested ) );
  147. RtlCopyMemory( &Property->Scanlines, &pHwDevExt->ScanlinesRequested, nBytes );
  148. pSrb->ActualBytesTransferred = nBytes + sizeof(KSPROPERTY);
  149. break;
  150. }
  151. case KSPROPERTY_VBICODECFILTERING_SCANLINES_DISCOVERED_BIT_ARRAY:
  152. {
  153. PKSPROPERTY_VBICODECFILTERING_SCANLINES_S Property =
  154. (PKSPROPERTY_VBICODECFILTERING_SCANLINES_S) pSPD->PropertyInfo;
  155. CDebugPrint(DebugLevelVerbose,
  156. ( CODECNAME ": CodecGetCodecGlobalProperty : KSPROPERTY_VBICODECFILTERING_SCANLINES_DISCOVERED_BIT_ARRAY\n"));
  157. nBytes = min( nBytes, sizeof(pHwDevExt->ScanlinesDiscovered ) );
  158. RtlCopyMemory( &Property->Scanlines, &pHwDevExt->ScanlinesDiscovered, nBytes );
  159. // Clear the data after the read so that it's always "fresh"
  160. RtlZeroMemory( &pHwDevExt->ScanlinesDiscovered, nBytes );
  161. pSrb->ActualBytesTransferred = nBytes + sizeof(KSPROPERTY);
  162. break;
  163. }
  164. case KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_REQUESTED_BIT_ARRAY:
  165. {
  166. PKSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S Property =
  167. (PKSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S) pSPD->PropertyInfo;
  168. CDebugPrint(DebugLevelVerbose,
  169. ( CODECNAME ": CodecGetCodecGlobalProperty : KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_REQUESTED_BIT_ARRAY\n"));
  170. nBytes = min( nBytes, sizeof(pHwDevExt->SubstreamsRequested ) );
  171. RtlCopyMemory( &Property->Substreams, &pHwDevExt->SubstreamsRequested, nBytes );
  172. pSrb->ActualBytesTransferred = nBytes + sizeof(KSPROPERTY);
  173. break;
  174. }
  175. case KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_DISCOVERED_BIT_ARRAY:
  176. {
  177. PKSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S Property =
  178. (PKSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S) pSPD->PropertyInfo;
  179. CDebugPrint(DebugLevelVerbose,
  180. ( CODECNAME ": CodecGetCodecGlobalProperty : KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_DISCOVERED_BIT_ARRAY\n"));
  181. nBytes = min( nBytes, sizeof(pHwDevExt->SubstreamsDiscovered ) );
  182. RtlCopyMemory( &Property->Substreams, &pHwDevExt->SubstreamsDiscovered, nBytes );
  183. // Clear the data after the read so that it's always "fresh"
  184. RtlZeroMemory( &pHwDevExt->SubstreamsDiscovered, nBytes );
  185. pSrb->ActualBytesTransferred = nBytes + sizeof(KSPROPERTY);
  186. break;
  187. }
  188. case KSPROPERTY_VBICODECFILTERING_STATISTICS:
  189. {
  190. PKSPROPERTY_VBICODECFILTERING_STATISTICS_CC_S Property =
  191. (PKSPROPERTY_VBICODECFILTERING_STATISTICS_CC_S) pSPD->PropertyInfo;
  192. CDebugPrint(DebugLevelVerbose,
  193. ( CODECNAME ": CodecGetCodecGlobalProperty : KSPROPERTY_VBICODECFILTERING_STATISTICS\n"));
  194. nBytes = min( nBytes, sizeof(pHwDevExt->Statistics ) );
  195. RtlCopyMemory( &Property->Statistics, &pHwDevExt->Statistics, nBytes );
  196. pSrb->ActualBytesTransferred = nBytes + sizeof(KSPROPERTY);
  197. break;
  198. }
  199. default:
  200. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  201. CDebugPrint(DebugLevelVerbose,
  202. ( CODECNAME ": CodecGetCodecGlobalProperty : Unknown Property Id=%d\n", Id));
  203. CDEBUG_BREAK();
  204. break;
  205. }
  206. }
  207. // -------------------------------------------------------------------
  208. // General entry point for all get/set codec properties
  209. // -------------------------------------------------------------------
  210. /*
  211. ** CodecSetProperty ()
  212. **
  213. ** Handles Set operations for all codec properties.
  214. **
  215. ** Arguments:
  216. **
  217. ** pSRB -
  218. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  219. **
  220. ** Returns:
  221. **
  222. ** Side Effects: none
  223. */
  224. VOID
  225. STREAMAPI
  226. CodecSetProperty(
  227. PHW_STREAM_REQUEST_BLOCK pSrb
  228. )
  229. {
  230. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  231. if (IsEqualGUID( &KSPROPSETID_Connection, &pSPD->Property->Set))
  232. {
  233. // CodecSetConnectionProperty(pSrb);
  234. }
  235. else if (IsEqualGUID( &KSPROPSETID_VBICodecFiltering, &pSPD->Property->Set))
  236. {
  237. CodecSetCodecGlobalProperty(pSrb);
  238. }
  239. else
  240. {
  241. //
  242. // We should never get here
  243. //
  244. CDEBUG_BREAK();
  245. }
  246. }
  247. /*
  248. ** CodecGetProperty ()
  249. **
  250. ** Handles Get operations for all codec properties.
  251. **
  252. ** Arguments:
  253. **
  254. ** pSRB -
  255. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  256. **
  257. ** Returns:
  258. **
  259. ** Side Effects: none
  260. */
  261. VOID
  262. STREAMAPI
  263. CodecGetProperty( PHW_STREAM_REQUEST_BLOCK pSrb )
  264. {
  265. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  266. if (IsEqualGUID( &KSPROPSETID_Connection, &pSPD->Property->Set))
  267. {
  268. // CodecGetConnectionProperty(pSrb);
  269. }
  270. else if (IsEqualGUID( &KSPROPSETID_VBICodecFiltering, &pSPD->Property->Set))
  271. {
  272. CodecGetCodecGlobalProperty(pSrb);
  273. }
  274. else
  275. {
  276. //
  277. // We should never get here
  278. //
  279. CDEBUG_BREAK();
  280. }
  281. }