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.

1944 lines
60 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 - 1996 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //==========================================================================;
  11. //
  12. // This file handles all adapter property sets
  13. //
  14. #include "strmini.h"
  15. #include "ksmedia.h"
  16. #include "capmain.h"
  17. #include "capdebug.h"
  18. #include "capxfer.h"
  19. #define DEFINE_MEDIUMS
  20. #include "mediums.h"
  21. // -------------------------------------------------------------------
  22. // A few notes about property set handling
  23. //
  24. // Property sets used in Testcap are of two varieties, those that have
  25. // default values, ranges, and stepping, such as VideoProcAmp and CameraControl,
  26. // and those which don't have defaults and ranges, such as TVTuner and
  27. // Crossbar.
  28. //
  29. // Default values and stepping are established by tables in capprop.h,
  30. // no code is required to implement this other than initally creating the tables.
  31. //
  32. // Many of the property sets require the ability to modify a number
  33. // of input parameters. Since KS doesn't allow this inherently, you'll
  34. // note that some property sets require copying the provided input parameters
  35. // to the ouput parameter list, effectively creating a "read, modify, write"
  36. // capability. For this reason, the input and output parameter lists
  37. // use identical structures.
  38. //
  39. // On an SRB_GET_DEVICE_PROPERTY, read-only input data to the driver is provided as:
  40. // pSrb->CommandData.PropertyInfo
  41. //
  42. // ... while the output data pointer is:
  43. // pSrb->CommandData.PropertyInfo.PropertyInfo
  44. //
  45. // -------------------------------------------------------------------
  46. // -------------------------------------------------------------------
  47. // XBar pin definitions
  48. // -------------------------------------------------------------------
  49. typedef struct _XBAR_PIN_DESCRIPTION {
  50. ULONG PinType;
  51. ULONG SynthImageCommand; // This driver simulates different inputs by synthesizing images
  52. ULONG RelatedPinIndex;
  53. const KSPIN_MEDIUM *Medium; // Describes hardware connectivity
  54. } XBAR_PIN_DESCRIPTION, *PXBAR_PIN_DESCRIPTION;
  55. XBAR_PIN_DESCRIPTION XBarInputPins[] = {
  56. // First list the video input pins, then the audio inputs, then the output pins
  57. // Note that audio pin index 6 is shared between two video inputs (index 1 and index 2)
  58. // PinType SynthImageCommand RelatedPinIndex Medium
  59. /*0*/ KS_PhysConn_Video_Tuner, IMAGE_XFER_NTSC_EIA_100AMP_100SAT, 5, &CrossbarMediums[0],
  60. /*1*/ KS_PhysConn_Video_Composite, IMAGE_XFER_NTSC_EIA_75AMP_100SAT, 6, &CrossbarMediums[1],
  61. /*2*/ KS_PhysConn_Video_SVideo, IMAGE_XFER_BLACK, 6, &CrossbarMediums[2],
  62. /*3*/ KS_PhysConn_Video_Tuner, IMAGE_XFER_WHITE, 7, &CrossbarMediums[3],
  63. /*4*/ KS_PhysConn_Video_Composite, IMAGE_XFER_GRAY_INCREASING, 8, &CrossbarMediums[4],
  64. /*5*/ KS_PhysConn_Audio_Tuner, 0, 0, &CrossbarMediums[5],
  65. /*6*/ KS_PhysConn_Audio_Line, 0, 1, &CrossbarMediums[6],
  66. /*7*/ KS_PhysConn_Audio_Tuner, 0, 3, &CrossbarMediums[7],
  67. /*8*/ KS_PhysConn_Audio_Line, 0, 4, &CrossbarMediums[8],
  68. };
  69. #define NUMBER_OF_XBAR_INPUTS (SIZEOF_ARRAY (XBarInputPins))
  70. XBAR_PIN_DESCRIPTION XBarOutputPins[] = {
  71. // PinType SynthImageCommand RelatedPinIndex
  72. /*0*/ KS_PhysConn_Video_VideoDecoder, 0, 1, &CrossbarMediums[9],
  73. /*1*/ KS_PhysConn_Audio_AudioDecoder, 0, 0, &CrossbarMediums[10],
  74. };
  75. #define NUMBER_OF_XBAR_OUTPUTS (SIZEOF_ARRAY (XBarOutputPins))
  76. #define NUMBER_OF_XBAR_PINS_TOTAL (NUMBER_OF_XBAR_INPUTS + NUMBER_OF_XBAR_OUTPUTS)
  77. // -------------------------------------------------------------------
  78. // XBar Property Set functions
  79. // -------------------------------------------------------------------
  80. /*
  81. ** AdapterSetCrossbarProperty ()
  82. **
  83. ** Handles Set operations on the Crossbar property set.
  84. ** Testcap uses this to select an image to synthesize.
  85. **
  86. ** Arguments:
  87. **
  88. ** pSRB -
  89. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  90. **
  91. ** Returns:
  92. **
  93. ** Side Effects: none
  94. */
  95. VOID
  96. STREAMAPI
  97. AdapterSetCrossbarProperty(
  98. PHW_STREAM_REQUEST_BLOCK pSrb
  99. )
  100. {
  101. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  102. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  103. ULONG Id = pSPD->Property->Id; // index of the property
  104. ULONG nS = pSPD->PropertyOutputSize; // size of data supplied
  105. switch (Id) {
  106. case KSPROPERTY_CROSSBAR_ROUTE: // W
  107. {
  108. PKSPROPERTY_CROSSBAR_ROUTE_S pRoute =
  109. (PKSPROPERTY_CROSSBAR_ROUTE_S)pSPD->PropertyInfo;
  110. ASSERT (nS >= sizeof (KSPROPERTY_CROSSBAR_ROUTE_S));
  111. // Copy the input property info to the output property info
  112. RtlCopyMemory( pRoute,
  113. pSPD->Property,
  114. sizeof (KSPROPERTY_CROSSBAR_ROUTE_S));
  115. // Default to failure
  116. pRoute->CanRoute = 0;
  117. // if video
  118. if (pRoute->IndexOutputPin == 0) {
  119. if (pRoute->IndexInputPin <= 4) {
  120. pHwDevExt->VideoInputConnected = pRoute->IndexInputPin;
  121. pRoute->CanRoute = 1;
  122. }
  123. }
  124. // if audio
  125. else if (pRoute->IndexOutputPin == 1) {
  126. // Special case! Audio Routing of (-1) means mute!!!
  127. if (pRoute->IndexInputPin == -1) {
  128. pHwDevExt->AudioInputConnected = pRoute->IndexInputPin;
  129. pRoute->CanRoute = 1;
  130. }
  131. else if (pRoute->IndexInputPin > 4 && pRoute->IndexInputPin <= 8) {
  132. pHwDevExt->AudioInputConnected = pRoute->IndexInputPin;
  133. pRoute->CanRoute = 1;
  134. }
  135. }
  136. // Somebody passed bogus data
  137. if (pRoute->CanRoute == 0) {
  138. pSrb->Status = STATUS_INVALID_PARAMETER;
  139. }
  140. }
  141. break;
  142. default:
  143. TRAP;
  144. break;
  145. }
  146. }
  147. /*
  148. ** AdapterGetCrossbarProperty ()
  149. **
  150. ** Handles Get operations on the Crossbar property set.
  151. ** Testcap uses this to select an image to synthesize.
  152. **
  153. ** Arguments:
  154. **
  155. ** pSRB -
  156. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  157. **
  158. ** Returns:
  159. **
  160. ** Side Effects: none
  161. */
  162. VOID
  163. STREAMAPI
  164. AdapterGetCrossbarProperty(
  165. PHW_STREAM_REQUEST_BLOCK pSrb
  166. )
  167. {
  168. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  169. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  170. ULONG Id = pSPD->Property->Id; // index of the property
  171. ULONG nS = pSPD->PropertyOutputSize; // size of data supplied
  172. switch (Id) {
  173. case KSPROPERTY_CROSSBAR_CAPS: // R
  174. {
  175. PKSPROPERTY_CROSSBAR_CAPS_S pCaps =
  176. (PKSPROPERTY_CROSSBAR_CAPS_S)pSPD->PropertyInfo;
  177. if (nS < sizeof (KSPROPERTY_CROSSBAR_CAPS_S))
  178. break;
  179. // Copy the input property info to the output property info
  180. RtlCopyMemory( pCaps,
  181. pSPD->Property,
  182. sizeof (KSPROPERTY_CROSSBAR_CAPS_S));
  183. pCaps->NumberOfInputs = NUMBER_OF_XBAR_INPUTS;
  184. pCaps->NumberOfOutputs = NUMBER_OF_XBAR_OUTPUTS;
  185. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_CROSSBAR_CAPS_S);
  186. }
  187. break;
  188. case KSPROPERTY_CROSSBAR_CAN_ROUTE: // R
  189. {
  190. PKSPROPERTY_CROSSBAR_ROUTE_S pRoute =
  191. (PKSPROPERTY_CROSSBAR_ROUTE_S)pSPD->PropertyInfo;
  192. if (nS < sizeof (KSPROPERTY_CROSSBAR_ROUTE_S))
  193. break;
  194. // Copy the input property info to the output property info
  195. RtlCopyMemory( pRoute,
  196. pSPD->Property,
  197. sizeof (KSPROPERTY_CROSSBAR_ROUTE_S));
  198. // Special case, audio output routed to (-1) means mute
  199. if (pRoute->IndexOutputPin == 1 && pRoute->IndexInputPin == -1) {
  200. pRoute->CanRoute = TRUE;
  201. }
  202. else if ((pRoute->IndexInputPin >= NUMBER_OF_XBAR_INPUTS) ||
  203. (pRoute->IndexOutputPin >= NUMBER_OF_XBAR_OUTPUTS)) {
  204. pRoute->CanRoute = FALSE;
  205. }
  206. else if ((pRoute->IndexInputPin <= 4) &&
  207. (pRoute->IndexOutputPin == 0) ||
  208. (pRoute->IndexInputPin >= 5) &&
  209. (pRoute->IndexOutputPin == 1)) {
  210. // This driver allows any video input to connect to any video output
  211. // and any audio input to connect to any audio output
  212. pRoute->CanRoute = TRUE;
  213. }
  214. else {
  215. pRoute->CanRoute = FALSE;
  216. }
  217. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_CROSSBAR_ROUTE_S);
  218. }
  219. break;
  220. case KSPROPERTY_CROSSBAR_PININFO: // R
  221. {
  222. PKSPROPERTY_CROSSBAR_PININFO_S pPinInfo =
  223. (PKSPROPERTY_CROSSBAR_PININFO_S)pSPD->PropertyInfo;
  224. if (nS < sizeof (KSPROPERTY_CROSSBAR_PININFO_S))
  225. break;
  226. // Copy the input property info to the output property info
  227. RtlCopyMemory( pPinInfo,
  228. pSPD->Property,
  229. sizeof (KSPROPERTY_CROSSBAR_PININFO_S));
  230. if (pPinInfo->Direction == KSPIN_DATAFLOW_IN) {
  231. ASSERT (pPinInfo->Index < NUMBER_OF_XBAR_INPUTS);
  232. if (pPinInfo->Index >= NUMBER_OF_XBAR_INPUTS) {
  233. pSrb->Status = STATUS_INVALID_PARAMETER;
  234. break;
  235. }
  236. pPinInfo->PinType = XBarInputPins[pPinInfo->Index].PinType;
  237. pPinInfo->RelatedPinIndex = XBarInputPins[pPinInfo->Index].RelatedPinIndex;
  238. pPinInfo->Medium = *XBarInputPins[pPinInfo->Index].Medium;
  239. }
  240. else {
  241. ASSERT (pPinInfo->Index < NUMBER_OF_XBAR_OUTPUTS);
  242. if (pPinInfo->Index >= NUMBER_OF_XBAR_OUTPUTS) {
  243. pSrb->Status = STATUS_INVALID_PARAMETER;
  244. break;
  245. }
  246. pPinInfo->PinType = XBarOutputPins[pPinInfo->Index].PinType;
  247. pPinInfo->RelatedPinIndex = XBarOutputPins[pPinInfo->Index].RelatedPinIndex;
  248. pPinInfo->Medium = *XBarOutputPins[pPinInfo->Index].Medium;
  249. }
  250. pPinInfo->Medium.Id = pHwDevExt->DriverMediumInstanceCount; // Multiple instance support
  251. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_CROSSBAR_PININFO_S);
  252. }
  253. break;
  254. case KSPROPERTY_CROSSBAR_ROUTE: // R
  255. {
  256. PKSPROPERTY_CROSSBAR_ROUTE_S pRoute =
  257. (PKSPROPERTY_CROSSBAR_ROUTE_S)pSPD->PropertyInfo;
  258. if (nS < sizeof (KSPROPERTY_CROSSBAR_ROUTE_S))
  259. break;
  260. // Copy the input property info to the output property info
  261. RtlCopyMemory( pRoute,
  262. pSPD->Property,
  263. sizeof (KSPROPERTY_CROSSBAR_ROUTE_S));
  264. // Sanity check
  265. if (pRoute->IndexOutputPin >= NUMBER_OF_XBAR_OUTPUTS) {
  266. pRoute->CanRoute = FALSE;
  267. }
  268. // querying the the video output pin
  269. else if (pRoute->IndexOutputPin == 0) {
  270. pRoute->IndexInputPin = pHwDevExt->VideoInputConnected;
  271. pRoute->CanRoute = TRUE;
  272. }
  273. // querying the the audio output pin
  274. else if (pRoute->IndexOutputPin == 1) {
  275. pRoute->IndexInputPin = pHwDevExt->AudioInputConnected;
  276. pRoute->CanRoute = TRUE;
  277. }
  278. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_CROSSBAR_ROUTE_S);
  279. }
  280. break;
  281. default:
  282. TRAP;
  283. break;
  284. }
  285. }
  286. // -------------------------------------------------------------------
  287. // TVTuner Property Set functions
  288. // -------------------------------------------------------------------
  289. /*
  290. ** AdapterSetTunerProperty ()
  291. **
  292. ** Handles Set operations on the TvTuner property set.
  293. ** Testcap uses this for demo purposes only.
  294. **
  295. ** Arguments:
  296. **
  297. ** pSRB -
  298. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  299. **
  300. ** Returns:
  301. **
  302. ** Side Effects: none
  303. */
  304. VOID
  305. STREAMAPI
  306. AdapterSetTunerProperty(
  307. PHW_STREAM_REQUEST_BLOCK pSrb
  308. )
  309. {
  310. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  311. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  312. ULONG Id = pSPD->Property->Id; // index of the property
  313. ULONG nS = pSPD->PropertyOutputSize; // size of data supplied
  314. switch (Id) {
  315. case KSPROPERTY_TUNER_MODE:
  316. {
  317. PKSPROPERTY_TUNER_MODE_S pMode =
  318. (PKSPROPERTY_TUNER_MODE_S)pSPD->Property;
  319. ASSERT (pMode->Mode & (KSPROPERTY_TUNER_MODE_TV |
  320. KSPROPERTY_TUNER_MODE_AM_RADIO |
  321. KSPROPERTY_TUNER_MODE_FM_RADIO |
  322. KSPROPERTY_TUNER_MODE_ATSC));
  323. pHwDevExt->TunerMode = pMode->Mode;
  324. }
  325. break;
  326. case KSPROPERTY_TUNER_STANDARD:
  327. {
  328. PKSPROPERTY_TUNER_STANDARD_S pStandard_S =
  329. (PKSPROPERTY_TUNER_STANDARD_S) pSPD->Property;
  330. pHwDevExt->VideoStandard = pStandard_S->Standard;
  331. }
  332. break;
  333. case KSPROPERTY_TUNER_FREQUENCY:
  334. {
  335. PKSPROPERTY_TUNER_FREQUENCY_S pFreq_S =
  336. (PKSPROPERTY_TUNER_FREQUENCY_S) pSPD->Property;
  337. pHwDevExt->Frequency = pFreq_S->Frequency;
  338. pHwDevExt->Country = pFreq_S->Country;
  339. pHwDevExt->Channel = pFreq_S->Channel;
  340. }
  341. break;
  342. case KSPROPERTY_TUNER_INPUT:
  343. {
  344. PKSPROPERTY_TUNER_INPUT_S pInput_S =
  345. (PKSPROPERTY_TUNER_INPUT_S) pSPD->Property;
  346. pHwDevExt->TunerInput = pInput_S->InputIndex;
  347. }
  348. break;
  349. default:
  350. TRAP;
  351. break;
  352. }
  353. }
  354. /*
  355. ** AdapterGetTunerProperty ()
  356. **
  357. ** Handles Get operations on the TvTuner property set.
  358. ** Testcap uses this for demo purposes only.
  359. **
  360. ** Arguments:
  361. **
  362. ** pSRB -
  363. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  364. **
  365. ** Returns:
  366. **
  367. ** Side Effects: none
  368. */
  369. VOID
  370. STREAMAPI
  371. AdapterGetTunerProperty(
  372. PHW_STREAM_REQUEST_BLOCK pSrb
  373. )
  374. {
  375. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  376. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  377. ULONG Id = pSPD->Property->Id; // index of the property
  378. ULONG nS = pSPD->PropertyOutputSize; // size of data supplied
  379. PVOID pV = pSPD->PropertyInfo; // pointer to the output data
  380. ASSERT (nS >= sizeof (LONG));
  381. switch (Id) {
  382. case KSPROPERTY_TUNER_CAPS:
  383. {
  384. PKSPROPERTY_TUNER_CAPS_S pCaps =
  385. (PKSPROPERTY_TUNER_CAPS_S)pSPD->Property;
  386. ASSERT (nS >= sizeof( KSPROPERTY_TUNER_CAPS_S ) );
  387. // now work with the output buffer
  388. pCaps =(PKSPROPERTY_TUNER_CAPS_S)pV;
  389. // Copy the input property info to the output property info
  390. RtlCopyMemory( pCaps,
  391. pSPD->Property,
  392. sizeof (KSPROPERTY_TUNER_CAPS_S));
  393. pCaps->ModesSupported =
  394. KSPROPERTY_TUNER_MODE_TV |
  395. KSPROPERTY_TUNER_MODE_FM_RADIO |
  396. KSPROPERTY_TUNER_MODE_AM_RADIO |
  397. KSPROPERTY_TUNER_MODE_ATSC;
  398. pCaps->VideoMedium = TVTunerMediums[0];
  399. pCaps->VideoMedium.Id = pHwDevExt->DriverMediumInstanceCount; // Multiple instance support
  400. pCaps->TVAudioMedium = TVTunerMediums[1];
  401. pCaps->TVAudioMedium.Id = pHwDevExt->DriverMediumInstanceCount; // Multiple instance support
  402. pCaps->RadioAudioMedium = TVTunerMediums[2]; // No separate radio audio pin?
  403. pCaps->RadioAudioMedium.Id = pHwDevExt->DriverMediumInstanceCount; // Multiple instance support
  404. pSrb->ActualBytesTransferred = sizeof( KSPROPERTY_TUNER_CAPS_S );
  405. }
  406. break;
  407. case KSPROPERTY_TUNER_MODE:
  408. {
  409. PKSPROPERTY_TUNER_MODE_S pMode =
  410. (PKSPROPERTY_TUNER_MODE_S)pSPD->Property;
  411. ASSERT (nS >= sizeof( KSPROPERTY_TUNER_MODE_S ) );
  412. // now work with the output buffer
  413. pMode =(PKSPROPERTY_TUNER_MODE_S)pV;
  414. // Copy the input property info to the output property info
  415. RtlCopyMemory( pMode,
  416. pSPD->Property,
  417. sizeof (KSPROPERTY_TUNER_MODE_S));
  418. pMode->Mode = pHwDevExt->TunerMode;
  419. pSrb->ActualBytesTransferred = sizeof( KSPROPERTY_TUNER_MODE_S);
  420. }
  421. break;
  422. case KSPROPERTY_TUNER_MODE_CAPS:
  423. {
  424. PKSPROPERTY_TUNER_MODE_CAPS_S pCaps =
  425. (PKSPROPERTY_TUNER_MODE_CAPS_S) pSPD->Property;
  426. ASSERT (nS >= sizeof (KSPROPERTY_TUNER_MODE_CAPS_S));
  427. // now work with the output buffer
  428. pCaps = (PKSPROPERTY_TUNER_MODE_CAPS_S) pV;
  429. // Copy the input property info to the output property info
  430. RtlCopyMemory( pCaps,
  431. pSPD->Property,
  432. sizeof (KSPROPERTY_TUNER_MODE_CAPS_S));
  433. pCaps->Mode = ((PKSPROPERTY_TUNER_MODE_CAPS_S) pSPD->Property)->Mode;
  434. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_TUNER_MODE_CAPS_S);
  435. switch (pCaps->Mode) {
  436. case KSPROPERTY_TUNER_MODE_TV:
  437. case KSPROPERTY_TUNER_MODE_ATSC:
  438. // List the formats actually supported by the tuner in this mode
  439. pCaps->StandardsSupported =
  440. (pHwDevExt->TunerMode == KSPROPERTY_TUNER_MODE_ATSC) ?
  441. KS_AnalogVideo_NTSC_M
  442. :
  443. KS_AnalogVideo_NTSC_M
  444. | KS_AnalogVideo_PAL_B
  445. | KS_AnalogVideo_PAL_D
  446. // | KS_AnalogVideo_PAL_H
  447. // | KS_AnalogVideo_PAL_I
  448. | KS_AnalogVideo_PAL_M
  449. | KS_AnalogVideo_PAL_N
  450. | KS_AnalogVideo_PAL_N_COMBO
  451. // | KS_AnalogVideo_SECAM_B
  452. // | KS_AnalogVideo_SECAM_D
  453. // | KS_AnalogVideo_SECAM_G
  454. // | KS_AnalogVideo_SECAM_H
  455. // | KS_AnalogVideo_SECAM_K
  456. // | KS_AnalogVideo_SECAM_K1
  457. // | KS_AnalogVideo_SECAM_L
  458. ;
  459. //
  460. // Get the min and max frequencies supported
  461. //
  462. pCaps->MinFrequency = 55250000L;
  463. pCaps->MaxFrequency = 997250000L;
  464. // What is the frequency step size?
  465. pCaps->TuningGranularity = 62500L;
  466. // How many inputs are on the tuner?
  467. pCaps->NumberOfInputs = 1;
  468. // What is the maximum settling time in milliseconds?
  469. pCaps->SettlingTime = 100;
  470. //
  471. // Strategy defines how the tuner knows when it is in tune:
  472. //
  473. // KS_TUNER_STRATEGY_PLL (Has PLL offset information)
  474. // KS_TUNER_STRATEGY_SIGNAL_STRENGTH (has signal strength info)
  475. // KS_TUNER_STRATEGY_DRIVER_TUNES (driver handles all fine tuning)
  476. //
  477. pCaps->Strategy = KS_TUNER_STRATEGY_PLL;
  478. break;
  479. case KSPROPERTY_TUNER_MODE_FM_RADIO:
  480. pCaps->StandardsSupported = 0;
  481. pCaps->MinFrequency = 88100000L;
  482. pCaps->MaxFrequency = 107900000L;
  483. // What is the frequency step size?
  484. pCaps->TuningGranularity = 200000L;
  485. // How many inputs are on the tuner?
  486. pCaps->NumberOfInputs = 1;
  487. // What is the maximum settling time in milliseconds?
  488. pCaps->SettlingTime = 100;
  489. // Strategy defines how the tuner knows when it is in tune:
  490. pCaps->Strategy = KS_TUNER_STRATEGY_DRIVER_TUNES;
  491. break;
  492. case KSPROPERTY_TUNER_MODE_AM_RADIO:
  493. pCaps->StandardsSupported = 0;
  494. pCaps->MinFrequency = 540000L;
  495. pCaps->MaxFrequency = 1700000L;
  496. // What is the frequency step size?
  497. pCaps->TuningGranularity = 1000L;
  498. // How many inputs are on the tuner?
  499. pCaps->NumberOfInputs = 1;
  500. // What is the maximum settling time in milliseconds?
  501. pCaps->SettlingTime = 100;
  502. // Strategy defines how the tuner knows when it is in tune:
  503. pCaps->Strategy = KS_TUNER_STRATEGY_DRIVER_TUNES;
  504. break;
  505. default:
  506. ASSERT (FALSE);
  507. break;
  508. }
  509. }
  510. break;
  511. case KSPROPERTY_TUNER_STANDARD:
  512. {
  513. // What is the currently selected video standard?
  514. // Copy the input property info to the output property info
  515. RtlCopyMemory( pSPD->PropertyInfo,
  516. pSPD->Property,
  517. sizeof (KSPROPERTY_TUNER_STANDARD_S));
  518. ((PKSPROPERTY_TUNER_STANDARD_S) pSPD->PropertyInfo)->Standard =
  519. pHwDevExt->VideoStandard;
  520. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_TUNER_STANDARD_S);
  521. }
  522. break;
  523. case KSPROPERTY_TUNER_INPUT:
  524. {
  525. // What is the currently selected input?
  526. // Copy the input property info to the output property info
  527. RtlCopyMemory( pSPD->PropertyInfo,
  528. pSPD->Property,
  529. sizeof (KSPROPERTY_TUNER_INPUT_S));
  530. ((PKSPROPERTY_TUNER_INPUT_S) pSPD->PropertyInfo)->InputIndex =
  531. pHwDevExt->TunerInput;
  532. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_TUNER_INPUT_S);
  533. }
  534. break;
  535. case KSPROPERTY_TUNER_STATUS:
  536. // Return the status of the tuner
  537. // PLLOffset is in units of TuningGranularity
  538. // SignalStrength is 0 to 100
  539. // Set Busy to 1 if tuning is still in process
  540. {
  541. PKSPROPERTY_TUNER_STATUS_S pStatus =
  542. (PKSPROPERTY_TUNER_STATUS_S) pSPD->PropertyInfo;
  543. ASSERT (nS >= sizeof (KSPROPERTY_TUNER_STATUS_S));
  544. // Copy the input property info to the output property info
  545. RtlCopyMemory( pStatus,
  546. pSPD->Property,
  547. sizeof (KSPROPERTY_TUNER_STATUS_S));
  548. pStatus->CurrentFrequency = pHwDevExt->Frequency;
  549. pStatus->PLLOffset = 0;
  550. pStatus->SignalStrength = 100;
  551. pStatus->Busy = pHwDevExt->Busy;
  552. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_TUNER_STATUS_S);
  553. }
  554. break;
  555. case KSPROPERTY_TUNER_IF_MEDIUM:
  556. {
  557. // Only Digital TV tuners should support this property
  558. PKSPROPERTY_TUNER_IF_MEDIUM_S pMedium =
  559. (PKSPROPERTY_TUNER_IF_MEDIUM_S)pSPD->Property;
  560. ASSERT (nS >= sizeof( KSPROPERTY_TUNER_IF_MEDIUM_S) );
  561. // now work with the output buffer
  562. pMedium =(PKSPROPERTY_TUNER_IF_MEDIUM_S)pV;
  563. // Copy the input property info to the output property info
  564. RtlCopyMemory( pMedium,
  565. pSPD->Property,
  566. sizeof (KSPROPERTY_TUNER_IF_MEDIUM_S));
  567. pMedium->IFMedium = TVTunerMediums[3];
  568. pMedium->IFMedium.Id = pHwDevExt->DriverMediumInstanceCount; // Multiple instance support
  569. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_TUNER_IF_MEDIUM_S);
  570. }
  571. break;
  572. default:
  573. TRAP;
  574. break;
  575. }
  576. }
  577. // -------------------------------------------------------------------
  578. // VideoProcAmp functions
  579. // -------------------------------------------------------------------
  580. /*
  581. ** AdapterSetVideoProcAmpProperty ()
  582. **
  583. ** Handles Set operations on the VideoProcAmp property set.
  584. ** Testcap uses this for demo purposes only.
  585. **
  586. ** Arguments:
  587. **
  588. ** pSRB -
  589. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  590. **
  591. ** Returns:
  592. **
  593. ** Side Effects: none
  594. */
  595. VOID
  596. STREAMAPI
  597. AdapterSetVideoProcAmpProperty(
  598. PHW_STREAM_REQUEST_BLOCK pSrb
  599. )
  600. {
  601. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  602. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  603. ULONG Id = pSPD->Property->Id; // index of the property
  604. PKSPROPERTY_VIDEOPROCAMP_S pS = (PKSPROPERTY_VIDEOPROCAMP_S) pSPD->PropertyInfo;
  605. ASSERT (pSPD->PropertyInputSize >= sizeof (KSPROPERTY_VIDEOPROCAMP_S));
  606. switch (Id) {
  607. case KSPROPERTY_VIDEOPROCAMP_BRIGHTNESS:
  608. pHwDevExt->Brightness = pS->Value;
  609. pHwDevExt->BrightnessFlags = pS->Flags;
  610. break;
  611. case KSPROPERTY_VIDEOPROCAMP_CONTRAST:
  612. pHwDevExt->Contrast = pS->Value;
  613. pHwDevExt->ContrastFlags = pS->Flags;
  614. break;
  615. case KSPROPERTY_VIDEOPROCAMP_COLORENABLE:
  616. pHwDevExt->ColorEnable = pS->Value;
  617. pHwDevExt->ColorEnableFlags = pS->Flags;
  618. break;
  619. default:
  620. TRAP;
  621. break;
  622. }
  623. }
  624. /*
  625. ** AdapterGetVideoProcAmpProperty ()
  626. **
  627. ** Handles Get operations on the VideoProcAmp property set.
  628. ** Testcap uses this for demo purposes only.
  629. **
  630. ** Arguments:
  631. **
  632. ** pSRB -
  633. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  634. **
  635. ** Returns:
  636. **
  637. ** Side Effects: none
  638. */
  639. VOID
  640. STREAMAPI
  641. AdapterGetVideoProcAmpProperty(
  642. PHW_STREAM_REQUEST_BLOCK pSrb
  643. )
  644. {
  645. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  646. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  647. ULONG Id = pSPD->Property->Id; // index of the property
  648. PKSPROPERTY_VIDEOPROCAMP_S pS = (PKSPROPERTY_VIDEOPROCAMP_S) pSPD->PropertyInfo;
  649. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_VIDEOPROCAMP_S));
  650. // Copy the input property info to the output property info
  651. RtlCopyMemory( pS,
  652. pSPD->Property,
  653. sizeof (KSPROPERTY_VIDEOPROCAMP_S));
  654. switch (Id) {
  655. case KSPROPERTY_VIDEOPROCAMP_BRIGHTNESS:
  656. pS->Value = pHwDevExt->Brightness;
  657. pS->Flags = pHwDevExt->BrightnessFlags;
  658. pS->Capabilities = KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL |
  659. KSPROPERTY_VIDEOPROCAMP_FLAGS_AUTO;
  660. break;
  661. case KSPROPERTY_VIDEOPROCAMP_CONTRAST:
  662. pS->Value = pHwDevExt->Contrast;
  663. pS->Flags = pHwDevExt->ContrastFlags;
  664. pS->Capabilities = KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL |
  665. KSPROPERTY_VIDEOPROCAMP_FLAGS_AUTO;
  666. break;
  667. case KSPROPERTY_VIDEOPROCAMP_COLORENABLE:
  668. pS->Value = pHwDevExt->ColorEnable;
  669. pS->Flags = pHwDevExt->ColorEnableFlags;
  670. pS->Capabilities = KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL;
  671. break;
  672. default:
  673. TRAP;
  674. break;
  675. }
  676. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEOPROCAMP_S);
  677. }
  678. // -------------------------------------------------------------------
  679. // CameraControl functions
  680. // -------------------------------------------------------------------
  681. /*
  682. ** AdapterSetCameraControlProperty ()
  683. **
  684. ** Handles Set operations on the CameraControl property set.
  685. ** Testcap uses this for demo purposes only.
  686. **
  687. ** Arguments:
  688. **
  689. ** pSRB -
  690. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  691. **
  692. ** Returns:
  693. **
  694. ** Side Effects: none
  695. */
  696. VOID
  697. STREAMAPI
  698. AdapterSetCameraControlProperty(
  699. PHW_STREAM_REQUEST_BLOCK pSrb
  700. )
  701. {
  702. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  703. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  704. ULONG Id = pSPD->Property->Id; // index of the property
  705. PKSPROPERTY_CAMERACONTROL_S pS = (PKSPROPERTY_CAMERACONTROL_S) pSPD->PropertyInfo;
  706. ASSERT (pSPD->PropertyInputSize >= sizeof (KSPROPERTY_CAMERACONTROL_S));
  707. switch (Id) {
  708. case KSPROPERTY_CAMERACONTROL_ZOOM:
  709. pHwDevExt->Zoom = pS->Value;
  710. pHwDevExt->ZoomFlags = pS->Flags;
  711. break;
  712. case KSPROPERTY_CAMERACONTROL_FOCUS:
  713. pHwDevExt->Focus = pS->Value;
  714. pHwDevExt->FocusFlags = pS->Flags;
  715. break;
  716. default:
  717. TRAP;
  718. break;
  719. }
  720. }
  721. /*
  722. ** AdapterGetCameraControlProperty ()
  723. **
  724. ** Handles Get operations on the CameraControl property set.
  725. ** Testcap uses this for demo purposes only.
  726. **
  727. ** Arguments:
  728. **
  729. ** pSRB -
  730. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  731. **
  732. ** Returns:
  733. **
  734. ** Side Effects: none
  735. */
  736. VOID
  737. STREAMAPI
  738. AdapterGetCameraControlProperty(
  739. PHW_STREAM_REQUEST_BLOCK pSrb
  740. )
  741. {
  742. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  743. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  744. ULONG Id = pSPD->Property->Id; // index of the property
  745. PKSPROPERTY_CAMERACONTROL_S pS = (PKSPROPERTY_CAMERACONTROL_S) pSPD->PropertyInfo; // pointer to the output data
  746. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_CAMERACONTROL_S));
  747. // Copy the input property info to the output property info
  748. RtlCopyMemory( pS,
  749. pSPD->Property,
  750. sizeof (KSPROPERTY_CAMERACONTROL_S));
  751. switch (Id) {
  752. case KSPROPERTY_CAMERACONTROL_ZOOM:
  753. pS->Value = pHwDevExt->Zoom;
  754. pS->Flags = pHwDevExt->ZoomFlags;
  755. pS->Capabilities = KSPROPERTY_CAMERACONTROL_FLAGS_MANUAL |
  756. KSPROPERTY_CAMERACONTROL_FLAGS_AUTO;
  757. break;
  758. case KSPROPERTY_CAMERACONTROL_FOCUS:
  759. pS->Value = pHwDevExt->Focus;
  760. pS->Flags = pHwDevExt->FocusFlags;
  761. pS->Capabilities = KSPROPERTY_CAMERACONTROL_FLAGS_MANUAL |
  762. KSPROPERTY_CAMERACONTROL_FLAGS_AUTO;
  763. break;
  764. default:
  765. TRAP;
  766. break;
  767. }
  768. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_CAMERACONTROL_S);
  769. }
  770. // -------------------------------------------------------------------
  771. // TVAudio functions
  772. // -------------------------------------------------------------------
  773. /*
  774. ** AdapterSetTVAudioProperty ()
  775. **
  776. ** Handles Set operations on the TVAudio property set.
  777. ** Testcap uses this for demo purposes only.
  778. **
  779. ** Arguments:
  780. **
  781. ** pSRB -
  782. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  783. **
  784. ** Returns:
  785. **
  786. ** Side Effects: none
  787. */
  788. VOID
  789. STREAMAPI
  790. AdapterSetTVAudioProperty(
  791. PHW_STREAM_REQUEST_BLOCK pSrb
  792. )
  793. {
  794. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  795. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  796. ULONG Id = pSPD->Property->Id; // index of the property
  797. switch (Id) {
  798. case KSPROPERTY_TVAUDIO_MODE:
  799. {
  800. PKSPROPERTY_TVAUDIO_S pS = (PKSPROPERTY_TVAUDIO_S) pSPD->PropertyInfo;
  801. pHwDevExt->TVAudioMode = pS->Mode;
  802. }
  803. break;
  804. default:
  805. TRAP;
  806. break;
  807. }
  808. }
  809. /*
  810. ** AdapterGetTVAudioProperty ()
  811. **
  812. ** Handles Get operations on the TVAudio property set.
  813. ** Testcap uses this for demo purposes only.
  814. **
  815. ** Arguments:
  816. **
  817. ** pSRB -
  818. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  819. **
  820. ** Returns:
  821. **
  822. ** Side Effects: none
  823. */
  824. VOID
  825. STREAMAPI
  826. AdapterGetTVAudioProperty(
  827. PHW_STREAM_REQUEST_BLOCK pSrb
  828. )
  829. {
  830. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  831. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  832. ULONG Id = pSPD->Property->Id; // index of the property
  833. switch (Id) {
  834. case KSPROPERTY_TVAUDIO_CAPS:
  835. {
  836. PKSPROPERTY_TVAUDIO_CAPS_S pS = (PKSPROPERTY_TVAUDIO_CAPS_S) pSPD->PropertyInfo; // pointer to the data
  837. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_TVAUDIO_CAPS_S));
  838. // Copy the input property info to the output property info
  839. RtlCopyMemory( pS,
  840. pSPD->Property,
  841. sizeof (KSPROPERTY_TVAUDIO_CAPS_S));
  842. pS->InputMedium = TVAudioMediums[0];
  843. pS->InputMedium.Id = pHwDevExt->DriverMediumInstanceCount; // Multiple instance support
  844. pS->OutputMedium = TVAudioMediums[1];
  845. pS->OutputMedium.Id = pHwDevExt->DriverMediumInstanceCount; // Multiple instance support
  846. // Report all of the possible audio decoding modes the hardware is capabable of
  847. pS->Capabilities = KS_TVAUDIO_MODE_MONO |
  848. KS_TVAUDIO_MODE_STEREO |
  849. KS_TVAUDIO_MODE_LANG_A |
  850. KS_TVAUDIO_MODE_LANG_B ;
  851. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_TVAUDIO_CAPS_S);
  852. }
  853. break;
  854. case KSPROPERTY_TVAUDIO_MODE:
  855. {
  856. PKSPROPERTY_TVAUDIO_S pS = (PKSPROPERTY_TVAUDIO_S) pSPD->PropertyInfo; // pointer to the data
  857. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_TVAUDIO_S));
  858. // Copy the input property info to the output property info
  859. RtlCopyMemory( pS,
  860. pSPD->Property,
  861. sizeof (KSPROPERTY_TVAUDIO_S));
  862. // Report the currently selected mode
  863. pS->Mode = pHwDevExt->TVAudioMode;
  864. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_TVAUDIO_S);
  865. }
  866. break;
  867. case KSPROPERTY_TVAUDIO_CURRENTLY_AVAILABLE_MODES:
  868. {
  869. PKSPROPERTY_TVAUDIO_S pS = (PKSPROPERTY_TVAUDIO_S) pSPD->PropertyInfo; // pointer to the data
  870. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_TVAUDIO_S));
  871. // Copy the input property info to the output property info
  872. RtlCopyMemory( pS,
  873. pSPD->Property,
  874. sizeof (KSPROPERTY_TVAUDIO_S));
  875. // Report which audio modes could potentially be selected right now
  876. pS->Mode = KS_TVAUDIO_MODE_MONO |
  877. KS_TVAUDIO_MODE_STEREO |
  878. KS_TVAUDIO_MODE_LANG_A ;
  879. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_TVAUDIO_S);
  880. }
  881. break;
  882. default:
  883. TRAP;
  884. break;
  885. }
  886. }
  887. // -------------------------------------------------------------------
  888. // AnalogVideoDecoder functions
  889. // -------------------------------------------------------------------
  890. /*
  891. ** AdapterSetAnalogVideoDecoderProperty ()
  892. **
  893. ** Handles Set operations on the AnalogVideoDecoder property set.
  894. ** Testcap uses this for demo purposes only.
  895. **
  896. ** Arguments:
  897. **
  898. ** pSRB -
  899. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  900. **
  901. ** Returns:
  902. **
  903. ** Side Effects: none
  904. */
  905. VOID
  906. STREAMAPI
  907. AdapterSetAnalogVideoDecoderProperty(
  908. PHW_STREAM_REQUEST_BLOCK pSrb
  909. )
  910. {
  911. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  912. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  913. ULONG Id = pSPD->Property->Id; // index of the property
  914. PKSPROPERTY_VIDEODECODER_S pS = (PKSPROPERTY_VIDEODECODER_S) pSPD->PropertyInfo;
  915. ASSERT (pSPD->PropertyInputSize >= sizeof (KSPROPERTY_VIDEODECODER_S));
  916. switch (Id) {
  917. case KSPROPERTY_VIDEODECODER_STANDARD:
  918. {
  919. pHwDevExt->VideoDecoderVideoStandard = pS->Value;
  920. }
  921. break;
  922. case KSPROPERTY_VIDEODECODER_OUTPUT_ENABLE:
  923. {
  924. pHwDevExt->VideoDecoderOutputEnable = pS->Value;
  925. }
  926. break;
  927. case KSPROPERTY_VIDEODECODER_VCR_TIMING:
  928. {
  929. pHwDevExt->VideoDecoderVCRTiming = pS->Value;
  930. }
  931. break;
  932. default:
  933. TRAP;
  934. break;
  935. }
  936. }
  937. /*
  938. ** AdapterGetAnalogVideoDecoderProperty ()
  939. **
  940. ** Handles Get operations on the AnalogVideoDecoder property set.
  941. ** Testcap uses this for demo purposes only.
  942. **
  943. ** Arguments:
  944. **
  945. ** pSRB -
  946. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  947. **
  948. ** Returns:
  949. **
  950. ** Side Effects: none
  951. */
  952. VOID
  953. STREAMAPI
  954. AdapterGetAnalogVideoDecoderProperty(
  955. PHW_STREAM_REQUEST_BLOCK pSrb
  956. )
  957. {
  958. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  959. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  960. ULONG Id = pSPD->Property->Id; // index of the property
  961. switch (Id) {
  962. case KSPROPERTY_VIDEODECODER_CAPS:
  963. {
  964. PKSPROPERTY_VIDEODECODER_CAPS_S pS = (PKSPROPERTY_VIDEODECODER_CAPS_S) pSPD->PropertyInfo; // pointer to the data
  965. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_VIDEODECODER_CAPS_S));
  966. // Copy the input property info to the output property info
  967. RtlCopyMemory( pS,
  968. pSPD->Property,
  969. sizeof (KSPROPERTY_VIDEODECODER_CAPS_S));
  970. pS->StandardsSupported =
  971. KS_AnalogVideo_NTSC_M
  972. | KS_AnalogVideo_PAL_B
  973. | KS_AnalogVideo_PAL_D
  974. // | KS_AnalogVideo_PAL_H
  975. // | KS_AnalogVideo_PAL_I
  976. | KS_AnalogVideo_PAL_M
  977. | KS_AnalogVideo_PAL_N
  978. // | KS_AnalogVideo_SECAM_B
  979. // | KS_AnalogVideo_SECAM_D
  980. // | KS_AnalogVideo_SECAM_G
  981. // | KS_AnalogVideo_SECAM_H
  982. // | KS_AnalogVideo_SECAM_K
  983. // | KS_AnalogVideo_SECAM_K1
  984. // | KS_AnalogVideo_SECAM_L
  985. ;
  986. pS->Capabilities = KS_VIDEODECODER_FLAGS_CAN_DISABLE_OUTPUT |
  987. KS_VIDEODECODER_FLAGS_CAN_USE_VCR_LOCKING |
  988. KS_VIDEODECODER_FLAGS_CAN_INDICATE_LOCKED ;
  989. pS->SettlingTime = 10; // How long to delay after tuning before
  990. // Locked indicator is valid
  991. pS->HSyncPerVSync = 6; // HSync per VSync
  992. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEODECODER_CAPS_S);
  993. }
  994. break;
  995. case KSPROPERTY_VIDEODECODER_STANDARD:
  996. {
  997. PKSPROPERTY_VIDEODECODER_S pS = (PKSPROPERTY_VIDEODECODER_S) pSPD->PropertyInfo; // pointer to the data
  998. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_VIDEODECODER_S));
  999. // Copy the input property info to the output property info
  1000. RtlCopyMemory( pS,
  1001. pSPD->Property,
  1002. sizeof (KSPROPERTY_VIDEODECODER_S));
  1003. pS->Value = pHwDevExt->VideoDecoderVideoStandard;
  1004. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEODECODER_S);
  1005. }
  1006. break;
  1007. case KSPROPERTY_VIDEODECODER_STATUS:
  1008. {
  1009. PKSPROPERTY_VIDEODECODER_STATUS_S pS = (PKSPROPERTY_VIDEODECODER_STATUS_S) pSPD->PropertyInfo; // pointer to the data
  1010. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_VIDEODECODER_STATUS_S));
  1011. // Copy the input property info to the output property info
  1012. RtlCopyMemory( pS,
  1013. pSPD->Property,
  1014. sizeof (KSPROPERTY_VIDEODECODER_STATUS_S));
  1015. pS->NumberOfLines = (pHwDevExt->VideoDecoderVideoStandard & KS_AnalogVideo_NTSC_Mask)
  1016. ? 525 : 625;
  1017. // Just to make things interesting, simulate that some channels aren't locked
  1018. // In the US, these are channels 54 through 70
  1019. pS->SignalLocked = (pHwDevExt->Frequency < 400000000 || pHwDevExt->Frequency > 500000000);
  1020. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEODECODER_S);
  1021. }
  1022. break;
  1023. case KSPROPERTY_VIDEODECODER_OUTPUT_ENABLE:
  1024. {
  1025. PKSPROPERTY_VIDEODECODER_S pS = (PKSPROPERTY_VIDEODECODER_S) pSPD->PropertyInfo; // pointer to the data
  1026. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_VIDEODECODER_S));
  1027. // Copy the input property info to the output property info
  1028. RtlCopyMemory( pS,
  1029. pSPD->Property,
  1030. sizeof (KSPROPERTY_VIDEODECODER_S));
  1031. pS->Value = pHwDevExt->VideoDecoderOutputEnable;
  1032. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEODECODER_S);
  1033. }
  1034. break;
  1035. case KSPROPERTY_VIDEODECODER_VCR_TIMING:
  1036. {
  1037. PKSPROPERTY_VIDEODECODER_S pS = (PKSPROPERTY_VIDEODECODER_S) pSPD->PropertyInfo; // pointer to the data
  1038. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_VIDEODECODER_S));
  1039. // Copy the input property info to the output property info
  1040. RtlCopyMemory( pS,
  1041. pSPD->Property,
  1042. sizeof (KSPROPERTY_VIDEODECODER_S));
  1043. pS->Value = pHwDevExt->VideoDecoderVCRTiming;
  1044. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEODECODER_S);
  1045. }
  1046. break;
  1047. default:
  1048. TRAP;
  1049. break;
  1050. }
  1051. }
  1052. // -------------------------------------------------------------------
  1053. // VideoControl functions
  1054. // -------------------------------------------------------------------
  1055. /*
  1056. ** AdapterSetVideoControlProperty ()
  1057. **
  1058. ** Handles Set operations on the VideoControl property set.
  1059. ** Testcap uses this for demo purposes only.
  1060. **
  1061. ** Arguments:
  1062. **
  1063. ** pSRB -
  1064. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  1065. **
  1066. ** Returns:
  1067. **
  1068. ** Side Effects: none
  1069. */
  1070. VOID
  1071. STREAMAPI
  1072. AdapterSetVideoControlProperty(
  1073. PHW_STREAM_REQUEST_BLOCK pSrb
  1074. )
  1075. {
  1076. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  1077. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  1078. ULONG Id = pSPD->Property->Id; // index of the property
  1079. PKSPROPERTY_VIDEOCONTROL_MODE_S pS = (PKSPROPERTY_VIDEOCONTROL_MODE_S) pSPD->PropertyInfo;
  1080. PSTREAMEX pStrmEx;
  1081. ULONG StreamIndex;
  1082. ULONG *pVideoControlMode;
  1083. // For this property set, the StreamIndex is always in the same place
  1084. // for each property
  1085. StreamIndex = ((PKSPROPERTY_VIDEOCONTROL_CAPS_S) pSPD->Property)->StreamIndex;
  1086. ASSERT (StreamIndex < MAX_TESTCAP_STREAMS);
  1087. // Verify the stream index is valid
  1088. if (StreamIndex >= MAX_TESTCAP_STREAMS) {
  1089. pSrb->Status = STATUS_INVALID_PARAMETER;
  1090. return;
  1091. }
  1092. pStrmEx = (PSTREAMEX) pHwDevExt->pStrmEx[StreamIndex];
  1093. // If the stream is not opened when this property set is used,
  1094. // store the values in the HwDevExt
  1095. if (pStrmEx) {
  1096. pVideoControlMode = &pStrmEx->VideoControlMode;
  1097. }
  1098. else {
  1099. pVideoControlMode = &pHwDevExt->VideoControlMode;
  1100. }
  1101. ASSERT (pSPD->PropertyInputSize >= sizeof (KSPROPERTY_VIDEOCONTROL_MODE_S));
  1102. switch (Id) {
  1103. case KSPROPERTY_VIDEOCONTROL_MODE:
  1104. {
  1105. *pVideoControlMode = pS->Mode;
  1106. }
  1107. break;
  1108. default:
  1109. TRAP;
  1110. break;
  1111. }
  1112. }
  1113. /*
  1114. ** AdapterGetVideoControlProperty ()
  1115. **
  1116. ** Handles Get operations on the VideoControl property set.
  1117. ** Testcap uses this for demo purposes only.
  1118. **
  1119. ** Arguments:
  1120. **
  1121. ** pSRB -
  1122. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  1123. **
  1124. ** Returns:
  1125. **
  1126. ** Side Effects: none
  1127. */
  1128. VOID
  1129. STREAMAPI
  1130. AdapterGetVideoControlProperty(
  1131. PHW_STREAM_REQUEST_BLOCK pSrb
  1132. )
  1133. {
  1134. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  1135. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  1136. ULONG Id = pSPD->Property->Id; // index of the property
  1137. PSTREAMEX pStrmEx;
  1138. ULONG StreamIndex;
  1139. ULONG *pVideoControlMode;
  1140. // For this property set, the StreamIndex is always in the same place
  1141. // for each property
  1142. StreamIndex = ((PKSPROPERTY_VIDEOCONTROL_CAPS_S) pSPD->Property)->StreamIndex;
  1143. ASSERT (StreamIndex < MAX_TESTCAP_STREAMS);
  1144. // Verify the stream index is valid
  1145. if (StreamIndex >= MAX_TESTCAP_STREAMS) {
  1146. pSrb->Status = STATUS_INVALID_PARAMETER;
  1147. return;
  1148. }
  1149. pStrmEx = (PSTREAMEX) pHwDevExt->pStrmEx[StreamIndex];
  1150. // If the stream is not opened when this property set is used,
  1151. // store the values in the HwDevExt
  1152. if (pStrmEx) {
  1153. pVideoControlMode = &pStrmEx->VideoControlMode;
  1154. }
  1155. else {
  1156. pVideoControlMode = &pHwDevExt->VideoControlMode;
  1157. }
  1158. switch (Id) {
  1159. case KSPROPERTY_VIDEOCONTROL_CAPS:
  1160. {
  1161. PKSPROPERTY_VIDEOCONTROL_CAPS_S pS = (PKSPROPERTY_VIDEOCONTROL_CAPS_S) pSPD->PropertyInfo; // pointer to the data
  1162. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_VIDEOCONTROL_CAPS_S));
  1163. // Copy the input property info to the output property info
  1164. RtlCopyMemory( pS,
  1165. pSPD->Property,
  1166. sizeof (KSPROPERTY_VIDEOCONTROL_CAPS_S));
  1167. pS->VideoControlCaps =
  1168. KS_VideoControlFlag_FlipHorizontal
  1169. // | KS_VideoControlFlag_FlipVertical
  1170. // | KS_VideoControlFlag_ExternalTriggerEnable
  1171. // | KS_VideoControlFlag_Trigger
  1172. ;
  1173. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEOCONTROL_CAPS_S);
  1174. }
  1175. break;
  1176. case KSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE:
  1177. {
  1178. PKSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE_S pS =
  1179. (PKSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE_S) pSPD->PropertyInfo; // pointer to the data
  1180. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE_S));
  1181. // Copy the input property info to the output property info
  1182. RtlCopyMemory( pS,
  1183. pSPD->Property,
  1184. sizeof (KSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE_S));
  1185. pS->CurrentActualFrameRate = 15; // TODO: Implement the right rates in shipping drivers.
  1186. pS->CurrentMaxAvailableFrameRate = 15; // TODO: Implement the right rates in shipping drivers.
  1187. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE_S);
  1188. }
  1189. break;
  1190. case KSPROPERTY_VIDEOCONTROL_FRAME_RATES:
  1191. {
  1192. // todo
  1193. }
  1194. break;
  1195. case KSPROPERTY_VIDEOCONTROL_MODE:
  1196. {
  1197. PKSPROPERTY_VIDEOCONTROL_MODE_S pS = (PKSPROPERTY_VIDEOCONTROL_MODE_S) pSPD->PropertyInfo; // pointer to the data
  1198. ASSERT (pSPD->PropertyOutputSize >= sizeof (KSPROPERTY_VIDEOCONTROL_MODE_S));
  1199. // Copy the input property info to the output property info
  1200. RtlCopyMemory( pS,
  1201. pSPD->Property,
  1202. sizeof (KSPROPERTY_VIDEOCONTROL_MODE_S));
  1203. pS->Mode = *pVideoControlMode;
  1204. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEOCONTROL_MODE_S);
  1205. }
  1206. break;
  1207. default:
  1208. TRAP;
  1209. break;
  1210. }
  1211. }
  1212. /*
  1213. ** AdapterGetVideoCompressionProperty()
  1214. **
  1215. ** Gets compressor settings
  1216. **
  1217. ** Arguments:
  1218. **
  1219. ** pSrb - pointer to the stream request block for properties
  1220. **
  1221. ** Returns:
  1222. **
  1223. ** Side Effects: none
  1224. */
  1225. VOID
  1226. STREAMAPI
  1227. AdapterGetVideoCompressionProperty(
  1228. PHW_STREAM_REQUEST_BLOCK pSrb
  1229. )
  1230. {
  1231. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  1232. PSTREAMEX pStrmEx;
  1233. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  1234. ULONG Id = pSPD->Property->Id; // index of the property
  1235. ULONG StreamIndex;
  1236. PCOMPRESSION_SETTINGS pCompressionSettings;
  1237. // For this property set, the StreamIndex is always in the same place
  1238. // for each property
  1239. StreamIndex = ((PKSPROPERTY_VIDEOCOMPRESSION_S) pSPD->Property)->StreamIndex;
  1240. ASSERT (StreamIndex < MAX_TESTCAP_STREAMS);
  1241. // Verify the stream index is valid
  1242. if (StreamIndex >= MAX_TESTCAP_STREAMS) {
  1243. pSrb->Status = STATUS_INVALID_PARAMETER;
  1244. return;
  1245. }
  1246. pStrmEx = (PSTREAMEX) pHwDevExt->pStrmEx[StreamIndex];
  1247. // If the stream is not opened when this property set is used,
  1248. // store the values in the HwDevExt
  1249. if (pStrmEx) {
  1250. pCompressionSettings = &pStrmEx->CompressionSettings;
  1251. }
  1252. else {
  1253. pCompressionSettings = &pHwDevExt->CompressionSettings;
  1254. }
  1255. switch (Id) {
  1256. case KSPROPERTY_VIDEOCOMPRESSION_GETINFO:
  1257. {
  1258. PKSPROPERTY_VIDEOCOMPRESSION_GETINFO_S pS =
  1259. (PKSPROPERTY_VIDEOCOMPRESSION_GETINFO_S) pSPD->PropertyInfo;
  1260. // Copy the input property info to the output property info
  1261. RtlCopyMemory( pS,
  1262. pSPD->Property,
  1263. sizeof (KSPROPERTY_VIDEOCOMPRESSION_GETINFO_S));
  1264. pS->DefaultKeyFrameRate = 15; // Key frame rate
  1265. pS->DefaultPFrameRate = 3; // Predeicted frames per Key frame
  1266. pS->DefaultQuality = 5000; // 0 to 10000
  1267. pS->Capabilities =
  1268. KS_CompressionCaps_CanQuality |
  1269. KS_CompressionCaps_CanKeyFrame |
  1270. KS_CompressionCaps_CanBFrame ;
  1271. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEOCOMPRESSION_GETINFO_S);
  1272. }
  1273. break;
  1274. case KSPROPERTY_VIDEOCOMPRESSION_KEYFRAME_RATE:
  1275. {
  1276. PKSPROPERTY_VIDEOCOMPRESSION_S pS =
  1277. (PKSPROPERTY_VIDEOCOMPRESSION_S) pSPD->PropertyInfo;
  1278. // Copy the input property info to the output property info
  1279. RtlCopyMemory( pS,
  1280. pSPD->Property,
  1281. sizeof (KSPROPERTY_VIDEOCOMPRESSION_S));
  1282. pS->Value = pCompressionSettings->CompressionKeyFrameRate;
  1283. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEOCOMPRESSION_S);
  1284. }
  1285. break;
  1286. case KSPROPERTY_VIDEOCOMPRESSION_PFRAMES_PER_KEYFRAME:
  1287. {
  1288. PKSPROPERTY_VIDEOCOMPRESSION_S pS =
  1289. (PKSPROPERTY_VIDEOCOMPRESSION_S) pSPD->PropertyInfo;
  1290. // Copy the input property info to the output property info
  1291. RtlCopyMemory( pS,
  1292. pSPD->Property,
  1293. sizeof (KSPROPERTY_VIDEOCOMPRESSION_S));
  1294. pS->Value = pCompressionSettings->CompressionPFramesPerKeyFrame;
  1295. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEOCOMPRESSION_S);
  1296. }
  1297. break;
  1298. case KSPROPERTY_VIDEOCOMPRESSION_QUALITY:
  1299. {
  1300. PKSPROPERTY_VIDEOCOMPRESSION_S pS =
  1301. (PKSPROPERTY_VIDEOCOMPRESSION_S) pSPD->PropertyInfo;
  1302. // Copy the input property info to the output property info
  1303. RtlCopyMemory( pS,
  1304. pSPD->Property,
  1305. sizeof (KSPROPERTY_VIDEOCOMPRESSION_S));
  1306. pS->Value = pCompressionSettings->CompressionQuality;
  1307. pSrb->ActualBytesTransferred = sizeof (KSPROPERTY_VIDEOCOMPRESSION_S);
  1308. }
  1309. break;
  1310. default:
  1311. TRAP;
  1312. break;
  1313. }
  1314. }
  1315. /*
  1316. ** AdapterSetVideoCompressionProperty()
  1317. **
  1318. ** Sets compressor settings
  1319. **
  1320. ** Arguments:
  1321. **
  1322. ** pSrb - pointer to the stream request block for properties
  1323. **
  1324. ** Returns:
  1325. **
  1326. ** Side Effects: none
  1327. */
  1328. VOID
  1329. STREAMAPI
  1330. AdapterSetVideoCompressionProperty(
  1331. PHW_STREAM_REQUEST_BLOCK pSrb
  1332. )
  1333. {
  1334. PHW_DEVICE_EXTENSION pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  1335. PSTREAMEX pStrmEx;
  1336. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  1337. PKSPROPERTY_VIDEOCOMPRESSION_S pS = (PKSPROPERTY_VIDEOCOMPRESSION_S) pSPD->Property;
  1338. ULONG Id = pSPD->Property->Id; // index of the property
  1339. ULONG StreamIndex;
  1340. PCOMPRESSION_SETTINGS pCompressionSettings;
  1341. // For this property set, the StreamIndex is always in the same place
  1342. // for each property
  1343. StreamIndex = ((PKSPROPERTY_VIDEOCOMPRESSION_S) pSPD->Property)->StreamIndex;
  1344. ASSERT (StreamIndex < MAX_TESTCAP_STREAMS);
  1345. // Verify the stream index is valid
  1346. if (StreamIndex >= MAX_TESTCAP_STREAMS) {
  1347. pSrb->Status = STATUS_INVALID_PARAMETER;
  1348. return;
  1349. }
  1350. pStrmEx = (PSTREAMEX) pHwDevExt->pStrmEx[StreamIndex];
  1351. // If the stream is not opened when this property set is used,
  1352. // store the values in the HwDevExt
  1353. if (pStrmEx) {
  1354. pCompressionSettings = &pStrmEx->CompressionSettings;
  1355. }
  1356. else {
  1357. pCompressionSettings = &pHwDevExt->CompressionSettings;
  1358. }
  1359. switch (Id) {
  1360. case KSPROPERTY_VIDEOCOMPRESSION_KEYFRAME_RATE:
  1361. {
  1362. pCompressionSettings->CompressionKeyFrameRate = pS->Value;
  1363. }
  1364. break;
  1365. case KSPROPERTY_VIDEOCOMPRESSION_PFRAMES_PER_KEYFRAME:
  1366. {
  1367. pCompressionSettings->CompressionPFramesPerKeyFrame = pS->Value;
  1368. }
  1369. break;
  1370. case KSPROPERTY_VIDEOCOMPRESSION_QUALITY:
  1371. {
  1372. pCompressionSettings->CompressionQuality = pS->Value;
  1373. }
  1374. break;
  1375. default:
  1376. TRAP;
  1377. break;
  1378. }
  1379. }
  1380. /*
  1381. ** AdapterGetVBIProperty()
  1382. **
  1383. ** Gets VBI settings
  1384. **
  1385. ** Arguments:
  1386. **
  1387. ** pSrb - pointer to the stream request block for properties
  1388. **
  1389. ** Returns:
  1390. **
  1391. ** Side Effects: none
  1392. */
  1393. VOID
  1394. STREAMAPI
  1395. AdapterGetVBIProperty(
  1396. PHW_STREAM_REQUEST_BLOCK pSrb
  1397. )
  1398. {
  1399. PHW_DEVICE_EXTENSION pHwDevExt = pSrb->HwDeviceExtension;
  1400. PSTREAMEX pStrmEx;
  1401. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  1402. ULONG Id = pSPD->Property->Id; // index of the property
  1403. ULONG StreamIndex;
  1404. PVBICAP_PROPERTIES_PROTECTION_S pS =
  1405. (PVBICAP_PROPERTIES_PROTECTION_S) pSPD->PropertyInfo;
  1406. StreamIndex = pS->StreamIndex;
  1407. ASSERT (StreamIndex < MAX_TESTCAP_STREAMS);
  1408. // Verify the stream index is valid
  1409. if (StreamIndex >= MAX_TESTCAP_STREAMS) {
  1410. pSrb->Status = STATUS_INVALID_PARAMETER;
  1411. return;
  1412. }
  1413. // Copy the input property info to the output property info
  1414. RtlCopyMemory( pS,
  1415. pSPD->Property,
  1416. sizeof (*pS));
  1417. pStrmEx = (PSTREAMEX) pHwDevExt->pStrmEx[StreamIndex];
  1418. pS->Status = 0;
  1419. if (pHwDevExt->ProtectionStatus & KS_VBI_FLAG_MV_PRESENT)
  1420. pS->Status |= KS_VBICAP_PROTECTION_MV_PRESENT;
  1421. if (pHwDevExt->ProtectionStatus & KS_VBI_FLAG_MV_HARDWARE)
  1422. pS->Status |= KS_VBICAP_PROTECTION_MV_HARDWARE;
  1423. if (pHwDevExt->ProtectionStatus & KS_VBI_FLAG_MV_DETECTED)
  1424. pS->Status |= KS_VBICAP_PROTECTION_MV_DETECTED;
  1425. pSrb->ActualBytesTransferred = sizeof (*pS);
  1426. }
  1427. #if DBG
  1428. /*
  1429. ** AdapterSetVBIProperty()
  1430. **
  1431. ** Sets VBI settings
  1432. **
  1433. ** Arguments:
  1434. **
  1435. ** pSrb - pointer to the stream request block for properties
  1436. **
  1437. ** Returns:
  1438. **
  1439. ** Side Effects: none
  1440. */
  1441. VOID
  1442. STREAMAPI
  1443. AdapterSetVBIProperty(
  1444. PHW_STREAM_REQUEST_BLOCK pSrb
  1445. )
  1446. {
  1447. PHW_DEVICE_EXTENSION pHwDevExt = pSrb->HwDeviceExtension;
  1448. PSTREAMEX pStrmEx;
  1449. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  1450. ULONG Id = pSPD->Property->Id; // index of the property
  1451. ULONG StreamIndex;
  1452. PVBICAP_PROPERTIES_PROTECTION_S pS =
  1453. (PVBICAP_PROPERTIES_PROTECTION_S) pSPD->PropertyInfo;
  1454. StreamIndex = pS->StreamIndex;
  1455. ASSERT (StreamIndex < MAX_TESTCAP_STREAMS);
  1456. // Verify the stream index is valid
  1457. if (StreamIndex >= MAX_TESTCAP_STREAMS) {
  1458. pSrb->Status = STATUS_INVALID_PARAMETER;
  1459. return;
  1460. }
  1461. pStrmEx = (PSTREAMEX) pHwDevExt->pStrmEx[StreamIndex];
  1462. pHwDevExt->ProtectionStatus = 0;
  1463. if (pS->Status & KS_VBICAP_PROTECTION_MV_PRESENT)
  1464. pHwDevExt->ProtectionStatus |= KS_VBI_FLAG_MV_PRESENT;
  1465. if (pS->Status & KS_VBICAP_PROTECTION_MV_HARDWARE)
  1466. pHwDevExt->ProtectionStatus |= KS_VBI_FLAG_MV_HARDWARE;
  1467. if (pS->Status & KS_VBICAP_PROTECTION_MV_DETECTED)
  1468. pHwDevExt->ProtectionStatus |= KS_VBI_FLAG_MV_DETECTED;
  1469. }
  1470. #endif //DBG
  1471. // -------------------------------------------------------------------
  1472. // General entry point for all get/set adapter properties
  1473. // -------------------------------------------------------------------
  1474. /*
  1475. ** AdapterSetProperty ()
  1476. **
  1477. ** Handles Set operations for all adapter properties.
  1478. **
  1479. ** Arguments:
  1480. **
  1481. ** pSRB -
  1482. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  1483. **
  1484. ** Returns:
  1485. **
  1486. ** Side Effects: none
  1487. */
  1488. VOID
  1489. STREAMAPI
  1490. AdapterSetProperty(
  1491. PHW_STREAM_REQUEST_BLOCK pSrb
  1492. )
  1493. {
  1494. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  1495. if (IsEqualGUID(&PROPSETID_VIDCAP_CROSSBAR, &pSPD->Property->Set)) {
  1496. AdapterSetCrossbarProperty (pSrb);
  1497. }
  1498. else if (IsEqualGUID(&PROPSETID_TUNER, &pSPD->Property->Set)) {
  1499. AdapterSetTunerProperty (pSrb);
  1500. }
  1501. else if (IsEqualGUID(&PROPSETID_VIDCAP_VIDEOPROCAMP, &pSPD->Property->Set)) {
  1502. AdapterSetVideoProcAmpProperty (pSrb);
  1503. }
  1504. else if (IsEqualGUID(&PROPSETID_VIDCAP_CAMERACONTROL, &pSPD->Property->Set)) {
  1505. AdapterSetCameraControlProperty (pSrb);
  1506. }
  1507. else if (IsEqualGUID(&PROPSETID_VIDCAP_TVAUDIO, &pSPD->Property->Set)) {
  1508. AdapterSetTVAudioProperty (pSrb);
  1509. }
  1510. else if (IsEqualGUID(&PROPSETID_VIDCAP_VIDEODECODER, &pSPD->Property->Set)) {
  1511. AdapterSetAnalogVideoDecoderProperty (pSrb);
  1512. }
  1513. else if (IsEqualGUID(&PROPSETID_VIDCAP_VIDEOCONTROL, &pSPD->Property->Set)) {
  1514. AdapterSetVideoControlProperty (pSrb);
  1515. }
  1516. else if (IsEqualGUID (&PROPSETID_VIDCAP_VIDEOCOMPRESSION, &pSPD->Property->Set)) {
  1517. AdapterSetVideoCompressionProperty (pSrb);
  1518. }
  1519. #if DBG
  1520. // Can't normally set protection status; only allow this for DEBUGGING
  1521. else if (IsEqualGUID (&KSPROPSETID_VBICAP_PROPERTIES, &pSPD->Property->Set)) {
  1522. AdapterSetVBIProperty (pSrb);
  1523. }
  1524. #endif //DBG
  1525. else {
  1526. //
  1527. // We should never get here
  1528. //
  1529. TRAP;
  1530. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1531. }
  1532. }
  1533. /*
  1534. ** AdapterGetProperty ()
  1535. **
  1536. ** Handles Get operations for all adapter properties.
  1537. **
  1538. ** Arguments:
  1539. **
  1540. ** pSRB -
  1541. ** Pointer to the HW_STREAM_REQUEST_BLOCK
  1542. **
  1543. ** Returns:
  1544. **
  1545. ** Side Effects: none
  1546. */
  1547. VOID
  1548. STREAMAPI
  1549. AdapterGetProperty(
  1550. PHW_STREAM_REQUEST_BLOCK pSrb
  1551. )
  1552. {
  1553. PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;
  1554. if (IsEqualGUID (&PROPSETID_VIDCAP_CROSSBAR, &pSPD->Property->Set)) {
  1555. AdapterGetCrossbarProperty (pSrb);
  1556. }
  1557. else if (IsEqualGUID (&PROPSETID_TUNER, &pSPD->Property->Set)) {
  1558. AdapterGetTunerProperty (pSrb);
  1559. }
  1560. else if (IsEqualGUID(&PROPSETID_VIDCAP_VIDEOPROCAMP, &pSPD->Property->Set)) {
  1561. AdapterGetVideoProcAmpProperty (pSrb);
  1562. }
  1563. else if (IsEqualGUID(&PROPSETID_VIDCAP_CAMERACONTROL, &pSPD->Property->Set)) {
  1564. AdapterGetCameraControlProperty (pSrb);
  1565. }
  1566. else if (IsEqualGUID(&PROPSETID_VIDCAP_TVAUDIO, &pSPD->Property->Set)) {
  1567. AdapterGetTVAudioProperty (pSrb);
  1568. }
  1569. else if (IsEqualGUID(&PROPSETID_VIDCAP_VIDEODECODER, &pSPD->Property->Set)) {
  1570. AdapterGetAnalogVideoDecoderProperty (pSrb);
  1571. }
  1572. else if (IsEqualGUID(&PROPSETID_VIDCAP_VIDEOCONTROL, &pSPD->Property->Set)) {
  1573. AdapterGetVideoControlProperty (pSrb);
  1574. }
  1575. else if (IsEqualGUID (&PROPSETID_VIDCAP_VIDEOCOMPRESSION, &pSPD->Property->Set)) {
  1576. AdapterGetVideoCompressionProperty (pSrb);
  1577. }
  1578. else if (IsEqualGUID (&KSPROPSETID_VBICAP_PROPERTIES, &pSPD->Property->Set)) {
  1579. AdapterGetVBIProperty (pSrb);
  1580. }
  1581. else {
  1582. //
  1583. // We should never get here
  1584. //
  1585. TRAP;
  1586. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1587. }
  1588. }