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.

294 lines
10 KiB

  1. //==========================================================================;
  2. //
  3. // TSndProp.CPP
  4. // WDM TVAudio MiniDriver.
  5. // AIW / AIWPro hardware platform.
  6. // WDM Properties management.
  7. // Copyright (c) 1996 - 1997 ATI Technologies Inc. All Rights Reserved.
  8. //
  9. // $Date: 30 Jul 1998 17:36:30 $
  10. // $Revision: 1.2 $
  11. // $Author: KLEBANOV $
  12. //
  13. //==========================================================================;
  14. extern "C"
  15. {
  16. #include "strmini.h"
  17. #include "ksmedia.h"
  18. #include "wdmdebug.h"
  19. }
  20. #include "wdmdrv.h"
  21. #include "atitvsnd.h"
  22. #include "aticonfg.h"
  23. /*^^*
  24. * AdapterGetProperty()
  25. * Purpose : Called when SRB_GET_PROPERTY SRB is received.
  26. *
  27. * Inputs : PHW_STREAM_REQUEST_BLOCK pSrb : pointer to the current Srb
  28. *
  29. * Outputs : BOOL : returns returns FALSE, if it is not a Tv Audio property
  30. * it also returns the required property
  31. * Author : IKLEBANOV
  32. *^^*/
  33. BOOL CWDMTVAudio::AdapterGetProperty( PHW_STREAM_REQUEST_BLOCK pSrb)
  34. {
  35. PSTREAM_PROPERTY_DESCRIPTOR pSpd = pSrb->CommandData.PropertyInfo;
  36. ULONG uiPropertyId = pSpd->Property->Id; // index of the property
  37. ULONG nPropertyOutSize = pSpd->PropertyOutputSize; // size of data requested
  38. if( !::IsEqualGUID(( const struct _GUID &)PROPSETID_VIDCAP_TVAUDIO, ( const struct _GUID &)pSpd->Property->Set))
  39. return( FALSE);
  40. OutputDebugInfo(( "CWDMAVXBar:AdapterGetProperty() Id = %d\n", uiPropertyId));
  41. switch( uiPropertyId)
  42. {
  43. case KSPROPERTY_TVAUDIO_CAPS:
  44. ASSERT( nPropertyOutSize >= sizeof( KSPROPERTY_TVAUDIO_CAPS_S));
  45. {
  46. PKSPROPERTY_TVAUDIO_CAPS_S pTVAudioCaps = ( PKSPROPERTY_TVAUDIO_CAPS_S)pSpd->PropertyInfo;
  47. // Copy the input property info to the output property info
  48. ::RtlCopyMemory( pTVAudioCaps, pSpd->Property, sizeof( KSPROPERTY_TVAUDIO_CAPS_S));
  49. pTVAudioCaps->Capabilities = m_ulModesSupported;
  50. pTVAudioCaps->InputMedium = m_wdmTVAudioPinsMediumInfo[0];
  51. pTVAudioCaps->OutputMedium = m_wdmTVAudioPinsMediumInfo[1];
  52. }
  53. pSrb->ActualBytesTransferred = sizeof( KSPROPERTY_TVAUDIO_CAPS_S);
  54. break;
  55. case KSPROPERTY_TVAUDIO_MODE:
  56. ASSERT( nPropertyOutSize >= sizeof( KSPROPERTY_TVAUDIO_S));
  57. {
  58. PKSPROPERTY_TVAUDIO_S pTVAudioMode = ( PKSPROPERTY_TVAUDIO_S)pSpd->PropertyInfo;
  59. // Copy the input property info to the output property info
  60. ::RtlCopyMemory( pTVAudioMode, pSpd->Property, sizeof( KSPROPERTY_TVAUDIO_S));
  61. // GetMode returns the mode the device was set up with, not the current read back from
  62. // the device itself ( current AudioSignal Properties)
  63. pTVAudioMode->Mode = m_ulTVAudioMode;
  64. pSrb->ActualBytesTransferred = sizeof( KSPROPERTY_TVAUDIO_S);
  65. }
  66. break;
  67. case KSPROPERTY_TVAUDIO_CURRENTLY_AVAILABLE_MODES:
  68. ASSERT( nPropertyOutSize >= sizeof( KSPROPERTY_TVAUDIO_S));
  69. {
  70. ULONG ulAudioMode;
  71. PKSPROPERTY_TVAUDIO_S pTVAudioMode = ( PKSPROPERTY_TVAUDIO_S)pSpd->PropertyInfo;
  72. // Copy the input property info to the output property info
  73. ::RtlCopyMemory( pTVAudioMode, pSpd->Property, sizeof( KSPROPERTY_TVAUDIO_S));
  74. if( !GetAudioOperationMode( &ulAudioMode))
  75. return( FALSE);
  76. m_ulTVAudioSignalProperties = ulAudioMode;
  77. pTVAudioMode->Mode = ulAudioMode;
  78. pSrb->ActualBytesTransferred = sizeof( KSPROPERTY_TVAUDIO_S);
  79. }
  80. break;
  81. default:
  82. TRAP;
  83. return( FALSE);
  84. }
  85. return( TRUE);
  86. }
  87. /*^^*
  88. * AdapterSetProperty()
  89. * Purpose : Called when SRB_GET_PROPERTY SRB is received.
  90. *
  91. * Inputs : PHW_STREAM_REQUEST_BLOCK pSrb : pointer to the current Srb
  92. *
  93. * Outputs : BOOL : returns FALSE, if it is not a TV Audio property
  94. * it also sets the required property
  95. * Author : IKLEBANOV
  96. *^^*/
  97. BOOL CWDMTVAudio::AdapterSetProperty( PHW_STREAM_REQUEST_BLOCK pSrb)
  98. {
  99. PSTREAM_PROPERTY_DESCRIPTOR pSpd = pSrb->CommandData.PropertyInfo;
  100. ULONG uiPropertyId = pSpd->Property->Id; // index of the property
  101. if( !::IsEqualGUID( ( const struct _GUID &)PROPSETID_VIDCAP_TVAUDIO, ( const struct _GUID &)pSpd->Property->Set))
  102. return( FALSE);
  103. OutputDebugInfo(( "CWDMAVXBar:AdapterSetProperty() Id = %d\n", uiPropertyId));
  104. switch( uiPropertyId)
  105. {
  106. case KSPROPERTY_TVAUDIO_MODE:
  107. ASSERT( pSpd->PropertyOutputSize >= sizeof( KSPROPERTY_TVAUDIO_S));
  108. {
  109. ULONG ulModeToSet = (( PKSPROPERTY_TVAUDIO_S)pSpd->PropertyInfo)->Mode;
  110. if( ulModeToSet == ( ulModeToSet & m_ulModesSupported))
  111. {
  112. // every mode we're asked to set is supported
  113. if( ulModeToSet != m_ulTVAudioMode)
  114. {
  115. if( !SetAudioOperationMode( ulModeToSet))
  116. return( FALSE);
  117. else
  118. // update the driver
  119. m_ulTVAudioMode = ulModeToSet;
  120. }
  121. }
  122. else
  123. return( FALSE);
  124. }
  125. break;
  126. default:
  127. TRAP;
  128. return( FALSE);
  129. }
  130. return( TRUE);
  131. }
  132. /*^^*
  133. * SetWDMTVAudioKSTopology()
  134. * Purpose : Sets the KSTopology structure
  135. * Called during CWDMTVAudio class construction time.
  136. *
  137. * Inputs : none
  138. *
  139. * Outputs : none
  140. * Author : IKLEBANOV
  141. *^^*/
  142. void CWDMTVAudio::SetWDMTVAudioKSTopology( void)
  143. {
  144. GUID wdmTVAudioTopologyCategory[] =
  145. {
  146. STATIC_KSCATEGORY_TVAUDIO
  147. };
  148. ::RtlCopyMemory( &m_wdmTVAudioTopologyCategory, wdmTVAudioTopologyCategory, sizeof( wdmTVAudioTopologyCategory));
  149. m_wdmTVAudioTopology.CategoriesCount = 1;
  150. m_wdmTVAudioTopology.Categories = &m_wdmTVAudioTopologyCategory;
  151. m_wdmTVAudioTopology.TopologyNodesCount = 0;
  152. m_wdmTVAudioTopology.TopologyNodes = NULL;
  153. m_wdmTVAudioTopology.TopologyConnectionsCount = 0;
  154. m_wdmTVAudioTopology.TopologyConnections = NULL;
  155. }
  156. /*^^*
  157. * SetWDMTVAudioKSProperties()
  158. * Purpose : Sets the KSProperty structures array
  159. * Called during CWDMTVAudio class construction time.
  160. *
  161. * Inputs : none
  162. *
  163. * Outputs : none
  164. * Author : IKLEBANOV
  165. *^^*/
  166. void CWDMTVAudio::SetWDMTVAudioKSProperties( void)
  167. {
  168. DEFINE_KSPROPERTY_TABLE( wdmTVAudioProperties)
  169. {
  170. DEFINE_KSPROPERTY_ITEM
  171. (
  172. KSPROPERTY_TVAUDIO_CAPS,
  173. TRUE, // GetSupported or Handler
  174. sizeof( KSPROPERTY_TVAUDIO_CAPS_S), // MinProperty
  175. sizeof( KSPROPERTY_TVAUDIO_CAPS_S), // MinData
  176. FALSE, // SetSupported or Handler
  177. NULL, // Values
  178. 0, // RelationsCount
  179. NULL, // Relations
  180. NULL, // SupportHandler
  181. 0 // SerializedSize
  182. ),
  183. DEFINE_KSPROPERTY_ITEM
  184. (
  185. KSPROPERTY_TVAUDIO_MODE,
  186. TRUE, // GetSupported or Handler
  187. sizeof( KSPROPERTY_TVAUDIO_S), // MinProperty
  188. sizeof( KSPROPERTY_TVAUDIO_S), // MinData
  189. TRUE, // SetSupported or Handler
  190. NULL, // Values
  191. 0, // RelationsCount
  192. NULL, // Relations
  193. NULL, // SupportHandler
  194. 0 // SerializedSize
  195. ),
  196. DEFINE_KSPROPERTY_ITEM
  197. (
  198. KSPROPERTY_TVAUDIO_CURRENTLY_AVAILABLE_MODES,
  199. TRUE, // GetSupported or Handler
  200. sizeof( KSPROPERTY_TVAUDIO_S), // MinProperty
  201. sizeof( KSPROPERTY_TVAUDIO_S), // MinData
  202. FALSE, // SetSupported or Handler
  203. NULL, // Values
  204. 0, // RelationsCount
  205. NULL, // Relations
  206. NULL, // SupportHandler
  207. 0 // SerializedSize
  208. )
  209. };
  210. DEFINE_KSPROPERTY_SET_TABLE( wdmTVAudioPropertySet)
  211. {
  212. DEFINE_KSPROPERTY_SET
  213. (
  214. &PROPSETID_VIDCAP_TVAUDIO, // Set
  215. KSPROPERTIES_TVAUDIO_NUMBER, // PropertiesCount
  216. m_wdmTVAudioProperties, // PropertyItems
  217. 0, // FastIoCount
  218. NULL // FastIoTable
  219. )
  220. };
  221. ::RtlCopyMemory( &m_wdmTVAudioProperties, wdmTVAudioProperties, sizeof( wdmTVAudioProperties));
  222. ::RtlCopyMemory( &m_wdmTVAudioPropertySet, wdmTVAudioPropertySet, sizeof( wdmTVAudioPropertySet));
  223. }
  224. /*^^*
  225. * SetWDMTVAudioKSEvents()
  226. * Purpose : Sets the KSEvent structures array
  227. * Called during CWDMTVAudio class construction time.
  228. *
  229. * Inputs : none
  230. *
  231. * Outputs : none
  232. * Author : IKLEBANOV
  233. *^^*/
  234. void CWDMTVAudio::SetWDMTVAudioKSEvents( void)
  235. {
  236. PKSEVENT_ITEM pKSEventItem = &m_wdmTVAudioEvents[0];
  237. pKSEventItem->EventId = KSEVENT_TVAUDIO_CHANGED;
  238. pKSEventItem->DataInput = pKSEventItem->ExtraEntryData = 0;
  239. pKSEventItem->AddHandler = NULL;
  240. pKSEventItem->RemoveHandler = NULL;
  241. pKSEventItem->SupportHandler = NULL;
  242. m_wdmTVAudioEventsSet[0].Set = &KSEVENTSETID_VIDCAP_TVAUDIO;
  243. m_wdmTVAudioEventsSet[0].EventsCount = 0;
  244. m_wdmTVAudioEventsSet[0].EventItem = pKSEventItem;
  245. }