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.

1656 lines
64 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1999 - 2001
  3. Module Name:
  4. StrmData.h
  5. Abstract:
  6. Header file for supporting SD DV over 1394;
  7. Last changed by:
  8. Author: Yee J. Wu
  9. --*/
  10. #ifndef _DVSTRM_INC
  11. #define _DVSTRM_INC
  12. #define STATIC_KSCATEGORY_RENDER_EXTERNAL \
  13. 0xcc7bfb41L, 0xf175, 0x11d1, 0xa3, 0x92, 0x00, 0xe0, 0x29, 0x1f, 0x39, 0x59
  14. DEFINE_GUIDSTRUCT("cc7bfb41-f175-11d1-a392-00e0291f3959", KSCATEGORY_RENDER_EXTERNAL);
  15. #define KSCATEGORY_RENDER_EXTERNAL DEFINE_GUIDNAMED(KSCATEGORY_RENDER_EXTERNAL)
  16. // stream topology stuff for DV
  17. static GUID DVCategories[] = {
  18. STATIC_KSCATEGORY_VIDEO, // Output pin
  19. STATIC_KSCATEGORY_CAPTURE, // Output pin
  20. STATIC_KSCATEGORY_RENDER, // Input pin
  21. STATIC_KSCATEGORY_RENDER_EXTERNAL, // Input pin
  22. };
  23. #define NUMBER_OF_DV_CATEGORIES SIZEOF_ARRAY (DVCategories)
  24. static KSTOPOLOGY DVTopology = {
  25. NUMBER_OF_DV_CATEGORIES, // CategoriesCount
  26. DVCategories, // Categories
  27. 0, // TopologyNodesCount
  28. NULL, // TopologyNodes
  29. 0, // TopologyConnectionsCount
  30. NULL, // TopologyConnections
  31. NULL, // TopologyNodesNames
  32. 0, // Reserved
  33. };
  34. // stream topology stuff for MPEG2TS
  35. static GUID MPEG2TSCategories[] = {
  36. STATIC_KSCATEGORY_VIDEO, // Output pin
  37. STATIC_KSCATEGORY_CAPTURE, // Output pin
  38. };
  39. #define NUMBER_OF_MPEG2TS_CATEGORIES SIZEOF_ARRAY (MPEG2TSCategories)
  40. static KSTOPOLOGY MPEG2TSTopology = {
  41. NUMBER_OF_MPEG2TS_CATEGORIES, // CategoriesCount
  42. MPEG2TSCategories, // Categories
  43. 0, // TopologyNodesCount
  44. NULL, // TopologyNodes
  45. 0, // TopologyConnectionsCount
  46. NULL, // TopologyConnections
  47. NULL, // TopologyNodesNames
  48. 0, // Reserved
  49. };
  50. #ifndef mmioFOURCC
  51. #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
  52. ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
  53. ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
  54. #endif
  55. #define FOURCC_DVSD mmioFOURCC('d', 'v', 's', 'd')
  56. #undef D_X_NTSC
  57. #undef D_Y_NTSC
  58. #undef D_X_NTSC_MIN
  59. #undef D_Y_NTSC_MIN
  60. #undef D_X_PAL
  61. #undef D_Y_PAL
  62. #undef D_X_PAL_MIN
  63. #undef D_Y_PAL_MIN
  64. #define D_X_NTSC 720
  65. #define D_Y_NTSC 480
  66. #define D_X_NTSC_MIN 360
  67. #define D_Y_NTSC_MIN 240
  68. #define D_X_PAL 720
  69. #define D_Y_PAL 576
  70. #define D_X_PAL_MIN 360
  71. #define D_Y_PAL_MIN 288
  72. // ------------------------------------------------------------------------
  73. // External Device PROPERTY
  74. // ------------------------------------------------------------------------
  75. DEFINE_KSPROPERTY_TABLE(ExternalDeviceProperties)
  76. {
  77. DEFINE_KSPROPERTY_ITEM
  78. (
  79. KSPROPERTY_EXTDEVICE_CAPABILITIES,
  80. TRUE, // GetSupported or Handler
  81. sizeof(KSPROPERTY), // MinProperty
  82. sizeof(KSPROPERTY_EXTDEVICE_S), // MinData
  83. FALSE, // SetSupported or Handler
  84. NULL, // Values
  85. 0, // RelationsCount
  86. NULL, // Relations
  87. NULL, // SupportHandler
  88. sizeof(ULONG) // SerializedSize
  89. ),
  90. DEFINE_KSPROPERTY_ITEM
  91. (
  92. KSPROPERTY_EXTDEVICE_PORT,
  93. TRUE, // GetSupported or Handler
  94. sizeof(KSPROPERTY), // MinProperty
  95. sizeof(KSPROPERTY_EXTDEVICE_S), // MinData
  96. FALSE, // SetSupported or Handler
  97. NULL, // Values
  98. 0, // RelationsCount
  99. NULL, // Relations
  100. NULL, // SupportHandler
  101. sizeof(ULONG) // SerializedSize
  102. ),
  103. DEFINE_KSPROPERTY_ITEM
  104. (
  105. KSPROPERTY_EXTDEVICE_POWER_STATE,
  106. TRUE, // GetSupported or Handler
  107. sizeof(KSPROPERTY), // MinProperty
  108. sizeof(KSPROPERTY_EXTDEVICE_S), // MinData
  109. TRUE, // SetSupported or Handler
  110. NULL, // Values
  111. 0, // RelationsCount
  112. NULL, // Relations
  113. NULL, // SupportHandler
  114. sizeof(ULONG) // SerializedSize
  115. ),
  116. DEFINE_KSPROPERTY_ITEM
  117. (
  118. KSPROPERTY_EXTDEVICE_ID,
  119. TRUE, // GetSupported or Handler
  120. sizeof(KSPROPERTY), // MinProperty
  121. sizeof(KSPROPERTY_EXTDEVICE_S), // MinData
  122. FALSE, // SetSupported or Handler
  123. NULL, // Values
  124. 0, // RelationsCount
  125. NULL, // Relations
  126. NULL, // SupportHandler
  127. sizeof(ULONG) // SerializedSize
  128. ),
  129. DEFINE_KSPROPERTY_ITEM
  130. (
  131. KSPROPERTY_EXTDEVICE_VERSION,
  132. TRUE, // GetSupported or Handler
  133. sizeof(KSPROPERTY), // MinProperty
  134. sizeof(KSPROPERTY_EXTDEVICE_S), // MinData
  135. FALSE, // SetSupported or Handler
  136. NULL, // Values
  137. 0, // RelationsCount
  138. NULL, // Relations
  139. NULL, // SupportHandler
  140. sizeof(ULONG) // SerializedSize
  141. ),
  142. };
  143. DEFINE_KSPROPERTY_TABLE(ExternalTransportProperties)
  144. {
  145. DEFINE_KSPROPERTY_ITEM
  146. (
  147. KSPROPERTY_EXTXPORT_CAPABILITIES,
  148. TRUE, // GetSupported or Handler
  149. sizeof(KSPROPERTY), // MinProperty
  150. sizeof(KSPROPERTY_EXTXPORT_S), // MinData
  151. FALSE, // SetSupported or Handler
  152. NULL, // Values
  153. 0, // RelationsCount
  154. NULL, // Relations
  155. NULL, // SupportHandler
  156. sizeof(ULONG) // SerializedSize
  157. ),
  158. DEFINE_KSPROPERTY_ITEM
  159. (
  160. KSPROPERTY_EXTXPORT_INPUT_SIGNAL_MODE,
  161. TRUE, // GetSupported or Handler
  162. sizeof(KSPROPERTY), // MinProperty
  163. sizeof(KSPROPERTY_EXTXPORT_S), // MinData
  164. FALSE, // SetSupported or Handler
  165. NULL, // Values
  166. 0, // RelationsCount
  167. NULL, // Relations
  168. NULL, // SupportHandler
  169. sizeof(ULONG) // SerializedSize
  170. ),
  171. DEFINE_KSPROPERTY_ITEM
  172. (
  173. KSPROPERTY_EXTXPORT_OUTPUT_SIGNAL_MODE,
  174. TRUE, // GetSupported or Handler
  175. sizeof(KSPROPERTY), // MinProperty
  176. sizeof(KSPROPERTY_EXTXPORT_S), // MinData
  177. FALSE, // SetSupported or Handler
  178. NULL, // Values
  179. 0, // RelationsCount
  180. NULL, // Relations
  181. NULL, // SupportHandler
  182. sizeof(ULONG) // SerializedSize
  183. ),
  184. DEFINE_KSPROPERTY_ITEM
  185. (
  186. KSPROPERTY_EXTXPORT_LOAD_MEDIUM,
  187. FALSE, // GetSupported or Handler
  188. sizeof(KSPROPERTY), // MinProperty
  189. sizeof(KSPROPERTY_EXTXPORT_S), // MinData
  190. TRUE, // SetSupported or Handler
  191. NULL, // Values
  192. 0, // RelationsCount
  193. NULL, // Relations
  194. NULL, // SupportHandler
  195. sizeof(ULONG) // SerializedSize
  196. ),
  197. DEFINE_KSPROPERTY_ITEM
  198. (
  199. KSPROPERTY_EXTXPORT_MEDIUM_INFO,
  200. TRUE, // GetSupported or Handler
  201. sizeof(KSPROPERTY), // MinProperty
  202. sizeof(KSPROPERTY_EXTXPORT_S), // MinData
  203. FALSE, // SetSupported or Handler
  204. NULL, // Values
  205. 0, // RelationsCount
  206. NULL, // Relations
  207. NULL, // SupportHandler
  208. sizeof(ULONG) // SerializedSize
  209. ),
  210. DEFINE_KSPROPERTY_ITEM
  211. (
  212. KSPROPERTY_EXTXPORT_STATE,
  213. TRUE, // GetSupported or Handler
  214. sizeof(KSPROPERTY), // MinProperty
  215. sizeof(KSPROPERTY_EXTXPORT_S), // MinData
  216. TRUE, // SetSupported or Handler
  217. NULL, // Values
  218. 0, // RelationsCount
  219. NULL, // Relations
  220. NULL, // SupportHandler
  221. sizeof(ULONG) // SerializedSize
  222. ),
  223. DEFINE_KSPROPERTY_ITEM
  224. (
  225. // If this is an asychronous operation, we need to set and then get in separate calls.
  226. KSPROPERTY_EXTXPORT_STATE_NOTIFY,
  227. TRUE, // GetSupported or Handler
  228. sizeof(KSPROPERTY), // MinProperty
  229. sizeof(KSPROPERTY_EXTXPORT_S), // MinData
  230. TRUE, // SetSupported or Handler
  231. NULL, // Values
  232. 0, // RelationsCount
  233. NULL, // Relations
  234. NULL, // SupportHandler
  235. sizeof(ULONG) // SerializedSize
  236. ),
  237. DEFINE_KSPROPERTY_ITEM
  238. (
  239. KSPROPERTY_EXTXPORT_TIMECODE_SEARCH,
  240. FALSE, // GetSupported or Handler
  241. sizeof(KSPROPERTY), // MinProperty
  242. sizeof(KSPROPERTY_EXTXPORT_S), // MinData
  243. TRUE, // SetSupported or Handler
  244. NULL, // Values
  245. 0, // RelationsCount
  246. NULL, // Relations
  247. NULL, // SupportHandler
  248. sizeof(ULONG) // SerializedSize
  249. ),
  250. DEFINE_KSPROPERTY_ITEM
  251. (
  252. KSPROPERTY_EXTXPORT_ATN_SEARCH,
  253. FALSE, // GetSupported or Handler
  254. sizeof(KSPROPERTY), // MinProperty
  255. sizeof(KSPROPERTY_EXTXPORT_S), // MinData
  256. TRUE, // SetSupported or Handler
  257. NULL, // Values
  258. 0, // RelationsCount
  259. NULL, // Relations
  260. NULL, // SupportHandler
  261. sizeof(ULONG) // SerializedSize
  262. ),
  263. DEFINE_KSPROPERTY_ITEM
  264. (
  265. KSPROPERTY_EXTXPORT_RTC_SEARCH,
  266. FALSE, // GetSupported or Handler
  267. sizeof(KSPROPERTY), // MinProperty
  268. sizeof(KSPROPERTY_EXTXPORT_S), // MinData
  269. TRUE, // SetSupported or Handler
  270. NULL, // Values
  271. 0, // RelationsCount
  272. NULL, // Relations
  273. NULL, // SupportHandler
  274. sizeof(ULONG) // SerializedSize
  275. ),
  276. //
  277. // Allow any RAW AVC to go through including Vendor dependent
  278. //
  279. DEFINE_KSPROPERTY_ITEM
  280. (
  281. KSPROPERTY_RAW_AVC_CMD,
  282. TRUE, // GetSupported or Handler
  283. sizeof(KSPROPERTY), // MinProperty
  284. sizeof(KSPROPERTY_EXTXPORT_S), // MinData
  285. TRUE, // SetSupported or Handler
  286. NULL, // Values
  287. 0, // RelationsCount
  288. NULL, // Relations
  289. NULL, // SupportHandler
  290. sizeof(ULONG) // SerializedSize
  291. ),
  292. };
  293. DEFINE_KSPROPERTY_TABLE(TimeCodeReaderProperties)
  294. {
  295. DEFINE_KSPROPERTY_ITEM
  296. (
  297. KSPROPERTY_TIMECODE_READER,
  298. TRUE, // GetSupported or Handler
  299. sizeof(KSPROPERTY), // MinProperty
  300. sizeof(KSPROPERTY_TIMECODE_S), // MinData
  301. FALSE, // SetSupported or Handler
  302. NULL, // Values
  303. 0, // RelationsCount
  304. NULL, // Relations
  305. NULL, // SupportHandler
  306. sizeof(ULONG) // SerializedSize
  307. ),
  308. DEFINE_KSPROPERTY_ITEM
  309. (
  310. KSPROPERTY_ATN_READER,
  311. TRUE, // GetSupported or Handler
  312. sizeof(KSPROPERTY), // MinProperty
  313. sizeof(KSPROPERTY_TIMECODE_S), // MinData
  314. FALSE, // SetSupported or Handler
  315. NULL, // Values
  316. 0, // RelationsCount
  317. NULL, // Relations
  318. NULL, // SupportHandler
  319. sizeof(ULONG) // SerializedSize
  320. ),
  321. DEFINE_KSPROPERTY_ITEM
  322. (
  323. KSPROPERTY_RTC_READER,
  324. TRUE, // GetSupported or Handler
  325. sizeof(KSPROPERTY), // MinProperty
  326. sizeof(KSPROPERTY_TIMECODE_S), // MinData
  327. FALSE, // SetSupported or Handler
  328. NULL, // Values
  329. 0, // RelationsCount
  330. NULL, // Relations
  331. NULL, // SupportHandler
  332. sizeof(ULONG) // SerializedSize
  333. ),
  334. };
  335. DEFINE_KSPROPERTY_TABLE(MediaSeekingProperties)
  336. {
  337. DEFINE_KSPROPERTY_ITEM
  338. (
  339. // Corresponding to IMediaSeeking::IsFormatSupported()
  340. KSPROPERTY_MEDIASEEKING_FORMATS,
  341. TRUE, // GetSupported or Handler
  342. sizeof(KSPROPERTY), // MinProperty
  343. 0, // MinData; MULTIPLE_ITEM, 2 step process to get data
  344. FALSE, // SetSupported or Handler
  345. NULL, // Values
  346. 0, // RelationsCount
  347. NULL, // Relations
  348. NULL, // SupportHandler
  349. sizeof(ULONG) // SerializedSize
  350. ),
  351. };
  352. KSPROPERTY_SET VideoDeviceProperties[] =
  353. {
  354. DEFINE_KSPROPERTY_SET
  355. (
  356. &PROPSETID_EXT_DEVICE, // Set
  357. SIZEOF_ARRAY(ExternalDeviceProperties), // PropertiesCount
  358. ExternalDeviceProperties, // PropertyItem
  359. 0, // FastIoCount
  360. NULL // FastIoTable
  361. ),
  362. DEFINE_KSPROPERTY_SET
  363. (
  364. &PROPSETID_EXT_TRANSPORT, // Set
  365. SIZEOF_ARRAY(ExternalTransportProperties), // PropertiesCount
  366. ExternalTransportProperties, // PropertyItem
  367. 0, // FastIoCount
  368. NULL // FastIoTable
  369. ),
  370. DEFINE_KSPROPERTY_SET
  371. (
  372. &PROPSETID_TIMECODE_READER, // Set
  373. SIZEOF_ARRAY(TimeCodeReaderProperties), // PropertiesCount
  374. TimeCodeReaderProperties, // PropertyItem
  375. 0, // FastIoCount
  376. NULL // FastIoTable
  377. ),
  378. DEFINE_KSPROPERTY_SET
  379. (
  380. &KSPROPSETID_MediaSeeking, // Set
  381. SIZEOF_ARRAY(MediaSeekingProperties), // PropertiesCount
  382. MediaSeekingProperties, // PropertyItem
  383. 0, // FastIoCount
  384. NULL // FastIoTable
  385. ),
  386. };
  387. #define NUMBER_VIDEO_DEVICE_PROPERTIES (SIZEOF_ARRAY(VideoDeviceProperties))
  388. // ------------------------------------------------------------------------
  389. // External Device Events
  390. // ------------------------------------------------------------------------
  391. KSEVENT_ITEM ExtDevCommandItm[] =
  392. {
  393. {
  394. KSEVENT_EXTDEV_COMMAND_NOTIFY_INTERIM_READY,
  395. 0, // sizeof(KSEVENT_ITEM),
  396. 0,
  397. NULL,
  398. NULL,
  399. NULL
  400. },
  401. {
  402. KSEVENT_EXTDEV_COMMAND_CONTROL_INTERIM_READY,
  403. 0, // sizeof(KSEVENT_ITEM),
  404. 0,
  405. NULL,
  406. NULL,
  407. NULL
  408. },
  409. #ifdef MSDVDV_SUPPORT_BUSRESET_EVENT
  410. // Application cares about this since AVC command will be ABORTED!
  411. {
  412. KSEVENT_EXTDEV_COMMAND_BUSRESET,
  413. 0, // sizeof(KSEVENT_ITEM),
  414. 0,
  415. NULL,
  416. NULL,
  417. NULL
  418. },
  419. #endif
  420. // Tell client this device is being removed.
  421. {
  422. KSEVENT_EXTDEV_NOTIFY_REMOVAL,
  423. 0, // sizeof(KSEVENT_ITEM),
  424. 0,
  425. NULL,
  426. NULL,
  427. NULL
  428. },
  429. };
  430. // define event set related with streams
  431. KSEVENT_SET VideoDeviceEvents[] =
  432. {
  433. {
  434. &KSEVENTSETID_EXTDEV_Command,
  435. SIZEOF_ARRAY(ExtDevCommandItm),
  436. ExtDevCommandItm,
  437. },
  438. };
  439. #define NUMBER_VIDEO_DEVICE_EVENTS (SIZEOF_ARRAY(VideoDeviceEvents))
  440. // ------------------------------------------------------------------------
  441. // Stream Property sets for all video capture streams
  442. // ------------------------------------------------------------------------
  443. DEFINE_KSPROPERTY_TABLE(VideoStreamConnectionProperties)
  444. {
  445. DEFINE_KSPROPERTY_ITEM
  446. (
  447. KSPROPERTY_CONNECTION_ALLOCATORFRAMING,
  448. TRUE, // GetSupported or Handler
  449. sizeof(KSPROPERTY), // MinProperty
  450. sizeof(KSALLOCATOR_FRAMING), // MinData
  451. FALSE, // SetSupported or Handler
  452. NULL, // Values
  453. 0, // RelationsCount
  454. NULL, // Relations
  455. NULL, // SupportHandler
  456. sizeof(ULONG) // SerializedSize
  457. ),
  458. };
  459. DEFINE_KSPROPERTY_TABLE(VideoStreamDroppedFramesProperties)
  460. {
  461. DEFINE_KSPROPERTY_ITEM
  462. (
  463. KSPROPERTY_DROPPEDFRAMES_CURRENT,
  464. TRUE, // GetSupported or Handler
  465. sizeof(KSPROPERTY_DROPPEDFRAMES_CURRENT_S),// MinProperty
  466. sizeof(KSPROPERTY_DROPPEDFRAMES_CURRENT_S),// MinData
  467. FALSE, // SetSupported or Handler
  468. NULL, // Values
  469. 0, // RelationsCount
  470. NULL, // Relations
  471. NULL, // SupportHandler
  472. 0 // SerializedSize
  473. ),
  474. };
  475. KSPROPERTY_SET VideoStreamProperties[] =
  476. {
  477. DEFINE_KSPROPERTY_SET
  478. (
  479. &KSPROPSETID_Connection, // Set
  480. SIZEOF_ARRAY(VideoStreamConnectionProperties), // PropertiesCount
  481. VideoStreamConnectionProperties, // PropertyItem
  482. 0, // FastIoCount
  483. NULL // FastIoTable
  484. ),
  485. DEFINE_KSPROPERTY_SET
  486. (
  487. &PROPSETID_VIDCAP_DROPPEDFRAMES, // Set
  488. SIZEOF_ARRAY(VideoStreamDroppedFramesProperties), // PropertiesCount
  489. VideoStreamDroppedFramesProperties, // PropertyItem
  490. 0, // FastIoCount
  491. NULL // FastIoTable
  492. ),
  493. };
  494. #define NUMBER_VIDEO_STREAM_PROPERTIES (SIZEOF_ARRAY(VideoStreamProperties))
  495. // ----------------------------------------------------------------------
  496. // Stream events
  497. // ------------------------------------------------------------------------
  498. // FORMAT_DVInfo
  499. //
  500. // Create a local copy of this GUID and make sure that it is not in the PAGED segment
  501. //
  502. const
  503. GUID
  504. KSEVENTSETID_Connection_Local = {STATICGUIDOF(KSEVENTSETID_Connection)};
  505. const
  506. GUID
  507. KSEVENTSETID_Clock_Local = {STATICGUIDOF(KSEVENTSETID_Clock)};
  508. // Isoch transmit End of stream event item
  509. KSEVENT_ITEM EndOfStreamEventItm[] =
  510. {
  511. {
  512. KSEVENT_CONNECTION_ENDOFSTREAM,
  513. 0,
  514. 0,
  515. NULL,
  516. NULL,
  517. NULL
  518. }
  519. };
  520. // Clock event item
  521. KSEVENT_ITEM ClockEventItm[] =
  522. {
  523. {
  524. KSEVENT_CLOCK_POSITION_MARK, // position mark event supported
  525. sizeof (KSEVENT_TIME_MARK), // requires this data as input
  526. sizeof (KSEVENT_TIME_MARK), // allocate space to copy the data
  527. NULL,
  528. NULL,
  529. NULL
  530. },
  531. #if 0
  532. {
  533. KSEVENT_CLOCK_INTERVAL_MARK, // interval mark event supported
  534. sizeof (KSEVENT_TIME_INTERVAL), // requires interval data as input
  535. sizeof (MYTIME), // we use an additional workspace of
  536. // size longlong for processing
  537. // this event
  538. NULL,
  539. NULL,
  540. NULL
  541. }
  542. #endif
  543. };
  544. KSEVENT_SET ClockEventSet[] =
  545. {
  546. {
  547. &KSEVENTSETID_Clock,
  548. SIZEOF_ARRAY(ClockEventItm),
  549. ClockEventItm,
  550. }
  551. };
  552. // define event set related with streams
  553. // Output pin event set
  554. KSEVENT_SET StreamEventsOutPin[] =
  555. {
  556. {
  557. &KSEVENTSETID_Clock_Local,
  558. SIZEOF_ARRAY(ClockEventItm),
  559. ClockEventItm,
  560. },
  561. };
  562. // Input pin events set
  563. KSEVENT_SET StreamEventsInPin[] =
  564. {
  565. {
  566. &KSEVENTSETID_Connection_Local,
  567. SIZEOF_ARRAY(EndOfStreamEventItm),
  568. EndOfStreamEventItm,
  569. },
  570. {
  571. &KSEVENTSETID_Clock_Local,
  572. SIZEOF_ARRAY(ClockEventItm),
  573. ClockEventItm,
  574. },
  575. };
  576. // Input pin events set for MPEG2TS (has EOS but no clock event)
  577. KSEVENT_SET StreamEventsInPinMPEG2TS[] =
  578. {
  579. {
  580. &KSEVENTSETID_Connection_Local,
  581. SIZEOF_ARRAY(EndOfStreamEventItm),
  582. EndOfStreamEventItm,
  583. },
  584. };
  585. #define NUMBER_STREAM_EVENTS_OUT_PIN (SIZEOF_ARRAY(StreamEventsOutPin))
  586. #define NUMBER_STREAM_EVENTS_IN_PIN (SIZEOF_ARRAY(StreamEventsInPin))
  587. #define NUMBER_STREAM_EVENTS_IN_PIN_MPEG2TS (SIZEOF_ARRAY(StreamEventsInPinMPEG2TS))
  588. // ----------------------------------------------------------------------
  589. // Stream data ranges
  590. // ------------------------------------------------------------------------
  591. /**********************************************************************
  592. SDDV data range
  593. **********************************************************************/
  594. // NTSC stream
  595. KS_DATARANGE_VIDEO DvcrNTSCVideoStream =
  596. {
  597. // KSDATARANGE
  598. {
  599. sizeof (KS_DATARANGE_VIDEO), // FormatSize
  600. 0, // Flags
  601. FRAME_SIZE_SDDV_NTSC, // SampleSize
  602. 0, // Reserved
  603. STATIC_KSDATAFORMAT_TYPE_VIDEO,
  604. STATIC_KSDATAFORMAT_SUBTYPE_DVSD,
  605. STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO,
  606. },
  607. TRUE, // BOOL, bFixedSizeSamples (all samples same size?)
  608. FALSE, // BOOL, bTemporalCompression (all I frames?)
  609. KS_VIDEOSTREAM_CAPTURE, // StreamDescriptionFlags (KS_VIDEO_DESC_*)
  610. 0, // MemoryAllocationFlags (KS_VIDEO_ALLOC_*)
  611. // _KS_VIDEO_STREAM_CONFIG_CAPS
  612. {
  613. STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO, //MEDIATYPE_Video
  614. KS_AnalogVideo_NTSC_M, // AnalogVideoStandard
  615. D_X_NTSC, D_Y_NTSC, // InputSize, (the inherent size of the incoming signal
  616. // with every digitized pixel unique)
  617. D_X_NTSC_MIN, D_Y_NTSC_MIN, // MinCroppingSize, smallest rcSrc cropping rect allowed
  618. D_X_NTSC, D_Y_NTSC, // MaxCroppingSize, largest rcSrc cropping rect allowed
  619. 1, // CropGranularityX, granularity of cropping size
  620. 1, // CropGranularityY
  621. 1, // CropAlignX, alignment of cropping rect
  622. 1, // CropAlignY;
  623. D_X_NTSC_MIN, D_Y_NTSC_MIN, // MinOutputSize, smallest bitmap stream can produce
  624. D_X_NTSC, D_Y_NTSC, // MaxOutputSize, largest bitmap stream can produce
  625. 1, // OutputGranularityX, granularity of output bitmap size
  626. 1, // OutputGranularityY;
  627. 0, // StretchTapsX (0 no stretch, 1 pix dup, 2 interp...)
  628. 0, // StretchTapsY
  629. 0, // ShrinkTapsX
  630. 0, // ShrinkTapsY
  631. 333667, // MinFrameInterval, 100 nS units// MinFrameInterval, 100 nS units
  632. 333667, // MaxFrameInterval, 100 nS units
  633. (FRAME_SIZE_SDDV_NTSC * 8)*30, // MinBitsPerSecond;
  634. (FRAME_SIZE_SDDV_NTSC * 8)*30, // MaxBitsPerSecond;
  635. },
  636. // KS_VIDEOINFOHEADER (default format)
  637. {
  638. 0,0,0,0, //D_X_NTSC,D_Y_NTSC, // 0,0,720,480
  639. 0,0,0,0, // RECT rcTarget; // Where the video should go
  640. (FRAME_SIZE_SDDV_NTSC * 8 * 30), // DWORD dwBitRate; // Approximate bit data rate
  641. 0L, // DWORD dwBitErrorRate; // Bit error rate for this stream
  642. 333667, // REFERENCE_TIME AvgTimePerFrame; // Average time per frame (100ns units)
  643. sizeof (KS_BITMAPINFOHEADER), // DWORD biSize;
  644. D_X_NTSC, // LONG biWidth;
  645. D_Y_NTSC, // LONG biHeight;
  646. 1, // WORD biPlanes;
  647. 24, // WORD biBitCount;
  648. FOURCC_DVSD, // DWORD biCompression;
  649. FRAME_SIZE_SDDV_NTSC, // DWORD biSizeImage;
  650. 0, // LONG biXPelsPerMeter;
  651. 0, // LONG biYPelsPerMeter;
  652. 0, // DWORD biClrUsed;
  653. 0, // DWORD biClrImportant;
  654. },
  655. };
  656. // PAL stream format
  657. KS_DATARANGE_VIDEO DvcrPALVideoStream =
  658. {
  659. // KSDATARANGE
  660. {
  661. sizeof (KS_DATARANGE_VIDEO),
  662. 0, // Flags
  663. FRAME_SIZE_SDDV_PAL, // SampleSize
  664. 0, // Reserved
  665. STATIC_KSDATAFORMAT_TYPE_VIDEO,
  666. STATIC_KSDATAFORMAT_SUBTYPE_DVSD,
  667. STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO,
  668. },
  669. TRUE, // BOOL, bFixedSizeSamples (all samples same size?)
  670. FALSE, // BOOL, bTemporalCompression (all I frames?)
  671. KS_VIDEOSTREAM_CAPTURE, // StreamDescriptionFlags (KS_VIDEO_DESC_*)
  672. 0, // MemoryAllocationFlags (KS_VIDEO_ALLOC_*)
  673. // _KS_VIDEO_STREAM_CONFIG_CAPS
  674. {
  675. STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO, //MEDIATYPE_Video
  676. KS_AnalogVideo_PAL_B, // AnalogVideoStandard
  677. D_X_PAL, D_Y_PAL, // InputSize, (the inherent size of the incoming signal
  678. // with every digitized pixel unique)
  679. D_X_PAL_MIN, D_Y_PAL_MIN, // MinCroppingSize, smallest rcSrc cropping rect allowed
  680. D_X_PAL, D_Y_PAL, // MaxCroppingSize, largest rcSrc cropping rect allowed
  681. 1, // CropGranularityX, granularity of cropping size
  682. 1, // CropGranularityY
  683. 1, // CropAlignX, alignment of cropping rect
  684. 1, // CropAlignY;
  685. D_X_PAL_MIN, D_Y_PAL_MIN, // MinOutputSize, smallest bitmap stream can produce
  686. D_X_PAL, D_Y_PAL, // MaxOutputSize, largest bitmap stream can produce
  687. 1, // OutputGranularityX, granularity of output bitmap size
  688. 1, // OutputGranularityY;
  689. 0, // StretchTapsX (0 no stretch, 1 pix dup, 2 interp...)
  690. 0, // StretchTapsY
  691. 0, // ShrinkTapsX
  692. 0, // ShrinkTapsY
  693. 400000, // MinFrameInterval, 100 nS units
  694. 400000, // MaxFrameInterval, 100 nS units
  695. (FRAME_SIZE_SDDV_PAL * 8)*25, // MinBitsPerSecond;
  696. (FRAME_SIZE_SDDV_PAL * 8)*25, // MaxBitsPerSecond;
  697. },
  698. // KS_VIDEOINFOHEADER (default format)
  699. {
  700. 0,0,0,0, // D_X_PAL,D_Y_PAL, // 0,0,720,480
  701. 0,0,0,0, // RECT rcTarget; // Where the video should go
  702. (FRAME_SIZE_SDDV_PAL * 8 * 25), // DWORD dwBitRate; // Approximate bit data rate
  703. 0L, // DWORD dwBitErrorRate; // Bit error rate for this stream
  704. 400000, // REFERENCE_TIME AvgTimePerFrame; // Average time per frame (100ns units)
  705. sizeof (KS_BITMAPINFOHEADER), // DWORD biSize;
  706. D_X_PAL, // LONG biWidth;
  707. D_Y_PAL, // LONG biHeight;
  708. 1, // WORD biPlanes;
  709. 24, // WORD biBitCount;
  710. FOURCC_DVSD, // DWORD biCompression;
  711. FRAME_SIZE_SDDV_PAL, // DWORD biSizeImage;
  712. 0, // LONG biXPelsPerMeter;
  713. 0, // LONG biYPelsPerMeter;
  714. 0, // DWORD biClrUsed;
  715. 0, // DWORD biClrImportant;
  716. },
  717. };
  718. #define NTSC_DVAAuxSrc 0xd1c030cf
  719. #define PAL_DVAAuxSrc 0xd1e030d0
  720. #define NTSC_DVAAuxSrc_DVCPRO 0xd1de30cf
  721. #define PAL_DVAAuxSrc_DVCPRO 0xd1fe30d0
  722. // NTSC stream (for iavs connections)
  723. #ifdef SUPPORT_NEW_AVC
  724. KS_DATARANGE_DV_AVC
  725. #else
  726. KS_DATARANGE_DVVIDEO
  727. #endif
  728. DvcrNTSCiavStream =
  729. {
  730. // KSDATARANGE
  731. {
  732. #ifdef SUPPORT_NEW_AVC
  733. sizeof (KS_DATARANGE_DV_AVC), // FormatSize
  734. #else
  735. sizeof (KS_DATARANGE_DVVIDEO), // FormatSize
  736. #endif
  737. 0, // Flags
  738. FRAME_SIZE_SDDV_NTSC, // SampleSize
  739. 0, // Reserved
  740. STATIC_KSDATAFORMAT_TYPE_INTERLEAVED,
  741. STATIC_KSDATAFORMAT_SUBTYPE_DVSD,
  742. STATIC_KSDATAFORMAT_SPECIFIER_DVINFO,
  743. },
  744. // DVINFO
  745. // Note: audio is set for 32khz
  746. {
  747. //for 1st 5/6 DIF seq.
  748. NTSC_DVAAuxSrc, // 0xd1c030cf, // DWORD dwDVAAuxSrc;
  749. 0xffa0c733, // DWORD dwDVAAuxCtl;
  750. // for 2nd 5/6 DIF seq.
  751. 0xd1c03fcf, // DWORD dwDVAAuxSrc1; 32K, 12bit
  752. 0xffa0ff3f, // DWORD dwDVAAuxCtl1;
  753. //for video information
  754. 0xff00ffff, // DWORD dwDVVAuxSrc;
  755. 0xfffcc833, // DWORD dwDVVAuxCtl;
  756. 0, // DWORD dwDVReserved[2];
  757. 0, //
  758. },
  759. #ifdef SUPPORT_NEW_AVC
  760. // AVCPRECONNECTINFO
  761. {
  762. 0, // Device ID
  763. 0, // Subunit address
  764. 0, // Subunit Plug number
  765. 0, // Data Flow
  766. 0, // Flag/Plug Handle
  767. 0, // UnitPlugNumber
  768. },
  769. #endif
  770. };
  771. // PAL stream (for iavs connections)
  772. #ifdef SUPPORT_NEW_AVC
  773. KS_DATARANGE_DV_AVC
  774. #else
  775. KS_DATARANGE_DVVIDEO
  776. #endif
  777. DvcrPALiavStream =
  778. {
  779. // KSDATARANGE
  780. {
  781. #ifdef SUPPORT_NEW_AVC
  782. sizeof (KS_DATARANGE_DV_AVC), // FormatSize
  783. #else
  784. sizeof (KS_DATARANGE_DVVIDEO), // FormatSize
  785. #endif
  786. 0, // Flags
  787. FRAME_SIZE_SDDV_PAL, // SampleSize
  788. 0, // Reserved
  789. STATIC_KSDATAFORMAT_TYPE_INTERLEAVED,
  790. STATIC_KSDATAFORMAT_SUBTYPE_DVSD,
  791. STATIC_KSDATAFORMAT_SPECIFIER_DVINFO,
  792. },
  793. // DVINFO
  794. // Note: Audio is set for 32khz.
  795. {
  796. //for 1st 5/6 DIF seq.
  797. PAL_DVAAuxSrc, // 0xd1e030d0, // DWORD dwDVAAuxSrc;
  798. 0xffa0cf3f, // DWORD dwDVAAuxCtl;
  799. // for 2nd 5/6 DIF seq.
  800. 0xd1e03fd0, // DWORD dwDVAAuxSrc1; 32k, 12bit
  801. 0xffa0cf3f, // DWORD dwDVAAuxCtl1;
  802. //for video information
  803. 0xff20ffff, // DWORD dwDVVAuxSrc;
  804. 0xfffdc83f, // DWORD dwDVVAuxCtl;
  805. 0, // DWORD dwDVReserved[2];
  806. 0, //
  807. },
  808. #ifdef SUPPORT_NEW_AVC
  809. // AVCPRECONNECTINFO
  810. {
  811. 0, // Device ID
  812. 0, // Subunit address
  813. 0, // Subunit Plug number
  814. 0, // Data Flow
  815. 0, // Flag/Plug Handle
  816. 0, // UnitPlugNumber
  817. },
  818. #endif
  819. };
  820. // NTSC stream (for iavs connections)
  821. #ifdef SUPPORT_NEW_AVC
  822. KS_DATARANGE_DV_AVC
  823. #else
  824. KS_DATARANGE_DVVIDEO
  825. #endif
  826. DvcrNTSCiavStreamIn =
  827. {
  828. // KSDATARANGE
  829. {
  830. #ifdef SUPPORT_NEW_AVC
  831. sizeof (KS_DATARANGE_DV_AVC), // FormatSize
  832. #else
  833. sizeof (KS_DATARANGE_DVVIDEO), // FormatSize
  834. #endif
  835. 0, // Flags
  836. FRAME_SIZE_SDDV_NTSC, // SampleSize
  837. 0, // Reserved
  838. STATIC_KSDATAFORMAT_TYPE_INTERLEAVED,
  839. STATIC_KSDATAFORMAT_SUBTYPE_DVSD,
  840. STATIC_KSDATAFORMAT_SPECIFIER_DVINFO,
  841. },
  842. // DVINFO
  843. // Note: audio is set for 32khz
  844. {
  845. //for 1st 5/6 DIF seq.
  846. NTSC_DVAAuxSrc, // 0xd1c030cf, // DWORD dwDVAAuxSrc;
  847. 0xffa0c733, // DWORD dwDVAAuxCtl;
  848. // for 2nd 5/6 DIF seq.
  849. 0xd1c03fcf, // DWORD dwDVAAuxSrc1; 32K, 12bit
  850. 0xffa0ff3f, // DWORD dwDVAAuxCtl1;
  851. //for video information
  852. 0xff00ffff, // DWORD dwDVVAuxSrc;
  853. 0xfffcc833, // DWORD dwDVVAuxCtl;
  854. 0, // DWORD dwDVReserved[2];
  855. 0, //
  856. },
  857. #ifdef SUPPORT_NEW_AVC
  858. // AVCPRECONNECTINFO
  859. {
  860. 0, // Device ID
  861. 0, // Subunit address
  862. 0, // Subunit Plug number
  863. 0, // Data Flow
  864. 0, // Flag/Plug Handle
  865. 0, // UnitPlugNumber
  866. },
  867. #endif
  868. };
  869. // PAL stream (for iavs connections)
  870. #ifdef SUPPORT_NEW_AVC
  871. KS_DATARANGE_DV_AVC
  872. #else
  873. KS_DATARANGE_DVVIDEO
  874. #endif
  875. DvcrPALiavStreamIn =
  876. {
  877. // KSDATARANGE
  878. {
  879. #ifdef SUPPORT_NEW_AVC
  880. sizeof (KS_DATARANGE_DV_AVC), // FormatSize
  881. #else
  882. sizeof (KS_DATARANGE_DVVIDEO), // FormatSize
  883. #endif
  884. 0, // Flags
  885. FRAME_SIZE_SDDV_PAL, // SampleSize
  886. 0, // Reserved
  887. STATIC_KSDATAFORMAT_TYPE_INTERLEAVED,
  888. STATIC_KSDATAFORMAT_SUBTYPE_DVSD,
  889. STATIC_KSDATAFORMAT_SPECIFIER_DVINFO,
  890. },
  891. // DVINFO
  892. // Note: Audio is set for 32khz.
  893. {
  894. //for 1st 5/6 DIF seq.
  895. PAL_DVAAuxSrc, // 0xd1e030d0, // DWORD dwDVAAuxSrc;
  896. 0xffa0cf3f, // DWORD dwDVAAuxCtl;
  897. // for 2nd 5/6 DIF seq.
  898. 0xd1e03fd0, // DWORD dwDVAAuxSrc1; 32k, 12bit
  899. 0xffa0cf3f, // DWORD dwDVAAuxCtl1;
  900. //for video information
  901. 0xff20ffff, // DWORD dwDVVAuxSrc;
  902. 0xfffdc83f, // DWORD dwDVVAuxCtl;
  903. 0, // DWORD dwDVReserved[2];
  904. 0, //
  905. },
  906. #ifdef SUPPORT_NEW_AVC
  907. // AVCPRECONNECTINFO
  908. {
  909. 0, // Device ID
  910. 0, // Subunit address
  911. 0, // Subunit Plug number
  912. 0, // Data Flow
  913. 0, // Flag/Plug Handle
  914. 0, // UnitPlugNumber
  915. },
  916. #endif
  917. };
  918. //
  919. // A driver does not support both format at the same time,
  920. // the MediaType (NTSC or PAL) is determined at the load time.
  921. //
  922. PKSDATAFORMAT DVCRStream0Formats[] =
  923. {
  924. (PKSDATAFORMAT) &DvcrNTSCVideoStream,
  925. (PKSDATAFORMAT) &DvcrPALVideoStream,
  926. };
  927. PKSDATAFORMAT DVCRStream1Formats[] =
  928. {
  929. (PKSDATAFORMAT) &DvcrNTSCiavStream,
  930. (PKSDATAFORMAT) &DvcrPALiavStream,
  931. };
  932. PKSDATAFORMAT DVCRStream2Formats[] =
  933. {
  934. (PKSDATAFORMAT) &DvcrNTSCiavStreamIn,
  935. (PKSDATAFORMAT) &DvcrPALiavStreamIn,
  936. };
  937. static KSPIN_MEDIUM NULLMedium = {STATIC_GUID_NULL, 0, 0};
  938. #define NUM_DVCR_STREAM0_FORMATS (SIZEOF_ARRAY(DVCRStream0Formats))
  939. #define NUM_DVCR_STREAM1_FORMATS (SIZEOF_ARRAY(DVCRStream1Formats))
  940. #define NUM_DVCR_STREAM2_FORMATS (SIZEOF_ARRAY(DVCRStream2Formats))
  941. static GUID guidPinCategoryCapture = {STATIC_PINNAME_VIDEO_CAPTURE};
  942. static GUID guidPinNameDVVidOutput = {STATIC_PINNAME_DV_VID_OUTPUT};
  943. static GUID guidPinNameDVAVOutput = {STATIC_PINNAME_DV_AV_OUTPUT};
  944. static GUID guidPinNameDVAVInput = {STATIC_PINNAME_DV_AV_INPUT};
  945. //---------------------------------------------------------------------------
  946. // Create an array that holds the list of all of the streams supported
  947. //---------------------------------------------------------------------------
  948. STREAM_INFO_AND_OBJ DVStreams [] =
  949. {
  950. // -----------------------------------------------------------------
  951. // Stream 0, DV coming from the camcorder
  952. // -----------------------------------------------------------------
  953. {
  954. // HW_STREAM_INFORMATION -------------------------------------------
  955. {
  956. 1, // NumberOfPossibleInstances
  957. KSPIN_DATAFLOW_OUT, // DataFlow
  958. TRUE, // DataAccessible
  959. NUM_DVCR_STREAM0_FORMATS, // NumberOfFormatArrayEntries
  960. DVCRStream0Formats, // StreamFormatsArray
  961. 0, // ClassReserved[0]
  962. 0, // ClassReserved[1]
  963. 0, // ClassReserved[2]
  964. 0, // ClassReserved[3]
  965. NUMBER_VIDEO_STREAM_PROPERTIES, // NumStreamPropArrayEntries
  966. (PKSPROPERTY_SET) VideoStreamProperties, // StreamPropertiesArray
  967. NUMBER_STREAM_EVENTS_OUT_PIN, // NumStreamEventArrayEntries
  968. StreamEventsOutPin, // StreamEventsArray
  969. &guidPinCategoryCapture, // Category
  970. &guidPinNameDVVidOutput, // Name
  971. 0, // Mediums count
  972. &NULLMedium, // Mediums
  973. FALSE, // BridgeStream
  974. 0, // Reserved[0]
  975. 0, // Reserved[1]
  976. },
  977. // HW_STREAM_OBJECT ------------------------------------------------
  978. {
  979. sizeof(HW_STREAM_OBJECT),
  980. 0, // StreamNumber
  981. 0, // HwStreamExtension
  982. AVCTapeRcvDataPacket, // ReceiveDataPacket
  983. AVCTapeRcvControlPacket, // ReceiveControlPacket
  984. {
  985. (PHW_CLOCK_FUNCTION) AVCTapeStreamClockRtn, // HW_CLOCK_OBJECT.HWClockFunction
  986. CLOCK_SUPPORT_CAN_RETURN_STREAM_TIME, // HW_CLOCK_OBJECT.ClockSupportFlags
  987. 0, // HW_CLOCK_OBJECT.Reserved[0]
  988. 0, // HW_CLOCK_OBJECT.Reserved[1]
  989. },
  990. FALSE, // Dma
  991. FALSE, // Pio
  992. 0, // HwDeviceExtension
  993. sizeof(KS_FRAME_INFO), // StreamHeaderMediaSpecific
  994. 0, // StreamHeaderWorkspace
  995. FALSE, // Allocator
  996. AVCTapeEventHandler, // HwEventRoutine
  997. 0, // Reserved[0]
  998. 0, // Reserved[1]
  999. },
  1000. },
  1001. // -----------------------------------------------------------------
  1002. // Stream 1, DV coming from the camcorder (interleaved format)
  1003. // -----------------------------------------------------------------
  1004. {
  1005. // HW_STREAM_INFORMATION -------------------------------------------
  1006. {
  1007. 1, // NumberOfPossibleInstances
  1008. KSPIN_DATAFLOW_OUT, // DataFlow
  1009. TRUE, // DataAccessible
  1010. NUM_DVCR_STREAM1_FORMATS, // NumberOfFormatArrayEntries
  1011. DVCRStream1Formats, // StreamFormatsArrayf
  1012. 0, // ClassReserved[0]
  1013. 0, // ClassReserved[1]
  1014. 0, // ClassReserved[2]
  1015. 0, // ClassReserved[3]
  1016. NUMBER_VIDEO_STREAM_PROPERTIES, // NumStreamPropArrayEntries
  1017. (PKSPROPERTY_SET) VideoStreamProperties, // StreamPropertiesArray
  1018. NUMBER_STREAM_EVENTS_OUT_PIN, // NumStreamEventArrayEntries
  1019. StreamEventsOutPin, // StreamEventsArray
  1020. &guidPinCategoryCapture, // Category
  1021. &guidPinNameDVAVOutput, // Name
  1022. 0, // Mediums count
  1023. &NULLMedium, // Mediums
  1024. FALSE, // BridgeStream
  1025. 0, // Reserved[0]
  1026. 0, // Reserved[1]
  1027. },
  1028. // HW_STREAM_OBJECT ------------------------------------------------
  1029. {
  1030. sizeof(HW_STREAM_OBJECT),
  1031. 1, // StreamNumber
  1032. 0, // HwStreamExtension
  1033. AVCTapeRcvDataPacket, // ReceiveDataPacket
  1034. AVCTapeRcvControlPacket, // ReceiveControlPacket
  1035. {
  1036. (PHW_CLOCK_FUNCTION) AVCTapeStreamClockRtn, // HW_CLOCK_OBJECT.HWClockFunction
  1037. CLOCK_SUPPORT_CAN_RETURN_STREAM_TIME, // HW_CLOCK_OBJECT.ClockSupportFlags
  1038. 0, // HW_CLOCK_OBJECT.Reserved[0]
  1039. 0, // HW_CLOCK_OBJECT.Reserved[1]
  1040. },
  1041. FALSE, // Dma
  1042. FALSE, // Pio
  1043. 0, // HwDeviceExtension
  1044. 0, // StreamHeaderMediaSpecific
  1045. 0, // StreamHeaderWorkspace
  1046. FALSE, // Allocator
  1047. AVCTapeEventHandler, // HwEventRoutine
  1048. 0, // Reserved[0]
  1049. 0, // Reserved[1]
  1050. },
  1051. },
  1052. // -----------------------------------------------------------------
  1053. // Stream 2, DV flows out of the adapter (interleaved)
  1054. // -----------------------------------------------------------------
  1055. {
  1056. // HW_STREAM_INFORMATION -------------------------------------------
  1057. {
  1058. 1, // NumberOfPossibleInstances
  1059. KSPIN_DATAFLOW_IN, // DataFlow
  1060. TRUE, // DataAccessible
  1061. NUM_DVCR_STREAM2_FORMATS, // NumberOfFormatArrayEntries
  1062. DVCRStream2Formats, // StreamFormatsArray
  1063. 0, // ClassReserved[0]
  1064. 0, // ClassReserved[1]
  1065. 0, // ClassReserved[2]
  1066. 0, // ClassReserved[3]
  1067. NUMBER_VIDEO_STREAM_PROPERTIES, // NumStreamPropArrayEntries
  1068. (PKSPROPERTY_SET) VideoStreamProperties, // StreamPropertiesArray
  1069. NUMBER_STREAM_EVENTS_IN_PIN, // NumStreamEventArrayEntries
  1070. StreamEventsInPin, // StreamEventsArray
  1071. NULL, // Category
  1072. &guidPinNameDVAVInput, // Name
  1073. 0, // Mediums count
  1074. &NULLMedium, // Mediums
  1075. FALSE, // BridgeStream
  1076. 0, // Reserved[0]
  1077. 0, // Reserved[1]
  1078. },
  1079. // HW_STREAM_OBJECT ------------------------------------------------
  1080. {
  1081. sizeof(HW_STREAM_OBJECT),
  1082. 2, // StreamNumber
  1083. 0, // HwStreamExtension
  1084. AVCTapeRcvDataPacket, // ReceiveDataPacket
  1085. AVCTapeRcvControlPacket, // ReceiveControlPacket
  1086. {
  1087. (PHW_CLOCK_FUNCTION) AVCTapeStreamClockRtn, // HW_CLOCK_OBJECT.HWClockFunction
  1088. CLOCK_SUPPORT_CAN_RETURN_STREAM_TIME, // HW_CLOCK_OBJECT.ClockSupportFlags
  1089. 0, // HW_CLOCK_OBJECT.Reserved[0]
  1090. 0, // HW_CLOCK_OBJECT.Reserved[1]
  1091. },
  1092. FALSE, // Dma
  1093. FALSE, // Pio
  1094. 0, // HwDeviceExtension
  1095. 0, // StreamHeaderMediaSpecific
  1096. 0, // StreamHeaderWorkspace
  1097. FALSE, // Allocator
  1098. AVCTapeEventHandler, // HwEventRoutine
  1099. 0, // Reserved[0]
  1100. 0, // Reserved[1]
  1101. }
  1102. }
  1103. };
  1104. #define DV_STREAM_COUNT (SIZEOF_ARRAY(DVStreams))
  1105. /**********************************************************************
  1106. MPEG2TS data range
  1107. **********************************************************************/
  1108. static GUID guidPinNameMPEG2TSOutput = {STATIC_PINNAME_MPEG2TS_OUTPUT};
  1109. static GUID guidPinNameMPEG2TSInput = {STATIC_PINNAME_MPEG2TS_INPUT};
  1110. //
  1111. // Default buffer setting for MPEG2TS
  1112. //
  1113. #define SRC_PACKETS_PER_MPEG2TS_FRAME 256 // Variable length
  1114. #define BUFFER_SIZE_MPEG2TS (((CIP_DBS_MPEG << 2) * (1 << CIP_FN_MPEG) - 4) * SRC_PACKETS_PER_MPEG2TS_FRAME)
  1115. #define BUFFER_SIZE_MPEG2TS_SPH (((CIP_DBS_MPEG << 2) * (1 << CIP_FN_MPEG) ) * SRC_PACKETS_PER_MPEG2TS_FRAME)
  1116. #define NUM_OF_RCV_BUFFERS_MPEG2TS MAX_DATA_BUFFERS
  1117. #define NUM_OF_XMT_BUFFERS_MPEG2TS MAX_DATA_BUFFERS
  1118. // These values are from the "Blue book" Part 4 P. 9-10
  1119. // transmission rate:
  1120. // Src Pkt/cycle
  1121. // 1/8 : 188/8 bytes * 8000 cycles * 8 bits/byte = 1,504,000 bits/sec
  1122. // ...
  1123. // 1/2 : 188/2 bytes * 8000 cycles * 8 bits/byte = 6,015,000 bits/sec
  1124. // 1 : 188 bytes * 8000 cycles * 8 bits/byte = 12,032,000 bits/sec
  1125. // 5 : 188*5 bytes * 8000 cycles * 8 bits/byte = 60,160,000 bits/sec
  1126. //
  1127. // this structure reuqires inclusion of "bdatypes.h" for MPEG2_TRANSPORT_STRIDE
  1128. typedef struct tagKS_DATARANGE_MPEG2TS_STRIDE_AVC {
  1129. KSDATARANGE DataRange;
  1130. MPEG2_TRANSPORT_STRIDE Stride;
  1131. AVCPRECONNECTINFO ConnectInfo;
  1132. } KS_DATARANGE_MPEG2TS_STRIDE_AVC, *PKS_DATARANGE_MPEG2TS_STRIDE_AVC;
  1133. KS_DATARANGE_MPEG2TS_STRIDE_AVC
  1134. MPEG2TStreamOutStride =
  1135. {
  1136. // KSDATARANGE
  1137. {
  1138. #ifdef SUPPORT_NEW_AVC
  1139. sizeof(KS_DATARANGE_MPEG2TS_STRIDE_AVC), // FormatSize
  1140. #else
  1141. sizeof(KS_DATARANGE_MPEG2TS_STRIDE_AVC) - sizeof(AVCPRECONNECTINFO), // FormatSize; exclude AVCPRECONNECTINFO
  1142. #endif
  1143. 0, // Flags
  1144. BUFFER_SIZE_MPEG2TS_SPH, // SampleSize with SPH:192*N
  1145. 0, // Reserved
  1146. STATIC_KSDATAFORMAT_TYPE_STREAM,
  1147. STATIC_KSDATAFORMAT_TYPE_MPEG2_TRANSPORT_STRIDE,
  1148. // If there is a format block (like MPEG2_TRANSPORT_STRIDE),
  1149. // the specifier cannot use STATIC_KSDATAFORMAT_SPECIFIER_NONE or _WILDCARD
  1150. STATIC_KSDATAFORMAT_SPECIFIER_61883_4,
  1151. },
  1152. // MPEG2_TRANSPORT_STRIDE
  1153. {
  1154. MPEG2TS_STRIDE_OFFSET, // 4
  1155. MPEG2TS_STRIDE_PACKET_LEN, // 188
  1156. MPEG2TS_STRIDE_STRIDE_LEN, // 192
  1157. },
  1158. #ifdef SUPPORT_NEW_AVC
  1159. // AVCPRECONNECTINFO
  1160. {
  1161. 0, // Device ID
  1162. 0, // Subunit address
  1163. 0, // Subunit Plug number
  1164. 0, // Data Flow
  1165. 0, // Flag/Plug handle
  1166. 0, // UnitPlugNumber
  1167. },
  1168. #endif
  1169. };
  1170. KS_DATARANGE_MPEG2TS_AVC
  1171. MPEG2TStreamOut =
  1172. {
  1173. // KSDATARANGE
  1174. {
  1175. #ifdef SUPPORT_NEW_AVC
  1176. sizeof(KS_DATARANGE_MPEG2TS_AVC), // FormatSize
  1177. #else
  1178. sizeof(KS_DATARANGE_MPEG2TS_AVC) - sizeof(AVCPRECONNECTINFO), // FormatSize; exclude AVCPRECONNECTINFO
  1179. #endif
  1180. 0, // Flags
  1181. BUFFER_SIZE_MPEG2TS, // SampleSize:188*N
  1182. 0, // Reserved
  1183. STATIC_KSDATAFORMAT_TYPE_STREAM,
  1184. STATIC_KSDATAFORMAT_TYPE_MPEG2_TRANSPORT,
  1185. STATIC_KSDATAFORMAT_SPECIFIER_NONE,
  1186. },
  1187. #ifdef SUPPORT_NEW_AVC
  1188. // AVCPRECONNECTINFO
  1189. {
  1190. 0, // Device ID
  1191. 0, // Subunit address
  1192. 0, // Subunit Plug number
  1193. 0, // Data Flow
  1194. 0, // Flag/Plug handle
  1195. 0, // UnitPlugNumber
  1196. },
  1197. #endif
  1198. };
  1199. KS_DATARANGE_MPEG2TS_STRIDE_AVC
  1200. MPEG2TStreamInStride =
  1201. {
  1202. // KSDATARANGE
  1203. {
  1204. #ifdef SUPPORT_NEW_AVC
  1205. sizeof(KS_DATARANGE_MPEG2TS_STRIDE_AVC), // FormatSize
  1206. #else
  1207. sizeof(KS_DATARANGE_MPEG2TS_STRIDE_AVC) - sizeof(AVCPRECONNECTINFO), // FormatSize; exclude AVCPRECONNECTINFO
  1208. #endif
  1209. 0, // Flags
  1210. BUFFER_SIZE_MPEG2TS_SPH, // SampleSize with SPH:192*N
  1211. 0, // Reserved
  1212. STATIC_KSDATAFORMAT_TYPE_STREAM,
  1213. STATIC_KSDATAFORMAT_TYPE_MPEG2_TRANSPORT_STRIDE,
  1214. // If there is a format block (like MPEG2_TRANSPORT_STRIDE),
  1215. // the specifier cannot use STATIC_KSDATAFORMAT_SPECIFIER_NONE or _WILDCARD
  1216. STATIC_KSDATAFORMAT_SPECIFIER_61883_4,
  1217. },
  1218. // MPEG2_TRANSPORT_STRIDE
  1219. {
  1220. MPEG2TS_STRIDE_OFFSET, // 4
  1221. MPEG2TS_STRIDE_PACKET_LEN, // 188
  1222. MPEG2TS_STRIDE_STRIDE_LEN, // 192
  1223. },
  1224. #ifdef SUPPORT_NEW_AVC
  1225. // AVCPRECONNECTINFO
  1226. {
  1227. 0, // Device ID
  1228. 0, // Subunit address
  1229. 0, // Subunit Plug number
  1230. 0, // Data Flow
  1231. 0, // Flag/Plug handle
  1232. 0, // UnitPlugNumber
  1233. },
  1234. #endif
  1235. };
  1236. PKSDATAFORMAT MPEG2TStream0Formats[] =
  1237. {
  1238. (PKSDATAFORMAT) &MPEG2TStreamOutStride,
  1239. (PKSDATAFORMAT) &MPEG2TStreamOut,
  1240. };
  1241. #define NUM_MPEG_STREAM0_FORMATS (SIZEOF_ARRAY(MPEG2TStream0Formats))
  1242. PKSDATAFORMAT MPEG2TStream1Formats[] =
  1243. {
  1244. (PKSDATAFORMAT) &MPEG2TStreamInStride,
  1245. };
  1246. #define NUM_MPEG_STREAM1_FORMATS (SIZEOF_ARRAY(MPEG2TStream1Formats))
  1247. STREAM_INFO_AND_OBJ MPEGStreams [] =
  1248. {
  1249. // -----------------------------------------------------------------
  1250. // Stream 0, MPEG2 TS coming from the AV device
  1251. // -----------------------------------------------------------------
  1252. {
  1253. // HW_STREAM_INFORMATION -------------------------------------------
  1254. {
  1255. 1, // NumberOfPossibleInstances
  1256. KSPIN_DATAFLOW_OUT, // DataFlow
  1257. TRUE, // DataAccessible
  1258. NUM_MPEG_STREAM0_FORMATS, // NumberOfFormatArrayEntries
  1259. MPEG2TStream0Formats, // StreamFormatsArray
  1260. 0, // ClassReserved[0]
  1261. 0, // ClassReserved[1]
  1262. 0, // ClassReserved[2]
  1263. 0, // ClassReserved[3]
  1264. NUMBER_VIDEO_STREAM_PROPERTIES, // NumStreamPropArrayEntries
  1265. (PKSPROPERTY_SET) VideoStreamProperties, // StreamPropertiesArray
  1266. 0, // NUMBER_STREAM_EVENTS, // NumStreamEventArrayEntries
  1267. NULL, // StreamEvents,
  1268. &guidPinCategoryCapture, // Category
  1269. &guidPinNameMPEG2TSOutput, // Name
  1270. 0, // MediumsCount
  1271. NULL, // Mediums
  1272. FALSE, // BridgeStream
  1273. 0,
  1274. 0
  1275. },
  1276. // HW_STREAM_OBJECT ------------------------------------------------
  1277. {
  1278. sizeof(HW_STREAM_OBJECT),
  1279. 0, // StreamNumber
  1280. 0, // HwStreamExtension
  1281. AVCTapeRcvDataPacket, // ReceiveDataPacket
  1282. AVCTapeRcvControlPacket, // ReceiveControlPacket
  1283. {
  1284. #if 0
  1285. (PHW_CLOCK_FUNCTION) AVCTapeStreamClockRtn, // HW_CLOCK_OBJECT.HWClockFunction
  1286. CLOCK_SUPPORT_CAN_RETURN_STREAM_TIME, // HW_CLOCK_OBJECT.ClockSupportFlags
  1287. #else
  1288. (PHW_CLOCK_FUNCTION) NULL, // HW_CLOCK_OBJECT.HWClockFunction
  1289. 0, // HW_CLOCK_OBJECT.ClockSupportFlags
  1290. #endif
  1291. 0, // HW_CLOCK_OBJECT.Reserved[0]
  1292. 0, // HW_CLOCK_OBJECT.Reserved[1]
  1293. },
  1294. FALSE, // Dma
  1295. FALSE, // Pio
  1296. 0, // HwDeviceExtension
  1297. 0, // StreamHeaderMediaSpecific
  1298. 0, // StreamHeaderWorkspace
  1299. FALSE, // Allocator
  1300. NULL, // EventRoutine
  1301. 0, // Reserved[0]
  1302. 0, // Reserved[1]
  1303. },
  1304. },
  1305. // -----------------------------------------------------------------
  1306. // Stream 1, MPEG2 TS from adapter to the AV device
  1307. // -----------------------------------------------------------------
  1308. {
  1309. // HW_STREAM_INFORMATION -------------------------------------------
  1310. {
  1311. 1, // NumberOfPossibleInstances
  1312. KSPIN_DATAFLOW_IN, // DataFlow
  1313. TRUE, // DataAccessible
  1314. NUM_MPEG_STREAM1_FORMATS, // NumberOfFormatArrayEntries
  1315. MPEG2TStream1Formats, // StreamFormatsArray
  1316. 0, // ClassReserved[0]
  1317. 0, // ClassReserved[1]
  1318. 0, // ClassReserved[2]
  1319. 0, // ClassReserved[3]
  1320. NUMBER_VIDEO_STREAM_PROPERTIES, // NumStreamPropArrayEntries
  1321. (PKSPROPERTY_SET) VideoStreamProperties, // StreamPropertiesArray
  1322. NUMBER_STREAM_EVENTS_IN_PIN_MPEG2TS, // NumStreamEventArrayEntries
  1323. StreamEventsInPinMPEG2TS, // StreamEventsArray
  1324. &guidPinCategoryCapture, // Category
  1325. &guidPinNameMPEG2TSInput, // Name
  1326. 0, // MediumsCount
  1327. NULL, // Mediums
  1328. FALSE, // BridgeStream
  1329. 0,
  1330. 0
  1331. },
  1332. // HW_STREAM_OBJECT ------------------------------------------------
  1333. {
  1334. sizeof(HW_STREAM_OBJECT),
  1335. 1, // StreamNumber
  1336. 0, // HwStreamExtension
  1337. AVCTapeRcvDataPacket, // ReceiveDataPacket
  1338. AVCTapeRcvControlPacket, // ReceiveControlPacket
  1339. {
  1340. #if 0
  1341. (PHW_CLOCK_FUNCTION) AVCTapeStreamClockRtn, // HW_CLOCK_OBJECT.HWClockFunction
  1342. CLOCK_SUPPORT_CAN_RETURN_STREAM_TIME, // HW_CLOCK_OBJECT.ClockSupportFlags
  1343. #else
  1344. (PHW_CLOCK_FUNCTION) NULL, // HW_CLOCK_OBJECT.HWClockFunction
  1345. 0, // HW_CLOCK_OBJECT.ClockSupportFlags
  1346. #endif
  1347. 0, // HW_CLOCK_OBJECT.Reserved[0]
  1348. 0, // HW_CLOCK_OBJECT.Reserved[1]
  1349. },
  1350. FALSE, // Dma
  1351. FALSE, // Pio
  1352. 0, // HwDeviceExtension
  1353. 0, // StreamHeaderMediaSpecific
  1354. 0, // StreamHeaderWorkspace
  1355. FALSE, // Allocator
  1356. NULL, // EventRoutine
  1357. 0, // Reserved[0]
  1358. 0, // Reserved[1]
  1359. },
  1360. }
  1361. };
  1362. #define MPEG_STREAM_COUNT (SIZEOF_ARRAY(MPEGStreams))
  1363. /**********************************************************************
  1364. Supported AVC Stream format information table
  1365. **********************************************************************/
  1366. #define BLOCK_PERIOD_MPEG2TS 192 // number of 1394 cycle offset to send one block
  1367. AVCSTRM_FORMAT_INFO AVCStrmFormatInfoTable[] = {
  1368. //
  1369. // SDDV_NTSC
  1370. //
  1371. {
  1372. sizeof(AVCSTRM_FORMAT_INFO),
  1373. AVCSTRM_FORMAT_SDDV_NTSC,
  1374. {
  1375. 0,0,
  1376. CIP_DBS_SDDV,
  1377. CIP_FN_DV,
  1378. CIP_QPC_DV,
  1379. CIP_SPH_DV,0,
  1380. 0
  1381. }, // CIP header[0]
  1382. {
  1383. 0x2,
  1384. CIP_FMT_DV,
  1385. CIP_60_FIELDS,
  1386. CIP_STYPE_DV, 0,
  1387. 0
  1388. }, // CIP header[1]
  1389. SRC_PACKETS_PER_NTSC_FRAME,
  1390. FRAME_SIZE_SDDV_NTSC,
  1391. NUM_OF_RCV_BUFFERS_DV,
  1392. NUM_OF_XMT_BUFFERS_DV,
  1393. FALSE, // No source header
  1394. FRAME_TIME_NTSC,
  1395. BLOCK_PERIOD_2997,
  1396. 0,0,0,0,
  1397. },
  1398. //
  1399. // SDDV_PAL
  1400. //
  1401. {
  1402. sizeof(AVCSTRM_FORMAT_INFO),
  1403. AVCSTRM_FORMAT_SDDV_PAL,
  1404. {
  1405. 0,0,
  1406. CIP_DBS_SDDV,
  1407. CIP_FN_DV,
  1408. CIP_QPC_DV,
  1409. CIP_SPH_DV,0,
  1410. 0
  1411. }, // CIP header[0]
  1412. {
  1413. 0x2,
  1414. CIP_FMT_DV,
  1415. CIP_50_FIELDS,
  1416. CIP_STYPE_DV, 0,
  1417. 0
  1418. }, // CIP header[1]
  1419. SRC_PACKETS_PER_PAL_FRAME,
  1420. FRAME_SIZE_SDDV_PAL,
  1421. NUM_OF_RCV_BUFFERS_DV,
  1422. NUM_OF_XMT_BUFFERS_DV,
  1423. FALSE, // No source header
  1424. FRAME_TIME_PAL,
  1425. BLOCK_PERIOD_25,
  1426. 0,0,0,0,
  1427. },
  1428. //
  1429. // MPEG2TS
  1430. //
  1431. {
  1432. sizeof(AVCSTRM_FORMAT_INFO),
  1433. AVCSTRM_FORMAT_MPEG2TS,
  1434. {
  1435. 0,0,
  1436. CIP_DBS_MPEG,
  1437. CIP_FN_MPEG,
  1438. CIP_QPC_MPEG,
  1439. CIP_SPH_MPEG,0,
  1440. 0
  1441. }, // CIP header[0]
  1442. {
  1443. 0x2,
  1444. CIP_FMT_MPEG,
  1445. CIP_TSF_OFF,\
  1446. 0, 0,
  1447. 0
  1448. }, // CIP header[1]
  1449. SRC_PACKETS_PER_MPEG2TS_FRAME, // Default
  1450. BUFFER_SIZE_MPEG2TS_SPH, // Default
  1451. NUM_OF_RCV_BUFFERS_MPEG2TS,
  1452. NUM_OF_XMT_BUFFERS_MPEG2TS,
  1453. FALSE, // Strip source packet header
  1454. FRAME_TIME_NTSC,
  1455. BLOCK_PERIOD_MPEG2TS,
  1456. 0,0,0,0,
  1457. },
  1458. //
  1459. // HDDV_NTSC
  1460. // ...
  1461. //
  1462. // HDDV_PAL
  1463. // ...
  1464. //
  1465. // SDLDV_NTSC
  1466. // ...
  1467. //
  1468. // SDLDV_PAL
  1469. // ...
  1470. };
  1471. #endif // _DVSTRM_INC