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.

282 lines
14 KiB

  1. <html xmlns:o="urn:schemas-microsoft-com:office:office"
  2. xmlns:w="urn:schemas-microsoft-com:office:word"
  3. xmlns="http://www.w3.org/TR/REC-html40">
  4. <head>
  5. <meta http-equiv=Content-Type content="text/html; charset=windows-1252">
  6. <meta name=ProgId content=Word.Document>
  7. <meta name=Generator content="Microsoft Word 10">
  8. <meta name=Originator content="Microsoft Word 10">
  9. <link rel=File-List href="BDACap_files/filelist.xml">
  10. <title>BDACap: AVStream Simulated Hardware Sample Driver</title>
  11. <!--[if gte mso 9]><xml>
  12. <o:DocumentProperties>
  13. <o:Author>TC Pritchett</o:Author>
  14. <o:LastAuthor>Anand Ganesh</o:LastAuthor>
  15. <o:Revision>9</o:Revision>
  16. <o:TotalTime>26</o:TotalTime>
  17. <o:Created>2001-10-19T18:21:00Z</o:Created>
  18. <o:LastSaved>2002-05-06T23:15:00Z</o:LastSaved>
  19. <o:Pages>1</o:Pages>
  20. <o:Words>822</o:Words>
  21. <o:Characters>4686</o:Characters>
  22. <o:Company>Microsoft Corporation</o:Company>
  23. <o:Lines>39</o:Lines>
  24. <o:Paragraphs>10</o:Paragraphs>
  25. <o:CharactersWithSpaces>5498</o:CharactersWithSpaces>
  26. <o:Version>10.3501</o:Version>
  27. </o:DocumentProperties>
  28. </xml><![endif]--><!--[if gte mso 9]><xml>
  29. <w:WordDocument>
  30. <w:GrammarState>Clean</w:GrammarState>
  31. <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
  32. </w:WordDocument>
  33. </xml><![endif]-->
  34. <style>
  35. <!--
  36. /* Font Definitions */
  37. @font-face
  38. {font-family:"MS Sans Serif";
  39. panose-1:0 0 0 0 0 0 0 0 0 0;
  40. mso-font-charset:0;
  41. mso-generic-font-family:swiss;
  42. mso-font-format:other;
  43. mso-font-pitch:variable;
  44. mso-font-signature:3 0 0 0 1 0;}
  45. @font-face
  46. {font-family:Verdana;
  47. panose-1:2 11 6 4 3 5 4 4 2 4;
  48. mso-font-charset:0;
  49. mso-generic-font-family:swiss;
  50. mso-font-pitch:variable;
  51. mso-font-signature:536871559 0 0 0 415 0;}
  52. /* Style Definitions */
  53. p.MsoNormal, li.MsoNormal, div.MsoNormal
  54. {mso-style-parent:"";
  55. margin:0in;
  56. margin-bottom:.0001pt;
  57. mso-pagination:widow-orphan;
  58. font-size:12.0pt;
  59. font-family:"Times New Roman";
  60. mso-fareast-font-family:"Times New Roman";}
  61. a:link, span.MsoHyperlink
  62. {color:blue;
  63. text-decoration:underline;
  64. text-underline:single;}
  65. a:visited, span.MsoHyperlinkFollowed
  66. {color:blue;
  67. text-decoration:underline;
  68. text-underline:single;}
  69. p
  70. {mso-margin-top-alt:auto;
  71. margin-right:0in;
  72. mso-margin-bottom-alt:auto;
  73. margin-left:0in;
  74. mso-pagination:widow-orphan;
  75. font-size:12.0pt;
  76. font-family:"Times New Roman";
  77. mso-fareast-font-family:"Times New Roman";}
  78. pre
  79. {margin:0in;
  80. margin-bottom:.0001pt;
  81. mso-pagination:widow-orphan;
  82. tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
  83. font-size:10.0pt;
  84. font-family:"Courier New";
  85. mso-fareast-font-family:"Times New Roman";}
  86. span.GramE
  87. {mso-style-name:"";
  88. mso-gram-e:yes;}
  89. @page Section1
  90. {size:8.5in 11.0in;
  91. margin:1.0in 1.25in 1.0in 1.25in;
  92. mso-header-margin:.5in;
  93. mso-footer-margin:.5in;
  94. mso-paper-source:0;}
  95. div.Section1
  96. {page:Section1;}
  97. -->
  98. </style>
  99. <!--[if gte mso 10]>
  100. <style>
  101. /* Style Definitions */
  102. table.MsoNormalTable
  103. {mso-style-name:"Table Normal";
  104. mso-tstyle-rowband-size:0;
  105. mso-tstyle-colband-size:0;
  106. mso-style-noshow:yes;
  107. mso-style-parent:"";
  108. mso-padding-alt:0in 5.4pt 0in 5.4pt;
  109. mso-para-margin:0in;
  110. mso-para-margin-bottom:.0001pt;
  111. mso-pagination:widow-orphan;
  112. font-size:10.0pt;
  113. font-family:"Times New Roman";}
  114. </style>
  115. <![endif]-->
  116. </head>
  117. <body lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>
  118. <div class=Section1>
  119. <h2><span style='font-family:Verdana'>BDACap: AVStream Simulated Hardware
  120. Sample Driver <o:p></o:p></span></h2>
  121. <p><span style='font-size:10.0pt;font-family:Arial;color:red'>[This is
  122. preliminary documentation and subject to change.]</span><span style='font-size:
  123. 10.0pt;font-family:Verdana'><o:p></o:p></span></p>
  124. <h3><span style='font-family:Verdana'>SUMMARY<o:p></o:p></span></h3>
  125. <p><span style='font-size:10.0pt;font-family:Verdana'>The BDACap sample is
  126. based on the AVSHwS sample provided in the AVStream samples directory.
  127. Modifications were made to allow the original AVSHwS sample to work the the
  128. BDATuner sample.<span style='mso-spacerun:yes'></span>The purpose of the
  129. sample is to demonstrate how to write a pin-centric AVStream minidriver. The
  130. sample also shows how to implement DMA by using the related functionality
  131. provided by AVStream.<o:p></o:p></span></p>
  132. <p><span style='font-size:10.0pt;font-family:Verdana'>The driver is designed to
  133. be used with the BDA sample software tuner driver (BDATuner.sys).<o:p></o:p></span></p>
  134. <h3><span style='font-family:Verdana'>BUILDING THE SAMPLE<o:p></o:p></span></h3>
  135. <p><span style='font-size:10.0pt;font-family:Verdana'>Build the sample by
  136. typing <b>build -<span class=GramE>cz</span></b> in either the standard checked
  137. or free build environment. A successful build produces BDACap<i>.sys.<o:p></o:p></i></span></p>
  138. <p><span style='font-size:10.0pt;font-family:Verdana'>To use the driver you
  139. should build both BDACap.sys and BDATuner.sys.<span style='mso-spacerun:yes'>
  140. </span>Copy these files along with the BDA sample tuner INF (BDATuner.inf), the
  141. BDA sample capture INF (BDACap.inf), and the software receiver INF
  142. (BDASWRcv.inf) to an installation directory on the target machine.<span
  143. style='mso-spacerun:yes'>� </span>To start installation of the drivers, right
  144. click on <i>BDASWRcv.inf</i> and select Install.<o:p></o:p></span></p>
  145. <p><span style='font-size:10.0pt;font-family:Verdana'>The sample works on x86
  146. platforms and builds correctly using Microsoft� Visual C� 6.0. The driver uses
  147. Plug and Play. <o:p></o:p></span></p>
  148. <p><span style='font-size:10.0pt;font-family:Verdana'>This sample runs on
  149. Microsoft� Windows� 2000 and Windows XP�. <o:p></o:p></span></p>
  150. <h3><span style='font-family:Verdana'>PROGRAMMING TOUR<o:p></o:p></span></h3>
  151. <p><b><span style='font-size:10.0pt;font-family:Verdana'>DriverEntry</span></b><span
  152. style='font-size:10.0pt;font-family:Verdana'> in <i>device.cpp</i> is the
  153. initial point of entry. This routine passes control to AVStream through a call
  154. to <b>KsInitializeDriver</b>. In this call, the minidriver passes the device
  155. descriptor, an AVStream structure that recursively defines the AVStream object
  156. hierarchy for a driver. This is common behavior for an AVStream minidriver. <o:p></o:p></span></p>
  157. <p><span style='font-size:10.0pt;font-family:Verdana'>At device start time (see
  158. the <b>CcaptureDevice::PnpStart</b> method in <i>device.cpp</i>), a simulated
  159. piece of capture hardware is created (the ChardwareSimulation class)<span
  160. class=GramE>,</span> a DMA adapter is acquired from the operating system and is
  161. registered with AVStream through a call to <b>KsDeviceRegisterAdapterObject</b>.
  162. This call is required for a sample that performs DMA directly into the capture
  163. buffers, instead of using DMA to write to a common buffer. <o:p></o:p></span></p>
  164. <p><i><span style='font-size:10.0pt;font-family:Verdana'>Filter.cpp</span></i><span
  165. style='font-size:10.0pt;font-family:Verdana'> is where the sample lays out the
  166. KSPIN_DESCRIPTOR_EX structure for the single capture pin. In addition, a
  167. KSFILTER_DISPATCH structure and a KSFILTER_DESCRIPTOR structure are provided in
  168. this source file. The filter dispatch provides only a create dispatch, a
  169. routine that is included in <i>Filter.cpp</i>. The process dispatch is provided
  170. on the pin, since this is a pin-centric sample. <o:p></o:p></span></p>
  171. <p><i><span style='font-size:10.0pt;font-family:Verdana'>Capture.cpp</span></i><span
  172. style='font-size:10.0pt;font-family:Verdana'> contains source for the transport
  173. input and output pins on the capture filter. This is where the KSPIN_DISPATCH
  174. structure for the unique pin is provided. This dispatch structure specifies a
  175. Process callback routine, also defined in this source file. This routine is
  176. where stream pointer manipulation and cloning occurs. <o:p></o:p></span></p>
  177. <p><span style='font-size:10.0pt;font-family:Verdana'>The process callback is
  178. one of two routines of interest in <i>Capture.cpp</i> that demonstrate how to do
  179. DMA transfers using AVStream functionality. The other is <b>CCapturePin::CompleteMappings</b>.
  180. These two methods show how to use the queue, obtain clone pointers, use
  181. scatter/gather lists, and perform other DMA-related tasks. <o:p></o:p></span></p>
  182. <p><i><span style='font-size:10.0pt;font-family:Verdana'>Hwsim.cpp</span></i><span
  183. style='font-size:10.0pt;font-family:Verdana'> contains the hardware simulation
  184. code and also code that fills the scatter/gather mappings. This source file
  185. includes the Start, Pause and Stop methods for the hardware simulation class
  186. (CHardwaresimulation). Transport synthesis code is also here. The supplied
  187. objects provide a framework for synthesizing transport data. <o:p></o:p></span></p>
  188. <p><span style='font-size:10.0pt;font-family:Verdana'>See comments in all .cpp
  189. files. Also see complete AVStream documentation in the DDK documentation. <o:p></o:p></span></p>
  190. <h3><span style='font-family:Verdana'>RUNNING THE SAMPLE<o:p></o:p></span></h3>
  191. <p><span class=GramE><span style='font-size:10.0pt;font-family:Verdana'>Once
  192. installation is complete, access the driver through the graphedt tool.</span></span><span
  193. style='font-size:10.0pt;font-family:Verdana'> <i>Graphedt.exe</i> is available
  194. in the <i>Tools</i> directory of the DDK. In the Graphedt application, click
  195. the Graph menu and select Insert Filters. Click Insert Filter and the sample <span
  196. class=GramE>appears</span> under �Bda Receiver Component� as a single filter
  197. labelled as �Sample BDA Capture�. Then insert a Network Provider (ATSC<span
  198. class=GramE>) ,</span> connect it the the �Sample BDA Tuner�, and attach the
  199. output of the Sample BDA Tuner filter to the input of the Sample BDA Capture
  200. Filter. The Sample BDA Tuner Filter appears under the category �BDA Source
  201. Filters�. Finally attach the output of the capture filter to the input pin of
  202. the MPEG-2 Demultiplexer filter.<o:p></o:p></span></p>
  203. <p><span style='font-size:10.0pt;font-family:Verdana'>The sample BDA capture
  204. appears under &quot;BDA Receiver Components&quot; as &quot;Sample BDA
  205. Capture&quot;.<span style='mso-spacerun:yes'></span>The sample BDA tuner
  206. appears under �BDA Source Filters� as �Sample BDA Tuner Filter�.<span
  207. style='mso-spacerun:yes'>� </span>The MPEG-2 demultiplexer appears under
  208. �DirectShow Filters� as �MPEG-2 Demultiplexer�.<o:p></o:p></span></p>
  209. <h3><span style='font-family:Verdana'>COMMENTS<o:p></o:p></span></h3>
  210. <p class=MsoNormal><span style='font-size:10.0pt;font-family:Verdana'>For more
  211. information on AVStream, see the DDK documentation. <o:p></o:p></span></p>
  212. <h3><span style='font-family:Verdana'>CODE TOUR<o:p></o:p></span></h3>
  213. <h4><span style='font-family:Verdana'>File Manifest<o:p></o:p></span></h4>
  214. <pre><u>File</u><span style='mso-spacerun:yes'>���������� </span><u>Description<o:p></o:p></u></pre><pre><o:p>&nbsp;</o:p></pre><pre>BDACap.htm<span
  215. style='mso-tab-count:1'>���� </span>The Sample Tour documentation for this sample (this file).</pre><pre><span
  216. class=GramE>Sources<span style='mso-tab-count:2'>������� </span>The generic file for building the code sample.</span></pre><pre>BDACap.inf<span
  217. style='mso-tab-count:1'>���� </span>A sample capture installation file.</pre><pre><span
  218. class=GramE>BDASWRcv.inf<span style='mso-tab-count:1'>�� </span>A special �software receiver� installation file.</span></pre><pre>BDACap.h<span
  219. style='mso-tab-count:1'>������ </span>The main <span class=GramE>header file</span> for the sample.</pre><pre><span
  220. class=GramE>device.cpp</span><span style='mso-tab-count:1'>���� </span>DriverEntry, Plug and Play handling, initialization, device level code.</pre><pre><span
  221. class=GramE>device.h</span><span style='mso-tab-count:1'>������ </span>Header file for above.</pre><pre><span
  222. class=GramE>filter.cpp</span><span style='mso-tab-count:1'>���� </span>Filter level code for the capture filter.</pre><pre><span
  223. class=GramE>filter.h</span><span style='mso-tab-count:1'>������ </span>Header file for above.</pre><pre><span
  224. class=GramE>capture.cpp</span><span style='mso-tab-count:1'>��� </span>Pin level code for the capture pin, DMA handling.</pre><pre><span
  225. class=GramE>capture.h</span><span style='mso-tab-count:1'>����� </span>Header file for above.</pre><pre><span
  226. class=GramE>hwsim.cpp</span><span style='mso-tab-count:1'>����� </span>Hardware simulation code, filling scatter/gather mappings, etc.</pre><pre><span
  227. class=GramE>hwsim.h</span><span style='mso-tab-count:1'> </span><span style='mso-spacerun:yes'>���� </span><span
  228. style='mso-tab-count:1'>�� </span>Header file for above.</pre><pre>TStream.cpp<span
  229. style='mso-tab-count:1'>��� </span>Transport stream simulation framework.</pre><pre>TStream.h<span
  230. style='mso-tab-count:1'>����� </span>Header <span class=GramE>file</span> for above.</pre><pre>BDACap.rc<span
  231. style='mso-tab-count:1'>����� </span>Resource <span class=GramE>file</span> mainly for version.</pre><pre><o:p>&nbsp;</o:p></pre><pre><o:p>&nbsp;</o:p></pre><pre><o:p>&nbsp;</o:p></pre>
  232. <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=624
  233. style='width:6.5in;mso-cellspacing:0in;mso-padding-alt:0in 5.4pt 0in 5.4pt'>
  234. <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:1.5pt'>
  235. <td style='background:aqua;padding:.75pt .75pt .75pt .75pt;height:1.5pt'>
  236. <p class=MsoNormal><span style='font-size:2.0pt;mso-bidi-font-size:12.0pt'><o:p>&nbsp;</o:p></span></p>
  237. </td>
  238. </tr>
  239. </table>
  240. <pre><o:p>&nbsp;</o:p></pre><pre><o:p>&nbsp;</o:p></pre>
  241. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  242. style='font-size:7.5pt;font-family:"MS Sans Serif";mso-bidi-font-family:"Courier New"'>�
  243. 2001 Microsoft Corporation</span><span style='font-size:10.0pt;font-family:
  244. Verdana;mso-bidi-font-family:"Courier New"'> <o:p></o:p></span></p>
  245. <pre><o:p>&nbsp;</o:p></pre></div>
  246. </body>
  247. </html>