Source code of Windows XP (NT5)
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.

7079 lines
212 KiB

  1. //**************************************************************************
  2. //
  3. // Title : DVDWdm.cpp
  4. //
  5. // Date : 1997.11.28 1st making
  6. //
  7. // Author : Toshiba [PCS](PSY) Hideki Yagi
  8. //
  9. // Copyright 1997-1998 Toshiba Corporation. All Rights Reserved.
  10. //
  11. // -------------------------------------------------------------------------
  12. //
  13. // Change log :
  14. //
  15. // Date Revision Description
  16. // ------------ ---------- -----------------------------------------------
  17. // 1997.11.28 000.0000 1st making.
  18. //
  19. //**************************************************************************
  20. // K.Ishizaki
  21. #define DBG_CTRL
  22. // End
  23. #include "includes.h"
  24. #include "hal.h"
  25. #include "wdmkserv.h"
  26. #include "mpevent.h"
  27. #include "classlib.h"
  28. #include "ctime.h"
  29. #include "schdat.h"
  30. #include "ccque.h"
  31. #include "ctvctrl.h"
  32. #include "hlight.h"
  33. #include "hwdevex.h"
  34. #include "wdmbuff.h"
  35. #include "dvdinit.h"
  36. #include "dvdwdm.h"
  37. #include "wrapdef.h"
  38. //--- 98.06.01 S.Watanabe
  39. #include <mmsystem.h>
  40. //--- End.
  41. #include "ssif.h"
  42. #include "strmid.h"
  43. //--- 98.06.01 S.Watanabe
  44. //#include <mmsystem.h>
  45. //--- End.
  46. //
  47. // Pin name GUIDs - hopefully some day these will be added to ksmedia.h
  48. //
  49. #define STATIC_PINNAME_DVD_VIDEOIN \
  50. 0x33AD5F43, 0xF1BC, 0x11D1, 0x94, 0xA5, 0x00, 0x00, 0xF8, 0x05, 0x34, 0x84
  51. #define STATIC_PINNAME_DVD_VPEOUT \
  52. 0x33AD5F44, 0xF1BC, 0x11D1, 0x94, 0xA5, 0x00, 0x00, 0xF8, 0x05, 0x34, 0x84
  53. #define STATIC_PINNAME_DVD_AUDIOIN \
  54. 0x33AD5F45, 0xF1BC, 0x11D1, 0x94, 0xA5, 0x00, 0x00, 0xF8, 0x05, 0x34, 0x84
  55. #define STATIC_PINNAME_DVD_CCOUT \
  56. 0x33AD5F46, 0xF1BC, 0x11D1, 0x94, 0xA5, 0x00, 0x00, 0xF8, 0x05, 0x34, 0x84
  57. #define STATIC_PINNAME_DVD_SUBPICIN \
  58. 0x33AD5F47, 0xF1BC, 0x11D1, 0x94, 0xA5, 0x00, 0x00, 0xF8, 0x05, 0x34, 0x84
  59. #define STATIC_PINNAME_DVD_NTSCOUT \
  60. 0x33AD5F48, 0xF1BC, 0x11D1, 0x94, 0xA5, 0x00, 0x00, 0xF8, 0x05, 0x34, 0x84
  61. GUID g_PINNAME_DVD_VIDEOIN = {STATIC_PINNAME_DVD_VIDEOIN};
  62. GUID g_PINNAME_DVD_VPEOUT = {STATIC_PINNAME_DVD_VPEOUT};
  63. GUID g_PINNAME_DVD_CCOUT = {STATIC_PINNAME_DVD_CCOUT};
  64. GUID g_PINNAME_DVD_AUDIOIN = {STATIC_PINNAME_DVD_AUDIOIN};
  65. GUID g_PINNAME_DVD_SUBPICIN = {STATIC_PINNAME_DVD_SUBPICIN};
  66. GUID g_PINNAME_DVD_NTSCOUT = {STATIC_PINNAME_DVD_NTSCOUT};
  67. //#define LOWSENDDATA
  68. BOOL InitialHwDevExt( PHW_DEVICE_EXTENSION pHwDevExt );
  69. //--- 98.06.02 S.Watanabe
  70. BOOL SetCppFlag( PHW_DEVICE_EXTENSION pHwDevExt, BOOL NeedNotify );
  71. //--- End.
  72. //--- 98.06.01 S.Watanabe
  73. #ifdef DBG
  74. char * DebugLLConvtoStr( ULONGLONG val, int base );
  75. #endif
  76. //--- End.
  77. //--- 98.09.07 S.Watanabe
  78. VOID TimeoutCancelSrb(IN PHW_STREAM_REQUEST_BLOCK pSrb);
  79. VOID LowTimeoutCancelSrb(IN PHW_STREAM_REQUEST_BLOCK pSrb);
  80. //--- End.
  81. /**** Test OSD ***/
  82. #include "erase.h"
  83. ////// for only under constructions, MS will provide it in official release.
  84. KSPIN_MEDIUM VPMedium[] = {
  85. STATIC_KSMEDIUMSETID_VPBus,
  86. 0,
  87. 0
  88. };
  89. BOOL WriteDataChangeHwStreamState( IN PHW_DEVICE_EXTENSION pHwDevExt )
  90. {
  91. DWORD dProp;
  92. switch( pHwDevExt->StreamState )
  93. {
  94. case StreamState_Off:
  95. DBG_PRINTF((" Stream State is Off?????\r\n" ));
  96. DBG_BREAK();
  97. return FALSE; // Stream�̏��Ԃ���������
  98. case StreamState_Stop:
  99. if( pHwDevExt->dvdstrm.GetState() != Stop )
  100. {
  101. #ifndef REARRANGEMENT
  102. // FlushQueue(pHwDevExt);
  103. #endif REARRANGEMENT
  104. if( pHwDevExt->dvdstrm.Stop() == FALSE )
  105. {
  106. DBG_PRINTF(("HwStreamChange Error..... LINE=%d\r\n", __LINE__ ));
  107. DBG_BREAK();
  108. return FALSE;
  109. };
  110. };
  111. DBG_BREAK();
  112. return FALSE; // Stream�̏��Ԃ���������
  113. case StreamState_Pause:
  114. if( pHwDevExt->dvdstrm.GetState() != Pause )
  115. {
  116. if( pHwDevExt->dvdstrm.Pause() == FALSE )
  117. {
  118. DBG_PRINTF(("HwStreamChange Error..... LINE=%d\r\n", __LINE__ ));
  119. DBG_BREAK();
  120. return FALSE;
  121. };
  122. };
  123. break;
  124. case StreamState_Play:
  125. // Normal Play
  126. if( pHwDevExt->Rate == 10000 )
  127. {
  128. switch( pHwDevExt->dvdstrm.GetState() )
  129. {
  130. case PowerOff:
  131. DBG_PRINTF((" Stream State is Off?????\r\n" ));
  132. DBG_BREAK();
  133. return FALSE; // Stream�̏��Ԃ���������
  134. case Stop:
  135. if( pHwDevExt->dvdstrm.Pause() == FALSE )
  136. {
  137. DBG_PRINTF(("HwStreamChange Error..... LINE=%d\r\n", __LINE__ ));
  138. DBG_BREAK();
  139. return FALSE;
  140. };
  141. case Scan:
  142. case Slow:
  143. case Pause:
  144. if( pHwDevExt->dvdstrm.Play() == FALSE )
  145. {
  146. DBG_PRINTF(("HwStreamChange Error..... LINE=%d\r\n", __LINE__ ));
  147. DBG_BREAK();
  148. return FALSE;
  149. };
  150. dProp = pHwDevExt->m_ClosedCaption;
  151. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_ClosedCaption, &dProp ) )
  152. {
  153. DBG_PRINTF( ("DVDWDM: ClosedCaption Error\n\r") );
  154. DBG_BREAK();
  155. }
  156. break;
  157. case Play:
  158. break;
  159. };
  160. };
  161. if( pHwDevExt->Rate < 10000 ) // Scan Mode
  162. {
  163. switch( pHwDevExt->dvdstrm.GetState() )
  164. {
  165. case PowerOff:
  166. DBG_PRINTF((" Stream State is Off?????\r\n" ));
  167. DBG_BREAK();
  168. return FALSE; // Stream�̏��Ԃ���������
  169. case Stop:
  170. if( pHwDevExt->dvdstrm.Pause() == FALSE )
  171. {
  172. DBG_PRINTF(("HwStreamChange Error..... LINE=%d\r\n", __LINE__ ));
  173. DBG_BREAK();
  174. return FALSE;
  175. };
  176. case Slow:
  177. case Pause:
  178. case Play:
  179. if( pHwDevExt->dvdstrm.Scan( ScanOnlyI ) == FALSE )
  180. {
  181. DBG_PRINTF(("HwStreamChange Error..... LINE=%d\r\n", __LINE__ ));
  182. DBG_BREAK();
  183. return FALSE;
  184. };
  185. dProp = ClosedCaption_Off;
  186. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_ClosedCaption, &dProp ) ){
  187. DBG_PRINTF( ("DVDWDM: ClosedCaption Error\n\r") );
  188. DBG_BREAK();
  189. }
  190. break;
  191. case Scan:
  192. break;
  193. };
  194. }
  195. if( pHwDevExt->Rate > 10000 ) // Slow Mode
  196. {
  197. switch( pHwDevExt->dvdstrm.GetState() )
  198. {
  199. case PowerOff:
  200. DBG_PRINTF((" Stream State is Off?????\r\n" ));
  201. DBG_BREAK();
  202. return FALSE; // Stream�̏��Ԃ���������
  203. case Stop:
  204. if( pHwDevExt->dvdstrm.Pause() == FALSE )
  205. {
  206. DBG_PRINTF(("HwStreamChange Error..... LINE=%d\r\n", __LINE__ ));
  207. DBG_BREAK();
  208. return FALSE;
  209. };
  210. case Pause:
  211. case Play:
  212. case Scan:
  213. dProp = pHwDevExt->Rate/10000;
  214. if( dProp>1 && dProp<16 ){
  215. if( !pHwDevExt->dvdstrm.Slow( dProp ) ){
  216. DBG_PRINTF( ("DVDWDM: dvdstrm.Slow Error\n\r") );
  217. DBG_BREAK();
  218. }
  219. }else{
  220. DBG_PRINTF( ("DVDWDM: Slow Speed is invalid 0x%0x\n\r", dProp ) );
  221. DBG_BREAK();
  222. }
  223. dProp = pHwDevExt->m_ClosedCaption;
  224. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_ClosedCaption, &dProp ) )
  225. {
  226. DBG_PRINTF( ("DVDWDM: ClosedCaption Error\n\r") );
  227. DBG_BREAK();
  228. }
  229. break;
  230. case Slow:
  231. break;
  232. };
  233. };
  234. break;
  235. default:
  236. DBG_PRINTF((" Stream State Error!!!! Line = %d\r\n", __LINE__ ));
  237. DBG_BREAK();
  238. return FALSE;
  239. };
  240. return TRUE;
  241. };
  242. /******/
  243. extern "C" VOID STREAMAPI AdapterReceivePacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  244. {
  245. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  246. DBG_PRINTF( ( "DVDWDM:AdapterReceivePacket pSrb=0x%x\n\r",pSrb) );
  247. pSrb->Status = STATUS_PENDING;
  248. switch( pSrb->Command ){
  249. case SRB_INITIALIZE_DEVICE:
  250. case SRB_OPEN_STREAM:
  251. case SRB_CLOSE_STREAM:
  252. case SRB_CHANGE_POWER_STATE:
  253. StreamClassCallAtNewPriority(NULL,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowAdapterReceivePacket,pSrb);
  254. DeviceNextDeviceNotify( pSrb );
  255. return;
  256. };
  257. switch( pSrb->Command ){
  258. case SRB_GET_STREAM_INFO:
  259. DBG_PRINTF( ( "DVDWDM: SRB_GET_STREAM_INFO\n\r") );
  260. GetStreamInfo( pSrb );
  261. pSrb->Status = STATUS_SUCCESS;
  262. break;
  263. case SRB_OPEN_DEVICE_INSTANCE:
  264. DBG_PRINTF( ( "DVDWDM: SRB_OPEN_DEVICE_INSTANCE\n\r") );
  265. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  266. break;
  267. case SRB_CLOSE_DEVICE_INSTANCE:
  268. DBG_PRINTF( ( "DVDWDM: SRB_CLOSE_DEVICE_INSTANCE\n\r") );
  269. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  270. break;
  271. case SRB_GET_DEVICE_PROPERTY:
  272. DBG_PRINTF( ( "DVDWDM: SRB_GET_DEVICE_PROPERTY\n\r") );
  273. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  274. break;
  275. case SRB_SET_DEVICE_PROPERTY:
  276. DBG_PRINTF( ( "DVDWDM: SRB_SET_DEVICE_PROPERTY\n\r") );
  277. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  278. break;
  279. case SRB_UNINITIALIZE_DEVICE:
  280. DBG_PRINTF( ( "DVDWDM: SRB_UNINITIALIZE_DEVICE\n\r") );
  281. pSrb->Status = STATUS_SUCCESS;
  282. break;
  283. case SRB_UNKNOWN_DEVICE_COMMAND:
  284. DBG_PRINTF( ( "DVDWDM: SRB_UNKNOWN_DEVICE_COMMAND\n\r") );
  285. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  286. break;
  287. case SRB_PAGING_OUT_DRIVER:
  288. DBG_PRINTF( ( "DVDWDM: SRB_PAGING_OUT_DRIVER\n\r") );
  289. //////////// Yagi
  290. pSrb->Status = STATUS_SUCCESS;
  291. break;
  292. case SRB_INITIALIZATION_COMPLETE:
  293. DBG_PRINTF( ( "DVDWDM: SRB_INITIALIZATION_COMPLETE\n\r") );
  294. //////////// Yagi
  295. pSrb->Status = STATUS_SUCCESS;
  296. break;
  297. case SRB_GET_DATA_INTERSECTION:
  298. DBG_PRINTF( ( "DVDWDM: SRB_GET_DATA_INTERSECTION\n\r") );
  299. pSrb->Status = DataIntersection( pSrb );
  300. break;
  301. default:
  302. DBG_PRINTF( ( "DVDWDM: SRB(default)=0x%04x\n\r", pSrb->Command) );
  303. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  304. DBG_BREAK();
  305. break;
  306. }
  307. DeviceNextDeviceNotify( pSrb );
  308. DeviceCompleteNotify( pSrb );
  309. }
  310. /******/
  311. VOID LowAdapterReceivePacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  312. //extern "C" VOID STREAMAPI AdapterReceivePacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  313. {
  314. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  315. DBG_PRINTF( ( "DVDWDM:LowAdapterReceivePacket pSrb=0x%x\n\r",pSrb) );
  316. pSrb->Status = STATUS_SUCCESS;
  317. // 1999.1.11 Ishizaki
  318. if( (pSrb->Command == SRB_CHANGE_POWER_STATE)
  319. && (pSrb->CommandData.DeviceState == PowerDeviceD3) ){
  320. LIBSTATE st = pHwDevExt->dvdstrm.GetState();
  321. if((st != Stop) && (st != PowerOff) ){
  322. PHW_STREAM_REQUEST_BLOCK pTmp;
  323. #ifndef REARRANGEMENT
  324. // FlushQueue(pHwDevExt);
  325. #endif REARRANGEMENT
  326. if( !pHwDevExt->dvdstrm.Stop() ){
  327. DBG_PRINTF( ("DVDWDM: dvdstrm.Stop Error\n\r") );
  328. }
  329. // Flush Scheduler SRB queue.
  330. while( (pTmp=pHwDevExt->scheduler.getSRB())!=NULL ){
  331. pTmp->Status = STATUS_SUCCESS;
  332. CallAtDeviceCompleteNotify(pTmp, pTmp->Status);
  333. }
  334. // Flush C.C. queue.
  335. while( (pTmp=pHwDevExt->ccque.get())!=NULL ){
  336. pTmp->Status = STATUS_SUCCESS;
  337. CallAtDeviceCompleteNotify(pTmp, pTmp->Status);
  338. }
  339. }
  340. }
  341. // End
  342. switch( pSrb->Command ){
  343. case SRB_INITIALIZE_DEVICE:
  344. DBG_PRINTF( ( "DVDWDM: SRB_INITIALIZE_DEVICE\n\r") );
  345. if( !InitialHwDevExt( pHwDevExt ) ) {
  346. DBG_BREAK();
  347. pSrb->Status = STATUS_UNSUCCESSFUL;
  348. } else if( !GetPCIConfigSpace( pSrb ) ){
  349. DBG_BREAK();
  350. pSrb->Status = STATUS_NO_SUCH_DEVICE;
  351. } else if( !SetInitialize( pSrb ) ){
  352. DBG_BREAK();
  353. pSrb->Status = STATUS_IO_DEVICE_ERROR;
  354. } else if( !HwInitialize( pSrb ) ){
  355. DBG_BREAK();
  356. // pSrb->Status = STATUS_IO_DEVICE_ERROR;
  357. pSrb->Status = STATUS_UNSUCCESSFUL;
  358. // pSrb->Status = STATUS_NO_SUCH_DEVICDE;
  359. }
  360. break;
  361. case SRB_OPEN_STREAM:
  362. DBG_PRINTF( ( "DVDWDM: SRB_OPEN_STREAM\n\r") );
  363. OpenStream( pSrb );
  364. pHwDevExt->scheduler.Init();
  365. break;
  366. case SRB_CLOSE_STREAM:
  367. DBG_PRINTF( ( "DVDWDM: SRB_CLOSE_STREAM\n\r") );
  368. CloseStream( pSrb );
  369. break;
  370. case SRB_CHANGE_POWER_STATE:
  371. DBG_PRINTF( ( "DVDWDM: SRB_CHANGE_POWER_STATE\n\r") );
  372. //--- 98.06.15 S.Watanabe
  373. // for Debug
  374. switch( pSrb->CommandData.DeviceState ) {
  375. case PowerDeviceUnspecified:
  376. DBG_PRINTF( ( "DVDWDM: PowerDeviceUnspecified\n\r") );
  377. break;
  378. case PowerDeviceD0:
  379. DBG_PRINTF( ( "DVDWDM: PowerDeviceD0\n\r") );
  380. if( pHwDevExt->cOpenInputStream!=0 ){
  381. if( pHwDevExt->mpboard.PowerOn() ){
  382. pHwDevExt->dvdstrm.SetTransferMode( HALSTREAM_DVD_MODE );
  383. pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_DigitalOut, &pHwDevExt->m_AudioDigitalOut );
  384. #ifndef REARRANGEMENT
  385. // FlushQueue(pHwDevExt);
  386. #endif REARRANGEMENT
  387. if( pHwDevExt->dvdstrm.Stop() ){
  388. pHwDevExt->StreamState = StreamState_Stop;
  389. pHwDevExt->m_PlayMode = PLAY_MODE_NORMAL;
  390. }
  391. }else{
  392. DBG_PRINTF( ("DVDWDM:Power On Error\n\r") );
  393. }
  394. }
  395. break;
  396. case PowerDeviceD1:
  397. DBG_PRINTF( ( "DVDWDM: PowerDeviceD1\n\r") );
  398. break;
  399. case PowerDeviceD2:
  400. DBG_PRINTF( ( "DVDWDM: PowerDeviceD2\n\r") );
  401. break;
  402. case PowerDeviceD3:
  403. DBG_PRINTF( ( "DVDWDM: PowerDeviceD3\n\r") );
  404. // if( pHwDevExt->cOpenInputStream!=0 ){
  405. if( !pHwDevExt->mpboard.PowerOff() ){
  406. DBG_PRINTF( ("DVDWDM:Power Off Error\n\r") );
  407. }
  408. // }
  409. break;
  410. case PowerDeviceMaximum:
  411. DBG_PRINTF( ( "DVDWDM: PowerDeviceMaximum\n\r") );
  412. break;
  413. default:
  414. DBG_BREAK();
  415. break;
  416. }
  417. //--- End.
  418. //--- 98.07.08 S.Watanabe
  419. // /////////// Yagi
  420. // pSrb->Status = STATUS_NOT_IMPLEMENTED;
  421. pSrb->Status = STATUS_SUCCESS;
  422. //--- End.
  423. break;
  424. default:
  425. DBG_PRINTF( ( "DVDWDM: SRB(default)=0x%04x\n\r", pSrb->Command) );
  426. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  427. DBG_BREAK();
  428. break;
  429. }
  430. CallAtDeviceCompleteNotify( pSrb, pSrb->Status );
  431. }
  432. /******
  433. extern "C" VOID STREAMAPI AdapterCancelPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  434. {
  435. pSrb->Status = STATUS_PENDING;
  436. // DBG_BREAK();
  437. StreamClassCallAtNewPriority(
  438. NULL,
  439. pSrb->HwDeviceExtension,
  440. Low,
  441. (PHW_PRIORITY_ROUTINE)LowAdapterCancelPacket,
  442. pSrb
  443. );
  444. }
  445. ********/
  446. //VOID LowAdapterCancelPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  447. extern "C" VOID STREAMAPI AdapterCancelPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  448. {
  449. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  450. DBG_PRINTF( ("DVDWDM:Adapter Cancel Packet pSrb=0x%x\n\r",pSrb) );
  451. pSrb->Status = STATUS_CANCELLED;
  452. switch( pSrb->Flags & (SRB_HW_FLAGS_DATA_TRANSFER | SRB_HW_FLAGS_STREAM_REQUEST) ){
  453. //
  454. // find all stream commands, and do stream notifications
  455. //
  456. case SRB_HW_FLAGS_STREAM_REQUEST | SRB_HW_FLAGS_DATA_TRANSFER :
  457. DBG_PRINTF( ("DVDWDM:Cancele Packet SRB_HW_FLAGS_STREAM_REQUEST | SRB_HW_FLAGS_DATA_TRANSFER\n\r") );
  458. // Remove CC SRB from CC Queue.
  459. if( pHwDevExt->ccque.remove( pSrb ) ){
  460. DBG_PRINTF( ("DVDWDM:CC READ SRB is found in Queue\n\r") );
  461. pSrb->Status = STATUS_CANCELLED;
  462. StreamCompleteNotify( pSrb );
  463. }else
  464. // Remove WRITE_DATA SRB from Schedule Queue.
  465. if( pHwDevExt->scheduler.removeSRB( pSrb ) ){
  466. DBG_PRINTF( ("DVDWDM:Schedule WRITE_DATA SRB is found in Queue\n\r") );
  467. pSrb->Status = STATUS_CANCELLED;
  468. StreamCompleteNotify( pSrb );
  469. }
  470. break;
  471. case SRB_HW_FLAGS_STREAM_REQUEST:
  472. DBG_PRINTF( ("DVDWDM:Cancel Packet SRB_HW_FLAGS_STREAM_REQUEST\n\r") );
  473. pSrb->Status = STATUS_CANCELLED;
  474. StreamCompleteNotify( pSrb );
  475. break;
  476. default:
  477. DBG_PRINTF( ("DVDWDM:Cancel Packet default\n\r") );
  478. DBG_BREAK();
  479. pSrb->Status = STATUS_CANCELLED;
  480. StreamCompleteNotify( pSrb );
  481. break;
  482. }
  483. }
  484. /*******
  485. extern "C" VOID STREAMAPI AdapterTimeoutPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  486. {
  487. // pSrb->Status = STATUS_PENDING;
  488. // DBG_BREAK();
  489. StreamClassCallAtNewPriority(
  490. NULL,
  491. pSrb->HwDeviceExtension,
  492. Low,
  493. (PHW_PRIORITY_ROUTINE)LowAdapterTimeoutPacket,
  494. pSrb
  495. );
  496. }
  497. **********/
  498. //VOID LowAdapterTimeoutPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  499. extern "C" VOID STREAMAPI AdapterTimeoutPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  500. {
  501. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  502. DBG_PRINTF( ("DVDWDM:Adapter Timeout Packet pSrb=0x%x\n\r",pSrb) );
  503. if( pHwDevExt->StreamState == StreamState_Pause ){ // Pause state.
  504. DBG_PRINTF( ("DVDWDM: Pause Mode now !\n\r") );
  505. pSrb->TimeoutCounter = pSrb->TimeoutOriginal;
  506. return;
  507. }
  508. DBG_BREAK();
  509. //
  510. // clear all pending timeouts on all streams that use them
  511. //
  512. if( pHwDevExt->pstroVid ){
  513. StreamClassScheduleTimer( pHwDevExt->pstroVid,
  514. pHwDevExt, 0, NULL, pHwDevExt->pstroVid );
  515. }
  516. if( pHwDevExt->pstroAud ){
  517. StreamClassScheduleTimer( pHwDevExt->pstroAud,
  518. pHwDevExt, 0, NULL, pHwDevExt->pstroAud );
  519. }
  520. if( pHwDevExt->pstroSP ){
  521. StreamClassScheduleTimer( pHwDevExt->pstroSP,
  522. pHwDevExt, 0, NULL, pHwDevExt->pstroSP );
  523. }
  524. DBG_PRINTF( ("DVDWDM: Abort Outstanding\n\r") );
  525. /********
  526. #ifndef REARRANGEMENT
  527. // FlushQueue(pHwDevExt);
  528. #endif REARRANGEMENT
  529. if( !pHwDevExt->dvdstrm.Stop() ){
  530. DBG_PRINTF( ("DVDWDM: dvdstrm.Stop Error\n\r") );
  531. DBG_BREAK();
  532. }
  533. *******/
  534. //--- 98.09.07 S.Watanabe
  535. // TimeoutCancelSrb(pSrb);
  536. // Flush Scheduler SRB queue.
  537. PHW_STREAM_REQUEST_BLOCK pTmp;
  538. while( (pTmp=pHwDevExt->scheduler.getSRB())!=NULL ){
  539. pTmp->Status = STATUS_SUCCESS;
  540. StreamCompleteNotify(pTmp);
  541. }
  542. //--- End.
  543. //--- 98.09.08 H.Yagi
  544. // Flush C.C. queue.
  545. while( (pTmp=pHwDevExt->ccque.get())!=NULL ){
  546. pTmp->Status = STATUS_SUCCESS;
  547. StreamCompleteNotify(pTmp);
  548. }
  549. StreamClassCallAtNewPriority(
  550. NULL,
  551. pSrb->HwDeviceExtension,
  552. Low,
  553. (PHW_PRIORITY_ROUTINE)LowTimeoutCancelSrb,
  554. pSrb);
  555. //--- End.
  556. // StreamClassAbortOutstandingRequests( pHwDevExt, NULL, STATUS_CANCELLED );
  557. }
  558. VOID LowTimeoutCancelSrb(IN PHW_STREAM_REQUEST_BLOCK pSrb)
  559. {
  560. // DvdDebug(DBG_WRAPPER, 1,
  561. // ("tosdvd02: LowTimeoutCancelSrb - SRB %08x\n", pSrb));
  562. DBG_PRINTF( ("DVDWDM:LowTimeOutCnacelSRB -SRB %08x\n\r", pSrb ) );
  563. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  564. #ifndef REARRANGEMENT
  565. // FlushQueue(pHwDevExt);
  566. #endif REARRANGEMENT
  567. if( !pHwDevExt->dvdstrm.Stop() ){
  568. DBG_PRINTF( ("DVDWDM:dvdstrm Stop() Error!\n\r") );
  569. DBG_BREAK();
  570. }
  571. return;
  572. // if (pSrb->Command == SRB_WRITE_DATA) {
  573. // ((PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension))->dvdstrm.CancelTransferData(
  574. // ((IMPEGBuffer *)&((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff));
  575. // }
  576. }
  577. //--- End.
  578. extern "C" BOOLEAN STREAMAPI HwInterrupt( IN PHW_DEVICE_EXTENSION pHwDevExt )
  579. {
  580. HALRESULT result;
  581. BOOLEAN ret;
  582. ret = FALSE;
  583. pHwDevExt->kserv.CheckInt();
  584. // pHwDevExt->kserv.DisableHwInt();
  585. if( pHwDevExt->m_InitComplete==FALSE ){ // Not finish to initialize
  586. return( FALSE ); // all objects.
  587. }
  588. result = pHwDevExt->mphal.HALHwInterrupt();
  589. if( result==HAL_IRQ_MINE ){
  590. ret = TRUE;
  591. }else{
  592. ret = FALSE;
  593. }
  594. // pHwDevExt->kserv.EnableHwInt();
  595. return( ret );
  596. }
  597. /****************/
  598. extern "C" VOID STREAMAPI VideoReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  599. {
  600. pSrb->Status = STATUS_PENDING;
  601. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  602. DBG_PRINTF( ("DVDWDM:Video Receive Data Packet----- pSrb=0x%x\n\r",pSrb) );
  603. #ifdef LOWSENDDATA
  604. ULONG i;
  605. if( pSrb->Command == SRB_WRITE_DATA
  606. && pSrb->NumberOfPhysicalPages > 0
  607. && pHwDevExt->StreamState != StreamState_Stop )
  608. {
  609. BOOL LowFlag = FALSE;
  610. PKSSTREAM_HEADER pStruc;
  611. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  612. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  613. if( ( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY )
  614. || ( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY )
  615. || ( pStruc->TypeSpecificFlags & KS_AM_UseNewCSSKey )
  616. || ( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TYPECHANGED )
  617. || ( pStruc->DataUsed == 0 ))
  618. {
  619. LowFlag = TRUE;
  620. break;
  621. };
  622. }
  623. if( LowFlag == FALSE )
  624. {
  625. DBG_PRINTF( ("DVDWDM:---Video SRB_WRITE_DATA HighWrite >>>>>>>>>>>>>>>>>>>> pSrb = 0x%08x\n\r", pSrb) );
  626. // Valid DVD data to transfer decoder board.
  627. WriteDataChangeHwStreamState( pHwDevExt );
  628. pHwDevExt->kserv.DisableHwInt();
  629. CWDMBuffer *pWdmBuff;
  630. CWDMBuffer temp8;
  631. RtlCopyMemory( &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff), &temp8, sizeof(CWDMBuffer) );
  632. pWdmBuff = &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff);
  633. pWdmBuff->Init();
  634. pWdmBuff->SetSRB( pSrb );
  635. pHwDevExt->scheduler.SendData( pSrb ); // for F.F. & F.R.
  636. pHwDevExt->kserv.EnableHwInt();
  637. StreamNextDataNotify( pSrb );
  638. DBG_PRINTF( ("DVDWDM:<<<<<<<<<<<<<<<<<<<<\n\r") );
  639. return;
  640. };
  641. }
  642. #endif
  643. // StreamClassCallAtNewPriority(NULL,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowVideoReceiveDataPacket,pSrb);
  644. StreamClassCallAtNewPriority(pSrb->StreamObject,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowVideoReceiveDataPacket,pSrb);
  645. // StreamNextDataNotify( pSrb ); // move to LowVideoReceiveDataPacket
  646. }
  647. /************/
  648. //extern "C" VOID STREAMAPI VideoReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  649. VOID LowVideoReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  650. {
  651. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  652. DBG_PRINTF( ("DVDWDM:Low Video Receive Data Packet----- pSrb=0x%x\n\r",pSrb) );
  653. #ifdef DBG
  654. WORD wOrderNumber = 0;
  655. KSSTREAM_HEADER * pHeader;
  656. DBG_PRINTF( ("DVDWDM:Low Video Receive Data Packet----- NumberofBuffers=%x\n\r",pSrb->NumberOfBuffers) );
  657. for( ULONG ulNumber = 0; ulNumber < pSrb->NumberOfBuffers; ulNumber++ )
  658. {
  659. pHeader = ((PKSSTREAM_HEADER)pSrb->CommandData.DataBufferArray) + ulNumber;
  660. wOrderNumber = (WORD)(pHeader->TypeSpecificFlags >> 16); //get packet number
  661. DBG_PRINTF( ("DVDWDM: wOrderNumber=%x\n\r",wOrderNumber) );
  662. }
  663. #endif
  664. CWDMBuffer *pWdmBuff;
  665. // need this line.
  666. CWDMBuffer temp8;
  667. // add by H.Yagi 99.02.02
  668. OsdDataStruc TestOSD;
  669. TestOSD.OsdType = OSD_TYPE_ZIVA;
  670. TestOSD.pNextData = NULL;
  671. TestOSD.pData = &erase[0];
  672. TestOSD.dwOsdSize = sizeof( erase );
  673. #ifdef DBG
  674. /////// 99.01.22 for debug by H.Yagi start
  675. DWORD currentTime;
  676. /////// 99.01.22 for debug by H.Yagi end
  677. #endif
  678. StreamNextDataNotify( pSrb ); // move from VideoReceiveDataPacket
  679. #ifndef REARRANGEMENT
  680. for (int buffcnt = 0; buffcnt < WDM_BUFFER_MAX; buffcnt++)
  681. RtlCopyMemory( &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff[buffcnt]), &temp8, sizeof(CWDMBuffer) );
  682. #else
  683. RtlCopyMemory( &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff), &temp8, sizeof(CWDMBuffer) );
  684. #endif REARRANGEMENT
  685. switch( pSrb->Command ){
  686. case SRB_WRITE_DATA:
  687. DBG_PRINTF( ("DVDWDM:---SRB_WRITE_DATA PhyPages=%d\n\r",pSrb->NumberOfPhysicalPages ) );
  688. ULONG i;
  689. PKSSTREAM_HEADER pStruc;
  690. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  691. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  692. if( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY ){
  693. DBG_PRINTF( ("DVDWDM: DATA_DISCONTINUITY(Video)\n\r" ));
  694. //
  695. USCC_Discontinuity( pHwDevExt ); // Flush the USCC Data
  696. }
  697. if( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY ){
  698. #ifdef DBG
  699. static int TimeDisCont = 0;
  700. DBG_PRINTF( ("DVDWDM: TIME_DISCONTINUITY(Video) %d\n\r",TimeDisCont++ ));
  701. #endif
  702. }
  703. //--- 98.06.16 S.Watanabe
  704. // for Debug
  705. if( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TIMEVALID ) {
  706. DBG_PRINTF((
  707. "DVDWDM:Video PTS: 0x%x( 0x%s(100ns) )\r\n",
  708. ConvertStrmtoPTS(pStruc->PresentationTime.Time),
  709. DebugLLConvtoStr( pStruc->PresentationTime.Time, 16 )
  710. ));
  711. }
  712. //--- End.
  713. //--- 98.06.02 S.Watanabe
  714. if( pStruc->TypeSpecificFlags & KS_AM_UseNewCSSKey ) {
  715. pHwDevExt->CppFlagCount++;
  716. DBG_PRINTF(( "DVDWDM: CppFlagCount=%ld\r\n", pHwDevExt->CppFlagCount ));
  717. if( pHwDevExt->CppFlagCount >= pHwDevExt->cOpenInputStream + 1 )
  718. SetCppFlag( pHwDevExt, TRUE );
  719. }
  720. //--- End.
  721. }
  722. ///
  723. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  724. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  725. DBG_PRINTF( ("DVDWDM: Video Packet Flag = 0x%x\n\r", pStruc->OptionsFlags ));
  726. if( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TYPECHANGED ){
  727. DBG_PRINTF( ("DVDWDM: TYPE CHANGE(Video)\n\r") );
  728. if( pStruc->DataUsed >= sizeof(KSDATAFORMAT) + sizeof(KS_MPEGVIDEOINFO2) ){
  729. // ProcessVideoFormat( (PKSDATAFORMAT)pStruc->Data, pHwDevExt );
  730. ProcessVideoFormat( pSrb, (PKSDATAFORMAT)pStruc->Data, pHwDevExt );
  731. }
  732. i = pSrb->NumberOfBuffers;
  733. break;
  734. }
  735. if( pStruc->DataUsed )
  736. break;
  737. }
  738. if( i==pSrb->NumberOfBuffers ){
  739. pSrb->Status = STATUS_SUCCESS;
  740. #ifndef REARRANGEMENT
  741. pHwDevExt->scheduler.SendData( pSrb );
  742. #endif REARRANGEMENT
  743. break;
  744. }
  745. if( pHwDevExt->StreamState == StreamState_Stop ){
  746. DBG_PRINTF( ("DVDWDM:STOP STATE now!!\n\r") );
  747. pSrb->Status = STATUS_SUCCESS;
  748. #ifndef REARRANGEMENT
  749. pHwDevExt->scheduler.SendData( pSrb );
  750. #endif REARRANGEMENT
  751. CallAtStreamCompleteNotify( pSrb, STATUS_SUCCESS );
  752. return;
  753. }
  754. ///
  755. if( pSrb->NumberOfPhysicalPages > 0 ){
  756. DBG_PRINTF( ("DVDWDM:>>>>>>>>>>>>>>>>>>>> pSrb = 0x%08x\n\r", pSrb) );
  757. // Valid DVD data to transfer decoder board.
  758. // add by H.Yagi 99.02.02
  759. // Before sending Data check APS and do some actions.
  760. if( pHwDevExt->m_APSChange == TRUE ){
  761. MacroVisionTVControl( pSrb, pHwDevExt->m_APSType, TestOSD );
  762. }
  763. WriteDataChangeHwStreamState( pHwDevExt );
  764. pHwDevExt->kserv.DisableHwInt();
  765. #ifndef REARRANGEMENT
  766. for (buffcnt = 0; buffcnt < WDM_BUFFER_MAX; buffcnt++)
  767. {
  768. pWdmBuff = &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff[buffcnt]);
  769. pWdmBuff->Init();
  770. pWdmBuff->SetSRB( pSrb );
  771. }
  772. #else
  773. pWdmBuff = &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff);
  774. pWdmBuff->Init();
  775. pWdmBuff->SetSRB( pSrb );
  776. #endif REARRANGEMENT
  777. // DumpPTSValue( pSrb ); // for debug by H.Yagi 98.08.21
  778. pSrb->Status = STATUS_PENDING;
  779. #ifdef DBG
  780. /////// 99.01.22 for debug by H.Yagi start
  781. pHwDevExt->kserv.GetTickCount( &currentTime );
  782. DBG_PRINTF( ("TIME = %08x\n\r", currentTime ) );
  783. /////// 99.01.22 for debug by H.Yagi end
  784. #endif
  785. pHwDevExt->scheduler.SendData( pSrb ); // for F.F. & F.R.
  786. pHwDevExt->kserv.EnableHwInt();
  787. DBG_PRINTF( ("DVDWDM:<<<<<<<<<<<<<<<<<<<<\n\r") );
  788. return;
  789. }
  790. pSrb->Status = STATUS_SUCCESS;
  791. break;
  792. default:
  793. DBG_PRINTF( ("DVDWDM:---deafult = 0x%08x\n\r", pSrb->Command) );
  794. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  795. break;
  796. }
  797. CallAtStreamCompleteNotify( pSrb, STATUS_SUCCESS );
  798. #ifndef REARRANGEMENT
  799. DBG_PRINTF( ("DVDWDM:LowVideoReceiveDataPacket-CompleteSrb = %x\n\r", pSrb) );
  800. #endif REARRANGEMENT
  801. }
  802. /*********/
  803. extern "C" VOID STREAMAPI VideoReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  804. {
  805. DBG_PRINTF( ("DVDWDM:Video Receive Control Packet----- pSrb=0x%x\n\r",pSrb) );
  806. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  807. pSrb->Status = STATUS_PENDING;
  808. switch( pSrb->Command ){
  809. case SRB_SET_STREAM_STATE:
  810. case SRB_GET_STREAM_PROPERTY:
  811. case SRB_SET_STREAM_PROPERTY:
  812. case SRB_BEGIN_FLUSH:
  813. case SRB_END_FLUSH:
  814. // StreamClassCallAtNewPriority(NULL,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowVideoReceiveCtrlPacket,pSrb);
  815. StreamClassCallAtNewPriority(pSrb->StreamObject,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowVideoReceiveCtrlPacket,pSrb);
  816. // StreamNextCtrlNotify( pSrb ); // move to LowVideoReceiveCtrlPacket
  817. return;
  818. case SRB_GET_STREAM_STATE:
  819. DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_STATE\n\r") );
  820. pSrb->Status = STATUS_SUCCESS;
  821. break;
  822. case SRB_OPEN_MASTER_CLOCK:
  823. DBG_PRINTF( ("DVDWDM:---SRB_OPEN_MASTER_CLOCK\n\r") );
  824. pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  825. pSrb->Status = STATUS_SUCCESS;
  826. break;
  827. case SRB_CLOSE_MASTER_CLOCK:
  828. DBG_PRINTF( ("DVDWDM:---SRB_CLOSE_MASTER_CLOCK\n\r") );
  829. pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  830. pSrb->Status = STATUS_SUCCESS;
  831. break;
  832. case SRB_INDICATE_MASTER_CLOCK:
  833. DBG_PRINTF( ("DVDWDM:---SRB_INDICATE_MASTER_CLOCK\n\r") );
  834. pHwDevExt->hClk = pSrb->CommandData.MasterClockHandle;
  835. pSrb->Status = STATUS_SUCCESS;
  836. break;
  837. case SRB_UNKNOWN_STREAM_COMMAND:
  838. DBG_PRINTF( ("DVDWDM:---SRB_UNKNOWN_STREAM_COMMAND\n\r") );
  839. DBG_BREAK();
  840. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  841. break;
  842. case SRB_SET_STREAM_RATE:
  843. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_RATE\n\r") );
  844. DBG_BREAK();
  845. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  846. break;
  847. case SRB_PROPOSE_DATA_FORMAT:
  848. DBG_PRINTF( ("DVDWDM:---SRB_PROPOSE_DATA_FORMAT\n\r") );
  849. VideoQueryAccept( pSrb );
  850. break;
  851. case SRB_PROPOSE_STREAM_RATE:
  852. DBG_PRINTF( ("---SRB_PROPOSE_STREAM_RATE\n\r") );
  853. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  854. break;
  855. default:
  856. DBG_PRINTF( ("DVDWDM:---deafult %d(0x%0x)\n\r", pSrb->Command, pSrb->Command) );
  857. DBG_BREAK();
  858. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  859. };
  860. StreamNextCtrlNotify( pSrb );
  861. StreamCompleteNotify( pSrb );
  862. }
  863. /**********/
  864. //extern "C" VOID STREAMAPI VideoReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  865. VOID LowVideoReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  866. {
  867. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  868. LIBSTATE HwStreamState;
  869. DBG_PRINTF( ("DVDWDM:Low Video Receive Control Packet----- pSrb=0x%x\n\r",pSrb) );
  870. StreamNextCtrlNotify( pSrb ); // move from LowVideoReceiveCtrlPacket
  871. switch( pSrb->Command ){
  872. case SRB_SET_STREAM_STATE:
  873. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_STATE\n\r") );
  874. pSrb->Status = STATUS_SUCCESS;
  875. switch( pSrb->CommandData.StreamState )
  876. {
  877. case KSSTATE_STOP:
  878. DBG_PRINTF( ("DVDWDM: Video KSSTATE_STOP\n\r") );
  879. // SetSinkWrapper when KSSTATE_RUN, and UnsetSinkWrapper when KSSATTE_STOP dynamically,
  880. // cause of MS bug?
  881. pHwDevExt->mphal.UnsetSinkWrapper( &(pHwDevExt->vsync) );
  882. pHwDevExt->StreamState = StreamState_Stop;
  883. SetVideoRateDefault( pHwDevExt );
  884. // pHwDevExt->Rate = VIDEO_MAX_FULL_RATE;
  885. //--- 98.06.02 S.Watanabe
  886. /////// 99.01.07 H.Yagi pHwDevExt->CppFlagCount = 0;
  887. //--- End.
  888. HwStreamState = pHwDevExt->dvdstrm.GetState();
  889. if( HwStreamState != Stop )
  890. {
  891. #ifndef REARRANGEMENT
  892. FlushQueue(pHwDevExt);
  893. #endif REARRANGEMENT
  894. if( !pHwDevExt->dvdstrm.Stop() )
  895. {
  896. DBG_PRINTF(("DVDWDM: Stop error! LINE=%d\r\n",__LINE__ ));
  897. pSrb->Status = STATUS_IO_DEVICE_ERROR;
  898. };
  899. };
  900. pHwDevExt->ticktime.Stop();
  901. break;
  902. case KSSTATE_PAUSE:
  903. DBG_PRINTF( ("DVDWDM: Video KSSTATE_PAUSE\n\r") );
  904. pHwDevExt->StreamState = StreamState_Pause;
  905. HwStreamState = pHwDevExt->dvdstrm.GetState();
  906. if( HwStreamState == Play || HwStreamState == Scan || HwStreamState == Slow )
  907. {
  908. if( !pHwDevExt->dvdstrm.Pause() )
  909. {
  910. DBG_PRINTF(("DVDWDM: Pause error! LINE=%d\r\n",__LINE__ ));
  911. pSrb->Status = STATUS_IO_DEVICE_ERROR;
  912. };
  913. };
  914. pHwDevExt->ticktime.Pause();
  915. break;
  916. case KSSTATE_RUN:
  917. DBG_PRINTF( ("DVDWDM: Video KSSTATE_RUN\n\r") );
  918. // SetSinkWrapper when KSSTATE_RUN, and UnsetSinkWrapper when KSSATTE_STOP dynamically,
  919. // cause of MS bug?
  920. pHwDevExt->mphal.SetSinkWrapper( &(pHwDevExt->vsync) );
  921. pHwDevExt->StreamState = StreamState_Play;
  922. HwStreamState = pHwDevExt->dvdstrm.GetState();
  923. if( HwStreamState == Pause )
  924. WriteDataChangeHwStreamState( pHwDevExt );
  925. pHwDevExt->ticktime.Run();
  926. break;
  927. }
  928. break;
  929. case SRB_GET_STREAM_PROPERTY:
  930. DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_PROPERTY\n\r") );
  931. GetVideoProperty( pSrb );
  932. if( pSrb->Status == STATUS_PENDING )
  933. return;
  934. break;
  935. case SRB_SET_STREAM_PROPERTY:
  936. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_PROPERTY\n\r") );
  937. SetVideoProperty( pSrb );
  938. if( pSrb->Status == STATUS_PENDING )
  939. return;
  940. break;
  941. case SRB_BEGIN_FLUSH:
  942. DBG_PRINTF( ("---SRB_BEGIN_FLUSH\n\r") );
  943. if( pHwDevExt->dvdstrm.GetState() != Stop )
  944. {
  945. #ifndef REARRANGEMENT
  946. FlushQueue(pHwDevExt);
  947. #endif REARRANGEMENT
  948. if( !pHwDevExt->dvdstrm.Stop() )
  949. {
  950. DBG_PRINTF( ("DVDWDM: dvdstrm.Stop Error\n\r") );
  951. DBG_BREAK();
  952. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  953. return;
  954. };
  955. };
  956. pSrb->Status = STATUS_SUCCESS;
  957. break;
  958. //--- 98.06.01 S.Watanabe
  959. case SRB_END_FLUSH:
  960. DBG_PRINTF( ("---SRB_END_FLUSH\n\r") );
  961. pSrb->Status = STATUS_SUCCESS;
  962. break;
  963. //--- End.
  964. default:
  965. DBG_PRINTF( ("DVDWDM:---deafult %d(0x%0x)\n\r", pSrb->Command, pSrb->Command) );
  966. // DBG_BREAK();
  967. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  968. break;
  969. }
  970. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  971. }
  972. /***********/
  973. extern "C" VOID STREAMAPI AudioReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  974. {
  975. pSrb->Status = STATUS_PENDING;
  976. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  977. DBG_PRINTF( ("DVDWDM: Audio Receive Data Packet----- pSrb=0x%x\n\r",pSrb) );
  978. #ifdef LOWSENDDATA
  979. ULONG i;
  980. if( pSrb->Command == SRB_WRITE_DATA
  981. && pSrb->NumberOfPhysicalPages > 0
  982. && pHwDevExt->StreamState != StreamState_Stop )
  983. {
  984. BOOL LowFlag = FALSE;
  985. PKSSTREAM_HEADER pStruc;
  986. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  987. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  988. if( ( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY )
  989. || ( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY )
  990. || ( pStruc->TypeSpecificFlags & KS_AM_UseNewCSSKey )
  991. || ( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TYPECHANGED )
  992. || ( pStruc->DataUsed == 0 ))
  993. {
  994. LowFlag = TRUE;
  995. break;
  996. };
  997. }
  998. if( LowFlag == FALSE )
  999. {
  1000. /// Set Audio channel # by checking into pack data.
  1001. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  1002. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  1003. // before sending data, check Audio channel,
  1004. if( pStruc->DataUsed ){
  1005. SetAudioID( pHwDevExt, pStruc );
  1006. }
  1007. }
  1008. CWDMBuffer *pWdmBuff;
  1009. CWDMBuffer temp8;
  1010. RtlCopyMemory( &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff), &temp8, sizeof(CWDMBuffer) );
  1011. DBG_PRINTF( ("DVDWDM:---Audio SRB_WRITE_DATA HighWrite >>>>>>>>>>>>>>>>>>>> pSrb = 0x%08x\n\r", pSrb) );
  1012. if( pHwDevExt->Rate < 10000 )
  1013. {
  1014. pSrb->Status = STATUS_SUCCESS;
  1015. StreamNextDataNotify( pSrb );
  1016. StreamCompleteNotify( pSrb );
  1017. };
  1018. // Valid DVD data to transfer decoder board.
  1019. WriteDataChangeHwStreamState( pHwDevExt );
  1020. pHwDevExt->kserv.DisableHwInt();
  1021. pWdmBuff = &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff);
  1022. pWdmBuff->Init();
  1023. pWdmBuff->SetSRB( pSrb );
  1024. pSrb->Status = STATUS_PENDING;
  1025. pHwDevExt->scheduler.SendData( pSrb ); // for F.F. & F.R.
  1026. pHwDevExt->kserv.EnableHwInt();
  1027. StreamNextDataNotify( pSrb );
  1028. DBG_PRINTF( ("DVDWDM:<<<<<<<<<<<<<<<<<<<<\n\r") );
  1029. return;
  1030. };
  1031. }
  1032. #endif
  1033. // StreamClassCallAtNewPriority(NULL,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowAudioReceiveDataPacket,pSrb);
  1034. StreamClassCallAtNewPriority(pSrb->StreamObject,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowAudioReceiveDataPacket,pSrb);
  1035. // StreamNextDataNotify( pSrb ); // move to LowAudioReceiveDataPacket
  1036. }
  1037. /***********/
  1038. //extern "C" VOID STREAMAPI AudioReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1039. VOID LowAudioReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1040. {
  1041. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1042. DBG_PRINTF( ("DVDWDM: Low Audio Receive Data Packet----- pSrb=0x%x\n\r",pSrb) );
  1043. #ifdef DBG
  1044. WORD wOrderNumber = 0;
  1045. KSSTREAM_HEADER * pHeader;
  1046. DBG_PRINTF( ("DVDWDM:Low Audio Receive Data Packet----- NumberofBuffers=%x\n\r",pSrb->NumberOfBuffers) );
  1047. for( ULONG ulNumber = 0; ulNumber < pSrb->NumberOfBuffers; ulNumber++ )
  1048. {
  1049. pHeader = ((PKSSTREAM_HEADER)pSrb->CommandData.DataBufferArray) + ulNumber;
  1050. wOrderNumber = (WORD)(pHeader->TypeSpecificFlags >> 16); //get packet number
  1051. DBG_PRINTF( ("DVDWDM: wOrderNumber=%x\n\r",wOrderNumber) );
  1052. }
  1053. #endif
  1054. CWDMBuffer *pWdmBuff;
  1055. // need to this line.
  1056. CWDMBuffer temp8;
  1057. StreamNextDataNotify( pSrb ); // move from LowAudioReceiveDataPacket
  1058. #ifndef REARRANGEMENT
  1059. for (int buffcnt = 0; buffcnt < WDM_BUFFER_MAX; buffcnt++)
  1060. RtlCopyMemory( &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff[buffcnt]), &temp8, sizeof(CWDMBuffer) );
  1061. #else
  1062. RtlCopyMemory( &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff), &temp8, sizeof(CWDMBuffer) );
  1063. #endif REARRANGEMENT
  1064. switch( pSrb->Command ){
  1065. case SRB_WRITE_DATA:
  1066. DBG_PRINTF( ("DVDWDM:---SRB_WRITE_DATA\n\r") );
  1067. ULONG i;
  1068. PKSSTREAM_HEADER pStruc;
  1069. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  1070. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  1071. if( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY ){
  1072. DBG_PRINTF( ("DVDWDM: DATA_DISCONTINUITY(Audio)\n\r" ));
  1073. }
  1074. if( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY ){
  1075. DBG_PRINTF( ("DVDWDM: TIME_DISCONTINUITY(Audio)\n\r" ));
  1076. }
  1077. //--- 98.06.16 S.Watanabe
  1078. // for Debug
  1079. if( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TIMEVALID ) {
  1080. DBG_PRINTF((
  1081. "DVDWDM:Audio PTS: 0x%x( 0x%s(100ns) )\r\n",
  1082. ConvertStrmtoPTS(pStruc->PresentationTime.Time),
  1083. DebugLLConvtoStr( pStruc->PresentationTime.Time, 16 )
  1084. ));
  1085. }
  1086. //--- End.
  1087. //--- 98.06.02 S.Watanabe
  1088. if( pStruc->TypeSpecificFlags & KS_AM_UseNewCSSKey ) {
  1089. pHwDevExt->CppFlagCount++;
  1090. DBG_PRINTF(( "DVDWDM: CppFlagCount=%ld\r\n", pHwDevExt->CppFlagCount ));
  1091. if( pHwDevExt->CppFlagCount >= pHwDevExt->cOpenInputStream + 1 )
  1092. SetCppFlag( pHwDevExt, TRUE );
  1093. }
  1094. //--- End.
  1095. }
  1096. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  1097. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  1098. DBG_PRINTF( ("DVDWDM: Audio Packet Flag = 0x%x\n\r", pStruc->OptionsFlags ) );
  1099. if( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TYPECHANGED ){
  1100. DBG_PRINTF( ("DVDWDM: TYPE CHANGE(Audio)\n\r") );
  1101. // if( pStruc->DataUsed >= sizeof(KSDATAFORMAT) + sizeof(KS_MPEGVIDEOINFO2) ){
  1102. if( pStruc->DataUsed ){
  1103. ProcessAudioFormat( (PKSDATAFORMAT)pStruc->Data, pHwDevExt );
  1104. }
  1105. i = pSrb->NumberOfBuffers;
  1106. break;
  1107. }
  1108. if( pStruc->DataUsed )
  1109. break;
  1110. }
  1111. if( i==pSrb->NumberOfBuffers ){
  1112. pSrb->Status = STATUS_SUCCESS;
  1113. #ifndef REARRANGEMENT
  1114. pHwDevExt->scheduler.SendData( pSrb );
  1115. #endif REARRANGEMENT
  1116. break;
  1117. }
  1118. //
  1119. if( pHwDevExt->StreamState == StreamState_Stop ){
  1120. DBG_PRINTF( ("DVDWDM:STOP STATE now!!\n\r") );
  1121. DBG_BREAK();
  1122. pSrb->Status = STATUS_SUCCESS;
  1123. #ifndef REARRANGEMENT
  1124. pHwDevExt->scheduler.SendData( pSrb );
  1125. #endif REARRANGEMENT
  1126. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  1127. return;
  1128. }
  1129. /// Set Audio channel # by checking into pack data.
  1130. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  1131. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  1132. // before sending data, check Audio channel,
  1133. if( pStruc->DataUsed ){
  1134. SetAudioID( pHwDevExt, pStruc );
  1135. }
  1136. }
  1137. if( pSrb->NumberOfPhysicalPages > 0 ){
  1138. DBG_PRINTF( ("DVDWDM:>>>>>>>>>>>>>>>>>>>> pSrb = 0x%08x\n\r", pSrb) );
  1139. // Valid DVD data to transfer decoder board.
  1140. if( pHwDevExt->Rate < 10000 )
  1141. {
  1142. pSrb->Status = STATUS_SUCCESS;
  1143. #ifndef REARRANGEMENT
  1144. pHwDevExt->scheduler.SendData( pSrb );
  1145. #endif REARRANGEMENT
  1146. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  1147. return;
  1148. };
  1149. WriteDataChangeHwStreamState( pHwDevExt );
  1150. pHwDevExt->kserv.DisableHwInt();
  1151. #ifndef REARRANGEMENT
  1152. for (buffcnt = 0; buffcnt < WDM_BUFFER_MAX; buffcnt++)
  1153. {
  1154. pWdmBuff = &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff[buffcnt]);
  1155. pWdmBuff->Init();
  1156. pWdmBuff->SetSRB( pSrb );
  1157. }
  1158. #else
  1159. pWdmBuff = &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff);
  1160. pWdmBuff->Init();
  1161. pWdmBuff->SetSRB( pSrb );
  1162. #endif REARRANGEMENT
  1163. pSrb->Status = STATUS_PENDING;
  1164. pHwDevExt->scheduler.SendData( pSrb ); // for F.F. & F.R.
  1165. pHwDevExt->kserv.EnableHwInt();
  1166. DBG_PRINTF( ("DVDWDM:<<<<<<<<<<<<<<<<<<<<\n\r") );
  1167. return;
  1168. }
  1169. pSrb->Status = STATUS_SUCCESS;
  1170. break;
  1171. default:
  1172. DBG_PRINTF( ("DVDWDM:---deafult %d(0x%x)\n\r", pSrb->Command, pSrb->Command) );
  1173. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1174. break;
  1175. }
  1176. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  1177. #ifndef REARRANGEMENT
  1178. DBG_PRINTF( ("DVDWDM:LowAudioReceiveDataPacket-CompleteSrb = %x\n\r", pSrb) );
  1179. #endif REARRANGEMENT
  1180. }
  1181. /************/
  1182. extern "C" VOID STREAMAPI AudioReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1183. {
  1184. DBG_PRINTF( ("DVDWDM:Audio Receive Control Packet----- pSrb=0x%x\n\r",pSrb) );
  1185. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1186. pSrb->Status = STATUS_PENDING;
  1187. switch( pSrb->Command ){
  1188. case SRB_GET_STREAM_PROPERTY:
  1189. case SRB_SET_STREAM_PROPERTY:
  1190. // StreamClassCallAtNewPriority(NULL,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowAudioReceiveCtrlPacket,pSrb);
  1191. StreamClassCallAtNewPriority(pSrb->StreamObject,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowAudioReceiveCtrlPacket,pSrb);
  1192. // StreamNextCtrlNotify( pSrb ); // move to LowAudioReceiveCtrlPacket
  1193. return;
  1194. case SRB_SET_STREAM_STATE:
  1195. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_STATE\n\r") );
  1196. switch( pSrb->CommandData.StreamState ){
  1197. case KSSTATE_STOP:
  1198. DBG_PRINTF( ("DVDWDM: KSSTATE_STOP\n\r") );
  1199. SetAudioRateDefault( pHwDevExt );
  1200. break;
  1201. case KSSTATE_PAUSE:
  1202. DBG_PRINTF( ("DVDWDM: KSSTATE_PAUSE\n\r") );
  1203. break;
  1204. case KSSTATE_RUN:
  1205. DBG_PRINTF( ("DVDWDM: KSSTATE_RUN\n\r") );
  1206. break;
  1207. }
  1208. pSrb->Status = STATUS_SUCCESS;
  1209. break;
  1210. case SRB_GET_STREAM_STATE:
  1211. DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_STATE\n\r") );
  1212. pSrb->Status = STATUS_SUCCESS;
  1213. break;
  1214. case SRB_OPEN_MASTER_CLOCK:
  1215. DBG_PRINTF( ("DVDWDM:---SRB_OPEN_MASTER_CLOCK\n\r") );
  1216. pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  1217. pSrb->Status = STATUS_SUCCESS;
  1218. break;
  1219. case SRB_CLOSE_MASTER_CLOCK:
  1220. DBG_PRINTF( ("DVDWDM:---SRB_CLOSE_MASTER_CLOCK\n\r") );
  1221. pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  1222. pSrb->Status = STATUS_SUCCESS;
  1223. break;
  1224. case SRB_INDICATE_MASTER_CLOCK:
  1225. DBG_PRINTF( ("DVDWDM:---SRB_INDICATE_MASTER_CLOCK\n\r") );
  1226. pHwDevExt->hClk = pSrb->CommandData.MasterClockHandle;
  1227. pSrb->Status = STATUS_SUCCESS;
  1228. break;
  1229. case SRB_UNKNOWN_STREAM_COMMAND:
  1230. DBG_PRINTF( ("DVDWDM:---SRB_UNKNOWN_STREAM_COMMAND\n\r") );
  1231. DBG_BREAK();
  1232. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1233. break;
  1234. case SRB_SET_STREAM_RATE:
  1235. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_RATE\n\r") );
  1236. DBG_BREAK();
  1237. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1238. break;
  1239. case SRB_PROPOSE_DATA_FORMAT:
  1240. DBG_PRINTF( ("DVDWDM:---SRB_PROPOSE_DATA_FORMAT\n\r") );
  1241. AudioQueryAccept( pSrb );
  1242. break;
  1243. case SRB_BEGIN_FLUSH:
  1244. DBG_PRINTF( ("---SRB_BEGIN_FLUSH\n\r") );
  1245. pSrb->Status = STATUS_SUCCESS;
  1246. break;
  1247. case SRB_END_FLUSH:
  1248. DBG_PRINTF( ("---SRB_END_FLUSH\n\r") );
  1249. pSrb->Status = STATUS_SUCCESS;
  1250. break;
  1251. default:
  1252. DBG_PRINTF( ("DVDWDM:---deafult %d(0x%x)\n\r", pSrb->Command, pSrb->Command) );
  1253. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1254. break;
  1255. }
  1256. StreamNextCtrlNotify( pSrb );
  1257. StreamCompleteNotify( pSrb );
  1258. };
  1259. /***********/
  1260. VOID LowAudioReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1261. //extern "C" VOID STREAMAPI AudioReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1262. {
  1263. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1264. DBG_PRINTF( ("DVDWDM:Low Audio Receive Control Packet----- pSrb=0x%x\n\r",pSrb) );
  1265. StreamNextCtrlNotify( pSrb ); // move from AudioReceiveCtrlPacket
  1266. switch( pSrb->Command ){
  1267. case SRB_GET_STREAM_PROPERTY:
  1268. DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_PROPERTY\n\r") );
  1269. GetAudioProperty( pSrb );
  1270. if( pSrb->Status == STATUS_PENDING )
  1271. return;
  1272. break;
  1273. case SRB_SET_STREAM_PROPERTY:
  1274. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_PROPERTY\n\r") );
  1275. SetAudioProperty( pSrb );
  1276. if( pSrb->Status == STATUS_PENDING )
  1277. return;
  1278. break;
  1279. default:
  1280. DBG_PRINTF( ("DVDWDM:---deafult %d(0x%x)\n\r", pSrb->Command, pSrb->Command) );
  1281. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1282. break;
  1283. }
  1284. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  1285. }
  1286. /*********/
  1287. extern "C" VOID STREAMAPI SubpicReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1288. {
  1289. pSrb->Status = STATUS_PENDING;
  1290. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1291. DBG_PRINTF( ("DVDWDM:Sub-pic Receive Data Packet----- pSrb=0x%x\n\r",pSrb) );
  1292. #ifdef LOWSENDDATA
  1293. ULONG i;
  1294. if( pSrb->Command == SRB_WRITE_DATA
  1295. && pSrb->NumberOfPhysicalPages > 0
  1296. && pHwDevExt->StreamState != StreamState_Stop )
  1297. {
  1298. BOOL LowFlag = FALSE;
  1299. PKSSTREAM_HEADER pStruc;
  1300. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  1301. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  1302. if( ( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY )
  1303. || ( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY )
  1304. || ( pStruc->TypeSpecificFlags & KS_AM_UseNewCSSKey )
  1305. || ( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TYPECHANGED )
  1306. || ( pStruc->DataUsed == 0 ))
  1307. {
  1308. LowFlag = TRUE;
  1309. break;
  1310. };
  1311. }
  1312. if( LowFlag == FALSE )
  1313. {
  1314. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  1315. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  1316. // before sending data, check Subpic channel,
  1317. ASSERT( pStruc!=NULL );
  1318. if( pStruc->Data ){
  1319. SetSubpicID( pHwDevExt, pStruc );
  1320. }
  1321. }
  1322. CWDMBuffer *pWdmBuff;
  1323. CWDMBuffer temp8;
  1324. RtlCopyMemory( &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff), &temp8, sizeof(CWDMBuffer) );
  1325. DBG_PRINTF( ("DVDWDM:---SubPic SRB_WRITE_DATA HighWrite >>>>>>>>>>>>>>>>>>>> pSrb = 0x%08x\n\r", pSrb) );
  1326. // Valid DVD data to transfer decoder board.
  1327. if( pHwDevExt->Rate < 10000 )
  1328. {
  1329. pSrb->Status = STATUS_SUCCESS;
  1330. StreamNextDataNotify( pSrb );
  1331. StreamCompleteNotify( pSrb );
  1332. };
  1333. WriteDataChangeHwStreamState( pHwDevExt );
  1334. pHwDevExt->kserv.DisableHwInt();
  1335. pWdmBuff = &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff);
  1336. pWdmBuff->Init();
  1337. pWdmBuff->SetSRB( pSrb );
  1338. pSrb->Status = STATUS_PENDING;
  1339. pHwDevExt->scheduler.SendData( pSrb ); // for F.F. & F.R.
  1340. pHwDevExt->kserv.EnableHwInt();
  1341. StreamNextDataNotify( pSrb );
  1342. DBG_PRINTF( ("DVDWDM:<<<<<<<<<<<<<<<<<<<<\n\r") );
  1343. return;
  1344. };
  1345. }
  1346. #endif
  1347. // StreamClassCallAtNewPriority(NULL,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowSubpicReceiveDataPacket,pSrb);
  1348. StreamClassCallAtNewPriority(pSrb->StreamObject,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowSubpicReceiveDataPacket,pSrb);
  1349. // StreamNextDataNotify( pSrb ); // move to LowSubpicReceiveDataPacket
  1350. }
  1351. /************/
  1352. //extern "C" VOID STREAMAPI SubpicReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1353. VOID LowSubpicReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1354. {
  1355. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1356. #ifdef DBG
  1357. WORD wOrderNumber = 0;
  1358. KSSTREAM_HEADER * pHeader;
  1359. DBG_PRINTF( ("DVDWDM:Low Subpic Receive Data Packet----- NumberofBuffers=%x\n\r",pSrb->NumberOfBuffers) );
  1360. for( ULONG ulNumber = 0; ulNumber < pSrb->NumberOfBuffers; ulNumber++ )
  1361. {
  1362. pHeader = ((PKSSTREAM_HEADER)pSrb->CommandData.DataBufferArray) + ulNumber;
  1363. wOrderNumber = (WORD)(pHeader->TypeSpecificFlags >> 16); //get packet number
  1364. DBG_PRINTF( ("DVDWDM: wOrderNumber=%x\n\r",wOrderNumber) );
  1365. }
  1366. #endif
  1367. DBG_PRINTF( ("DVDWDM:Low Sub-pic Receive Data Packet----- pSrb=0x%x\n\r",pSrb) );
  1368. CWDMBuffer *pWdmBuff;
  1369. // need to this line.
  1370. CWDMBuffer temp8;
  1371. #ifndef REARRANGEMENT
  1372. for (int buffcnt = 0; buffcnt < WDM_BUFFER_MAX; buffcnt++)
  1373. RtlCopyMemory( &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff[buffcnt]), &temp8, sizeof(CWDMBuffer) );
  1374. #else
  1375. RtlCopyMemory( &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff), &temp8, sizeof(CWDMBuffer) );
  1376. #endif REARRANGEMENT
  1377. ULONG i;
  1378. PKSSTREAM_HEADER pStruc;
  1379. StreamNextDataNotify( pSrb ); // move from SubpicReceiveDataPacket
  1380. switch( pSrb->Command ){
  1381. case SRB_WRITE_DATA:
  1382. DBG_PRINTF( ("DVDWDM:---SRB_WRITE_DATA\n\r") );
  1383. // ULONG i;
  1384. // PKSSTREAM_HEADER pStruc;
  1385. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  1386. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  1387. if( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY ){
  1388. DBG_PRINTF( ("DVDWDM: DATA_DISCONTINUITY(Subpic)\n\r" ));
  1389. }
  1390. if( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY ){
  1391. DBG_PRINTF( ("DVDWDM: TIME_DISCONTINUITY(Subpic)\n\r" ));
  1392. }
  1393. if( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TIMEVALID ) {
  1394. DBG_PRINTF((
  1395. "DVDWDM:Subpic PTS: 0x%x( 0x%s(100ns) )\r\n",
  1396. ConvertStrmtoPTS(pStruc->PresentationTime.Time),
  1397. DebugLLConvtoStr( pStruc->PresentationTime.Time, 16 )
  1398. ));
  1399. }
  1400. //--- 98.06.02 S.Watanabe
  1401. if( pStruc->TypeSpecificFlags & KS_AM_UseNewCSSKey ) {
  1402. pHwDevExt->CppFlagCount++;
  1403. DBG_PRINTF(( "DVDWDM: CppFlagCount=%ld\r\n", pHwDevExt->CppFlagCount ));
  1404. if( pHwDevExt->CppFlagCount >= pHwDevExt->cOpenInputStream + 1 )
  1405. SetCppFlag( pHwDevExt, TRUE );
  1406. }
  1407. //--- End.
  1408. }
  1409. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  1410. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  1411. DBG_PRINTF( ("DVDWDM: Subpic PacketFlag = 0x%x\n\r", pStruc->OptionsFlags ));
  1412. if( pStruc->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TYPECHANGED ){
  1413. DBG_PRINTF( ("DVDWDM: TYPE CHANGE(Subpic)\n\r") );
  1414. i = pSrb->NumberOfBuffers;
  1415. break;
  1416. }
  1417. if( pStruc->DataUsed )
  1418. break;
  1419. }
  1420. if( i==pSrb->NumberOfBuffers ){
  1421. pSrb->Status = STATUS_SUCCESS;
  1422. #ifndef REARRANGEMENT
  1423. pHwDevExt->scheduler.SendData( pSrb );
  1424. #endif REARRANGEMENT
  1425. break;
  1426. }
  1427. //
  1428. if( pHwDevExt->StreamState == StreamState_Stop ){
  1429. DBG_PRINTF( ("DVDWDM:STOP STATE now!!\n\r") );
  1430. #ifndef REARRANGEMENT
  1431. pSrb->Status = STATUS_SUCCESS;
  1432. pHwDevExt->scheduler.SendData( pSrb );
  1433. #endif REARRANGEMENT
  1434. CallAtStreamCompleteNotify( pSrb, STATUS_SUCCESS );
  1435. return;
  1436. }
  1437. ///
  1438. for( i=0; i<(pSrb->NumberOfBuffers); i++ ){
  1439. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  1440. // before sending data, check Subpic channel,
  1441. ASSERT( pStruc!=NULL );
  1442. if( pStruc->DataUsed ){
  1443. SetSubpicID( pHwDevExt, pStruc );
  1444. }
  1445. }
  1446. if( pSrb->NumberOfPhysicalPages > 0 ){
  1447. DBG_PRINTF( ("DVDWDM:>>>>>>>>>>>>>>>>>>>> pSrb = 0x%08x\n\r", pSrb ) );
  1448. // Valid DVD data to transfer decoder board.
  1449. if( pHwDevExt->Rate < 10000 )
  1450. {
  1451. pSrb->Status = STATUS_SUCCESS;
  1452. #ifndef REARRANGEMENT
  1453. pHwDevExt->scheduler.SendData( pSrb );
  1454. #endif REARRANGEMENT
  1455. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  1456. return;
  1457. };
  1458. WriteDataChangeHwStreamState( pHwDevExt );
  1459. pHwDevExt->kserv.DisableHwInt();
  1460. #ifndef REARRANGEMENT
  1461. for (buffcnt = 0; buffcnt < WDM_BUFFER_MAX; buffcnt++)
  1462. {
  1463. pWdmBuff = &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff[buffcnt]);
  1464. pWdmBuff->Init();
  1465. pWdmBuff->SetSRB( pSrb );
  1466. }
  1467. #else
  1468. pWdmBuff = &(((PSRB_EXTENSION)(pSrb->SRBExtension))->m_wdmbuff);
  1469. pWdmBuff->Init();
  1470. pWdmBuff->SetSRB( pSrb );
  1471. #endif REARRANGEMENT
  1472. pSrb->Status = STATUS_PENDING;
  1473. pHwDevExt->scheduler.SendData( pSrb ); // for F.F. & F.R.
  1474. pHwDevExt->kserv.EnableHwInt();
  1475. DBG_PRINTF( ("DVDWDM:<<<<<<<<<<<<<<<<<<<<\n\r") );
  1476. return;
  1477. }
  1478. pSrb->Status = STATUS_SUCCESS;
  1479. break;
  1480. default:
  1481. DBG_PRINTF( ("DVDWDM:---deafult %d(0x%x)\n\r", pSrb->Command, pSrb->Command) );
  1482. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1483. break;
  1484. }
  1485. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  1486. #ifndef REARRANGEMENT
  1487. DBG_PRINTF( ("DVDWDM:LowSubpicReceiveDataPacket-CompleteSrb = %x\n\r", pSrb) );
  1488. #endif REARRANGEMENT
  1489. }
  1490. /********/
  1491. extern "C" VOID STREAMAPI SubpicReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1492. {
  1493. DBG_PRINTF( ("DVDWDM:Sub-pic Receive Control Packet----- pSrb=0x%x\n\r",pSrb) );
  1494. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1495. pSrb->Status = STATUS_PENDING;
  1496. switch( pSrb->Command ){
  1497. case SRB_GET_STREAM_PROPERTY:
  1498. case SRB_SET_STREAM_PROPERTY:
  1499. case SRB_BEGIN_FLUSH:
  1500. // StreamClassCallAtNewPriority(NULL,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowSubpicReceiveCtrlPacket,pSrb);
  1501. StreamClassCallAtNewPriority(pSrb->StreamObject,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowSubpicReceiveCtrlPacket,pSrb);
  1502. // StreamNextCtrlNotify( pSrb ); // move to LowSubpicReceiveCtrlPacket
  1503. return;
  1504. case SRB_SET_STREAM_STATE:
  1505. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_STATE\n\r") );
  1506. switch( pSrb->CommandData.StreamState ){
  1507. case KSSTATE_STOP:
  1508. DBG_PRINTF( ("DVDWDM: KSSTATE_STOP\n\r") );
  1509. SetSubpicRateDefault( pHwDevExt );
  1510. break;
  1511. case KSSTATE_PAUSE:
  1512. DBG_PRINTF( ("DVDWDM: KSSTATE_PAUSE\n\r") );
  1513. break;
  1514. case KSSTATE_RUN:
  1515. DBG_PRINTF( ("DVDWDM: KSSTATE_RUN\n\r") );
  1516. break;
  1517. }
  1518. pSrb->Status = STATUS_SUCCESS;
  1519. break;
  1520. case SRB_GET_STREAM_STATE:
  1521. DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_STATE\n\r") );
  1522. pSrb->Status = STATUS_SUCCESS;
  1523. break;
  1524. case SRB_OPEN_MASTER_CLOCK:
  1525. DBG_PRINTF( ("DVDWDM:---SRB_OPEN_MASTER_CLOCK\n\r") );
  1526. pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  1527. pSrb->Status = STATUS_SUCCESS;
  1528. break;
  1529. case SRB_CLOSE_MASTER_CLOCK:
  1530. DBG_PRINTF( ("DVDWDM:---SRB_CLOSE_MASTER_CLOCK\n\r") );
  1531. pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  1532. pSrb->Status = STATUS_SUCCESS;
  1533. break;
  1534. case SRB_INDICATE_MASTER_CLOCK:
  1535. DBG_PRINTF( ("DVDWDM:---SRB_INDICATE_MASTER_CLOCK\n\r") );
  1536. pHwDevExt->hClk = pSrb->CommandData.MasterClockHandle;
  1537. pSrb->Status = STATUS_SUCCESS;
  1538. break;
  1539. case SRB_UNKNOWN_STREAM_COMMAND:
  1540. DBG_PRINTF( ("DVDWDM:---SRB_UNKNOWN_STREAM_COMMAND\n\r") );
  1541. DBG_BREAK();
  1542. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1543. break;
  1544. case SRB_SET_STREAM_RATE:
  1545. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_RATE\n\r") );
  1546. DBG_BREAK();
  1547. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1548. break;
  1549. case SRB_PROPOSE_DATA_FORMAT:
  1550. DBG_PRINTF( ("DVDWDM:---SRB_PROPOSE_DATA_FORMAT\n\r") );
  1551. DBG_BREAK();
  1552. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1553. break;
  1554. case SRB_END_FLUSH:
  1555. DBG_PRINTF( ("---SRB_END_FLUSH\n\r") );
  1556. pSrb->Status = STATUS_SUCCESS;
  1557. break;
  1558. default:
  1559. DBG_PRINTF( ("DVDWDM:---deafult %d(0x%x)\n\r", pSrb->Command, pSrb->Command ) );
  1560. DBG_BREAK();
  1561. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1562. break;
  1563. }
  1564. StreamNextCtrlNotify( pSrb );
  1565. StreamCompleteNotify( pSrb );
  1566. }
  1567. /********/
  1568. //extern "C" VOID STREAMAPI SubpicReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1569. VOID LowSubpicReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1570. {
  1571. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1572. DBG_PRINTF( ("DVDWDM:Low Sub-pic Receive Control Packet----- pSrb=0x%x\n\r",pSrb) );
  1573. StreamNextCtrlNotify( pSrb ); // move from SubpicReceiveCtrlPacket
  1574. switch( pSrb->Command ){
  1575. case SRB_GET_STREAM_PROPERTY:
  1576. DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_PROPERTY\n\r") );
  1577. GetSubpicProperty( pSrb );
  1578. if( pSrb->Status == STATUS_PENDING )
  1579. return;
  1580. break;
  1581. case SRB_SET_STREAM_PROPERTY:
  1582. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_PROPERTY\n\r") );
  1583. SetSubpicProperty( pSrb );
  1584. if( pSrb->Status == STATUS_PENDING )
  1585. return;
  1586. break;
  1587. case SRB_BEGIN_FLUSH:
  1588. DBG_PRINTF( ("---SRB_BEGIN_FLUSH\n\r") );
  1589. // if( pHwDevExt->dvdstrm.GetState() != Stop )
  1590. {
  1591. // flush Sub-pic data.
  1592. DWORD tmpSpProp;
  1593. tmpSpProp = 0xffff;
  1594. if( !pHwDevExt->dvdstrm.SetSubpicProperty( SubpicProperty_FlushBuff, &tmpSpProp ) ){
  1595. DBG_PRINTF( ("DVDWDM: Subpic Flush Error\n\r") );
  1596. DBG_BREAK();
  1597. CallAtStreamCompleteNotify( pSrb,STATUS_IO_DEVICE_ERROR );
  1598. return;
  1599. }
  1600. }
  1601. pSrb->Status = STATUS_SUCCESS;
  1602. break;
  1603. default:
  1604. DBG_PRINTF( ("DVDWDM:---deafult %d(0x%x)\n\r", pSrb->Command, pSrb->Command ) );
  1605. DBG_BREAK();
  1606. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1607. break;
  1608. }
  1609. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  1610. }
  1611. //--- 98.06.01 S.Watanabe
  1612. ///*********/
  1613. //extern "C" VOID STREAMAPI NtscReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1614. //{
  1615. // pSrb->Status = STATUS_PENDING;
  1616. //// DBG_BREAK();
  1617. // StreamClassCallAtNewPriority(
  1618. // NULL,
  1619. // pSrb->HwDeviceExtension,
  1620. // Low,
  1621. // (PHW_PRIORITY_ROUTINE)LowNtscReceiveDataPacket,
  1622. // pSrb
  1623. // );
  1624. //}
  1625. ///*********/
  1626. //
  1627. ////extern "C" VOID STREAMAPI NtscReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1628. //VOID LowNtscReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1629. //{
  1630. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1631. //
  1632. // DBG_PRINTF( ("DVDWDM:NTSC Receive Data Packet-----\n\r") );
  1633. //
  1634. // switch( pSrb->Command ){
  1635. // case SRB_WRITE_DATA:
  1636. // DBG_PRINTF( ("DVDWDM:---SRB_WRITE_DATA\n\r") );
  1637. // pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1638. // break;
  1639. //
  1640. // default:
  1641. // DBG_PRINTF( ("DVDWDM:---deafult\n\r") );
  1642. // pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1643. // break;
  1644. // }
  1645. // StreamClassStreamNotification( ReadyForNextStreamDataRequest,
  1646. // pSrb->StreamObject );
  1647. // StreamClassStreamNotification( StreamRequestComplete,
  1648. // pSrb->StreamObject, pSrb );
  1649. //
  1650. //}
  1651. //
  1652. //
  1653. ///************/
  1654. //extern "C" VOID STREAMAPI NtscReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1655. //{
  1656. // pSrb->Status = STATUS_PENDING;
  1657. //// DBG_BREAK();
  1658. // StreamClassCallAtNewPriority(
  1659. // NULL,
  1660. // pSrb->HwDeviceExtension,
  1661. // Low,
  1662. // (PHW_PRIORITY_ROUTINE)LowNtscReceiveCtrlPacket,
  1663. // pSrb
  1664. // );
  1665. //}
  1666. ///***********/
  1667. //
  1668. ////extern "C" VOID STREAMAPI NtscReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1669. //VOID LowNtscReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1670. //{
  1671. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1672. //
  1673. // DBG_PRINTF( ("DVDWDM:NTSC Receive Control Packet-----\n\r") );
  1674. //
  1675. // switch( pSrb->Command ){
  1676. // case SRB_SET_STREAM_STATE:
  1677. // DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_STATE\n\r") );
  1678. // switch( pSrb->CommandData.StreamState ){
  1679. // case KSSTATE_STOP:
  1680. // DBG_PRINTF( ("DVDWDM: KSSTATE_STOP\n\r") );
  1681. // break;
  1682. //
  1683. // case KSSTATE_PAUSE:
  1684. // DBG_PRINTF( ("DVDWDM: KSSTATE_PAUSE\n\r") );
  1685. // break;
  1686. //
  1687. // case KSSTATE_RUN:
  1688. // DBG_PRINTF( ("DVDWDM: KSSTATE_RUN\n\r") );
  1689. // break;
  1690. // }
  1691. // pSrb->Status = STATUS_SUCCESS;
  1692. // break;
  1693. //
  1694. // case SRB_GET_STREAM_STATE:
  1695. // DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_STATE\n\r") );
  1696. // pSrb->Status = STATUS_SUCCESS;
  1697. // break;
  1698. //
  1699. // case SRB_GET_STREAM_PROPERTY:
  1700. // DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_PROPERTY\n\r") );
  1701. //
  1702. // GetNtscProperty( pSrb );
  1703. //
  1704. //// pSrb->Status = STATUS_SUCCESS;
  1705. // if( pSrb->Status != STATUS_PENDING ){
  1706. // StreamClassStreamNotification( ReadyForNextStreamControlRequest,
  1707. // pSrb->StreamObject );
  1708. // StreamClassStreamNotification( StreamRequestComplete,
  1709. // pSrb->StreamObject,
  1710. // pSrb );
  1711. // }
  1712. // return;
  1713. // break;
  1714. //
  1715. // case SRB_SET_STREAM_PROPERTY:
  1716. // DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_PROPERTY\n\r") );
  1717. //
  1718. // SetNtscProperty( pSrb );
  1719. //
  1720. // break;
  1721. //
  1722. // case SRB_OPEN_MASTER_CLOCK:
  1723. // DBG_PRINTF( ("DVDWDM:---SRB_OPEN_MASTER_CLOCK\n\r") );
  1724. //
  1725. // pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  1726. //
  1727. // pSrb->Status = STATUS_SUCCESS;
  1728. // break;
  1729. //
  1730. // case SRB_CLOSE_MASTER_CLOCK:
  1731. // DBG_PRINTF( ("DVDWDM:---SRB_CLOSE_MASTER_CLOCK\n\r") );
  1732. //
  1733. // pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  1734. //
  1735. // pSrb->Status = STATUS_SUCCESS;
  1736. // break;
  1737. //
  1738. // case SRB_INDICATE_MASTER_CLOCK:
  1739. // DBG_PRINTF( ("DVDWDM:---SRB_INDICATE_MASTER_CLOCK\n\r") );
  1740. //
  1741. // pHwDevExt->hClk = pSrb->CommandData.MasterClockHandle;
  1742. //
  1743. // pSrb->Status = STATUS_SUCCESS;
  1744. // break;
  1745. //
  1746. // case SRB_UNKNOWN_STREAM_COMMAND:
  1747. // DBG_PRINTF( ("DVDWDM:---SRB_UNKNOWN_STREAM_COMMAND\n\r") );
  1748. // DBG_BREAK();
  1749. // pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1750. // break;
  1751. //
  1752. // case SRB_SET_STREAM_RATE:
  1753. // DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_RATE\n\r") );
  1754. // DBG_BREAK();
  1755. // pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1756. // break;
  1757. //
  1758. // case SRB_PROPOSE_DATA_FORMAT:
  1759. // DBG_PRINTF( ("DVDWDM:---SRB_PROPOSE_DATA_FORMAT\n\r") );
  1760. // DBG_BREAK();
  1761. // pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1762. // break;
  1763. //
  1764. // default:
  1765. // DBG_PRINTF( ("DVDWDM:---deafult %d(0x%x)\n\r", pSrb->Command, pSrb->Command ) );
  1766. // DBG_BREAK();
  1767. // pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1768. // break;
  1769. // }
  1770. // StreamClassStreamNotification( ReadyForNextStreamControlRequest,
  1771. // pSrb->StreamObject );
  1772. // StreamClassStreamNotification( StreamRequestComplete,
  1773. // pSrb->StreamObject, pSrb );
  1774. //
  1775. //}
  1776. //--- End.
  1777. extern "C" VOID STREAMAPI VpeReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1778. {
  1779. DBG_PRINTF( ("DVDWDM:Low VPE Receive Data Packet----- pSrb=0x%x\n\r",pSrb) );
  1780. switch( pSrb->Command ){
  1781. case SRB_READ_DATA:
  1782. DBG_PRINTF( ("DVDWDM:---SRB_READ_DATA\n\r") );
  1783. pSrb->ActualBytesTransferred = 0;
  1784. DBG_BREAK();
  1785. pSrb->Status = STATUS_SUCCESS;
  1786. break;
  1787. case SRB_WRITE_DATA:
  1788. DBG_PRINTF( ("DVDWDM:---SRB_WRITE_DATA\n\r") );
  1789. DBG_BREAK();
  1790. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1791. break;
  1792. default:
  1793. DBG_PRINTF( ("DVDWDM:---deafult %d(0x%x)\n\r", pSrb->Command, pSrb->Command) );
  1794. DBG_BREAK();
  1795. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1796. break;
  1797. }
  1798. StreamNextDataNotify( pSrb );
  1799. StreamCompleteNotify( pSrb );
  1800. }
  1801. /*********/
  1802. extern "C" VOID STREAMAPI VpeReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1803. {
  1804. DBG_PRINTF( ("DVDWDM:VPE Receive Control Packet----- pSrb=0x%x\n\r",pSrb) );
  1805. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1806. pSrb->Status = STATUS_PENDING;
  1807. switch( pSrb->Command ){
  1808. case SRB_GET_STREAM_PROPERTY:
  1809. case SRB_SET_STREAM_PROPERTY:
  1810. // StreamClassCallAtNewPriority(NULL,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowVpeReceiveCtrlPacket,pSrb);
  1811. StreamClassCallAtNewPriority(pSrb->StreamObject,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowVpeReceiveCtrlPacket,pSrb);
  1812. // StreamNextCtrlNotify( pSrb ); // move to LowVpeReceiveCtrlPacket
  1813. return;
  1814. case SRB_SET_STREAM_STATE:
  1815. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_STATE\n\r") );
  1816. switch( pSrb->CommandData.StreamState ){
  1817. case KSSTATE_STOP:
  1818. DBG_PRINTF( ("DVDWDM: VPE KSSTATE_STOP\n\r") );
  1819. break;
  1820. case KSSTATE_PAUSE:
  1821. DBG_PRINTF( ("DVDWDM: VPE KSSTATE_PAUSE\n\r") );
  1822. break;
  1823. case KSSTATE_RUN:
  1824. DBG_PRINTF( ("DVDWDM: VPE KSSTATE_RUN\n\r") );
  1825. break;
  1826. }
  1827. pSrb->Status = STATUS_SUCCESS;
  1828. break;
  1829. case SRB_GET_STREAM_STATE:
  1830. DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_STATE\n\r") );
  1831. pSrb->Status = STATUS_SUCCESS;
  1832. break;
  1833. case SRB_OPEN_MASTER_CLOCK:
  1834. DBG_PRINTF( ("DVDWDM:---SRB_OPEN_MASTER_CLOCK\n\r") );
  1835. pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  1836. pSrb->Status = STATUS_SUCCESS;
  1837. break;
  1838. case SRB_CLOSE_MASTER_CLOCK:
  1839. DBG_PRINTF( ("DVDWDM:---SRB_CLOSE_MASTER_CLOCK\n\r") );
  1840. pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  1841. pSrb->Status = STATUS_SUCCESS;
  1842. break;
  1843. case SRB_INDICATE_MASTER_CLOCK:
  1844. DBG_PRINTF( ("DVDWDM:---SRB_INDICATE_MASTER_CLOCK\n\r") );
  1845. pHwDevExt->hClk = pSrb->CommandData.MasterClockHandle;
  1846. pSrb->Status = STATUS_SUCCESS;
  1847. break;
  1848. case SRB_UNKNOWN_STREAM_COMMAND:
  1849. DBG_PRINTF( ("DVDWDM:---SRB_UNKNOWN_STREAM_COMMAND\n\r") );
  1850. DBG_BREAK();
  1851. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1852. break;
  1853. case SRB_SET_STREAM_RATE:
  1854. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_RATE\n\r") );
  1855. DBG_BREAK();
  1856. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1857. break;
  1858. case SRB_PROPOSE_DATA_FORMAT:
  1859. DBG_PRINTF( ("DVDWDM:---SRB_PROPOSE_DATA_FORMAT\n\r") );
  1860. DBG_BREAK();
  1861. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1862. break;
  1863. default:
  1864. DBG_PRINTF( ("DVDWDM:---deafult %d(0x%x)\n\r", pSrb->Command, pSrb->Command) );
  1865. DBG_BREAK();
  1866. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1867. break;
  1868. }
  1869. StreamNextCtrlNotify( pSrb );
  1870. StreamCompleteNotify( pSrb );
  1871. }
  1872. /*********/
  1873. //extern "C" VOID STREAMAPI VpeReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1874. VOID LowVpeReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1875. {
  1876. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1877. DBG_PRINTF( ("DVDWDM:Low VPE Receive Control Packet----- pSrb=0x%x\n\r",pSrb) );
  1878. StreamNextCtrlNotify( pSrb ); // move from VpeReceiveCtrlPacket
  1879. switch( pSrb->Command ){
  1880. case SRB_GET_STREAM_PROPERTY:
  1881. DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_PROPERTY\n\r") );
  1882. //--- 98.06.16 S.Watanabe
  1883. // if( ToshibaNotePC( pSrb )!=TRUE ){
  1884. if( !pHwDevExt->bToshibaNotePC ) {
  1885. //--- End.
  1886. GetVpeProperty( pSrb );
  1887. }else{
  1888. GetVpeProperty2( pSrb );
  1889. }
  1890. if( pSrb->Status == STATUS_PENDING )
  1891. return;
  1892. break;
  1893. case SRB_SET_STREAM_PROPERTY:
  1894. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_PROPERTY\n\r") );
  1895. //--- 98.06.16 S.Watanabe
  1896. // if( ToshibaNotePC( pSrb )!=TRUE ){
  1897. if( !pHwDevExt->bToshibaNotePC ) {
  1898. //--- End.
  1899. SetVpeProperty( pSrb );
  1900. }else{
  1901. SetVpeProperty2( pSrb );
  1902. }
  1903. break;
  1904. default:
  1905. DBG_PRINTF( ("DVDWDM:---deafult %d(0x%x)\n\r", pSrb->Command, pSrb->Command) );
  1906. DBG_BREAK();
  1907. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1908. break;
  1909. }
  1910. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  1911. }
  1912. /************/
  1913. extern "C" VOID STREAMAPI CcReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1914. {
  1915. pSrb->Status = STATUS_PENDING;
  1916. // DBG_BREAK();
  1917. // StreamClassCallAtNewPriority( NULL, pSrb->HwDeviceExtension, Low, (PHW_PRIORITY_ROUTINE)LowCcReceiveDataPacket, pSrb );
  1918. StreamClassCallAtNewPriority( pSrb->StreamObject, pSrb->HwDeviceExtension, Low, (PHW_PRIORITY_ROUTINE)LowCcReceiveDataPacket, pSrb );
  1919. // StreamNextDataNotify( pSrb ); // move to LowCcReceiveDataPacket
  1920. }
  1921. /**************/
  1922. //extern "C" VOID STREAMAPI CcReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1923. VOID LowCcReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1924. {
  1925. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1926. #ifdef DBG
  1927. WORD wOrderNumber = 0;
  1928. KSSTREAM_HEADER * pHeader;
  1929. DBG_PRINTF( ("DVDWDM:LowCcReceiveDataPacket----- NumberofBuffers=%x\n\r",pSrb->NumberOfBuffers) );
  1930. for( ULONG ulNumber = 0; ulNumber < pSrb->NumberOfBuffers; ulNumber++ )
  1931. {
  1932. pHeader = ((PKSSTREAM_HEADER)pSrb->CommandData.DataBufferArray) + ulNumber;
  1933. wOrderNumber = (WORD)(pHeader->TypeSpecificFlags >> 16); //get packet number
  1934. DBG_PRINTF( ("DVDWDM: wOrderNumber=%x\n\r",wOrderNumber) );
  1935. }
  1936. #endif
  1937. DBG_PRINTF( ("DVDWDM:Low CC Receive Data Packet----- pSrb=0x%x\n\r",pSrb) );
  1938. StreamNextDataNotify( pSrb ); // move from CcReceiveDataPacket
  1939. switch( pSrb->Command ){
  1940. case SRB_READ_DATA:
  1941. DBG_PRINTF( ("DVDWDM:---SRB_READ_DATA\n\r") );
  1942. // if( pHwDevExt->Rate < 10000 ){
  1943. // pSrb->Status = STATUS_SUCCESS;
  1944. //
  1945. // }else{
  1946. pHwDevExt->ccque.put( pSrb );
  1947. pSrb->Status = STATUS_PENDING;
  1948. // pSrb->TimeoutOriginal = 0;
  1949. pSrb->TimeoutCounter = 0;
  1950. return;
  1951. // }
  1952. break;
  1953. case SRB_WRITE_DATA:
  1954. DBG_PRINTF( ("DVDWDM:---SRB_WRITE_DATA\n\r") );
  1955. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1956. break;
  1957. default:
  1958. DBG_PRINTF( ("DVDWDM:---deafult\n\r") );
  1959. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  1960. break;
  1961. }
  1962. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  1963. }
  1964. /***********/
  1965. extern "C" VOID STREAMAPI CcReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  1966. {
  1967. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  1968. DBG_PRINTF( ("DVDWDM:CC Receive Control Packet----- pSrb=0x%x\n\r",pSrb) );
  1969. pSrb->Status = STATUS_PENDING;
  1970. switch( pSrb->Command ){
  1971. case SRB_GET_STREAM_PROPERTY:
  1972. case SRB_SET_STREAM_PROPERTY:
  1973. // StreamClassCallAtNewPriority(NULL,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowCcReceiveCtrlPacket,pSrb);
  1974. StreamClassCallAtNewPriority(pSrb->StreamObject,pSrb->HwDeviceExtension,Low,(PHW_PRIORITY_ROUTINE)LowCcReceiveCtrlPacket,pSrb);
  1975. // StreamNextCtrlNotify( pSrb ); // move to LowCcReceiveCtrlPacket
  1976. return;
  1977. case SRB_SET_STREAM_STATE:
  1978. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_STATE\n\r") );
  1979. switch( pSrb->CommandData.StreamState ){
  1980. case KSSTATE_STOP:
  1981. DBG_PRINTF( ("DVDWDM: CC KSSTATE_STOP\n\r") );
  1982. break;
  1983. case KSSTATE_PAUSE:
  1984. DBG_PRINTF( ("DVDWDM: CC KSSTATE_PAUSE\n\r") );
  1985. break;
  1986. case KSSTATE_RUN:
  1987. DBG_PRINTF( ("DVDWDM: CC KSSTATE_RUN\n\r") );
  1988. break;
  1989. }
  1990. pSrb->Status = STATUS_SUCCESS;
  1991. break;
  1992. case SRB_GET_STREAM_STATE:
  1993. DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_STATE\n\r") );
  1994. pSrb->Status = STATUS_SUCCESS;
  1995. break;
  1996. case SRB_OPEN_MASTER_CLOCK:
  1997. DBG_PRINTF( ("DVDWDM:---SRB_OPEN_MASTER_CLOCK\n\r") );
  1998. pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  1999. pSrb->Status = STATUS_SUCCESS;
  2000. break;
  2001. case SRB_CLOSE_MASTER_CLOCK:
  2002. DBG_PRINTF( ("DVDWDM:---SRB_CLOSE_MASTER_CLOCK\n\r") );
  2003. pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  2004. pSrb->Status = STATUS_SUCCESS;
  2005. break;
  2006. case SRB_INDICATE_MASTER_CLOCK:
  2007. DBG_PRINTF( ("DVDWDM:---SRB_INDICATE_MASTER_CLOCK\n\r") );
  2008. pHwDevExt->hClk = pSrb->CommandData.MasterClockHandle;
  2009. pSrb->Status = STATUS_SUCCESS;
  2010. break;
  2011. case SRB_UNKNOWN_STREAM_COMMAND:
  2012. DBG_PRINTF( ("DVDWDM:---SRB_UNKNOWN_STREAM_COMMAND\n\r") );
  2013. DBG_BREAK();
  2014. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  2015. break;
  2016. case SRB_SET_STREAM_RATE:
  2017. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_RATE\n\r") );
  2018. DBG_BREAK();
  2019. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  2020. break;
  2021. case SRB_PROPOSE_DATA_FORMAT:
  2022. DBG_PRINTF( ("DVDWDM:---SRB_PROPOSE_DATA_FORMAT\n\r") );
  2023. DBG_BREAK();
  2024. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  2025. break;
  2026. default:
  2027. DBG_PRINTF( ("DVDWDM:---deafult%d(0x%x)\n\r", pSrb->Command, pSrb->Command ) );
  2028. DBG_BREAK();
  2029. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  2030. break;
  2031. }
  2032. StreamNextCtrlNotify( pSrb );
  2033. StreamCompleteNotify( pSrb );
  2034. }
  2035. /**********/
  2036. //extern "C" VOID STREAMAPI CcReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2037. VOID LowCcReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2038. {
  2039. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  2040. DBG_PRINTF( ("DVDWDM:Low CC Receive Control Packet----- pSrb=0x%x\n\r",pSrb) );
  2041. StreamNextCtrlNotify( pSrb ); // move from CcReceiveCtrlPacket
  2042. switch( pSrb->Command ){
  2043. case SRB_GET_STREAM_PROPERTY:
  2044. DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_PROPERTY\n\r") );
  2045. GetCCProperty( pSrb );
  2046. break;
  2047. case SRB_SET_STREAM_PROPERTY:
  2048. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_PROPERTY\n\r") );
  2049. SetCCProperty( pSrb );
  2050. break;
  2051. default:
  2052. DBG_PRINTF( ("DVDWDM:---deafult%d(0x%x)\n\r", pSrb->Command, pSrb->Command ) );
  2053. DBG_BREAK();
  2054. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  2055. break;
  2056. }
  2057. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  2058. }
  2059. //--- 98.05.21 S.Watanabe
  2060. /***********/
  2061. extern "C" VOID STREAMAPI SSReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2062. {
  2063. pSrb->Status = STATUS_PENDING;
  2064. // DBG_BREAK();
  2065. // StreamClassCallAtNewPriority( NULL, pSrb->HwDeviceExtension, Low, (PHW_PRIORITY_ROUTINE)LowSSReceiveDataPacket, pSrb );
  2066. StreamClassCallAtNewPriority( pSrb->StreamObject, pSrb->HwDeviceExtension, Low, (PHW_PRIORITY_ROUTINE)LowSSReceiveDataPacket, pSrb );
  2067. // StreamNextDataNotify( pSrb ); // move to LowSSReceiveDataPacket
  2068. }
  2069. /***********/
  2070. //extern "C" VOID STREAMAPI SSReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2071. VOID LowSSReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2072. {
  2073. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  2074. #ifdef DBG
  2075. WORD wOrderNumber = 0;
  2076. KSSTREAM_HEADER * pHeader;
  2077. DBG_PRINTF( ("DVDWDM:LowSSReceiveDataPacket----- NumberofBuffers=%x\n\r",pSrb->NumberOfBuffers) );
  2078. for( ULONG ulNumber = 0; ulNumber < pSrb->NumberOfBuffers; ulNumber++ )
  2079. {
  2080. pHeader = ((PKSSTREAM_HEADER)pSrb->CommandData.DataBufferArray) + ulNumber;
  2081. wOrderNumber = (WORD)(pHeader->TypeSpecificFlags >> 16); //get packet number
  2082. DBG_PRINTF( ("DVDWDM: wOrderNumber=%x\n\r",wOrderNumber) );
  2083. }
  2084. #endif
  2085. OsdDataStruc TestOSD;
  2086. DBG_PRINTF( ("DVDWDM:Low SS Receive Data Packet----- pSrb=0x%x\n\r",pSrb) );
  2087. StreamNextDataNotify( pSrb ); // move from SSReceiveDataPacket
  2088. switch( pSrb->Command ){
  2089. case SRB_WRITE_DATA:
  2090. DBG_PRINTF( ("DVDWDM:---SRB_WRITE_DATA\n\r") );
  2091. //--- 98.05.21 S.Watanabe
  2092. PKSSTREAM_HEADER pStruc;
  2093. CMD *pcmd;
  2094. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[0];
  2095. pcmd = (CMD *)pStruc->Data;
  2096. // BUGBUG �\���̂̃T�C�Y�`�F�b�N���s������
  2097. pSrb->Status = STATUS_SUCCESS;
  2098. switch ( pcmd->dwCmd ) {
  2099. case CAP_AUDIO_DIGITAL_OUT:
  2100. pcmd->dwCap = 1; // 1: support
  2101. break; // 0: not support
  2102. case CAP_VIDEO_DIGITAL_PALETTE:
  2103. pcmd->dwCap = 1;
  2104. break;
  2105. case CAP_VIDEO_TVOUT:
  2106. DWORD PropType;
  2107. PropType = 0;
  2108. if( !pHwDevExt->dvdstrm.GetCapability( VideoProperty, &PropType ) ){
  2109. DBG_PRINTF( ("DVDWDM: GetCapability Error\n\r") );
  2110. DBG_BREAK();
  2111. }
  2112. if( PropType & VideoProperty_OutputSource_BIT ){
  2113. pcmd->dwCap = 1;
  2114. }else{
  2115. pcmd->dwCap = 0;
  2116. }
  2117. break;
  2118. //--- 99.01.14 S.Watanabe
  2119. case CAP_VIDEO_DISPMODE:
  2120. pcmd->dwCap = 1;
  2121. break;
  2122. //--- End.
  2123. case SET_AUDIO_DIGITAL_OUT:
  2124. {
  2125. DWORD dp;
  2126. if( pcmd->dwAudioOut == 2 )
  2127. dp = AudioDigitalOut_On;
  2128. else if( pcmd->dwAudioOut == 1 )
  2129. dp = AudioDigitalOut_On;
  2130. else
  2131. dp = AudioDigitalOut_Off;
  2132. pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_DigitalOut, &dp );
  2133. pHwDevExt->m_AudioDigitalOut = dp;
  2134. if( pcmd->dwAudioOut == 2 ) {
  2135. dp = AudioOut_Decoded;
  2136. pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_AudioOut, &dp );
  2137. }
  2138. else if( pcmd->dwAudioOut == 1 ) {
  2139. dp = AudioOut_Encoded;
  2140. pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_AudioOut, &dp );
  2141. }
  2142. pHwDevExt->m_AudioEncode = dp;
  2143. }
  2144. break;
  2145. case SET_VIDEO_DIGITAL_PALETTE:
  2146. {
  2147. Digital_Palette dp;
  2148. dp.Select = Video_Palette_Y;
  2149. dp.pPalette = pcmd->Y;
  2150. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_DigitalPalette, &dp );
  2151. dp.Select = Video_Palette_Cb;
  2152. dp.pPalette = pcmd->Cb;
  2153. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_DigitalPalette, &dp );
  2154. dp.Select = Video_Palette_Cr;
  2155. dp.pPalette = pcmd->Cr;
  2156. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_DigitalPalette, &dp );
  2157. }
  2158. break;
  2159. case SET_VIDEO_TVOUT:
  2160. {
  2161. DWORD dp;
  2162. if( pcmd->dwTVOut == 0 ){
  2163. dp = OutputSource_VGA;
  2164. }else{
  2165. dp = OutputSource_DVD;
  2166. }
  2167. TestOSD.OsdType = OSD_TYPE_ZIVA;
  2168. TestOSD.pNextData = NULL;
  2169. TestOSD.pData = &erase[0];
  2170. TestOSD.dwOsdSize = sizeof( erase );
  2171. if( VGADVDTVControl( pSrb, dp, TestOSD )==TRUE ){ // 98.07.07 H.Yagi
  2172. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dp );
  2173. }
  2174. pHwDevExt->m_OutputSource = dp;
  2175. }
  2176. break;
  2177. //--- 99.01.14 S.Watanabe
  2178. case SET_VIDEO_DISPMODE:
  2179. {
  2180. DWORD fPSLB = 0;
  2181. DWORD dProp;
  2182. if( pcmd->dwDispMode == SSIF_DISPMODE_43TV )
  2183. pHwDevExt->m_DisplayDevice = DisplayDevice_NormalTV;
  2184. else if( pcmd->dwDispMode == SSIF_DISPMODE_169TV )
  2185. pHwDevExt->m_DisplayDevice = DisplayDevice_WideTV;
  2186. else
  2187. pHwDevExt->m_DisplayDevice = DisplayDevice_VGA;
  2188. if( pHwDevExt->m_VideoFormatFlags & 0x20 ){ // KS_MPEG2_LetterboxAnalogOut){
  2189. DBG_PRINTF( ("DVDWDM: KS_MPEG2_SourceisLetterboxed\n\r") );
  2190. if( pHwDevExt->m_DisplayDevice == DisplayDevice_NormalTV )
  2191. fPSLB |= 0x01;
  2192. }
  2193. if( pHwDevExt->m_VideoFormatFlags & KS_MPEG2_DoPanScan ){
  2194. DBG_PRINTF( ("DVDWDM: KS_MPEG2_DoPanScan\n\r") );
  2195. if( pHwDevExt->m_DisplayDevice != DisplayDevice_WideTV )
  2196. fPSLB |= 0x02;
  2197. }
  2198. switch( fPSLB ) {
  2199. case 0x00:
  2200. dProp = Display_Original;
  2201. break;
  2202. case 0x01:
  2203. dProp = Display_LetterBox;
  2204. break;
  2205. case 0x02:
  2206. dProp = Display_PanScan;
  2207. break;
  2208. default:
  2209. dProp = Display_Original;
  2210. DBG_PRINTF( ("DVDWDM: Invalid info(LB&PS)\n\r") );
  2211. DBG_BREAK();
  2212. break;
  2213. }
  2214. if( pHwDevExt->m_AspectRatio == Aspect_04_03 ){ // check dwFlags is avilable
  2215. dProp = Display_Original;
  2216. }
  2217. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_DisplayMode, &dProp ) ){
  2218. DBG_PRINTF( ("DVDWDM:Set LetterBox & PanScan Error\n\r") );
  2219. DBG_BREAK();
  2220. }
  2221. pHwDevExt->m_DisplayMode = dProp;
  2222. }
  2223. break;
  2224. //--- End.
  2225. default:
  2226. DBG_BREAK();
  2227. pSrb->Status = STATUS_UNSUCCESSFUL;
  2228. break;
  2229. }
  2230. //--- End.
  2231. break;
  2232. default:
  2233. DBG_PRINTF( ("DVDWDM:---deafult\n\r") );
  2234. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  2235. break;
  2236. }
  2237. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  2238. }
  2239. /***********/
  2240. extern "C" VOID STREAMAPI SSReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2241. {
  2242. pSrb->Status = STATUS_PENDING;
  2243. // DBG_BREAK();
  2244. // StreamClassCallAtNewPriority( NULL, pSrb->HwDeviceExtension, Low, (PHW_PRIORITY_ROUTINE)LowSSReceiveCtrlPacket, pSrb );
  2245. StreamClassCallAtNewPriority( pSrb->StreamObject, pSrb->HwDeviceExtension, Low, (PHW_PRIORITY_ROUTINE)LowSSReceiveCtrlPacket, pSrb );
  2246. // StreamNextCtrlNotify( pSrb ); // move to SSReceiveCtrlPacket
  2247. }
  2248. /***********/
  2249. //extern "C" VOID STREAMAPI SSReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2250. VOID LowSSReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2251. {
  2252. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  2253. DBG_PRINTF( ("DVDWDM:Low SS Receive Control Packet----- pSrb=0x%x\n\r",pSrb) );
  2254. StreamNextCtrlNotify( pSrb ); // move from SSReceiveCtrlPacket
  2255. switch( pSrb->Command ){
  2256. case SRB_SET_STREAM_STATE:
  2257. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_STATE\n\r") );
  2258. switch( pSrb->CommandData.StreamState ){
  2259. case KSSTATE_STOP:
  2260. DBG_PRINTF( ("DVDWDM: KSSTATE_STOP\n\r") );
  2261. break;
  2262. case KSSTATE_PAUSE:
  2263. DBG_PRINTF( ("DVDWDM: KSSTATE_PAUSE\n\r") );
  2264. break;
  2265. case KSSTATE_RUN:
  2266. DBG_PRINTF( ("DVDWDM: KSSTATE_RUN\n\r") );
  2267. break;
  2268. }
  2269. pSrb->Status = STATUS_SUCCESS;
  2270. break;
  2271. case SRB_GET_STREAM_STATE:
  2272. DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_STATE\n\r") );
  2273. pSrb->Status = STATUS_SUCCESS;
  2274. break;
  2275. case SRB_GET_STREAM_PROPERTY:
  2276. DBG_PRINTF( ("DVDWDM:---SRB_GET_STREAM_PROPERTY\n\r") );
  2277. DBG_BREAK();
  2278. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  2279. break;
  2280. case SRB_SET_STREAM_PROPERTY:
  2281. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_PROPERTY\n\r") );
  2282. DBG_BREAK();
  2283. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  2284. break;
  2285. case SRB_OPEN_MASTER_CLOCK:
  2286. DBG_PRINTF( ("DVDWDM:---SRB_OPEN_MASTER_CLOCK\n\r") );
  2287. pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  2288. pSrb->Status = STATUS_SUCCESS;
  2289. break;
  2290. case SRB_CLOSE_MASTER_CLOCK:
  2291. DBG_PRINTF( ("DVDWDM:---SRB_CLOSE_MASTER_CLOCK\n\r") );
  2292. pHwDevExt->hMaster = pSrb->CommandData.MasterClockHandle;
  2293. pSrb->Status = STATUS_SUCCESS;
  2294. break;
  2295. case SRB_INDICATE_MASTER_CLOCK:
  2296. DBG_PRINTF( ("DVDWDM:---SRB_INDICATE_MASTER_CLOCK\n\r") );
  2297. pHwDevExt->hClk = pSrb->CommandData.MasterClockHandle;
  2298. pSrb->Status = STATUS_SUCCESS;
  2299. break;
  2300. case SRB_UNKNOWN_STREAM_COMMAND:
  2301. DBG_PRINTF( ("DVDWDM:---SRB_UNKNOWN_STREAM_COMMAND\n\r") );
  2302. DBG_BREAK();
  2303. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  2304. break;
  2305. case SRB_SET_STREAM_RATE:
  2306. DBG_PRINTF( ("DVDWDM:---SRB_SET_STREAM_RATE\n\r") );
  2307. DBG_BREAK();
  2308. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  2309. break;
  2310. case SRB_PROPOSE_DATA_FORMAT:
  2311. DBG_PRINTF( ("DVDWDM:---SRB_PROPOSE_DATA_FORMAT\n\r") );
  2312. DBG_BREAK();
  2313. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  2314. break;
  2315. default:
  2316. DBG_PRINTF( ("DVDWDM:---deafult %d(0x%x)\n\r", pSrb->Command, pSrb->Command ) );
  2317. DBG_BREAK();
  2318. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  2319. break;
  2320. }
  2321. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  2322. }
  2323. //--- End.
  2324. ////////////////////////////////////////////////////////////////////////////
  2325. //
  2326. // Private Functions
  2327. //
  2328. ////////////////////////////////////////////////////////////////////////////
  2329. void ErrorStreamNotification( PHW_STREAM_REQUEST_BLOCK pSrb, NTSTATUS stat )
  2330. {
  2331. pSrb->Status = stat;
  2332. StreamClassStreamNotification( ReadyForNextStreamControlRequest,
  2333. pSrb->StreamObject );
  2334. StreamClassStreamNotification( StreamRequestComplete,
  2335. pSrb->StreamObject, pSrb );
  2336. }
  2337. BOOL GetStreamInfo( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2338. {
  2339. PHW_STREAM_INFORMATION pstrinfo =
  2340. &(pSrb->CommandData.StreamBuffer->StreamInfo);
  2341. // define the number of streams which mini-driver can support.
  2342. pSrb->CommandData.StreamBuffer->StreamHeader.NumberOfStreams = STREAMNUM;
  2343. // pSrb->CommandData.StreamBuffer->StreamHeader.NumberOfStreams = STREAMNUM-1; // CC doesn't support for Debug.
  2344. pSrb->CommandData.StreamBuffer->StreamHeader.SizeOfHwStreamInformation =
  2345. sizeof( HW_STREAM_INFORMATION );
  2346. // store a pointer to the topology for the device.
  2347. pSrb->CommandData.StreamBuffer->StreamHeader.Topology =
  2348. (KSTOPOLOGY *)&Topology;
  2349. // pSrb->CommandData.StreamBuffer->StreamHeader.NumDevPropArrayEntries =1;
  2350. // pSrb->CommandData.StreamBuffer->StreamHeader.DevicePropertiesArray = devicePropSet;
  2351. // Video
  2352. pstrinfo->NumberOfPossibleInstances = 1;
  2353. pstrinfo->DataFlow = KSPIN_DATAFLOW_IN;
  2354. pstrinfo->DataAccessible = TRUE;
  2355. pstrinfo->NumberOfFormatArrayEntries = SIZEOF_ARRAY( Mpeg2VidInfo );
  2356. pstrinfo->StreamFormatsArray = Mpeg2VidInfo;
  2357. pstrinfo->Category = &g_PINNAME_DVD_VIDEOIN;
  2358. pstrinfo->Name = &g_PINNAME_DVD_VIDEOIN;
  2359. pstrinfo->NumStreamPropArrayEntries = SIZEOF_ARRAY( mpegVidPropSet );
  2360. pstrinfo->StreamPropertiesArray = mpegVidPropSet;
  2361. pstrinfo++;
  2362. // Audio
  2363. pstrinfo->NumberOfPossibleInstances = 1;
  2364. pstrinfo->DataFlow = KSPIN_DATAFLOW_IN;
  2365. pstrinfo->DataAccessible = TRUE;
  2366. pstrinfo->NumberOfFormatArrayEntries = SIZEOF_ARRAY( Mpeg2AudInfo );
  2367. //--- 98.06.01 S.Watanabe
  2368. /*
  2369. Initialize the formats now. For each format (there are currently 2),
  2370. take the array of sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX) bytes
  2371. allocated for it and paste the KSDATAFORMAT and WAVEFORMATEX structs
  2372. into it. Cannot just declare a struct that contains the two because
  2373. due to alignment its size would exceed the total of the components,
  2374. and apparently KS assumes that the size of the format block (in this
  2375. case WAVEFORMATEX) is the size of the format minus sizeof(KSDATAFORMAT).
  2376. */
  2377. RtlCopyMemory (hwfmtiLPCMAud, &LPCMksdataformat, sizeof (KSDATAFORMAT));
  2378. RtlCopyMemory (hwfmtiLPCMAud + sizeof(KSDATAFORMAT), &LPCMwaveformatex, sizeof(WAVEFORMATEX));
  2379. RtlCopyMemory (hwfmtiMpeg2Aud, &Mpeg2ksdataformat, sizeof (KSDATAFORMAT));
  2380. RtlCopyMemory (hwfmtiMpeg2Aud + sizeof(KSDATAFORMAT), &Mpeg2waveformatex, sizeof(WAVEFORMATEX));
  2381. //--- End.
  2382. pstrinfo->StreamFormatsArray = Mpeg2AudInfo;
  2383. pstrinfo->Category = &g_PINNAME_DVD_AUDIOIN;
  2384. pstrinfo->Name = &g_PINNAME_DVD_AUDIOIN;
  2385. pstrinfo->NumStreamPropArrayEntries = SIZEOF_ARRAY( mpegAudioPropSet );
  2386. pstrinfo->StreamPropertiesArray = mpegAudioPropSet;
  2387. pstrinfo->StreamEventsArray = ClockEventSet;
  2388. pstrinfo->NumStreamEventArrayEntries = SIZEOF_ARRAY( ClockEventSet );
  2389. pstrinfo++;
  2390. // Sub-picture
  2391. pstrinfo->NumberOfPossibleInstances = 1;
  2392. pstrinfo->DataFlow = KSPIN_DATAFLOW_IN;
  2393. pstrinfo->DataAccessible = TRUE;
  2394. pstrinfo->NumberOfFormatArrayEntries = SIZEOF_ARRAY( Mpeg2SubpicInfo );
  2395. pstrinfo->StreamFormatsArray = Mpeg2SubpicInfo;
  2396. pstrinfo->Category = &g_PINNAME_DVD_SUBPICIN;
  2397. pstrinfo->Name = &g_PINNAME_DVD_SUBPICIN;
  2398. pstrinfo->NumStreamPropArrayEntries = SIZEOF_ARRAY( SPPropSet );
  2399. pstrinfo->StreamPropertiesArray = SPPropSet;
  2400. pstrinfo++;
  2401. //--- 98.06.01 S.Watanabe
  2402. // // NTSC
  2403. // pstrinfo->NumberOfPossibleInstances = 1;
  2404. // pstrinfo->DataFlow = KSPIN_DATAFLOW_OUT;
  2405. // pstrinfo->DataAccessible = TRUE;
  2406. // pstrinfo->NumberOfFormatArrayEntries = SIZEOF_ARRAY( NtscInfo );
  2407. // pstrinfo->StreamFormatsArray = NtscInfo;
  2408. // pstrinfo->NumStreamPropArrayEntries = SIZEOF_ARRAY( NTSCPropSet );
  2409. // pstrinfo->StreamPropertiesArray = NTSCPropSet;
  2410. // pstrinfo++;
  2411. //--- End.
  2412. // Video port
  2413. pstrinfo->NumberOfPossibleInstances = 1;
  2414. pstrinfo->DataFlow = KSPIN_DATAFLOW_OUT;
  2415. pstrinfo->DataAccessible = TRUE;
  2416. pstrinfo->NumberOfFormatArrayEntries = SIZEOF_ARRAY( VPEInfo );
  2417. pstrinfo->StreamFormatsArray = VPEInfo;
  2418. pstrinfo->Category = &g_PINNAME_DVD_VPEOUT;
  2419. pstrinfo->Name = &g_PINNAME_DVD_VPEOUT;
  2420. pstrinfo->NumStreamPropArrayEntries = SIZEOF_ARRAY(VideoPortPropSet );
  2421. pstrinfo->StreamPropertiesArray = VideoPortPropSet;
  2422. pstrinfo->MediumsCount = SIZEOF_ARRAY( VPMedium );
  2423. pstrinfo->Mediums= VPMedium;
  2424. pstrinfo->StreamEventsArray = VPEventSet;
  2425. pstrinfo->NumStreamEventArrayEntries = SIZEOF_ARRAY( VPEventSet );
  2426. pstrinfo++;
  2427. // Closed Caption
  2428. // CC doesn't support for Debug
  2429. pstrinfo->NumberOfPossibleInstances = 1;
  2430. pstrinfo->DataFlow = KSPIN_DATAFLOW_OUT;
  2431. pstrinfo->DataAccessible = TRUE;
  2432. pstrinfo->NumberOfFormatArrayEntries = SIZEOF_ARRAY( CCInfo );
  2433. pstrinfo->StreamFormatsArray = CCInfo;
  2434. pstrinfo->Category = &g_PINNAME_DVD_CCOUT;
  2435. pstrinfo->Name = &g_PINNAME_DVD_CCOUT;
  2436. pstrinfo->NumStreamPropArrayEntries = SIZEOF_ARRAY( CCPropSet );
  2437. pstrinfo->StreamPropertiesArray = CCPropSet;
  2438. //--- 98.05.21 S.Watanabe
  2439. pstrinfo++;
  2440. // Special Stream
  2441. pstrinfo->NumberOfPossibleInstances = 1;
  2442. pstrinfo->DataFlow = KSPIN_DATAFLOW_OUT;
  2443. pstrinfo->DataAccessible = TRUE;
  2444. pstrinfo->NumberOfFormatArrayEntries = SIZEOF_ARRAY( SSInfo );
  2445. pstrinfo->StreamFormatsArray = SSInfo;
  2446. pstrinfo->NumStreamPropArrayEntries = 0;
  2447. //--- End.
  2448. return( TRUE );
  2449. }
  2450. BOOL OpenStream( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2451. {
  2452. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  2453. DBG_PRINTF( ("DVDWDM:OpenStream HwDevExt=%08x\n\r", pHwDevExt ) );
  2454. pHwDevExt->lCPPStrm = -1; // reset the copy protection stream number
  2455. switch( pSrb->StreamObject->StreamNumber ){
  2456. case strmVideo:
  2457. DBG_PRINTF( ("DVDWDM:Open Stream Video\n\r") );
  2458. pSrb->StreamObject->ReceiveDataPacket = VideoReceiveDataPacket;
  2459. pSrb->StreamObject->ReceiveControlPacket = VideoReceiveCtrlPacket;
  2460. pHwDevExt->pstroVid = pSrb->StreamObject;
  2461. pHwDevExt->Rate = VIDEO_MAX_FULL_RATE;
  2462. // Power On ZiVA board.
  2463. if( pHwDevExt->mpboard.PowerOn() ){
  2464. pHwDevExt->dvdstrm.SetTransferMode( HALSTREAM_DVD_MODE );
  2465. pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_DigitalOut, &pHwDevExt->m_AudioDigitalOut );
  2466. #ifndef REARRANGEMENT
  2467. // FlushQueue(pHwDevExt);
  2468. #endif REARRANGEMENT
  2469. if( pHwDevExt->dvdstrm.Stop() ){
  2470. pHwDevExt->StreamState = StreamState_Stop;
  2471. pHwDevExt->m_PlayMode = PLAY_MODE_NORMAL;
  2472. }else{
  2473. return( FALSE );
  2474. }
  2475. }else{
  2476. return( FALSE );
  2477. }
  2478. // ProcessVideoFormat( pSrb->CommandData.OpenFormat, pHwDevExt );
  2479. ProcessVideoFormat( pSrb, pSrb->CommandData.OpenFormat, pHwDevExt );
  2480. SetVideoRateDefault( pHwDevExt );
  2481. if( pHwDevExt->m_PCID==PC_TECRA8000 ){
  2482. DWORD dProp = OutputSource_DVD;
  2483. pHwDevExt->m_OutputSource = OutputSource_DVD;
  2484. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  2485. }
  2486. OsdDataStruc TestOSD;
  2487. TestOSD.OsdType = OSD_TYPE_ZIVA;
  2488. TestOSD.pNextData = NULL;
  2489. TestOSD.pData = &erase[0];
  2490. TestOSD.dwOsdSize = sizeof( erase );
  2491. OpenTVControl( pSrb, TestOSD ); // 98.06.29 H.Yagi
  2492. //// 99.03.02 add by H.Yagi
  2493. pHwDevExt->dvdstrm.CppInit();
  2494. //// ---End
  2495. //--- 98.06.02 S.Watanabe
  2496. pHwDevExt->cOpenInputStream++;
  2497. //--- End.
  2498. break;
  2499. case strmAudio:
  2500. DBG_PRINTF( ("DVDWDM:Open Stream Audio\n\r") );
  2501. pSrb->StreamObject->ReceiveDataPacket = AudioReceiveDataPacket;
  2502. pSrb->StreamObject->ReceiveControlPacket = AudioReceiveCtrlPacket;
  2503. pSrb->StreamObject->HwClockObject.HwClockFunction = StreamClockRtn;
  2504. pSrb->StreamObject->HwClockObject.ClockSupportFlags =
  2505. CLOCK_SUPPORT_CAN_SET_ONBOARD_CLOCK | CLOCK_SUPPORT_CAN_READ_ONBOARD_CLOCK |
  2506. CLOCK_SUPPORT_CAN_RETURN_STREAM_TIME;
  2507. pHwDevExt->pstroAud = pSrb->StreamObject;
  2508. ProcessAudioFormat( pSrb->CommandData.OpenFormat, pHwDevExt );
  2509. pSrb->StreamObject->HwEventRoutine = (PHW_EVENT_ROUTINE)AudioEvent;
  2510. SetAudioRateDefault( pHwDevExt );
  2511. //--- 98.06.02 S.Watanabe
  2512. pHwDevExt->cOpenInputStream++;
  2513. //--- End.
  2514. break;
  2515. case strmSubpicture:
  2516. DBG_PRINTF( ("DVDWDM:Open Stream Sub-picture\n\r") );
  2517. pSrb->StreamObject->ReceiveDataPacket = SubpicReceiveDataPacket;
  2518. pSrb->StreamObject->ReceiveControlPacket = SubpicReceiveCtrlPacket;
  2519. pHwDevExt->pstroSP = pSrb->StreamObject;
  2520. SetSubpicRateDefault( pHwDevExt );
  2521. pHwDevExt->m_HlightControl.OpenControl();
  2522. //--- 98.06.02 S.Watanabe
  2523. pHwDevExt->cOpenInputStream++;
  2524. //--- End.
  2525. break;
  2526. //--- 98.06.01 S.Watanabe
  2527. // case strmNTSCVideo:
  2528. // DBG_PRINTF( ("DVDWDM:Open Stream NTSC\n\r") );
  2529. // pSrb->StreamObject->ReceiveDataPacket = NtscReceiveDataPacket;
  2530. // pSrb->StreamObject->ReceiveControlPacket = NtscReceiveCtrlPacket;
  2531. // break;
  2532. //--- End.
  2533. case strmYUVVideo:
  2534. DBG_PRINTF( ("DVDWDM:Open Stream YUV\n\r") );
  2535. pSrb->StreamObject->ReceiveDataPacket = VpeReceiveDataPacket;
  2536. pSrb->StreamObject->ReceiveControlPacket = VpeReceiveCtrlPacket;
  2537. pHwDevExt->pstroYUV = pSrb->StreamObject;
  2538. pSrb->StreamObject->HwEventRoutine = (PHW_EVENT_ROUTINE)CycEvent;
  2539. //--- 98.06.16 S.Watanabe
  2540. pHwDevExt->bToshibaNotePC = ToshibaNotePC( pSrb );
  2541. //--- End.
  2542. break;
  2543. case strmCCOut:
  2544. DBG_PRINTF( ("DVDWDM:Open Stream Closed Caption\n\r") );
  2545. pSrb->StreamObject->ReceiveDataPacket = CcReceiveDataPacket;
  2546. pSrb->StreamObject->ReceiveControlPacket = CcReceiveCtrlPacket;
  2547. pHwDevExt->pstroCC = pSrb->StreamObject;
  2548. pHwDevExt->ccque.Init();
  2549. pHwDevExt->userdata.Init( pHwDevExt );
  2550. pHwDevExt->mphal.SetSinkWrapper( &(pHwDevExt->userdata) );
  2551. DWORD dProp;
  2552. dProp = ClosedCaption_On;
  2553. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_ClosedCaption, &dProp ) ){
  2554. DBG_PRINTF( ("DVDWDM: USCC on Error!\n\r") );
  2555. DBG_BREAK();
  2556. return( FALSE );
  2557. }
  2558. pHwDevExt->m_ClosedCaption = ClosedCaption_On;
  2559. break;
  2560. //--- 98.05.21 S.Watanabe
  2561. case strmSS:
  2562. DBG_PRINTF( ("DVDWDM:Open Special Stream\n\r") );
  2563. pSrb->StreamObject->ReceiveDataPacket = SSReceiveDataPacket;
  2564. pSrb->StreamObject->ReceiveControlPacket = SSReceiveCtrlPacket;
  2565. pHwDevExt->pstroSS = pSrb->StreamObject;
  2566. break;
  2567. //--- End.
  2568. default :
  2569. DBG_PRINTF( ("DVDWDM:Open Stream default = 0x%0x\n\r", pSrb->StreamObject->StreamNumber ) );
  2570. DBG_BREAK();
  2571. break;
  2572. }
  2573. pSrb->StreamObject->Dma = TRUE;
  2574. pSrb->StreamObject->Pio = TRUE; // Need Pio = TRUE for access on CPU
  2575. return( TRUE );
  2576. }
  2577. BOOL CloseStream( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2578. {
  2579. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  2580. switch( pSrb->StreamObject->StreamNumber ){
  2581. case strmVideo:
  2582. DBG_PRINTF( ("DVDWDM:Close Stream Video\n\r") );
  2583. pHwDevExt->pstroVid = NULL;
  2584. //--- 98.06.02 S.Watanabe
  2585. pHwDevExt->cOpenInputStream--;
  2586. //--- End.
  2587. if( pHwDevExt->dvdstrm.GetState() != Stop )
  2588. {
  2589. #ifndef REARRANGEMENT
  2590. // FlushQueue(pHwDevExt);
  2591. #endif REARRANGEMENT
  2592. pHwDevExt->dvdstrm.Stop();
  2593. }
  2594. CloseTVControl( pSrb );
  2595. pHwDevExt->StreamState = StreamState_Off;
  2596. if( !pHwDevExt->mpboard.PowerOff() ){
  2597. DBG_PRINTF( ("DVDWDM: mpboard.PowerOff Error\n\r") );
  2598. DBG_BREAK();
  2599. return( FALSE );
  2600. }
  2601. break;
  2602. case strmAudio:
  2603. DBG_PRINTF( ("DVDWDM:Close Stream Audio\n\r") );
  2604. pHwDevExt->pstroAud = NULL;
  2605. //--- 98.06.02 S.Watanabe
  2606. pHwDevExt->cOpenInputStream--;
  2607. //--- End.
  2608. break;
  2609. case strmSubpicture:
  2610. DBG_PRINTF( ("DVDWDM:Close Stream Sub-picture\n\r") );
  2611. pHwDevExt->pstroSP = NULL;
  2612. //--- 98.06.02 S.Watanabe
  2613. pHwDevExt->cOpenInputStream--;
  2614. //--- End.
  2615. pHwDevExt->m_HlightControl.CloseControl();
  2616. break;
  2617. //--- 98.06.01 S.Watanabe
  2618. // case strmNTSCVideo:
  2619. // DBG_PRINTF( ("DVDWDM:Close Stream NTSC\n\r") );
  2620. // break;
  2621. //--- End.
  2622. case strmYUVVideo:
  2623. DBG_PRINTF( ("DVDWDM:Close Stream YUV\n\r") );
  2624. pHwDevExt->pstroYUV = NULL;
  2625. break;
  2626. case strmCCOut:
  2627. DBG_PRINTF( ("DVDWDM:Close Stream Closed Caption\n\r") );
  2628. pHwDevExt->pstroCC = NULL;
  2629. pHwDevExt->mphal.UnsetSinkWrapper( &(pHwDevExt->userdata) );
  2630. DWORD dProp;
  2631. dProp = ClosedCaption_Off;
  2632. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_ClosedCaption, &dProp ) ){
  2633. DBG_PRINTF( ("DVDWDM: USCC off Error!\n\r") );
  2634. DBG_BREAK();
  2635. return( FALSE );
  2636. }
  2637. pHwDevExt->m_ClosedCaption = ClosedCaption_Off;
  2638. break;
  2639. //--- 98.05.21 S.Watanabe
  2640. case strmSS:
  2641. DBG_PRINTF( ("DVDWDM:Close Special Stream\n\r") );
  2642. pHwDevExt->pstroSS = NULL;
  2643. break;
  2644. //--- End.
  2645. default :
  2646. DBG_PRINTF( ("DVDWDM:Close Stream default = 0x%0x\n\r", pSrb->StreamObject->StreamNumber ) );
  2647. DBG_BREAK();
  2648. break;
  2649. }
  2650. return( TRUE );
  2651. }
  2652. NTSTATUS DataIntersection( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2653. {
  2654. NTSTATUS Status = STATUS_SUCCESS;
  2655. PSTREAM_DATA_INTERSECT_INFO IntersectInfo;
  2656. PKSDATARANGE DataRange;
  2657. PKSDATAFORMAT pFormat = NULL;
  2658. ULONG formatSize;
  2659. IntersectInfo = pSrb->CommandData.IntersectInfo;
  2660. //--- 98.06.01 S.Watanabe
  2661. DataRange = IntersectInfo->DataRange;
  2662. //--- End.
  2663. switch( IntersectInfo->StreamNumber ){
  2664. case strmVideo:
  2665. DBG_PRINTF( ("DVDWDM: Video\n\r") );
  2666. pFormat = &hwfmtiMpeg2Vid;
  2667. formatSize = sizeof( hwfmtiMpeg2Vid );
  2668. break;
  2669. case strmAudio:
  2670. //--- 98.06.01 S.Watanabe
  2671. // pFormat = &hwfmtiMpeg2Aud[0];
  2672. // formatSize = sizeof( hwfmtiMpeg2Aud );
  2673. DBG_PRINTF( ("TOSDVD: Audio\r\n") );
  2674. if (IsEqualGUID2(&(DataRange->SubFormat), &(Mpeg2ksdataformat.SubFormat))) {
  2675. DBG_PRINTF( ("TOSDVD: AC3 Audio format query\r\n") );
  2676. pFormat = (PKSDATAFORMAT) hwfmtiMpeg2Aud;
  2677. formatSize = sizeof (KSDATAFORMAT) + sizeof (WAVEFORMATEX);
  2678. }
  2679. else if (IsEqualGUID2(&(DataRange->SubFormat), &(LPCMksdataformat.SubFormat))) {
  2680. DBG_PRINTF( ("TOSDVD: LPCM Audio format query\r\n") );
  2681. pFormat = (PKSDATAFORMAT) hwfmtiLPCMAud;
  2682. formatSize = sizeof (KSDATAFORMAT) + sizeof (WAVEFORMATEX);
  2683. }
  2684. else {
  2685. DBG_PRINTF( ("TOSDVD: unknown Audio format query\r\n") );
  2686. pFormat = NULL;
  2687. formatSize = 0;
  2688. }
  2689. //--- End.
  2690. break;
  2691. //--- 98.06.01 S.Watanabe
  2692. // case strmNTSCVideo:
  2693. // pFormat = &hwfmtiNtscOut;
  2694. // formatSize = sizeof( hwfmtiNtscOut );
  2695. // break;
  2696. //--- End.
  2697. case strmSubpicture:
  2698. DBG_PRINTF( ("DVDWDM: SubPic\n\r") );
  2699. pFormat = &hwfmtiMpeg2Subpic;
  2700. formatSize = sizeof( hwfmtiMpeg2Subpic );
  2701. break;
  2702. case strmYUVVideo:
  2703. DBG_PRINTF( ("DVDWDM: VPE\n\r") );
  2704. pFormat = &hwfmtiVPEOut;
  2705. formatSize = sizeof( hwfmtiVPEOut );
  2706. break;
  2707. case strmCCOut:
  2708. DBG_PRINTF( ("DVDWDM: CC\n\r") );
  2709. pFormat = &hwfmtiCCOut;
  2710. formatSize = sizeof( hwfmtiCCOut );
  2711. break;
  2712. //--- 98.05.21 S.Watanabe
  2713. case strmSS:
  2714. DBG_PRINTF( ("DVDWDM: SS\n\r") );
  2715. pFormat = &hwfmtiSS;
  2716. formatSize = sizeof( hwfmtiSS );
  2717. break;
  2718. //--- End.
  2719. default :
  2720. DBG_PRINTF( ("DVDWDM:STATUS_NOT_IMPLEMENTED\n\r") );
  2721. Status = STATUS_NOT_IMPLEMENTED;
  2722. return( Status );
  2723. }
  2724. if( pFormat ){
  2725. //
  2726. // do a minimal compare of the dataranges to at least verify
  2727. // that the guids are the same.
  2728. // BUGBUG - this is worefully incomplete.
  2729. //
  2730. DataRange = IntersectInfo->DataRange;
  2731. if( !(IsEqualGUID2( &DataRange->MajorFormat, &pFormat->MajorFormat) &&
  2732. IsEqualGUID2( &DataRange->Specifier, &pFormat->Specifier) ) ){
  2733. DBG_PRINTF( ("DVDWDM: No Match!\n\r") );
  2734. DBG_BREAK();
  2735. Status = STATUS_NO_MATCH;
  2736. }else{
  2737. //
  2738. // check to see if the size of the passed in buffer is a ULONG.
  2739. // if so, this indicates that we are to return only the size
  2740. // needed, and not return the actual data.
  2741. //
  2742. if( IntersectInfo->SizeOfDataFormatBuffer!=sizeof(ULONG)) {
  2743. //
  2744. // we are to copy the data, not just return size
  2745. //
  2746. if( IntersectInfo->SizeOfDataFormatBuffer<formatSize ){
  2747. DBG_PRINTF( ("DVDWDM: Too Small!!\n\r") );
  2748. // DBG_BREAK();
  2749. Status = STATUS_BUFFER_TOO_SMALL;
  2750. }else{
  2751. RtlCopyMemory( IntersectInfo->DataFormatBuffer, pFormat, formatSize );
  2752. pSrb->ActualBytesTransferred = formatSize;
  2753. DBG_PRINTF( ("DVDWDM: STATUS_SUCCESS(data copy)\n\r") );
  2754. Status = STATUS_SUCCESS;
  2755. }
  2756. }else{
  2757. //
  2758. // caller wants just the size of the buffer.
  2759. //
  2760. *(PULONG)IntersectInfo->DataFormatBuffer = formatSize;
  2761. pSrb->ActualBytesTransferred = sizeof(ULONG);
  2762. DBG_PRINTF( ("DVDWDM: STATUS_SUCCESS(retuen size)\n\r") );
  2763. }
  2764. }
  2765. }else{
  2766. DBG_PRINTF( ("DVDWDM: STATUS_NOT_SUPPORTED\n\r") );
  2767. DBG_BREAK();
  2768. Status = STATUS_NOT_SUPPORTED;
  2769. }
  2770. // pSrb->Status = Status;
  2771. return( Status );
  2772. }
  2773. NTSTATUS STREAMAPI AudioEvent( PHW_EVENT_DESCRIPTOR pEvent )
  2774. {
  2775. PUCHAR pCopy = (PUCHAR)( pEvent->EventEntry+1 );
  2776. PMYTIME pmyt = (PMYTIME)pCopy;
  2777. PUCHAR pSrc = (PUCHAR)pEvent->EventData;
  2778. ULONG cCopy;
  2779. DBG_PRINTF( ("DVDWDM:AudioEvent()\n\r") );
  2780. if( pEvent->Enable ){
  2781. switch( pEvent->EventEntry->EventItem->EventId ){
  2782. case KSEVENT_CLOCK_POSITION_MARK:
  2783. cCopy = sizeof( KSEVENT_TIME_MARK );
  2784. break;
  2785. case KSEVENT_CLOCK_INTERVAL_MARK:
  2786. cCopy = sizeof( KSEVENT_TIME_INTERVAL );
  2787. break;
  2788. default:
  2789. DBG_BREAK();
  2790. return( STATUS_NOT_IMPLEMENTED );
  2791. }
  2792. if( pEvent->EventEntry->EventItem->DataInput != cCopy ){
  2793. DBG_BREAK();
  2794. return( STATUS_INVALID_BUFFER_SIZE );
  2795. }
  2796. // copy the input buffer
  2797. for( ; cCopy>0; cCopy-- ){
  2798. *pCopy++ = *pSrc++;
  2799. }
  2800. if( pEvent->EventEntry->EventItem->EventId == KSEVENT_CLOCK_INTERVAL_MARK ){
  2801. pmyt->LastTime = 0;
  2802. }
  2803. }
  2804. return( STATUS_SUCCESS );
  2805. }
  2806. VOID STREAMAPI StreamClockRtn( IN PHW_TIME_CONTEXT TimeContext )
  2807. {
  2808. //
  2809. // Return Value at the case of
  2810. // STOP state : 0
  2811. // PAUSE state : Counting time at pausing
  2812. // RUN(Normal) state : Counting time as normal speed
  2813. // RUN(Slow) state : Counting time as slow speed
  2814. // RUN(FF/FR) state : Counting time as FF/FR spped
  2815. //
  2816. DBG_PRINTF( ("DVDWDM:Stream Clock Rtn\n\r") );
  2817. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)TimeContext->HwDeviceExtension;
  2818. if( TimeContext->Function != TIME_GET_STREAM_TIME ){
  2819. //
  2820. // should handle set onboard, and read onboard clock here.
  2821. //
  2822. DBG_BREAK();
  2823. return;
  2824. }
  2825. TimeContext->Time = pHwDevExt->ticktime.GetStreamTime();
  2826. TimeContext->SystemTime = pHwDevExt->ticktime.GetSystemTime();
  2827. //--- 98.06.01 S.Watanabe
  2828. DBG_PRINTF(( "DVDWDM:Clk : 0x%x( 0x%s(100ns) )\r\n", ConvertStrmtoPTS(TimeContext->Time), DebugLLConvtoStr( TimeContext->Time, 16 ) ));
  2829. //--- End.
  2830. return;
  2831. }
  2832. NTSTATUS STREAMAPI CycEvent( PHW_EVENT_DESCRIPTOR pEvent )
  2833. {
  2834. PSTREAMEX pstrm = (PSTREAMEX)( pEvent->StreamObject->HwStreamExtension );
  2835. DBG_PRINTF( ("DVDWDM:CycEvent\n\r") );
  2836. if( pEvent->Enable ){
  2837. pstrm->EventCount++;
  2838. }else{
  2839. pstrm->EventCount--;
  2840. }
  2841. return( STATUS_SUCCESS );
  2842. }
  2843. void GetVpeProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  2844. {
  2845. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION) pSrb->HwDeviceExtension;
  2846. DWORD dwInputBufferSize;
  2847. DWORD dwOutputBufferSize;
  2848. DWORD dwNumConnectInfo=2;
  2849. DWORD dwNumVideoFormat=1;
  2850. DWORD dwFieldWidth=720;
  2851. DWORD dwFieldHeight= 240;
  2852. DWORD dwPerField = 17000;
  2853. DWORD dwFrameRate = 30;
  2854. switch( pHwDevExt->m_TVSystem ){
  2855. case TV_NTSC:
  2856. dwFieldWidth = 720;
  2857. dwFieldHeight = 240;
  2858. dwPerField = 17000;
  2859. dwFrameRate = 30;
  2860. break;
  2861. case TV_PALB:
  2862. case TV_PALD:
  2863. case TV_PALG:
  2864. case TV_PALH:
  2865. case TV_PALI:
  2866. case TV_PALM:
  2867. dwFieldWidth = 720;
  2868. dwFieldHeight = 288; // 576/2 = 288 OK?
  2869. dwPerField = 20000;
  2870. dwFrameRate = 25;
  2871. break;
  2872. }
  2873. // the pointers to which the input buffer will be cast to
  2874. LPDDVIDEOPORTCONNECT pConnectInfo;
  2875. LPDDPIXELFORMAT pVideoFormat;
  2876. PKSVPMAXPIXELRATE pMaxPixelRate;
  2877. PKS_AMVPDATAINFO pVpdata;
  2878. // LPAMSCALINGINFO pScaleFactor;
  2879. //
  2880. // NOTE: ABSOLUTELY DO NOT use pmulitem, until it is determined that
  2881. // the stream property descriptor describes a multiple item, or you will
  2882. // pagefault.
  2883. //
  2884. PKSMULTIPLE_ITEM pmulitem =
  2885. &(((PKSMULTIPLE_DATA_PROP)pSrb->CommandData.PropertyInfo->Property)->MultipleItem);
  2886. //
  2887. // NOTE: same goes for this one as above.
  2888. //
  2889. // PKS_AMVPSIZE pdim =
  2890. // &(((PKSVPSIZE_PROP)pSrb->CommandData.PropertyInfo->Property)->Size);
  2891. if( pSrb->CommandData.PropertyInfo->PropertySetID ){
  2892. DBG_BREAK();
  2893. pSrb->Status = STATUS_NO_MATCH;
  2894. return;
  2895. }
  2896. dwInputBufferSize = pSrb->CommandData.PropertyInfo->PropertyInputSize;
  2897. dwOutputBufferSize = pSrb->CommandData.PropertyInfo->PropertyOutputSize;
  2898. pSrb->Status = STATUS_SUCCESS;
  2899. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  2900. case KSPROPERTY_VPCONFIG_NUMCONNECTINFO:
  2901. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_NUMCONNECTINFO\n\r") );
  2902. // check that the size of the output buffer is correct
  2903. ASSERT( dwInputBufferSize >= sizeof(DWORD) );
  2904. pSrb->ActualBytesTransferred = sizeof(DWORD);
  2905. *(PULONG) pSrb->CommandData.PropertyInfo->PropertyInfo
  2906. = dwNumConnectInfo;
  2907. break;
  2908. case KSPROPERTY_VPCONFIG_NUMVIDEOFORMAT:
  2909. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_NUMVIDEOFORMAT\n\r") );
  2910. // check that the size of the output buffer is correct
  2911. ASSERT( dwInputBufferSize >= sizeof(DWORD) );
  2912. pSrb->ActualBytesTransferred = sizeof(DWORD);
  2913. *(PULONG) pSrb->CommandData.PropertyInfo->PropertyInfo
  2914. = dwNumVideoFormat;
  2915. break;
  2916. case KSPROPERTY_VPCONFIG_GETCONNECTINFO:
  2917. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_GETCONNECTINFO\n\r") );
  2918. if( pmulitem->Count>dwNumConnectInfo ||
  2919. pmulitem->Size!=sizeof(DDVIDEOPORTCONNECT) ||
  2920. dwOutputBufferSize < (pmulitem->Count * sizeof(DDVIDEOPORTCONNECT)))
  2921. {
  2922. DBG_PRINTF( ("DVDWDM: pmulitem->Count %d\n\r", pmulitem->Count) );
  2923. DBG_PRINTF( ("DVDWDM: pmulitem->Size %d\n\r", pmulitem->Size) );
  2924. DBG_PRINTF( ("DVDWDM: dwOutputBufferSize %d\n\r", dwOutputBufferSize) );
  2925. DBG_PRINTF( ("DVDWDM: sizeof(DDVIDEOPORTCONNECT) %d\n\r", sizeof(DDVIDEOPORTCONNECT)) );
  2926. DBG_BREAK();
  2927. //
  2928. // buffer size is invalid, so error the call
  2929. //
  2930. pSrb->Status = STATUS_INVALID_BUFFER_SIZE;
  2931. return;
  2932. }
  2933. //
  2934. // specify the number of bytes written
  2935. //
  2936. pSrb->ActualBytesTransferred = pmulitem->Count*sizeof(DDVIDEOPORTCONNECT);
  2937. pConnectInfo = (LPDDVIDEOPORTCONNECT)(pSrb->CommandData.PropertyInfo->PropertyInfo);
  2938. // S3
  2939. pConnectInfo->dwSize = sizeof(DDVIDEOPORTCONNECT);
  2940. pConnectInfo->dwPortWidth = 8;
  2941. pConnectInfo->guidTypeID = g_S3Guid;
  2942. pConnectInfo->dwFlags = 0x3F;
  2943. pConnectInfo->dwReserved1 = 0;
  2944. pConnectInfo++;
  2945. // ATI
  2946. pConnectInfo->dwSize = sizeof(DDVIDEOPORTCONNECT);
  2947. pConnectInfo->dwPortWidth = 8;
  2948. pConnectInfo->guidTypeID = g_ATIGuid;
  2949. pConnectInfo->dwFlags = 0x4;
  2950. pConnectInfo->dwReserved1 = 0;
  2951. break;
  2952. case KSPROPERTY_VPCONFIG_VPDATAINFO:
  2953. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_VPDATAINFO\n\r") );
  2954. //
  2955. // specify the number of bytes written
  2956. //
  2957. pSrb->ActualBytesTransferred = sizeof(KS_AMVPDATAINFO);
  2958. //
  2959. // cast the buffer to the proper type
  2960. //
  2961. pVpdata = (PKS_AMVPDATAINFO)pSrb->CommandData.PropertyInfo->PropertyInfo;
  2962. *pVpdata = pHwDevExt->VPFmt;
  2963. pVpdata->dwSize = sizeof(KS_AMVPDATAINFO);
  2964. pVpdata->dwMicrosecondsPerField = dwPerField;
  2965. ASSERT( pVpdata->dwNumLinesInVREF==0 );
  2966. pVpdata->dwNumLinesInVREF = 0;
  2967. if( pHwDevExt->m_DigitalOut==DigitalOut_LPB08 ){
  2968. DBG_PRINTF( ("DVDWDM: Set for S3 LPB\r\n" ) );
  2969. // S3
  2970. pVpdata->bEnableDoubleClock = FALSE;
  2971. pVpdata->bEnableVACT = FALSE;
  2972. pVpdata->bDataIsInterlaced = TRUE;
  2973. pVpdata->lHalfLinesOdd = 0;
  2974. pVpdata->lHalfLinesEven = 0;
  2975. pVpdata->bFieldPolarityInverted = FALSE;
  2976. pVpdata->amvpDimInfo.dwFieldWidth = dwFieldWidth + 158/2;
  2977. pVpdata->amvpDimInfo.dwFieldHeight = dwFieldHeight + 1; // check it later!!
  2978. pVpdata->amvpDimInfo.rcValidRegion.left = 158/2;
  2979. pVpdata->amvpDimInfo.rcValidRegion.top = 1; // Check it Later!!
  2980. pVpdata->amvpDimInfo.rcValidRegion.right = dwFieldWidth + 158/2;
  2981. pVpdata->amvpDimInfo.rcValidRegion.bottom = dwFieldHeight + 1; // Check it later!!
  2982. pVpdata->amvpDimInfo.dwVBIWidth = pVpdata->amvpDimInfo.dwFieldWidth;
  2983. pVpdata->amvpDimInfo.dwVBIHeight = pVpdata->amvpDimInfo.rcValidRegion.top;
  2984. }else if( pHwDevExt->m_DigitalOut == DigitalOut_AMCbt ) {
  2985. DBG_PRINTF( ("DVDWDM: Set for ATI AMC\r\n" ) );
  2986. // ATI AMC
  2987. pVpdata->bEnableDoubleClock = FALSE;
  2988. pVpdata->bEnableVACT = FALSE;
  2989. pVpdata->bDataIsInterlaced = TRUE;
  2990. pVpdata->lHalfLinesOdd = 1;
  2991. pVpdata->lHalfLinesEven = 0;
  2992. pVpdata->bFieldPolarityInverted = FALSE;
  2993. pVpdata->amvpDimInfo.dwFieldWidth = dwFieldWidth;
  2994. pVpdata->amvpDimInfo.dwFieldHeight = dwFieldHeight + 2; // Check it later!!
  2995. pVpdata->amvpDimInfo.rcValidRegion.left = 0;
  2996. pVpdata->amvpDimInfo.rcValidRegion.top = 2; // Check it later!!
  2997. pVpdata->amvpDimInfo.rcValidRegion.right = dwFieldWidth;
  2998. pVpdata->amvpDimInfo.rcValidRegion.bottom = dwFieldHeight + 2; // Check it later!!
  2999. pVpdata->amvpDimInfo.dwVBIWidth = pVpdata->amvpDimInfo.dwFieldWidth;
  3000. pVpdata->amvpDimInfo.dwVBIHeight = pVpdata->amvpDimInfo.rcValidRegion.top;
  3001. }else{
  3002. DBG_BREAK();
  3003. }
  3004. break;
  3005. case KSPROPERTY_VPCONFIG_MAXPIXELRATE:
  3006. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_MAXPIXELRATE\n\r") );
  3007. //
  3008. // NOTE:
  3009. // this property is special. And has another different
  3010. // inoput property.
  3011. //
  3012. if( dwInputBufferSize<sizeof(KSVPSIZE_PROP) ){
  3013. DBG_BREAK();
  3014. pSrb->Status = STATUS_INVALID_BUFFER_SIZE;
  3015. return;
  3016. }
  3017. pSrb->ActualBytesTransferred = sizeof(KSVPMAXPIXELRATE);
  3018. // cast the buffer to the proper type
  3019. pMaxPixelRate = (PKSVPMAXPIXELRATE)pSrb->CommandData.PropertyInfo->PropertyInfo;
  3020. // tell the app that the pixel rate is valid for these dimensions
  3021. pMaxPixelRate->Size.dwWidth = dwFieldWidth;
  3022. pMaxPixelRate->Size.dwHeight = dwFieldHeight;
  3023. pMaxPixelRate->MaxPixelsPerSecond = dwFieldWidth * dwFieldHeight * dwFrameRate;
  3024. break;
  3025. case KSPROPERTY_VPCONFIG_INFORMVPINPUT:
  3026. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  3027. break;
  3028. case KSPROPERTY_VPCONFIG_GETVIDEOFORMAT:
  3029. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_GETVIDEOFORMAT\n\r") );
  3030. //
  3031. // check that the size of the output buffer is correct
  3032. //
  3033. if( pmulitem->Count > dwNumConnectInfo ||
  3034. pmulitem->Size != sizeof(DDPIXELFORMAT) ||
  3035. dwOutputBufferSize < (pmulitem->Count * sizeof(DDPIXELFORMAT) ))
  3036. {
  3037. DBG_PRINTF( ("DVDWDM: pmulitem->Count %d\n\r", pmulitem->Count ) );
  3038. DBG_PRINTF( ("DVDWDM: pmulitem->Size %d\n\r", pmulitem->Size ) );
  3039. DBG_PRINTF( ("DVDWDM: dwOutputBufferSize %d\n\r", dwOutputBufferSize ) );
  3040. DBG_PRINTF( ("DVDWDM: sizeof(DDPIXELFORMAt) %d\n\r", sizeof(DDPIXELFORMAT) ) );
  3041. DBG_BREAK();
  3042. //
  3043. // buffer size is invalid, so error the call
  3044. //
  3045. pSrb->Status = STATUS_INVALID_BUFFER_SIZE;
  3046. return;
  3047. }
  3048. //
  3049. // specify the number of bytes written
  3050. //
  3051. pSrb->ActualBytesTransferred = pmulitem->Count*sizeof(DDPIXELFORMAT);
  3052. pVideoFormat = (LPDDPIXELFORMAT)(pSrb->CommandData.PropertyInfo->PropertyInfo);
  3053. if( pHwDevExt->m_DigitalOut == DigitalOut_LPB08 ){
  3054. DBG_PRINTF( ("DVDWDM: Set for S3 LPB\n\r") );
  3055. // S3 LPB
  3056. pVideoFormat->dwSize = sizeof(DDPIXELFORMAT);
  3057. pVideoFormat->dwFlags = DDPF_FOURCC;
  3058. pVideoFormat->dwFourCC = MKFOURCC( 'Y', 'U', 'Y', '2' );
  3059. pVideoFormat->dwYUVBitCount = 16;
  3060. }else if( pHwDevExt->m_DigitalOut == DigitalOut_AMCbt ){
  3061. DBG_PRINTF( ("DVDWDM: Set for ATI AMC\n\r") );
  3062. // ATI AMC
  3063. pVideoFormat->dwSize = sizeof(DDPIXELFORMAT);
  3064. pVideoFormat->dwFlags = DDPF_FOURCC;
  3065. pVideoFormat->dwFourCC = MKFOURCC( 'U', 'Y', 'V', 'Y' );
  3066. pVideoFormat->dwYUVBitCount = 16;
  3067. // Not need?
  3068. pVideoFormat->dwYBitMask = (DWORD)0xFF00FF00;
  3069. pVideoFormat->dwUBitMask = (DWORD)0x000000FF;
  3070. pVideoFormat->dwVBitMask = (DWORD)0x00FF0000;
  3071. }else{
  3072. DBG_BREAK();
  3073. }
  3074. break;
  3075. case KSPROPERTY_VPCONFIG_DECIMATIONCAPABILITY:
  3076. //
  3077. // indicate that we can decimate anything, especialy if it's lat.
  3078. //
  3079. pSrb->ActualBytesTransferred = sizeof(BOOL);
  3080. *((PBOOL)pSrb->CommandData.PropertyInfo->PropertyInfo) = TRUE;
  3081. break;
  3082. default:
  3083. DBG_PRINTF( ("DVDWDM: PropertyID 0 default %d(0x%x)\n\r", pSrb->CommandData.PropertyInfo->Property->Id, pSrb->CommandData.PropertyInfo->Property->Id ));
  3084. DBG_BREAK();
  3085. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  3086. break;
  3087. }
  3088. }
  3089. void GetVpeProperty2( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  3090. {
  3091. ASSERT( pSrb != NULL );
  3092. // This function is need only for Toshiba NoteBook PC.
  3093. //
  3094. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION) pSrb->HwDeviceExtension;
  3095. DWORD dwInputBufferSize;
  3096. DWORD dwOutputBufferSize;
  3097. DWORD dwNumConnectInfo=1; // Only ZV
  3098. DWORD dwNumVideoFormat=1;
  3099. DWORD dwFieldWidth=720;
  3100. DWORD dwFieldHeight= 240;
  3101. DWORD dwPerField = 17000;
  3102. DWORD dwFrameRate = 30;
  3103. switch( pHwDevExt->m_TVSystem ){
  3104. case TV_NTSC:
  3105. dwFieldWidth = 720;
  3106. dwFieldHeight = 240;
  3107. dwPerField = 17000;
  3108. dwFrameRate = 30;
  3109. break;
  3110. case TV_PALB:
  3111. case TV_PALD:
  3112. case TV_PALG:
  3113. case TV_PALH:
  3114. case TV_PALI:
  3115. case TV_PALM:
  3116. dwFieldWidth = 720;
  3117. dwFieldHeight = 288; // 576/2 = 288 OK?
  3118. dwPerField = 20000; // 1/50 = 20ms
  3119. dwFrameRate = 25;
  3120. break;
  3121. }
  3122. // the pointers to which the input buffer will be cast to
  3123. LPDDVIDEOPORTCONNECT pConnectInfo;
  3124. LPDDPIXELFORMAT pVideoFormat;
  3125. PKSVPMAXPIXELRATE pMaxPixelRate;
  3126. PKS_AMVPDATAINFO pVpdata;
  3127. // LPAMSCALINGINFO pScaleFactor;
  3128. //
  3129. // NOTE: ABSOLUTELY DO NOT use pmulitem, until it is determined that
  3130. // the stream property descriptor describes a multiple item, or you will
  3131. // pagefault.
  3132. //
  3133. ASSERT( pSrb->CommandData.PropertyInfo != NULL );
  3134. ASSERT( pSrb->CommandData.PropertyInfo->Property != NULL );
  3135. PKSMULTIPLE_ITEM pmulitem =
  3136. &(((PKSMULTIPLE_DATA_PROP)pSrb->CommandData.PropertyInfo->Property)->MultipleItem);
  3137. ASSERT( pmulitem != NULL );
  3138. //
  3139. // NOTE: same goes for this one as above.
  3140. //
  3141. // PKS_AMVPSIZE pdim =
  3142. // &(((PKSVPSIZE_PROP)pSrb->CommandData.PropertyInfo->Property)->Size);
  3143. // ASSERT( pdim != NULL );
  3144. if( pSrb->CommandData.PropertyInfo->PropertySetID ){
  3145. DBG_BREAK();
  3146. pSrb->Status = STATUS_NO_MATCH;
  3147. return;
  3148. }
  3149. dwInputBufferSize = pSrb->CommandData.PropertyInfo->PropertyInputSize;
  3150. dwOutputBufferSize = pSrb->CommandData.PropertyInfo->PropertyOutputSize;
  3151. pSrb->Status = STATUS_SUCCESS;
  3152. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  3153. case KSPROPERTY_VPCONFIG_NUMCONNECTINFO:
  3154. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_NUMCONNECTINFO\n\r") );
  3155. // check that the size of the output buffer is correct
  3156. ASSERT( dwInputBufferSize >= sizeof(DWORD) );
  3157. pSrb->ActualBytesTransferred = sizeof(DWORD);
  3158. *(PULONG) pSrb->CommandData.PropertyInfo->PropertyInfo
  3159. = dwNumConnectInfo;
  3160. break;
  3161. case KSPROPERTY_VPCONFIG_NUMVIDEOFORMAT:
  3162. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_NUMVIDEOFORMAT\n\r") );
  3163. // check that the size of the output buffer is correct
  3164. ASSERT( dwInputBufferSize >= sizeof(DWORD) );
  3165. pSrb->ActualBytesTransferred = sizeof(DWORD);
  3166. *(PULONG) pSrb->CommandData.PropertyInfo->PropertyInfo
  3167. = dwNumVideoFormat;
  3168. break;
  3169. case KSPROPERTY_VPCONFIG_GETCONNECTINFO:
  3170. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_GETCONNECTINFO\n\r") );
  3171. if( pmulitem->Count>dwNumConnectInfo ||
  3172. pmulitem->Size!=sizeof(DDVIDEOPORTCONNECT) ||
  3173. dwOutputBufferSize < (pmulitem->Count * sizeof(DDVIDEOPORTCONNECT)))
  3174. {
  3175. DBG_PRINTF( ("DVDWDM: pmulitem->Count %d\n\r", pmulitem->Count) );
  3176. DBG_PRINTF( ("DVDWDM: pmulitem->Size %d\n\r", pmulitem->Size) );
  3177. DBG_PRINTF( ("DVDWDM: dwOutputBufferSize %d\n\r", dwOutputBufferSize) );
  3178. DBG_PRINTF( ("DVDWDM: sizeof(DDVIDEOPORTCONNECT) %d\n\r", sizeof(DDVIDEOPORTCONNECT)) );
  3179. DBG_BREAK();
  3180. //
  3181. // buffer size is invalid, so error the call
  3182. //
  3183. pSrb->Status = STATUS_INVALID_BUFFER_SIZE;
  3184. return;
  3185. }
  3186. //
  3187. // specify the number of bytes written
  3188. //
  3189. pSrb->ActualBytesTransferred = pmulitem->Count*sizeof(DDVIDEOPORTCONNECT);
  3190. pConnectInfo = (LPDDVIDEOPORTCONNECT)(pSrb->CommandData.PropertyInfo->PropertyInfo);
  3191. // ZV
  3192. pConnectInfo->dwSize = sizeof(DDVIDEOPORTCONNECT);
  3193. pConnectInfo->dwPortWidth = 16;
  3194. pConnectInfo->guidTypeID = g_ZVGuid;
  3195. pConnectInfo->dwFlags = DDVPCONNECT_DISCARDSVREFDATA; // 0x08?
  3196. pConnectInfo->dwReserved1 = 0;
  3197. break;
  3198. case KSPROPERTY_VPCONFIG_VPDATAINFO:
  3199. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_VPDATAINFO\n\r") );
  3200. //
  3201. // specify the number of bytes written
  3202. //
  3203. pSrb->ActualBytesTransferred = sizeof(KS_AMVPDATAINFO);
  3204. //
  3205. // cast the buffer to the proper type
  3206. //
  3207. pVpdata = (PKS_AMVPDATAINFO)pSrb->CommandData.PropertyInfo->PropertyInfo;
  3208. *pVpdata = pHwDevExt->VPFmt;
  3209. pVpdata->dwSize = sizeof(KS_AMVPDATAINFO);
  3210. pVpdata->dwMicrosecondsPerField = dwPerField;
  3211. ASSERT( pVpdata->dwNumLinesInVREF==0 );
  3212. pVpdata->dwNumLinesInVREF = 0;
  3213. if( pHwDevExt->m_DigitalOut==DigitalOut_ZV ){
  3214. /*********** ZV ***************/
  3215. pVpdata->bEnableDoubleClock = FALSE;
  3216. pVpdata->bEnableVACT = FALSE;
  3217. pVpdata->bDataIsInterlaced = TRUE;
  3218. pVpdata->lHalfLinesOdd = 0;
  3219. pVpdata->lHalfLinesEven = 0;
  3220. pVpdata->bFieldPolarityInverted = FALSE;
  3221. pVpdata->amvpDimInfo.dwFieldWidth = dwFieldWidth;
  3222. pVpdata->amvpDimInfo.dwFieldHeight = dwFieldHeight;
  3223. pVpdata->amvpDimInfo.rcValidRegion.left = 0;
  3224. pVpdata->amvpDimInfo.rcValidRegion.top = 0;
  3225. pVpdata->amvpDimInfo.rcValidRegion.right = dwFieldWidth;
  3226. pVpdata->amvpDimInfo.rcValidRegion.bottom = dwFieldHeight;
  3227. pVpdata->amvpDimInfo.dwVBIWidth = pVpdata->amvpDimInfo.dwFieldWidth;
  3228. pVpdata->amvpDimInfo.dwVBIHeight = pVpdata->amvpDimInfo.rcValidRegion.top;
  3229. }else{
  3230. DBG_BREAK();
  3231. }
  3232. break;
  3233. case KSPROPERTY_VPCONFIG_MAXPIXELRATE:
  3234. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_MAXPIXELRATE\n\r") );
  3235. //
  3236. // NOTE:
  3237. // this property is special. And has another different
  3238. // inoput property.
  3239. //
  3240. if( dwInputBufferSize<sizeof(KSVPSIZE_PROP) ){
  3241. DBG_BREAK();
  3242. pSrb->Status = STATUS_INVALID_BUFFER_SIZE;
  3243. return;
  3244. }
  3245. pSrb->ActualBytesTransferred = sizeof(KSVPMAXPIXELRATE);
  3246. // cast the buffer to the proper type
  3247. pMaxPixelRate = (PKSVPMAXPIXELRATE)pSrb->CommandData.PropertyInfo->PropertyInfo;
  3248. // tell the app that the pixel rate is valid for these dimensions
  3249. pMaxPixelRate->Size.dwWidth = dwFieldWidth;
  3250. pMaxPixelRate->Size.dwHeight = dwFieldHeight;
  3251. pMaxPixelRate->MaxPixelsPerSecond = dwFieldWidth * dwFieldHeight * dwFrameRate;
  3252. break;
  3253. case KSPROPERTY_VPCONFIG_INFORMVPINPUT:
  3254. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  3255. break;
  3256. case KSPROPERTY_VPCONFIG_GETVIDEOFORMAT:
  3257. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_GETVIDEOFORMAT\n\r") );
  3258. //
  3259. // check that the size of the output buffer is correct
  3260. //
  3261. if( pmulitem->Count > dwNumConnectInfo ||
  3262. pmulitem->Size != sizeof(DDPIXELFORMAT) ||
  3263. dwOutputBufferSize < (pmulitem->Count * sizeof(DDPIXELFORMAT) ))
  3264. {
  3265. DBG_PRINTF( ("DVDWDM: pmulitem->Count %d\n\r", pmulitem->Count ) );
  3266. DBG_PRINTF( ("DVDWDM: pmulitem->Size %d\n\r", pmulitem->Size ) );
  3267. DBG_PRINTF( ("DVDWDM: dwOutputBufferSize %d\n\r", dwOutputBufferSize ) );
  3268. DBG_PRINTF( ("DVDWDM: sizeof(DDPIXELFORMAt) %d\n\r", sizeof(DDPIXELFORMAT) ) );
  3269. DBG_BREAK();
  3270. //
  3271. // buffer size is invalid, so error the call
  3272. //
  3273. pSrb->Status = STATUS_INVALID_BUFFER_SIZE;
  3274. return;
  3275. }
  3276. //
  3277. // specify the number of bytes written
  3278. //
  3279. pSrb->ActualBytesTransferred = pmulitem->Count*sizeof(DDPIXELFORMAT);
  3280. pVideoFormat = (LPDDPIXELFORMAT)(pSrb->CommandData.PropertyInfo->PropertyInfo);
  3281. if( pHwDevExt->m_DigitalOut == DigitalOut_ZV ){
  3282. DBG_PRINTF( ("DVDWDM: Set for S3 LPB\n\r") );
  3283. // S3 LPB
  3284. pVideoFormat->dwSize = sizeof(DDPIXELFORMAT);
  3285. pVideoFormat->dwFlags = DDPF_FOURCC;
  3286. pVideoFormat->dwFourCC = MKFOURCC( 'Y', 'U', 'Y', '2' );
  3287. pVideoFormat->dwYUVBitCount = 16;
  3288. /*********************************
  3289. }else if( pHwDevExt->m_DigitalOut == DigitalOut_AMCbt ){
  3290. DBG_PRINTF( ("DVDWDM: Set for ATI AMC\n\r") );
  3291. // ATI AMC
  3292. pVideoFormat->dwSize = sizeof(DDPIXELFORMAT);
  3293. pVideoFormat->dwFlags = DDPF_FOURCC;
  3294. pVideoFormat->dwFourCC = MKFOURCC( 'U', 'Y', 'V', 'Y' );
  3295. pVideoFormat->dwYUVBitCount = 16;
  3296. // Not need?
  3297. pVideoFormat->dwYBitMask = (DWORD)0xFF00FF00;
  3298. pVideoFormat->dwUBitMask = (DWORD)0x000000FF;
  3299. pVideoFormat->dwVBitMask = (DWORD)0x00FF0000;
  3300. ***************************/
  3301. }else{
  3302. DBG_BREAK();
  3303. }
  3304. break;
  3305. case KSPROPERTY_VPCONFIG_DECIMATIONCAPABILITY:
  3306. //
  3307. // indicate that we can decimate anything, especialy if it's lat.
  3308. //
  3309. pSrb->ActualBytesTransferred = sizeof(BOOL);
  3310. *((PBOOL)pSrb->CommandData.PropertyInfo->PropertyInfo) = TRUE;
  3311. break;
  3312. default:
  3313. DBG_PRINTF( ("DVDWDM: PropertyID 0 default %d(0x%x)\n\r", pSrb->CommandData.PropertyInfo->Property->Id, pSrb->CommandData.PropertyInfo->Property->Id ));
  3314. DBG_BREAK();
  3315. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  3316. break;
  3317. }
  3318. }
  3319. void SetVpeProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  3320. {
  3321. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  3322. DWORD dwInputBufferSize;
  3323. DWORD dwOutputBufferSize;
  3324. DWORD *lpdwOutputBufferSize;
  3325. ULONG index;
  3326. PKS_AMVPSIZE pDim;
  3327. if( pSrb->CommandData.PropertyInfo->PropertySetID ){
  3328. DBG_BREAK();
  3329. pSrb->Status = STATUS_NO_MATCH;
  3330. return;
  3331. }
  3332. dwInputBufferSize = pSrb->CommandData.PropertyInfo->PropertyInputSize;
  3333. dwOutputBufferSize = pSrb->CommandData.PropertyInfo->PropertyOutputSize;
  3334. lpdwOutputBufferSize = &(pSrb->ActualBytesTransferred);
  3335. pSrb->Status = STATUS_SUCCESS;
  3336. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  3337. case KSPROPERTY_VPCONFIG_SETCONNECTINFO:
  3338. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_SETCONNECTINFO\n\r") );
  3339. //
  3340. // pSrb->CommandData.PropertyInfo->PropertyInfo
  3341. // points to ULONG which is an index into the array of
  3342. // connectinfo struct returned to the caller from the
  3343. // Get call to Connectinfo.
  3344. //
  3345. // Since the sample only supports one connection type right
  3346. // now, we will ensure that the requested index is 0.
  3347. //
  3348. //
  3349. // at this point, we would program the hardware to use
  3350. // the right connection information for the videoport.
  3351. // since we are only supporting one connection, we don't
  3352. // need to do anything, so we will just indicate success
  3353. //
  3354. index = *((ULONG *)(pSrb->CommandData.PropertyInfo->PropertyInfo) );
  3355. DBG_PRINTF( ("DVDWDM: %d\n\r", index ) );
  3356. DWORD dProp;
  3357. switch( index ){
  3358. case 0: // S3 LPB
  3359. pHwDevExt->m_DigitalOut = DigitalOut_LPB08;
  3360. dProp = DigitalOut_LPB08;
  3361. break;
  3362. case 1: // ATI AMC
  3363. pHwDevExt->m_DigitalOut = DigitalOut_AMCbt;
  3364. dProp = DigitalOut_AMCbt;
  3365. break;
  3366. default:
  3367. DBG_PRINTF( ("DVDWDM: SET CONNECt INFO default(%x)\n\r", index ) );
  3368. DBG_BREAK();
  3369. pHwDevExt->m_DigitalOut = DigitalOut_LPB08; // S3 LPB
  3370. dProp = DigitalOut_LPB08;
  3371. break;
  3372. }
  3373. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_DigitalOut, &dProp ) ){
  3374. DBG_PRINTF( ("DVDWDM: Set VideoProperty DigitalOut Error\n\r") );
  3375. DBG_BREAK();
  3376. }
  3377. break;
  3378. case KSPROPERTY_VPCONFIG_DDRAWHANDLE:
  3379. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_DDRAWHANDLE\n\r") );
  3380. pHwDevExt->ddrawHandle =
  3381. (*(PULONG)pSrb->CommandData.PropertyInfo->PropertyInfo);
  3382. break;
  3383. case KSPROPERTY_VPCONFIG_VIDEOPORTID:
  3384. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_VIDEOPORTID\n\r") );
  3385. pHwDevExt->VidPortID =
  3386. (*(PULONG)pSrb->CommandData.PropertyInfo->PropertyInfo);
  3387. break;
  3388. case KSPROPERTY_VPCONFIG_DDRAWSURFACEHANDLE:
  3389. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_DDRAWSURFACEHANDLE\n\r") );
  3390. pHwDevExt->SurfaceHandle =
  3391. (*(PULONG)pSrb->CommandData.PropertyInfo->PropertyInfo);
  3392. break;
  3393. case KSPROPERTY_VPCONFIG_SETVIDEOFORMAT:
  3394. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_SETVIDEOFORMAT\n\r") );
  3395. //
  3396. // pSrb->CommandData.PropertyInfo->PropertyInfo
  3397. // points to a ULONG which is an index into the array of
  3398. // VIDEOFORMAT structs returned to the caller from the
  3399. // Get call to FORMATINFO
  3400. //
  3401. // Since the sample only supports one FORMAT type right
  3402. // now, we will ensure that the requested index is 0.
  3403. //
  3404. //
  3405. // at this point, we would program the hardware to use
  3406. // the right connection information for the videoport.
  3407. // since we are only supporting one connection, we don't
  3408. // need to do anything, so we will just indicate success
  3409. //
  3410. index = *((ULONG *)(pSrb->CommandData.PropertyInfo->PropertyInfo));
  3411. DBG_PRINTF( ("DVDWDM: %d\n\r", index ) );
  3412. break;
  3413. case KSPROPERTY_VPCONFIG_INFORMVPINPUT:
  3414. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_INFORMVPINPUT\n\r") );
  3415. //
  3416. // these are the preferred formats for the VPE client
  3417. //
  3418. // they are multiple properties passed in, retuen success
  3419. //
  3420. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  3421. break;
  3422. case KSPROPERTY_VPCONFIG_INVERTPOLARITY:
  3423. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_INVERTPOLARITY\n\r") );
  3424. //
  3425. // Toggles the global polarity flag, telling the output
  3426. // of the VPE port to be inverted. Since this hardware
  3427. // does not support this feature, we will just return
  3428. // success for now, although this should be returning not
  3429. // implemented
  3430. //
  3431. break;
  3432. case KSPROPERTY_VPCONFIG_SCALEFACTOR:
  3433. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_SCALEFACTOR\n\r") );
  3434. //
  3435. // the sizes for the scalling factor are passed in, and the
  3436. // image dimensions should be scaled appropriately
  3437. //
  3438. // if there is a horizontal scaling available, do it here.
  3439. //
  3440. DBG_BREAK();
  3441. pDim = (PKS_AMVPSIZE)(pSrb->CommandData.PropertyInfo->PropertyInfo);
  3442. break;
  3443. default:
  3444. DBG_PRINTF( ("DVDWDM: PropertySetID 0 default %d(0x%x)\n\r", pSrb->CommandData.PropertyInfo->Property->Id, pSrb->CommandData.PropertyInfo->Property->Id ) );
  3445. DBG_BREAK();
  3446. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  3447. break;
  3448. }
  3449. }
  3450. void SetVpeProperty2( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  3451. {
  3452. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  3453. DWORD dwInputBufferSize;
  3454. DWORD dwOutputBufferSize;
  3455. DWORD *lpdwOutputBufferSize;
  3456. ULONG index;
  3457. PKS_AMVPSIZE pDim;
  3458. if( pSrb->CommandData.PropertyInfo->PropertySetID ){
  3459. DBG_BREAK();
  3460. pSrb->Status = STATUS_NO_MATCH;
  3461. return;
  3462. }
  3463. dwInputBufferSize = pSrb->CommandData.PropertyInfo->PropertyInputSize;
  3464. dwOutputBufferSize = pSrb->CommandData.PropertyInfo->PropertyOutputSize;
  3465. lpdwOutputBufferSize = &(pSrb->ActualBytesTransferred);
  3466. pSrb->Status = STATUS_SUCCESS;
  3467. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  3468. case KSPROPERTY_VPCONFIG_SETCONNECTINFO:
  3469. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_SETCONNECTINFO\n\r") );
  3470. //
  3471. // pSrb->CommandData.PropertyInfo->PropertyInfo
  3472. // points to ULONG which is an index into the array of
  3473. // connectinfo struct returned to the caller from the
  3474. // Get call to Connectinfo.
  3475. //
  3476. // Since the sample only supports one connection type right
  3477. // now, we will ensure that the requested index is 0.
  3478. //
  3479. //
  3480. // at this point, we would program the hardware to use
  3481. // the right connection information for the videoport.
  3482. // since we are only supporting one connection, we don't
  3483. // need to do anything, so we will just indicate success
  3484. //
  3485. index = *((ULONG *)(pSrb->CommandData.PropertyInfo->PropertyInfo) );
  3486. DBG_PRINTF( ("DVDWDM: %d\n\r", index ) );
  3487. DWORD dProp;
  3488. switch( index ){
  3489. case 0: // ZV
  3490. pHwDevExt->m_DigitalOut = DigitalOut_ZV;
  3491. dProp = DigitalOut_ZV;
  3492. break;
  3493. /*******************************
  3494. case 0: // S3 LPB
  3495. pHwDevExt->m_DigitalOut = DigitalOut_LPB08;
  3496. dProp = DigitalOut_LPB08;
  3497. break;
  3498. case 1: // ATI AMC
  3499. pHwDevExt->m_DigitalOut = DigitalOut_AMCbt;
  3500. dProp = DigitalOut_AMCbt;
  3501. break;
  3502. **********************************/
  3503. default:
  3504. DBG_PRINTF( ("DVDWDM: SET CONNECt INFO default(%x)\n\r", index ) );
  3505. DBG_BREAK();
  3506. pHwDevExt->m_DigitalOut = DigitalOut_LPB08; // S3 LPB
  3507. dProp = DigitalOut_LPB08;
  3508. break;
  3509. }
  3510. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_DigitalOut, &dProp ) ){
  3511. DBG_PRINTF( ("DVDWDM: Set VideoProperty DigitalOut Error\n\r") );
  3512. DBG_BREAK();
  3513. }
  3514. break;
  3515. case KSPROPERTY_VPCONFIG_DDRAWHANDLE:
  3516. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_DDRAWHANDLE\n\r") );
  3517. pHwDevExt->ddrawHandle =
  3518. (*(PULONG)pSrb->CommandData.PropertyInfo->PropertyInfo);
  3519. break;
  3520. case KSPROPERTY_VPCONFIG_VIDEOPORTID:
  3521. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_VIDEOPORTID\n\r") );
  3522. pHwDevExt->VidPortID =
  3523. (*(PULONG)pSrb->CommandData.PropertyInfo->PropertyInfo);
  3524. break;
  3525. case KSPROPERTY_VPCONFIG_DDRAWSURFACEHANDLE:
  3526. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_DDRAWSURFACEHANDLE\n\r") );
  3527. pHwDevExt->SurfaceHandle =
  3528. (*(PULONG)pSrb->CommandData.PropertyInfo->PropertyInfo);
  3529. break;
  3530. case KSPROPERTY_VPCONFIG_SETVIDEOFORMAT:
  3531. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_SETVIDEOFORMAT\n\r") );
  3532. //
  3533. // pSrb->CommandData.PropertyInfo->PropertyInfo
  3534. // points to a ULONG which is an index into the array of
  3535. // VIDEOFORMAT structs returned to the caller from the
  3536. // Get call to FORMATINFO
  3537. //
  3538. // Since the sample only supports one FORMAT type right
  3539. // now, we will ensure that the requested index is 0.
  3540. //
  3541. //
  3542. // at this point, we would program the hardware to use
  3543. // the right connection information for the videoport.
  3544. // since we are only supporting one connection, we don't
  3545. // need to do anything, so we will just indicate success
  3546. //
  3547. index = *((ULONG *)(pSrb->CommandData.PropertyInfo->PropertyInfo));
  3548. DBG_PRINTF( ("DVDWDM: %d\n\r", index ) );
  3549. break;
  3550. case KSPROPERTY_VPCONFIG_INFORMVPINPUT:
  3551. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_INFORMVPINPUT\n\r") );
  3552. //
  3553. // these are the preferred formats for the VPE client
  3554. //
  3555. // they are multiple properties passed in, retuen success
  3556. //
  3557. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  3558. break;
  3559. case KSPROPERTY_VPCONFIG_INVERTPOLARITY:
  3560. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_INVERTPOLARITY\n\r") );
  3561. //
  3562. // Toggles the global polarity flag, telling the output
  3563. // of the VPE port to be inverted. Since this hardware
  3564. // does not support this feature, we will just return
  3565. // success for now, although this should be returning not
  3566. // implemented
  3567. //
  3568. break;
  3569. case KSPROPERTY_VPCONFIG_SCALEFACTOR:
  3570. DBG_PRINTF( ("DVDWDM: KSPROPERTY_VPCONFIG_SCALEFACTOR\n\r") );
  3571. //
  3572. // the sizes for the scalling factor are passed in, and the
  3573. // image dimensions should be scaled appropriately
  3574. //
  3575. // if there is a horizontal scaling available, do it here.
  3576. //
  3577. DBG_BREAK();
  3578. pDim = (PKS_AMVPSIZE)(pSrb->CommandData.PropertyInfo->PropertyInfo);
  3579. break;
  3580. default:
  3581. DBG_PRINTF( ("DVDWDM: PropertySetID 0 default %d(0x%x)\n\r", pSrb->CommandData.PropertyInfo->Property->Id, pSrb->CommandData.PropertyInfo->Property->Id ) );
  3582. DBG_BREAK();
  3583. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  3584. break;
  3585. }
  3586. }
  3587. void VideoQueryAccept( PHW_STREAM_REQUEST_BLOCK pSrb )
  3588. {
  3589. DBG_PRINTF( ("DVDWDM:VideoQueryAccept\n\r") );
  3590. PKSDATAFORMAT pfmt = pSrb->CommandData.OpenFormat;
  3591. // KS_MPEGVIDEOINFO2 * pblock = (KS_MPEGVIDEOINFO2 *)((ULONG)pfmt + sizeof(KSDATAFORMAT));
  3592. //
  3593. // pick up the format block and examine it. Default not inplemented.
  3594. //
  3595. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  3596. if( pfmt->FormatSize != sizeof(KSDATAFORMAT) + sizeof(KS_MPEGVIDEOINFO2))
  3597. {
  3598. return;
  3599. }
  3600. pSrb->Status = STATUS_SUCCESS;
  3601. }
  3602. void AudioQueryAccept( PHW_STREAM_REQUEST_BLOCK pSrb )
  3603. {
  3604. DBG_PRINTF( ("DVDWDM:AudioQueryAccept\n\r") );
  3605. pSrb->Status = STATUS_SUCCESS;
  3606. }
  3607. void ProcessVideoFormat( PHW_STREAM_REQUEST_BLOCK pSrb, PKSDATAFORMAT pfmt, PHW_DEVICE_EXTENSION pHwDevExt )
  3608. {
  3609. DWORD dProp;
  3610. DBG_PRINTF( ("DVDWDM:ProccessVideoFormat\n\r") );
  3611. KS_MPEGVIDEOINFO2 *VidFmt = (KS_MPEGVIDEOINFO2 *)((ULONG)pfmt + sizeof(KSDATAFORMAT) );
  3612. if( pfmt->FormatSize != sizeof(KSDATAFORMAT) + sizeof(KS_MPEGVIDEOINFO2) ){
  3613. DBG_BREAK();
  3614. return;
  3615. }
  3616. /////////// for debug.
  3617. DBG_PRINTF( ("DVDWDM: KS_MPEGVIDEOINFO2\n\r") );
  3618. DBG_PRINTF( ("DVDWDM: dwProfile =0x%08x\n\r", VidFmt->dwProfile) );
  3619. DBG_PRINTF( ("DVDWDM: dwLevel =0x%08x\n\r", VidFmt->dwLevel) );
  3620. DBG_PRINTF( ("DVDWDM: dwFlags =0x%08x\n\r", VidFmt->dwFlags) );
  3621. DBG_PRINTF( ("DVDWDM: KS_VIDEOINFOHEADER2\n\r") );
  3622. DBG_PRINTF( ("DVDWDM: dwBitRate =0x%08x\n\r", VidFmt->hdr.dwBitRate) );
  3623. DBG_PRINTF( ("DVDWDM: dwBitErrorRate =0x%08x\n\r", VidFmt->hdr.dwBitErrorRate) );
  3624. DBG_PRINTF( ("DVDWDM: dwInterlaceFlags=0x%08x\n\r", VidFmt->hdr.dwInterlaceFlags) );
  3625. DBG_PRINTF( ("DVDWDM: dwCopyProtFlags =0x%08x\n\r", VidFmt->hdr.dwCopyProtectFlags) );
  3626. DBG_PRINTF( ("DVDWDM: KS_VIDEOINFOHEADER2\n\r") );
  3627. DBG_PRINTF( ("DVDWDM: biSize =%0d\n\r", VidFmt->hdr.bmiHeader.biSize) );
  3628. DBG_PRINTF( ("DVDWDM: biWidth =%0d\n\r", VidFmt->hdr.bmiHeader.biWidth) );
  3629. DBG_PRINTF( ("DVDWDM: biHeight =%0d\n\r", VidFmt->hdr.bmiHeader.biHeight) );
  3630. DBG_PRINTF( ("DVDWDM: biSizeImage =%0d\n\r", VidFmt->hdr.bmiHeader.biSizeImage) );
  3631. //////////
  3632. //--- 99.01.14 S.Watanabe
  3633. pHwDevExt->m_VideoFormatFlags = VidFmt->dwFlags;
  3634. //--- End.
  3635. // Check Source Picture Resolution;
  3636. pHwDevExt->m_ResHorizontal = VidFmt->hdr.bmiHeader.biWidth;
  3637. pHwDevExt->m_ResVertical = VidFmt->hdr.bmiHeader.biHeight;
  3638. // Check NTSC or PAL by biWidth & biHeight.
  3639. switch( pHwDevExt->m_ResVertical ){
  3640. case 480: // NTSC
  3641. case 240:
  3642. dProp = TV_NTSC;
  3643. break;
  3644. case 576: // PAL
  3645. case 288:
  3646. dProp = TV_PALB; // PAL_B OK?
  3647. break;
  3648. default:
  3649. DBG_PRINTF( ("DVDWDM:Invalid Source Resolution Height = %0d\n\r", pHwDevExt->m_ResVertical) );
  3650. DBG_BREAK();
  3651. break;
  3652. }
  3653. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_TVSystem, &dProp ) ){
  3654. DBG_PRINTF( ("DVDWDM:Set TV System Error\n\r") );
  3655. DBG_BREAK();
  3656. }
  3657. pHwDevExt->m_TVSystem = dProp;
  3658. //
  3659. // copy the picture aspect ratio for now
  3660. //
  3661. pHwDevExt->VPFmt.dwPictAspectRatioX = VidFmt->hdr.dwPictAspectRatioX;
  3662. pHwDevExt->VPFmt.dwPictAspectRatioY = VidFmt->hdr.dwPictAspectRatioY;
  3663. DBG_PRINTF( ("DVDWDM: AspectRaioX %d\n\r", VidFmt->hdr.dwPictAspectRatioX) );
  3664. DBG_PRINTF( ("DVDWDM: AspectRaioY %d\n\r", VidFmt->hdr.dwPictAspectRatioY) );
  3665. if( pHwDevExt->VPFmt.dwPictAspectRatioX == 4 && pHwDevExt->VPFmt.dwPictAspectRatioY == 3 ){
  3666. // set aspect raio 4:3
  3667. dProp = Aspect_04_03;
  3668. }else if( pHwDevExt->VPFmt.dwPictAspectRatioX == 16 && pHwDevExt->VPFmt.dwPictAspectRatioY == 9 ){
  3669. // set aspect raio 16:9
  3670. dProp = Aspect_16_09;
  3671. }
  3672. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_AspectRatio, &dProp ) ){
  3673. DBG_PRINTF( ("DVDWDM:Set Aspect Ratio Error\n\r") );
  3674. DBG_BREAK();
  3675. }
  3676. pHwDevExt->m_AspectRatio = dProp;
  3677. //
  3678. // check for pan-scan / letter-box enabled
  3679. //
  3680. DWORD fPSLB = 0;
  3681. // if( VidFmt->dwFlags & KS_MPEG2_SourceIsLetterboxed){
  3682. if( VidFmt->dwFlags & 0x20 ){ // KS_MPEG2_LetterboxAnalogOut){
  3683. DBG_PRINTF( ("DVDWDM: KS_MPEG2_SourceisLetterboxed\n\r") );
  3684. //--- 99.01.13 S.Watanabe
  3685. // if( pHwDevExt->m_DisplayDevice==DisplayDevice_Normal ){ // 98.12.23 H.Yagi
  3686. if( pHwDevExt->m_DisplayDevice == DisplayDevice_NormalTV ) {
  3687. //--- End.
  3688. fPSLB |= 0x01;
  3689. }
  3690. }
  3691. if( VidFmt->dwFlags & KS_MPEG2_DoPanScan ){
  3692. DBG_PRINTF( ("DVDWDM: KS_MPEG2_DoPanScan\n\r") );
  3693. //--- 99.01.13 S.Watanabe
  3694. // fPSLB |= 0x02;
  3695. if( pHwDevExt->m_DisplayDevice != DisplayDevice_WideTV )
  3696. fPSLB |= 0x02;
  3697. //--- End.
  3698. }
  3699. if( VidFmt->dwFlags & KS_MPEG2_DVDLine21Field1 ){
  3700. DBG_PRINTF( ("DVDWDM: KS_MPEG2_DVDLine21Field1\n\r") );
  3701. }
  3702. if( VidFmt->dwFlags & KS_MPEG2_DVDLine21Field2 ){
  3703. DBG_PRINTF( ("DVDWDM: KS_MPEG2_DVDLine21Field2\n\r") );
  3704. }
  3705. if( VidFmt->dwFlags & KS_MPEG2_FilmCameraMode ){
  3706. DBG_PRINTF( ("DVDWDM: KS_MPEG2_FilmCameraMode\n\r") );
  3707. }
  3708. if( VidFmt->dwFlags & KS_MPEG2_DoPanScan )
  3709. {
  3710. //
  3711. // under pan-scan for DVD for NTSC, we must be going to a 540 by
  3712. // 480 bit image, from a 720 x 480( or 704 x 480 ). We will
  3713. // use this as the base starting dimensions. If ths Seaquence
  3714. // header provides other sizes, then those should be updated,
  3715. // and the Video port connection should be updated when the
  3716. // seaquence header is received.
  3717. //
  3718. //
  3719. // change the picture aspect ratio. Since we will be stretching
  3720. // from 540 to 720 in the horizontal direction, our aspect ratio
  3721. // will
  3722. //
  3723. pHwDevExt->VPFmt.dwPictAspectRatioX = (VidFmt->hdr.dwPictAspectRatioX * (54000/72) );
  3724. pHwDevExt->VPFmt.dwPictAspectRatioY = VidFmt->hdr.dwPictAspectRatioY * 1000;
  3725. }
  3726. // set pan-scan / letter-box enabled
  3727. switch( fPSLB ){
  3728. case 0x00:
  3729. dProp = Display_Original;
  3730. break;
  3731. case 0x01:
  3732. dProp = Display_LetterBox;
  3733. break;
  3734. case 0x02:
  3735. dProp = Display_PanScan;
  3736. break;
  3737. default:
  3738. dProp = Display_Original;
  3739. DBG_PRINTF( ("DVDWDM: Invalid info(LB&PS)\n\r") );
  3740. DBG_BREAK();
  3741. break;
  3742. }
  3743. if( pHwDevExt->m_AspectRatio == Aspect_04_03 ){ // check dwFlags is avilable
  3744. dProp = Display_Original;
  3745. }
  3746. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_DisplayMode, &dProp ) ){
  3747. DBG_PRINTF( ("DVDWDM:Set LetterBox & PanScan Error\n\r") );
  3748. DBG_BREAK();
  3749. }
  3750. pHwDevExt->m_DisplayMode = dProp;
  3751. //
  3752. // Set FilmCamera Mode
  3753. //
  3754. if( VidFmt->dwFlags & KS_MPEG2_FilmCameraMode ){
  3755. DBG_PRINTF( ("DVDWDM: KS_MPEG2_FilmCameraMode\n\r") );
  3756. dProp = Source_Film; // need to check if it is Ok?
  3757. }else{
  3758. dProp = Source_Camera; // need to check if it is OK?
  3759. }
  3760. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_FilmCamera, &dProp ) ){
  3761. DBG_PRINTF( ("DVDWDM:Set Film/Camera mode Error\n\r") );
  3762. DBG_BREAK();
  3763. }
  3764. pHwDevExt->m_SourceFilmCamera = dProp;
  3765. //
  3766. // call the IVPConfig interface here
  3767. //
  3768. if( pHwDevExt->pstroYUV &&
  3769. ((PSTREAMEX)(pHwDevExt->pstroYUV->HwStreamExtension))->EventCount)
  3770. {
  3771. // StreamClassStreamNotification( SignalMultipleStreamEvents,
  3772. // pHwDevExt->pstroYUV,
  3773. // &MY_KSEVENTSETID_VPNOTIFY,
  3774. // KSEVENT_VPNOTIFY_FORMATCHANGE );
  3775. // DBG_BREAK();
  3776. // CallAtStreamSignalMultipleNotify( pHwDevExt );
  3777. CallAtStreamSignalMultipleNotify( pSrb );
  3778. }
  3779. }
  3780. void ProcessAudioFormat( PKSDATAFORMAT pfmt, PHW_DEVICE_EXTENSION pHwDevExt )
  3781. {
  3782. DWORD aPropType, aPropFS;
  3783. DBG_PRINTF( ("DVDWDM: ProcessAudioFormat\n\r") );
  3784. if( ( IsEqualGUID2( &pfmt->MajorFormat, &KSDATAFORMAT_TYPE_DVD_ENCRYPTED_PACK ) &&
  3785. IsEqualGUID2( &pfmt->SubFormat, &KSDATAFORMAT_SUBTYPE_AC3_AUDIO ) ) )
  3786. {
  3787. // AC-3
  3788. DBG_PRINTF( ("DVDWDM: AC-3 Audio\n\r") );
  3789. aPropType = AudioType_AC3;
  3790. aPropFS = 48000;
  3791. }else if( (IsEqualGUID2( &pfmt->MajorFormat, &KSDATAFORMAT_TYPE_DVD_ENCRYPTED_PACK) &&
  3792. IsEqualGUID2( &pfmt->SubFormat, &KSDATAFORMAT_SUBTYPE_LPCM_AUDIO )) )
  3793. {
  3794. // L-PCM
  3795. DBG_PRINTF( ("DVDWDM: L-PCM Audio\n\r") );
  3796. // WAVEFORMATEX * pblock = (WAVEFORMATEX *)((ULONG)pfmt + sizeof(KSDATAFORMAT) );
  3797. // DBG_PRINTF( ("DVDWDM: wFormatTag %d\n\r", (DWORD)(pblock->wFormatTag) ));
  3798. // DBG_PRINTF( ("DVDWDM: nChannels %d\n\r", (DWORD)(pblock->nChannels) ));
  3799. // DBG_PRINTF( ("DVDWDM: nSamplesPerSec %d\n\r", (DWORD)(pblock->nSamplesPerSec) ));
  3800. // DBG_PRINTF( ("DVDWDM: nAvgBytesPerSec %d\n\r", (DWORD)(pblock->nAvgBytesPerSec) ));
  3801. // DBG_PRINTF( ("DVDWDM: nBlockAlign %d\n\r", (DWORD)(pblock->nBlockAlign) ));
  3802. // DBG_PRINTF( ("DVDWDM: wBitsPerSample %d\n\r", (DWORD)(pblock->wBitsPerSample) ));
  3803. // DBG_PRINTF( ("DVDWDM: cbSize %d\n\r", (DWORD)(pblock->cbSize) ));
  3804. aPropType = AudioType_PCM;
  3805. aPropFS = 48000; // test there is possibility in 48000/96000.
  3806. }else{
  3807. DBG_PRINTF( ("DVDWDM: Unsupport audio typ\n\r" ) );
  3808. DBG_PRINTF( ("DVDWDM Major %08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x\n\r",
  3809. pfmt->MajorFormat.Data1,
  3810. pfmt->MajorFormat.Data2,
  3811. pfmt->MajorFormat.Data3,
  3812. pfmt->MajorFormat.Data4[0],
  3813. pfmt->MajorFormat.Data4[1],
  3814. pfmt->MajorFormat.Data4[2],
  3815. pfmt->MajorFormat.Data4[3],
  3816. pfmt->MajorFormat.Data4[4],
  3817. pfmt->MajorFormat.Data4[5],
  3818. pfmt->MajorFormat.Data4[6],
  3819. pfmt->MajorFormat.Data4[7]
  3820. ));
  3821. DBG_PRINTF( ("DVDWDM Sub %08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x\n\r",
  3822. pfmt->SubFormat.Data1,
  3823. pfmt->SubFormat.Data2,
  3824. pfmt->SubFormat.Data3,
  3825. pfmt->SubFormat.Data4[0],
  3826. pfmt->SubFormat.Data4[1],
  3827. pfmt->SubFormat.Data4[2],
  3828. pfmt->SubFormat.Data4[3],
  3829. pfmt->SubFormat.Data4[4],
  3830. pfmt->SubFormat.Data4[5],
  3831. pfmt->SubFormat.Data4[6],
  3832. pfmt->SubFormat.Data4[7]
  3833. ));
  3834. DBG_PRINTF( ("DVDWDM Format %08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x\n\r",
  3835. pfmt->Specifier.Data1,
  3836. pfmt->Specifier.Data2,
  3837. pfmt->Specifier.Data3,
  3838. pfmt->Specifier.Data4[0],
  3839. pfmt->Specifier.Data4[1],
  3840. pfmt->Specifier.Data4[2],
  3841. pfmt->Specifier.Data4[3],
  3842. pfmt->Specifier.Data4[4],
  3843. pfmt->Specifier.Data4[5],
  3844. pfmt->Specifier.Data4[6],
  3845. pfmt->Specifier.Data4[7]
  3846. ));
  3847. DBG_BREAK();
  3848. return;
  3849. }
  3850. if( !pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_Type, &aPropType ) ){
  3851. DBG_PRINTF( ("DVDWDM:Set Audio Type Error\n\r") );
  3852. DBG_BREAK();
  3853. }
  3854. pHwDevExt->m_AudioType = aPropType;
  3855. if( !pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_Type, &aPropType ) ){
  3856. DBG_PRINTF( ("DVDWDM:Set Audio Type Error\n\r") );
  3857. DBG_BREAK();
  3858. }
  3859. pHwDevExt->m_AudioFS = aPropFS;
  3860. }
  3861. void GetCCProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  3862. {
  3863. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  3864. if( pSrb->CommandData.PropertyInfo->PropertySetID ){
  3865. DBG_BREAK();
  3866. pSrb->Status = STATUS_NO_MATCH;
  3867. return;
  3868. }
  3869. PKSALLOCATOR_FRAMING pfrm = (PKSALLOCATOR_FRAMING)
  3870. pSrb->CommandData.PropertyInfo->PropertyInfo;
  3871. PKSSTATE State;
  3872. pSrb->Status = STATUS_SUCCESS;
  3873. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  3874. case KSPROPERTY_CONNECTION_ALLOCATORFRAMING:
  3875. DBG_PRINTF( ("DVDWDM: KSPROPERTY_CONNECTION_ALLOCATORFRAMING\n\r") );
  3876. pfrm->OptionsFlags = 0;
  3877. pfrm->PoolType = NonPagedPool;
  3878. pfrm->Frames = 10;
  3879. pfrm->FrameSize = 200;
  3880. pfrm->FileAlignment = 0;
  3881. pfrm->Reserved = 0;
  3882. pSrb->ActualBytesTransferred = sizeof( KSALLOCATOR_FRAMING );
  3883. break;
  3884. case KSPROPERTY_CONNECTION_STATE:
  3885. DBG_PRINTF( ("DVDWDM: KSPROPERTY_CONNECTION_STATE\n\r") );
  3886. State = (PKSSTATE)pSrb->CommandData.PropertyInfo->PropertyInfo;
  3887. pSrb->ActualBytesTransferred = sizeof( State );
  3888. // A very odd rule:
  3889. // When transitioning from stop to pause, DShow tries to preroll
  3890. // the graph. Capture sources can't preroll, and indicate this
  3891. // by returning VFW_S_CANT_CUE in user mode. To indicate this
  3892. // condition from drivers, they must return ERROR_NO_DATA_DETECTED
  3893. *State = ((PSTREAMEX)(pHwDevExt->pstroCC->HwStreamExtension))->state;
  3894. if( ((PSTREAMEX)pHwDevExt->pstroCC->HwStreamExtension)->state == KSSTATE_PAUSE ){
  3895. //
  3896. // wired stuff for capture type state change. When you tarnsition
  3897. // from stop to pause, we need to indicate that this device cannot
  3898. // preroll, and has no data to send.
  3899. //
  3900. pSrb->Status = STATUS_NO_DATA_DETECTED;
  3901. }
  3902. break;
  3903. default:
  3904. DBG_PRINTF( ("DVDWDM: PropertySetID 0 default %d(0x%x)\n\r", pSrb->CommandData.PropertyInfo->Property->Id, pSrb->CommandData.PropertyInfo->Property->Id ) );
  3905. DBG_BREAK();
  3906. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  3907. break;
  3908. }
  3909. }
  3910. void SetCCProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  3911. {
  3912. DBG_BREAK();
  3913. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  3914. return;
  3915. }
  3916. void GetVideoProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  3917. {
  3918. switch( pSrb->CommandData.PropertyInfo->PropertySetID ){
  3919. case 0:
  3920. DBG_PRINTF( ("DVDWDM: GetVideoProperty 0\n\r") );
  3921. DBG_BREAK();
  3922. pSrb->Status = STATUS_SUCCESS;
  3923. break;
  3924. case 1:
  3925. DBG_PRINTF( ("DVDWDM: GetVideoProperty 1\n\r") );
  3926. GetCppProperty( pSrb, strmVideo );
  3927. break;
  3928. case 2:
  3929. DBG_PRINTF( ("DVDWDM: GetVideoProperty 2\n\r") );
  3930. GetVideoRateChange( pSrb );
  3931. // pSrb->Status = STATUS_SUCCESS;
  3932. break;
  3933. default:
  3934. DBG_PRINTF( ("DVDWDM: GetVideoProperty ----- default\n\r") );
  3935. DBG_BREAK();
  3936. pSrb->Status = STATUS_SUCCESS;
  3937. break;
  3938. }
  3939. }
  3940. void SetVideoProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  3941. {
  3942. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  3943. switch( pSrb->CommandData.PropertyInfo->PropertySetID ){
  3944. case 0:
  3945. DBG_PRINTF( ("DVDWDM: SetVideoProperty 0\n\r") );
  3946. DBG_BREAK();
  3947. pSrb->Status = STATUS_SUCCESS;
  3948. break;
  3949. case 1:
  3950. DBG_PRINTF( ("DVDWDM: SetVideoProperty 1\n\r") );
  3951. SetCppProperty( pSrb );
  3952. break;
  3953. case 2:
  3954. DBG_PRINTF( ("DVDWDM: SetVideoProperty 2\n\r") );
  3955. // DBG_BREAK();
  3956. SetVideoRateChange( pSrb );
  3957. // pSrb->Status = STATUS_SUCCESS;
  3958. break;
  3959. default:
  3960. DBG_PRINTF( ("DVDWDM: SetVideoProperty ----- default\n\r") );
  3961. DBG_BREAK();
  3962. pSrb->Status = STATUS_SUCCESS;
  3963. break;
  3964. }
  3965. }
  3966. void GetCppProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb, LONG strm )
  3967. {
  3968. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  3969. DBG_PRINTF( ("DVDWDM: GetCppProperty\n\r") );
  3970. DWORD *lpdwOutputBufferSize;
  3971. lpdwOutputBufferSize = &(pSrb->ActualBytesTransferred);
  3972. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  3973. case KSPROPERTY_DVDCOPY_CHLG_KEY:
  3974. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_CHLG_KEY\n\r") );
  3975. BYTE pKeyData[10];
  3976. PKS_DVDCOPY_CHLGKEY pChlgKey;
  3977. pChlgKey = (PKS_DVDCOPY_CHLGKEY)pSrb->CommandData.PropertyInfo->PropertyInfo;
  3978. if( !pHwDevExt->dvdstrm.GetChlgKey(pKeyData) ){
  3979. DBG_PRINTF( ("DVDWDM: GetChlgKey Error\n\r") );
  3980. DBG_BREAK();
  3981. }
  3982. DBG_PRINTF( ("DVDWDM: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n\r",
  3983. pKeyData[0], pKeyData[1], pKeyData[2], pKeyData[3], pKeyData[4],
  3984. pKeyData[5], pKeyData[6], pKeyData[7], pKeyData[8], pKeyData[9]
  3985. ) );
  3986. pChlgKey->ChlgKey[0] = pKeyData[0];
  3987. pChlgKey->ChlgKey[1] = pKeyData[1];
  3988. pChlgKey->ChlgKey[2] = pKeyData[2];
  3989. pChlgKey->ChlgKey[3] = pKeyData[3];
  3990. pChlgKey->ChlgKey[4] = pKeyData[4];
  3991. pChlgKey->ChlgKey[5] = pKeyData[5];
  3992. pChlgKey->ChlgKey[6] = pKeyData[6];
  3993. pChlgKey->ChlgKey[7] = pKeyData[7];
  3994. pChlgKey->ChlgKey[8] = pKeyData[8];
  3995. pChlgKey->ChlgKey[9] = pKeyData[9];
  3996. *lpdwOutputBufferSize = sizeof( KS_DVDCOPY_CHLGKEY );
  3997. pSrb->Status = STATUS_SUCCESS;
  3998. break;
  3999. case KSPROPERTY_DVDCOPY_DVD_KEY1:
  4000. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_DVD_KEY1\n\r") );
  4001. pSrb->Status = STATUS_SUCCESS;
  4002. break;
  4003. case KSPROPERTY_DVDCOPY_DEC_KEY2:
  4004. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_DEC_KEY2\n\r") );
  4005. BYTE pD2KeyData[5];
  4006. PKS_DVDCOPY_BUSKEY pBusKey;
  4007. pBusKey = (PKS_DVDCOPY_BUSKEY)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4008. if( !pHwDevExt->dvdstrm.GetDVDKey2(pD2KeyData) ){
  4009. DBG_PRINTF( ("DVDWDM: GetDVDKey2 Error \n\r") );
  4010. DBG_BREAK();
  4011. }
  4012. DBG_PRINTF( ("DVDWDM: %02x %02x %02x %02x %02x\n\r",
  4013. pD2KeyData[0], pD2KeyData[1], pD2KeyData[2], pD2KeyData[3], pD2KeyData[4]
  4014. ) );
  4015. pBusKey->BusKey[0] = pD2KeyData[0];
  4016. pBusKey->BusKey[1] = pD2KeyData[1];
  4017. pBusKey->BusKey[2] = pD2KeyData[2];
  4018. pBusKey->BusKey[3] = pD2KeyData[3];
  4019. pBusKey->BusKey[4] = pD2KeyData[4];
  4020. *lpdwOutputBufferSize = sizeof( KS_DVDCOPY_BUSKEY );
  4021. pSrb->Status = STATUS_SUCCESS;
  4022. break;
  4023. case KSPROPERTY_DVDCOPY_TITLE_KEY:
  4024. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_TITLE_KEY\n\r") );
  4025. pSrb->Status = STATUS_SUCCESS;
  4026. break;
  4027. case KSPROPERTY_DVDCOPY_DISC_KEY:
  4028. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_DISC_KEY\n\r") );
  4029. pSrb->Status = STATUS_SUCCESS;
  4030. break;
  4031. case KSPROPERTY_DVDCOPY_SET_COPY_STATE:
  4032. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_SET_COPY_STATE\n\r") );
  4033. if( pHwDevExt->lCPPStrm == -1 || pHwDevExt->lCPPStrm == strm ){
  4034. DBG_PRINTF( ("DVDWDM: return REQUIRED\n\r") );
  4035. pHwDevExt->lCPPStrm = strm;
  4036. ((PKS_DVDCOPY_SET_COPY_STATE)(pSrb->CommandData.PropertyInfo->PropertyInfo))->DVDCopyState
  4037. = KS_DVDCOPYSTATE_AUTHENTICATION_REQUIRED;
  4038. }else{
  4039. DBG_PRINTF( ("DVDWDM: return NOT REQUIRED\n\r") );
  4040. ((PKS_DVDCOPY_SET_COPY_STATE)(pSrb->CommandData.PropertyInfo->PropertyInfo))->DVDCopyState
  4041. = KS_DVDCOPYSTATE_AUTHENTICATION_NOT_REQUIRED;
  4042. }
  4043. pSrb->ActualBytesTransferred = sizeof( KS_DVDCOPY_SET_COPY_STATE );
  4044. pSrb->Status = STATUS_SUCCESS;
  4045. break;
  4046. // case KSPROPERTY_DVDCOPY_REGION:
  4047. // DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_REGION\n\r") );
  4048. // DBG_BREAK();
  4049. //
  4050. // // indicate Region 1 for US content.
  4051. // ((PKS_DVDCOPY_REGION)(pSrb->CommandData.PropertyInfo->PropertyInfo))->RegionData = 0x01;
  4052. // pSrb->ActualBytesTransferred = sizeof(KS_DVDCOPY_REGION);
  4053. // pSrb->Status = STATUS_SUCCESS;
  4054. // break;
  4055. default:
  4056. DBG_PRINTF( ("DVDWDM: PropertySetID 1 default %d(0x%x)\n\r", pSrb->CommandData.PropertyInfo->Property->Id, pSrb->CommandData.PropertyInfo->Property->Id ) );
  4057. pSrb->Status = STATUS_SUCCESS;
  4058. break;
  4059. }
  4060. }
  4061. void SetCppProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  4062. {
  4063. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4064. DWORD aProp;
  4065. DBG_PRINTF( ("DVDWDM: SetCppProperty\n\r") );
  4066. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  4067. case KSPROPERTY_DVDCOPY_CHLG_KEY:
  4068. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_CHLG_KEY\n\r") );
  4069. BYTE chlgKeyData[10];
  4070. PKS_DVDCOPY_CHLGKEY pChlgKey;
  4071. pChlgKey = (PKS_DVDCOPY_CHLGKEY)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4072. chlgKeyData[0] = pChlgKey->ChlgKey[0];
  4073. chlgKeyData[1] = pChlgKey->ChlgKey[1];
  4074. chlgKeyData[2] = pChlgKey->ChlgKey[2];
  4075. chlgKeyData[3] = pChlgKey->ChlgKey[3];
  4076. chlgKeyData[4] = pChlgKey->ChlgKey[4];
  4077. chlgKeyData[5] = pChlgKey->ChlgKey[5];
  4078. chlgKeyData[6] = pChlgKey->ChlgKey[6];
  4079. chlgKeyData[7] = pChlgKey->ChlgKey[7];
  4080. chlgKeyData[8] = pChlgKey->ChlgKey[8];
  4081. chlgKeyData[9] = pChlgKey->ChlgKey[9];
  4082. DBG_PRINTF( ("DVDWDM: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n\r",
  4083. chlgKeyData[0], chlgKeyData[1], chlgKeyData[2], chlgKeyData[3], chlgKeyData[4],
  4084. chlgKeyData[5], chlgKeyData[6], chlgKeyData[7], chlgKeyData[8], chlgKeyData[9]
  4085. ) );
  4086. if( !pHwDevExt->dvdstrm.SetChlgKey( chlgKeyData ) ){
  4087. DBG_PRINTF( ("DVDWDM: Set Chllenge Key Error\n\r") );
  4088. DBG_BREAK();
  4089. }
  4090. pSrb->Status = STATUS_SUCCESS;
  4091. break;
  4092. case KSPROPERTY_DVDCOPY_DVD_KEY1:
  4093. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_DVD_KEY1\n\r") );
  4094. PKS_DVDCOPY_BUSKEY pBusKey;
  4095. BYTE BusKeyData[5];
  4096. pBusKey = (PKS_DVDCOPY_BUSKEY) pSrb->CommandData.PropertyInfo->PropertyInfo;
  4097. BusKeyData[0] = pBusKey->BusKey[0];
  4098. BusKeyData[1] = pBusKey->BusKey[1];
  4099. BusKeyData[2] = pBusKey->BusKey[2];
  4100. BusKeyData[3] = pBusKey->BusKey[3];
  4101. BusKeyData[4] = pBusKey->BusKey[4];
  4102. DBG_PRINTF( ("DVDWDM: %02x %02x %02x %02x %02x\n\r",
  4103. BusKeyData[0], BusKeyData[1], BusKeyData[2], BusKeyData[3], BusKeyData[4]
  4104. ) );
  4105. if( !pHwDevExt->dvdstrm.SetDVDKey1( BusKeyData ) ){
  4106. DBG_PRINTF( ("DVDWDM: Set Bus Key Error\n\r") );
  4107. DBG_BREAK();
  4108. }
  4109. pSrb->Status = STATUS_SUCCESS;
  4110. break;
  4111. case KSPROPERTY_DVDCOPY_DEC_KEY2:
  4112. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_DEC_KEY2\n\r") );
  4113. pSrb->Status = STATUS_SUCCESS;
  4114. break;
  4115. case KSPROPERTY_DVDCOPY_TITLE_KEY:
  4116. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_TITLE_KEY\n\r") );
  4117. PKS_DVDCOPY_TITLEKEY pTitleKey;
  4118. BYTE TitleKeyData[6];
  4119. pTitleKey = (PKS_DVDCOPY_TITLEKEY)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4120. TitleKeyData[0] = 0x00; // pTitleKey->KeyFlags;
  4121. TitleKeyData[1] = pTitleKey->TitleKey[0];
  4122. TitleKeyData[2] = pTitleKey->TitleKey[1];
  4123. TitleKeyData[3] = pTitleKey->TitleKey[2];
  4124. TitleKeyData[4] = pTitleKey->TitleKey[3];
  4125. TitleKeyData[5] = pTitleKey->TitleKey[4];
  4126. DBG_PRINTF( ("DVDWDM: %02x %02x %02x %02x %02x\n\r",
  4127. TitleKeyData[0], TitleKeyData[1], TitleKeyData[2], TitleKeyData[3], TitleKeyData[4]
  4128. ) );
  4129. if( !pHwDevExt->dvdstrm.SetTitleKey( TitleKeyData ) ){
  4130. DBG_PRINTF( ("DVDWDM: Set Title Key Error\n\r" ) );
  4131. DBG_BREAK();
  4132. }
  4133. // Set CGMS for Digital Copy Guard & NTSC Analogue Copy Guard.
  4134. DWORD cgms;
  4135. cgms = (DWORD)((pTitleKey->KeyFlags & 0x30)>>4);
  4136. switch( cgms ){
  4137. case 0x00:
  4138. DBG_PRINTF( ("DVDWDM: CGMS OFF\n\r") );
  4139. pHwDevExt->m_CgmsType = CgmsType_Off;
  4140. pHwDevExt->m_AudioCgms = AudioCgms_Off;
  4141. aProp = CgmsType_Off;
  4142. break;
  4143. case 0x02:
  4144. DBG_PRINTF( ("DVDWDM: CGMS 1\n\r") );
  4145. pHwDevExt->m_CgmsType = CgmsType_1;
  4146. pHwDevExt->m_AudioCgms = AudioCgms_1;
  4147. aProp = CgmsType_1;
  4148. break;
  4149. case 0x03:
  4150. DBG_PRINTF( ("DVDWDM: CGMS ON\n\r") );
  4151. pHwDevExt->m_CgmsType = CgmsType_On;
  4152. pHwDevExt->m_AudioCgms = AudioCgms_On;
  4153. aProp = CgmsType_On;
  4154. break;
  4155. }
  4156. if( !pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_Cgms, &aProp ) ){
  4157. DBG_PRINTF( ("CCDVD: Set Audio cgms Error\n\r") );
  4158. DBG_BREAK();
  4159. }
  4160. pSrb->Status = STATUS_SUCCESS;
  4161. break;
  4162. case KSPROPERTY_DVDCOPY_DISC_KEY:
  4163. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_DISC_KEY\n\r") );
  4164. PKS_DVDCOPY_DISCKEY pDiscKey;
  4165. pDiscKey = (PKS_DVDCOPY_DISCKEY)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4166. DBG_PRINTF( ("DVDWDM: %02x %02x %02x %02x %02x %02x %02x %02x\n\r",
  4167. pDiscKey->DiscKey[0], pDiscKey->DiscKey[1], pDiscKey->DiscKey[2], pDiscKey->DiscKey[3],
  4168. pDiscKey->DiscKey[4], pDiscKey->DiscKey[5], pDiscKey->DiscKey[6], pDiscKey->DiscKey[7]
  4169. ) );
  4170. if( !pHwDevExt->dvdstrm.SetDiscKey( (UCHAR *)( pDiscKey->DiscKey ) )){
  4171. DBG_PRINTF( ("DVDWDM: Set Disc Key Error\n\r") );
  4172. DBG_BREAK();
  4173. }
  4174. pSrb->Status = STATUS_SUCCESS;
  4175. break;
  4176. case KSPROPERTY_DVDCOPY_SET_COPY_STATE:
  4177. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_SET_COPY_STATE\n\r") );
  4178. PKS_DVDCOPY_SET_COPY_STATE pCopyState;
  4179. pCopyState = (PKS_DVDCOPY_SET_COPY_STATE)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4180. //--- 98.06.02 S.Watanabe
  4181. pSrb->Status = STATUS_SUCCESS;
  4182. //--- End.
  4183. switch( pCopyState->DVDCopyState ){
  4184. case KS_DVDCOPYSTATE_INITIALIZE :
  4185. DBG_PRINTF( ("DVDWDM: KS_DVDCOPYSTATE_INITIALIZE\n\r") );
  4186. pHwDevExt->pSrbCpp = pSrb;
  4187. pHwDevExt->bCppReset = TRUE;
  4188. pHwDevExt->CppFlagCount++;
  4189. pSrb->Status = STATUS_PENDING;
  4190. DBG_PRINTF(( "TOSDVD: CppFlagCount=%ld\r\n", pHwDevExt->CppFlagCount ));
  4191. if( pHwDevExt->CppFlagCount >= pHwDevExt->cOpenInputStream + 1 ){
  4192. if( SetCppFlag( pHwDevExt, FALSE ) == FALSE ){
  4193. pSrb->Status = STATUS_SUCCESS;
  4194. }
  4195. }
  4196. //--- End.
  4197. break;
  4198. case KS_DVDCOPYSTATE_INITIALIZE_TITLE:
  4199. DBG_PRINTF( ("DVDWDM: KS_DVDCOPYSTATE_INITIALIZE_TITLE\n\r") );
  4200. pHwDevExt->CppFlagCount++;
  4201. ASSERT( !pHwDevExt->pSrbCpp );
  4202. pHwDevExt->pSrbCpp = pSrb;
  4203. pHwDevExt->bCppReset = FALSE;
  4204. pSrb->Status = STATUS_PENDING;
  4205. DBG_PRINTF(( "TOSDVD: CppFlagCount=%ld\r\n", pHwDevExt->CppFlagCount ));
  4206. if( pHwDevExt->CppFlagCount >= pHwDevExt->cOpenInputStream + 1 ){
  4207. if( SetCppFlag( pHwDevExt, FALSE ) == FALSE ){
  4208. pSrb->Status = STATUS_SUCCESS;
  4209. }
  4210. }
  4211. //--- End.
  4212. break;
  4213. case KS_DVDCOPYSTATE_DONE:
  4214. DBG_PRINTF( ("DVDWDM: KS_DVDCOPYSTATE_DONE\n\r") );
  4215. //--- 98.06.02 S.Watanabe
  4216. //--- 99.10.04 H.Yagi pHwDevExt->CppFlagCount = 0;
  4217. //--- End.
  4218. break;
  4219. default:
  4220. DBG_PRINTF( ("DVDWDM: KS_DVDCOPYSTATE_?????\n\r") );
  4221. break;
  4222. }
  4223. break;
  4224. case KSPROPERTY_COPY_MACROVISION:
  4225. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDCOPY_MACROVISION\n\r") );
  4226. /************* Test Code .....start This part is not neccessary
  4227. BYTE tmp;
  4228. tmp = READ_PORT_UCHAR( (PUCHAR)0x0071 ); // 0x0071 RTC I/O port
  4229. DBG_PRINTF( ("DVDWDM: RTC I/O(0x0071) = 0x%0x\n\r", tmp) );
  4230. pSrb->Status = STATUS_UNSUCCESSFUL;
  4231. return;
  4232. ************* Test Code .....end ******/
  4233. PKS_COPY_MACROVISION pLevel;
  4234. DWORD apsLevel;
  4235. VideoAPSStruc vAPS;
  4236. // OsdDataStruc TestOSD; // removed by H.Yagi 99.02.02
  4237. pLevel = (PKS_COPY_MACROVISION)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4238. apsLevel = pLevel->MACROVISIONLevel;
  4239. if( pHwDevExt->m_APSType != (apsLevel&0x03) ){ // add by H.Yagi 99.02.02
  4240. pHwDevExt->m_APSChange = TRUE;
  4241. }
  4242. switch( (apsLevel&0x03) ){
  4243. case 0:
  4244. pHwDevExt->m_APSType = ApsType_Off;
  4245. break;
  4246. case 1:
  4247. pHwDevExt->m_APSType = ApsType_1;
  4248. break;
  4249. case 2:
  4250. pHwDevExt->m_APSType = ApsType_2;
  4251. break;
  4252. case 3:
  4253. pHwDevExt->m_APSType = ApsType_3;
  4254. break;
  4255. }
  4256. vAPS.APSType = (APSTYPE)pHwDevExt->m_APSType;
  4257. vAPS.CgmsType = (CGMSTYPE)pHwDevExt->m_CgmsType;
  4258. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_APS, &vAPS ) ){
  4259. DBG_PRINTF( ("DVDWDM: Set APS Error\n\r") );
  4260. DBG_BREAK();
  4261. }
  4262. // removed by H.Yagi 99.02.02
  4263. // TestOSD.OsdType = OSD_TYPE_ZIVA;
  4264. // TestOSD.pNextData = NULL;
  4265. // TestOSD.pData = &erase[0];
  4266. // TestOSD.dwOsdSize = sizeof( erase );
  4267. /******** Commented out to call MacroVisionTVControl().
  4268. ********* Because before starting APS data, this setting
  4269. ********* is passed to mini-driver. So mini-driver call
  4270. ********* MacroVisonTVControl() just before decodeing
  4271. ********* APS data.
  4272. MacroVisionTVControl( pSrb, pHwDevExt->m_APSType, TestOSD );
  4273. *********/
  4274. pSrb->Status = STATUS_SUCCESS;
  4275. break;
  4276. default:
  4277. DBG_PRINTF( ("DVDWDM: PropertySetID 1 default %d(0x%x)\n\r", pSrb->CommandData.PropertyInfo->Property->Id, pSrb->CommandData.PropertyInfo->Property->Id ) );
  4278. pSrb->Status = STATUS_SUCCESS;
  4279. break;
  4280. }
  4281. }
  4282. void GetAudioProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  4283. {
  4284. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4285. switch( pSrb->CommandData.PropertyInfo->PropertySetID ){
  4286. case 0:
  4287. DBG_PRINTF( ("DVDWDM: GetAudioProperty 0\n\r") );
  4288. pSrb->Status = STATUS_SUCCESS;
  4289. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  4290. case KSPROPERTY_AUDDECOUT_MODES:
  4291. *(PULONG)(pSrb->CommandData.PropertyInfo->PropertyInfo ) =
  4292. KSAUDDECOUTMODE_STEREO_ANALOG | KSAUDDECOUTMODE_SPDIFF;
  4293. break;
  4294. case KSPROPERTY_AUDDECOUT_CUR_MODE:
  4295. DWORD aProp;
  4296. aProp = pHwDevExt->m_AudioDigitalOut;
  4297. switch( aProp ){
  4298. case AudioDigitalOut_On:
  4299. *(PULONG)(pSrb->CommandData.PropertyInfo->PropertyInfo ) |=
  4300. KSAUDDECOUTMODE_SPDIFF;
  4301. break;
  4302. case AudioDigitalOut_Off:
  4303. *(PULONG)(pSrb->CommandData.PropertyInfo->PropertyInfo ) &=
  4304. (~KSAUDDECOUTMODE_SPDIFF);
  4305. break;
  4306. }
  4307. aProp = pHwDevExt->m_AudioEncode;
  4308. switch( aProp ){
  4309. case AudioOut_Decoded:
  4310. *(PULONG)(pSrb->CommandData.PropertyInfo->PropertyInfo ) |=
  4311. KSAUDDECOUTMODE_STEREO_ANALOG;
  4312. break;
  4313. case AudioOut_Encoded:
  4314. *(PULONG)(pSrb->CommandData.PropertyInfo->PropertyInfo ) &=
  4315. (~KSAUDDECOUTMODE_STEREO_ANALOG);
  4316. break;
  4317. }
  4318. break;
  4319. default:
  4320. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4321. }
  4322. break;
  4323. case 1:
  4324. DBG_PRINTF( ("DVDWDM: GetAudioProperty 1\n\r") );
  4325. GetCppProperty( pSrb, strmAudio );
  4326. break;
  4327. case 2:
  4328. DBG_PRINTF( ("DVDWDM: GetAudioProperty 2\n\r") );
  4329. DBG_BREAK();
  4330. GetAudioRateChange( pSrb );
  4331. pSrb->Status = STATUS_SUCCESS;
  4332. break;
  4333. default:
  4334. DBG_PRINTF( ("DVDWDM: GetAudioProperty ----- default\n\r") );
  4335. DBG_BREAK();
  4336. pSrb->Status = STATUS_SUCCESS;
  4337. break;
  4338. }
  4339. }
  4340. void SetAudioProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  4341. {
  4342. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4343. DWORD aProp;
  4344. pSrb->Status = STATUS_SUCCESS;
  4345. switch( pSrb->CommandData.PropertyInfo->PropertySetID ){
  4346. case 0:
  4347. DBG_PRINTF( ("DVDWDM: SetAudioProperty 0\n\r") );
  4348. pSrb->Status = STATUS_SUCCESS;
  4349. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  4350. case KSPROPERTY_AUDDECOUT_CUR_MODE:
  4351. if( (*(PULONG)(pSrb->CommandData.PropertyInfo->PropertyInfo)) &
  4352. (!(KSAUDDECOUTMODE_STEREO_ANALOG | KSAUDDECOUTMODE_SPDIFF))){
  4353. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4354. break;
  4355. }
  4356. if( (*(PULONG)(pSrb->CommandData.PropertyInfo->PropertyInfo)) &
  4357. (KSAUDDECOUTMODE_SPDIFF) ){
  4358. aProp = AudioDigitalOut_On;
  4359. }else{
  4360. aProp = AudioDigitalOut_Off;
  4361. }
  4362. /************* commented out by H.Yagi 1998.10.30
  4363. if( !pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_DigitalOut, &aProp ) ){
  4364. DBG_PRINTF( ("DVDWDM: SetAudioProperty(DigitalOut) Error\n\r") );
  4365. DBG_BREAK();
  4366. }
  4367. pHwDevExt->m_AudioDigitalOut = aProp;
  4368. *************/
  4369. if( (*(PULONG)(pSrb->CommandData.PropertyInfo->PropertyInfo)) &
  4370. (KSAUDDECOUTMODE_STEREO_ANALOG) ){
  4371. aProp = AudioOut_Decoded;
  4372. }else{
  4373. aProp = AudioOut_Encoded;
  4374. }
  4375. /************* commented out by H.Yagi 1998.10.30
  4376. if( !pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_AudioOut, &aProp ) ){
  4377. DBG_PRINTF( ("DVDWDM: SetAudioProperty(AudioOut) Error\n\r") );
  4378. DBG_BREAK();
  4379. }
  4380. pHwDevExt->m_AudioEncode = aProp;
  4381. *************/
  4382. break;
  4383. default:
  4384. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4385. break;
  4386. }
  4387. break;
  4388. case 1:
  4389. DBG_PRINTF( ("DVDWDM: SetAudioProperty 1\n\r") );
  4390. SetCppProperty( pSrb );
  4391. break;
  4392. case 2:
  4393. DBG_PRINTF( ("DVDWDM: SetAudioProperty 2\n\r") );
  4394. // DBG_BREAK();
  4395. SetAudioRateChange( pSrb );
  4396. pSrb->Status = STATUS_SUCCESS;
  4397. break;
  4398. default:
  4399. DBG_PRINTF( ("DVDWDM: SetAudioProperty ----- default\n\r") );
  4400. DBG_BREAK();
  4401. pSrb->Status = STATUS_SUCCESS;
  4402. break;
  4403. }
  4404. }
  4405. void GetSubpicProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  4406. {
  4407. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4408. switch( pSrb->CommandData.PropertyInfo->PropertySetID ){
  4409. case 0:
  4410. DBG_PRINTF( ("DVDWDM: GetSubpicProperty 0\n\r") );
  4411. pSrb->Status = STATUS_SUCCESS;
  4412. break;
  4413. case 1:
  4414. DBG_PRINTF( ("DVDWDM: GetSubpicProperty 1\n\r") );
  4415. GetCppProperty( pSrb, strmSubpicture );
  4416. break;
  4417. case 2:
  4418. DBG_PRINTF( ("DVDWDM: GetSubpicProperty 2\n\r") );
  4419. GetSubpicRateChange( pSrb );
  4420. pSrb->Status = STATUS_SUCCESS;
  4421. break;
  4422. default:
  4423. DBG_PRINTF( ("DVDWDM: GetSubpicProperty ----- default\n\r") );
  4424. DBG_BREAK();
  4425. pSrb->Status = STATUS_SUCCESS;
  4426. break;
  4427. }
  4428. }
  4429. void SetSubpicProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  4430. {
  4431. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4432. pSrb->Status = STATUS_SUCCESS;
  4433. switch( pSrb->CommandData.PropertyInfo->PropertySetID ){
  4434. case 0:
  4435. DBG_PRINTF( ("DVDWDM: SetSubicProperty 0\n\r") );
  4436. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  4437. case KSPROPERTY_DVDSUBPIC_PALETTE:
  4438. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDSUBPIC_PALETTE\n\r") );
  4439. PKSPROPERTY_SPPAL ppal;
  4440. BYTE paldata[48];
  4441. int i;
  4442. ppal = (PKSPROPERTY_SPPAL)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4443. for( i=0; i<16; i++ ){
  4444. paldata[i*3+0] = (BYTE)ppal->sppal[i].Y;
  4445. paldata[i*3+1] = (BYTE)ppal->sppal[i].V; // -> Cr
  4446. paldata[i*3+2] = (BYTE)ppal->sppal[i].U; // -> Cb
  4447. }
  4448. if( !pHwDevExt->dvdstrm.SetSubpicProperty( SubpicProperty_Palette, &paldata )){
  4449. DBG_PRINTF( ("DVDWDM: SetSubpic Palette Error\n\r") );
  4450. DBG_BREAK();
  4451. }
  4452. pSrb->Status = STATUS_SUCCESS;
  4453. break;
  4454. case KSPROPERTY_DVDSUBPIC_HLI:
  4455. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDSUBPIC_HLI\n\r") );
  4456. PKSPROPERTY_SPHLI phli;
  4457. pSrb->Status = STATUS_SUCCESS;
  4458. phli = (PKSPROPERTY_SPHLI) pSrb->CommandData.PropertyInfo->PropertyInfo;
  4459. pHwDevExt->m_HlightControl.Set( phli );
  4460. break;
  4461. case KSPROPERTY_DVDSUBPIC_COMPOSIT_ON:
  4462. DWORD spProp;
  4463. if( *((PKSPROPERTY_COMPOSIT_ON)pSrb->CommandData.PropertyInfo->PropertyInfo )){
  4464. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDSUBPIC_COMPOSIT_ON\n\r") );
  4465. spProp = Subpic_On;
  4466. }else{
  4467. DBG_PRINTF( ("DVDWDM: KSPROPERTY_DVDSUBPIC_COMPOSIT_OFF\n\r") );
  4468. spProp = Subpic_Off;
  4469. }
  4470. if( !pHwDevExt->dvdstrm.SetSubpicProperty( SubpicProperty_State, &spProp ) ){
  4471. DBG_PRINTF( ("DVDWDM: Set Subpic Mute Error\n\r") );
  4472. DBG_BREAK();
  4473. }
  4474. pHwDevExt->m_SubpicMute = spProp;
  4475. pSrb->Status = STATUS_SUCCESS;
  4476. /********************* for test OSD start ****
  4477. OsdDataStruc TestOSD;
  4478. DWORD swOSD;
  4479. if( spProp == Subpic_On ){
  4480. swOSD = Video_OSD_On;
  4481. }else{
  4482. swOSD = Video_OSD_Off;
  4483. }
  4484. TestOSD.OsdType = OSD_TYPE_ZIVA;
  4485. TestOSD.pNextData = NULL;
  4486. TestOSD.pData = &goweb[0];
  4487. TestOSD.dwOsdSize = sizeof( goweb );
  4488. DBG_PRINTF( ("DVDWDM:TEST OSD pData=%08x, Size=%08x\n\r", TestOSD.pData, TestOSD.dwOsdSize ) );
  4489. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OSDData, &TestOSD ) ){
  4490. DBG_PRINTF( ("DVDWDM: OSD Data Error!\n\r") );
  4491. DBG_BREAK();
  4492. }
  4493. if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OSDSwitch, &swOSD ) ){
  4494. DBG_PRINTF( ("DVDWDM: OSD S/W Error!\n\r") );
  4495. DBG_BREAK();
  4496. }
  4497. ********************* for test OSD start *****/
  4498. break;
  4499. default:
  4500. pSrb->Status = STATUS_SUCCESS;
  4501. break;
  4502. }
  4503. break;
  4504. case 1:
  4505. DBG_PRINTF( ("DVDWDM: SetSubpicProperty 1\n\r") );
  4506. SetCppProperty( pSrb );
  4507. break;
  4508. case 2:
  4509. DBG_PRINTF( ("DVDWDM: SetSubpicProperty 2\n\r") );
  4510. // DBG_BREAK();
  4511. SetSubpicRateChange( pSrb );
  4512. pSrb->Status = STATUS_SUCCESS;
  4513. break;
  4514. default:
  4515. DBG_PRINTF( ("DVDWDM: SetSubpicProperty ----- default\n\r") );
  4516. DBG_BREAK();
  4517. pSrb->Status = STATUS_SUCCESS;
  4518. break;
  4519. }
  4520. }
  4521. //--- 98.06.01 S.Watanabe
  4522. //void GetNtscProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  4523. //{
  4524. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4525. //
  4526. // switch( pSrb->CommandData.PropertyInfo->PropertySetID ){
  4527. // case 0:
  4528. // DBG_PRINTF( ("DVDWDM: GetNtscProperty 0\n\r") );
  4529. // pSrb->Status = STATUS_SUCCESS;
  4530. // break;
  4531. //
  4532. // default:
  4533. // DBG_PRINTF( ("DVDWDM: GetNtscProperty ----- default\n\r") );
  4534. // DBG_BREAK();
  4535. // pSrb->Status = STATUS_SUCCESS;
  4536. // break;
  4537. // }
  4538. //}
  4539. //
  4540. //
  4541. //void SetNtscProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  4542. //{
  4543. // PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4544. //
  4545. // switch( pSrb->CommandData.PropertyInfo->PropertySetID ){
  4546. // case 0:
  4547. // DBG_PRINTF( ("DVDWDM: SetNtscProperty 0\n\r") );
  4548. // switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  4549. // case KSPROPERTY_COPY_MACROVISION:
  4550. // DBG_PRINTF( ("DVDWDM: KSPROPERTY_COPY_MACROVISION 0\n\r") );
  4551. // PKS_COPY_MACROVISION pLevel;
  4552. // DWORD apsLevel;
  4553. // VideoAPSStruc vAPS;
  4554. //
  4555. // pLevel = (PKS_COPY_MACROVISION)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4556. // apsLevel = pLevel->MACROVISIONLevel;
  4557. //
  4558. // switch( (apsLevel&0x03) ){
  4559. // case 0:
  4560. // pHwDevExt->m_APSType = ApsType_Off;
  4561. // break;
  4562. // case 1:
  4563. // pHwDevExt->m_APSType = ApsType_1;
  4564. // break;
  4565. // case 2:
  4566. // pHwDevExt->m_APSType = ApsType_2;
  4567. // break;
  4568. // case 3:
  4569. // pHwDevExt->m_APSType = ApsType_3;
  4570. // break;
  4571. // }
  4572. // vAPS.APSType = (APSTYPE)pHwDevExt->m_APSType;
  4573. // vAPS.CgmsType = (CGMSTYPE)pHwDevExt->m_CgmsType;
  4574. // if( !pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_APS, &vAPS ) ){
  4575. // DBG_PRINTF( ("DVDWDM: Set VideoProperty APS Error\n\r") );
  4576. // DBG_BREAK();
  4577. // }
  4578. // break;
  4579. // }
  4580. // pSrb->Status = STATUS_SUCCESS;
  4581. // break;
  4582. //
  4583. // default:
  4584. // DBG_PRINTF( ("DVDWDM: SetNtscProperty ----- default\n\r") );
  4585. // DBG_BREAK();
  4586. // pSrb->Status = STATUS_SUCCESS;
  4587. // break;
  4588. // }
  4589. //}
  4590. //--- End.
  4591. VOID SetAudioID( PHW_DEVICE_EXTENSION pHwDevExt, PKSSTREAM_HEADER pStruc )
  4592. {
  4593. DWORD strID;
  4594. DWORD aPropChannel, aProp, aPropFS;
  4595. strID = GetStreamID( pStruc->Data );
  4596. switch( (strID & 0xF8) ){
  4597. case 0x80:
  4598. aProp = AudioType_AC3;
  4599. aPropFS = 48000;;
  4600. break;
  4601. case 0xA0:
  4602. aProp = AudioType_PCM;
  4603. aPropFS = 48000; // 96000?
  4604. break;
  4605. case 0xC0:
  4606. aProp = AudioType_MPEG1;
  4607. aPropFS = 48000;
  4608. break;
  4609. case 0xD0:
  4610. aProp = AudioType_MPEG2;
  4611. aPropFS = 48000;
  4612. break;
  4613. default:
  4614. DBG_PRINTF( ("DVDWDM: This is not Audio Packet data\n\r") );
  4615. DBG_BREAK();
  4616. // break;
  4617. return;
  4618. }
  4619. if( pHwDevExt->m_AudioType != aProp ){
  4620. DBG_PRINTF( ("DVDWDM: Audio TYPE is cahnge\n\r") );
  4621. if( !pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_Type, &aProp ) ){
  4622. DBG_PRINTF( ("DVDWDM: SetAudioProperty(Audio Type) Error\n\r") );
  4623. DBG_BREAK();
  4624. }
  4625. pHwDevExt->m_AudioType = aProp;
  4626. if( !pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_Sampling, &aPropFS ) ){
  4627. DBG_PRINTF( ("DVDWDM: SetAudioProperty(Audio Sampling) Error\n\r") );
  4628. DBG_BREAK();
  4629. }
  4630. pHwDevExt->m_AudioFS = aPropFS;
  4631. }
  4632. aPropChannel = (strID & 0x07); // channel number
  4633. DBG_PRINTF( ("DVDWDM: Audio CHANNEL # = 0x%x\n\r", aPropChannel ) );
  4634. if( pHwDevExt->m_AudioChannel != aPropChannel ){
  4635. if( !pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_Number, &aPropChannel ) ){
  4636. DBG_PRINTF( ("DVDWDM: Set Audio Property( channel) Error\n\r") );
  4637. DBG_BREAK();
  4638. }
  4639. pHwDevExt->m_AudioChannel = aPropChannel;
  4640. }
  4641. }
  4642. VOID SetSubpicID( PHW_DEVICE_EXTENSION pHwDevExt, PKSSTREAM_HEADER pStruc )
  4643. {
  4644. DWORD strID;
  4645. DWORD spPropChannel;
  4646. strID = GetStreamID( pStruc->Data );
  4647. spPropChannel = (strID & 0x1F); // channel number
  4648. DBG_PRINTF( ("DVDWDM: Subpic channel # = 0x%x\n\r", spPropChannel ) );
  4649. if( pHwDevExt->m_SubpicChannel != spPropChannel ){
  4650. if( !pHwDevExt->dvdstrm.SetSubpicProperty( SubpicProperty_Number, &spPropChannel ) ){
  4651. DBG_PRINTF( ("DVDWDM: Set Subpic Property(channel) Error\n\r") );
  4652. DBG_BREAK();
  4653. }
  4654. pHwDevExt->m_SubpicChannel = spPropChannel;
  4655. }
  4656. }
  4657. DWORD GetStreamID( void *pBuff )
  4658. {
  4659. PUCHAR pDat = (PUCHAR)pBuff;
  4660. UCHAR strID, subID;
  4661. strID = *( pDat + 17 );
  4662. if( strID==0xBD ){ // Private stream 1(AC-3/LPCM/Subpic)
  4663. subID = *(pDat+(*(pDat+22)+23));
  4664. return( (DWORD)subID );
  4665. }
  4666. return( strID );
  4667. /****************************************
  4668. // Check Video Stream
  4669. if( strID == 0xE0 ){
  4670. return( (DWORD)strID );
  4671. }
  4672. // Check MPEG Audio
  4673. else if( ( strID & 0xC0 )==0xC0 ){ // MPEG1 Audio
  4674. return( (DWORD)strID );
  4675. }
  4676. else if( ( strID & 0xD0 )==0xD0 ){ // MPEG2 Audio
  4677. return( (DWORD)strID );
  4678. }
  4679. // Check private stream 1 (AC-3/PCM/Subpic)
  4680. else{
  4681. subID = *(pDat+(*(pDat+22)+23));
  4682. return( (DWORD)subID );
  4683. }
  4684. ****************************************/
  4685. }
  4686. void SetVideoRateChange( PHW_STREAM_REQUEST_BLOCK pSrb )
  4687. {
  4688. DBG_PRINTF( ("DVDWDM: SetVideoRateChange\n\r") );
  4689. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  4690. case KS_AM_RATE_SimpleRateChange:
  4691. {
  4692. KS_AM_SimpleRateChange *pRateChange;
  4693. PHW_DEVICE_EXTENSION pHwDevExt;
  4694. REFERENCE_TIME NewStartTime;
  4695. LONG NewRate, PrevRate;
  4696. // DWORD foo, bar;
  4697. DBG_PRINTF( ("DVDWDM: KS_AM_RATE_SimpleRateChange\n\r") );
  4698. pRateChange = (KS_AM_SimpleRateChange *)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4699. pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4700. // 1998.9.18 K.Ishizaki
  4701. if( pRateChange->StartTime >=0){
  4702. NewStartTime = pRateChange->StartTime;
  4703. } else {
  4704. NewStartTime = pHwDevExt->ticktime.GetStreamTime();
  4705. }
  4706. // End
  4707. NewRate = ( pRateChange->Rate <0 )? -pRateChange->Rate:pRateChange->Rate;
  4708. DBG_PRINTF( ("DVDWDM: ReceiveData \n\r" ) );
  4709. DBG_PRINTF( ("DVDWDM: StartTime = 0x%s\n\r", DebugLLConvtoStr( NewStartTime, 16 ) ) );
  4710. DBG_PRINTF( ("DVDWDM: NewRate = %d\n\r", NewRate ) );
  4711. DBG_PRINTF( ("DVDWDM: CurrentTime = 0x%s\n\r", DebugLLConvtoStr( pHwDevExt->ticktime.GetStreamTime(), 16 ) ));
  4712. DBG_PRINTF( ("DVDWDM: CurrentData\n\r") );
  4713. // DBG_PRINTF( ("DVDWDM: InterceptTime = 0x%08x\n\r", pHwDevExt->VideoInterceptTime ) );
  4714. // DBG_PRINTF( ("DVDWDM: StartTime = 0x%08x\n\r", pHwDevExt->VideoStartTime ) );
  4715. PrevRate = pHwDevExt->Rate;
  4716. pHwDevExt->Rate = NewRate;
  4717. /////////////// 98.07.29 H.Yagi start
  4718. pHwDevExt->OldCompleteRate = pHwDevExt->NewCompleteRate;
  4719. pHwDevExt->NewCompleteRate = pRateChange->Rate;
  4720. /////////////// 98.07.29 H.Yagi end
  4721. // if( NewRate == 10000 ){
  4722. // pHwDevExt->VideoInterceptTime = 0;
  4723. // pHwDevExt->VideoStartTime = 0;
  4724. // }else{
  4725. pHwDevExt->VideoInterceptTime = (-NewStartTime) * 10000 / NewRate + NewStartTime;
  4726. pHwDevExt->VideoStartTime = NewStartTime;
  4727. // }
  4728. SetRateChange( pHwDevExt, PrevRate );
  4729. }
  4730. pSrb->Status = STATUS_SUCCESS;
  4731. break;
  4732. case KS_AM_RATE_ExactRateChange:
  4733. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4734. break;
  4735. case KS_AM_RATE_MaxFullDataRate:
  4736. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4737. break;
  4738. case KS_AM_RATE_Step:
  4739. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4740. break;
  4741. }
  4742. }
  4743. void GetVideoRateChange( PHW_STREAM_REQUEST_BLOCK pSrb )
  4744. {
  4745. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4746. DBG_PRINTF( ("DVDWDM: GetVideoRateChange\n\r") );
  4747. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  4748. case KS_AM_RATE_SimpleRateChange:
  4749. {
  4750. KS_AM_SimpleRateChange *pRateChange;
  4751. DBG_PRINTF( ("DVDWDM: KS_AM_RATE_SimpleRateChange\n\r") );
  4752. pSrb->ActualBytesTransferred = sizeof( KS_AM_RATE_SimpleRateChange );
  4753. pRateChange = (KS_AM_SimpleRateChange *)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4754. pRateChange->StartTime = pHwDevExt->VideoStartTime;
  4755. pRateChange->Rate = pHwDevExt->Rate;
  4756. }
  4757. pSrb->Status = STATUS_SUCCESS;
  4758. break;
  4759. case KS_AM_RATE_ExactRateChange:
  4760. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4761. break;
  4762. case KS_AM_RATE_MaxFullDataRate :
  4763. {
  4764. KS_AM_MaxFullDataRate *pMaxRate;
  4765. DBG_PRINTF( ("DVVDWDM: KS_AM_RATE_MaxFullRate\n\r") );
  4766. pSrb->ActualBytesTransferred = sizeof( KS_AM_RATE_MaxFullDataRate);
  4767. pMaxRate = (KS_AM_MaxFullDataRate *)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4768. *pMaxRate = VIDEO_MAX_FULL_RATE;
  4769. }
  4770. pSrb->Status = STATUS_SUCCESS;
  4771. break;
  4772. case KS_AM_RATE_Step:
  4773. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4774. break;
  4775. }
  4776. }
  4777. void SetAudioRateChange( PHW_STREAM_REQUEST_BLOCK pSrb )
  4778. {
  4779. DBG_PRINTF( ("DVDWDM: SetAudioRateChange\n\r") );
  4780. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  4781. case KS_AM_RATE_SimpleRateChange:
  4782. {
  4783. KS_AM_SimpleRateChange *pRateChange;
  4784. PHW_DEVICE_EXTENSION pHwDevExt;
  4785. REFERENCE_TIME NewStartTime;
  4786. LONG NewRate;
  4787. DBG_PRINTF( ("DVDWDM: KS_AM_RATE_SimpleRateChange\n\r") );
  4788. pRateChange = (KS_AM_SimpleRateChange *)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4789. pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4790. // 1998.9.18 K.Ishizaki
  4791. if( pRateChange->StartTime >=0) {
  4792. NewStartTime = pRateChange->StartTime;
  4793. } else {
  4794. NewStartTime = pHwDevExt->ticktime.GetStreamTime();
  4795. }
  4796. // End
  4797. NewRate = ( pRateChange->Rate <0 )? -pRateChange->Rate:pRateChange->Rate;
  4798. DBG_PRINTF( ("DVDWDM: ReceiveData \n\r" ) );
  4799. DBG_PRINTF( ("DVDWDM: StartTime = 0x%s\n\r", DebugLLConvtoStr( NewStartTime, 16 ) ) );
  4800. DBG_PRINTF( ("DVDWDM: NewRate = %d\n\r", NewRate ) );
  4801. DBG_PRINTF( ("DVDWDM: CurrentTime = 0x%s\n\r", DebugLLConvtoStr( pHwDevExt->ticktime.GetStreamTime(), 16 ) ));
  4802. // DBG_PRINTF( ("DVDWDM: CurrentData\n\r") );
  4803. // DBG_PRINTF( ("DVDWDM: InterceptTime = 0x%08x\n\r", pHwDevExt->VideoInterceptTime ) );
  4804. // DBG_PRINTF( ("DVDWDM: StartTime = 0x%08x\n\r", pHwDevExt->VideoStartTime ) );
  4805. DBG_PRINTF( ("DVDWDM: Rate = %d\n\r", pHwDevExt->Rate ) );
  4806. // if( NewRate == 10000 ){
  4807. // pHwDevExt->AudioInterceptTime = 0;
  4808. // pHwDevExt->AudioStartTime = 0;
  4809. // }else{
  4810. pHwDevExt->AudioInterceptTime = (-NewStartTime) * 10000 / NewRate + NewStartTime;
  4811. pHwDevExt->AudioStartTime = NewStartTime;
  4812. // }
  4813. }
  4814. pSrb->Status = STATUS_SUCCESS;
  4815. break;
  4816. case KS_AM_RATE_ExactRateChange:
  4817. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4818. break;
  4819. case KS_AM_RATE_MaxFullDataRate:
  4820. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4821. break;
  4822. case KS_AM_RATE_Step:
  4823. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4824. break;
  4825. }
  4826. }
  4827. void GetAudioRateChange( PHW_STREAM_REQUEST_BLOCK pSrb )
  4828. {
  4829. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4830. DBG_PRINTF( ("DVDWDM: GetAudioRateChange\n\r") );
  4831. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  4832. case KS_AM_RATE_SimpleRateChange:
  4833. {
  4834. KS_AM_SimpleRateChange *pRateChange;
  4835. DBG_PRINTF( ("DVDWDM: KS_AM_RATE_SimpleRateChange\n\r") );
  4836. pSrb->ActualBytesTransferred = sizeof( KS_AM_RATE_SimpleRateChange );
  4837. pRateChange = (KS_AM_SimpleRateChange *)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4838. pRateChange->StartTime = pHwDevExt->AudioStartTime;
  4839. pRateChange->Rate = pHwDevExt->Rate;
  4840. }
  4841. pSrb->Status = STATUS_SUCCESS;
  4842. break;
  4843. case KS_AM_RATE_ExactRateChange:
  4844. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4845. break;
  4846. case KS_AM_RATE_MaxFullDataRate :
  4847. {
  4848. KS_AM_MaxFullDataRate *pMaxRate;
  4849. DBG_PRINTF( ("DVVDWDM: KS_AM_RATE_MaxFullRate\n\r") );
  4850. pSrb->ActualBytesTransferred = sizeof( KS_AM_RATE_MaxFullDataRate);
  4851. pMaxRate = (KS_AM_MaxFullDataRate *)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4852. *pMaxRate = AUDIO_MAX_FULL_RATE;
  4853. }
  4854. pSrb->Status = STATUS_SUCCESS;
  4855. break;
  4856. case KS_AM_RATE_Step:
  4857. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4858. break;
  4859. }
  4860. }
  4861. void SetSubpicRateChange( PHW_STREAM_REQUEST_BLOCK pSrb )
  4862. {
  4863. DBG_PRINTF( ("DVDWDM: SetSubpicRateChange\n\r") );
  4864. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  4865. case KS_AM_RATE_SimpleRateChange:
  4866. {
  4867. KS_AM_SimpleRateChange *pRateChange;
  4868. PHW_DEVICE_EXTENSION pHwDevExt;
  4869. REFERENCE_TIME NewStartTime;
  4870. LONG NewRate;
  4871. DBG_PRINTF( ("DVDWDM: KS_AM_RATE_SimpleRateChange\n\r") );
  4872. pRateChange = (KS_AM_SimpleRateChange *)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4873. pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4874. // 1998.9 18 K.Ishizaki
  4875. if( pRateChange->StartTime >=0) {
  4876. NewStartTime = pRateChange->StartTime;
  4877. } else {
  4878. NewStartTime = pHwDevExt->ticktime.GetStreamTime();
  4879. }
  4880. // End
  4881. NewRate = ( pRateChange->Rate <0 )? -pRateChange->Rate:pRateChange->Rate;
  4882. DBG_PRINTF( ("DVDWDM: ReceiveData \n\r" ) );
  4883. DBG_PRINTF( ("DVDWDM: StartTime = 0x%s\n\r", DebugLLConvtoStr( NewStartTime, 16 ) ) );
  4884. DBG_PRINTF( ("DVDWDM: NewRate = %d\n\r", NewRate ) );
  4885. DBG_PRINTF( ("DVDWDM: CurrentTime = 0x%s\n\r", DebugLLConvtoStr( pHwDevExt->ticktime.GetStreamTime(), 16 ) ));
  4886. // DBG_PRINTF( ("DVDWDM: CurrentData\n\r") );
  4887. // DBG_PRINTF( ("DVDWDM: InterceptTime = 0x%08x\n\r", pHwDevExt->VideoInterceptTime ) );
  4888. // DBG_PRINTF( ("DVDWDM: StartTime = 0x%08x\n\r", pHwDevExt->VideoStartTime ) );
  4889. DBG_PRINTF( ("DVDWDM: Rate = %d\n\r", pHwDevExt->Rate ) );
  4890. // if( NewRate == 10000 ){
  4891. // pHwDevExt->SubpicInterceptTime = 0;
  4892. // pHwDevExt->SubpicStartTime = 0;
  4893. // }else{
  4894. pHwDevExt->SubpicInterceptTime = (-NewStartTime) * 10000 / NewRate + NewStartTime;
  4895. pHwDevExt->SubpicStartTime = NewStartTime;
  4896. // }
  4897. }
  4898. pSrb->Status = STATUS_SUCCESS;
  4899. break;
  4900. case KS_AM_RATE_ExactRateChange:
  4901. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4902. break;
  4903. case KS_AM_RATE_MaxFullDataRate:
  4904. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4905. break;
  4906. case KS_AM_RATE_Step:
  4907. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4908. break;
  4909. }
  4910. }
  4911. void GetSubpicRateChange( PHW_STREAM_REQUEST_BLOCK pSrb )
  4912. {
  4913. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  4914. DBG_PRINTF( ("DVDWDM: GetSubpicRateChange\n\r") );
  4915. switch( pSrb->CommandData.PropertyInfo->Property->Id ){
  4916. case KS_AM_RATE_SimpleRateChange:
  4917. {
  4918. KS_AM_SimpleRateChange *pRateChange;
  4919. DBG_PRINTF( ("DVDWDM: KS_AM_RATE_SimpleRateChange\n\r") );
  4920. pSrb->ActualBytesTransferred = sizeof( KS_AM_RATE_SimpleRateChange );
  4921. pRateChange = (KS_AM_SimpleRateChange *)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4922. pRateChange->StartTime = pHwDevExt->SubpicStartTime;
  4923. pRateChange->Rate = pHwDevExt->Rate;
  4924. }
  4925. pSrb->Status = STATUS_SUCCESS;
  4926. break;
  4927. case KS_AM_RATE_ExactRateChange:
  4928. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4929. break;
  4930. case KS_AM_RATE_MaxFullDataRate :
  4931. {
  4932. KS_AM_MaxFullDataRate *pMaxRate;
  4933. DBG_PRINTF( ("DVVDWDM: KS_AM_RATE_MaxFullRate\n\r") );
  4934. pSrb->ActualBytesTransferred = sizeof( KS_AM_RATE_MaxFullDataRate);
  4935. pMaxRate = (KS_AM_MaxFullDataRate *)pSrb->CommandData.PropertyInfo->PropertyInfo;
  4936. *pMaxRate = SUBPIC_MAX_FULL_RATE;
  4937. }
  4938. pSrb->Status = STATUS_SUCCESS;
  4939. break;
  4940. case KS_AM_RATE_Step:
  4941. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  4942. break;
  4943. }
  4944. }
  4945. void SetRateChange( PHW_DEVICE_EXTENSION pHwDevExt, LONG PrevRate )
  4946. {
  4947. DWORD dProp;
  4948. PHW_STREAM_REQUEST_BLOCK pTmp;
  4949. pTmp = NULL;
  4950. DBG_PRINTF( ("DVDWDM: SetRateChange\n\r") );
  4951. DBG_PRINTF( ("DVDWDM: Rate = 0x%08x\n\r", pHwDevExt->Rate ) );
  4952. // Maybe buggy? use video rate, start time, and intercept time
  4953. pHwDevExt->StartTime = pHwDevExt->VideoStartTime;
  4954. pHwDevExt->InterceptTime = pHwDevExt->VideoInterceptTime;
  4955. if( pHwDevExt->Rate == 10000 ){ // Normal���[�h��
  4956. if( PrevRate < 10000 ) // Scan
  4957. {
  4958. // Flush Scheduler SRB queue.
  4959. #ifndef REARRANGEMENT
  4960. FlushQueue(pHwDevExt);
  4961. #else
  4962. while( (pTmp=pHwDevExt->scheduler.getSRB())!=NULL ){
  4963. // pTmp->Status = STATUS_CANCELLED;
  4964. pTmp->Status = STATUS_SUCCESS;
  4965. CallAtStreamCompleteNotify( pTmp, pTmp->Status );
  4966. }
  4967. #endif REARRANGEMENT
  4968. if( pHwDevExt->dvdstrm.GetState() != Stop )
  4969. pHwDevExt->dvdstrm.Stop();
  4970. pHwDevExt->ticktime.SetStreamTime( pHwDevExt->StartTime );
  4971. }
  4972. if( PrevRate > 10000 ) // Slow
  4973. {
  4974. // Normal Play
  4975. if( pHwDevExt->dvdstrm.GetState() == Slow )
  4976. {
  4977. if( !pHwDevExt->dvdstrm.Play() ){
  4978. DBG_PRINTF( ("DVDWDM: dvdstrm.Play Error\n\r") );
  4979. DBG_BREAK();
  4980. }
  4981. };
  4982. }
  4983. }else if( pHwDevExt->Rate < 10000 ){ // Scan���[�h��
  4984. if( PrevRate == 10000 ) // Normal
  4985. {
  4986. // Flush Scheduler SRB queue.
  4987. #ifndef REARRANGEMENT
  4988. FlushQueue(pHwDevExt);
  4989. #else
  4990. while( (pTmp=pHwDevExt->scheduler.getSRB())!=NULL ){
  4991. // pTmp->Status = STATUS_CANCELLED;
  4992. pTmp->Status = STATUS_SUCCESS;
  4993. CallAtStreamCompleteNotify( pTmp, pTmp->Status );
  4994. }
  4995. #endif REARRANGEMENT
  4996. if( pHwDevExt->dvdstrm.GetState() != Stop )
  4997. pHwDevExt->dvdstrm.Stop();
  4998. }
  4999. if( PrevRate > 10000 ) // Slow
  5000. {
  5001. if( pHwDevExt->dvdstrm.GetState() != Stop )
  5002. {
  5003. #ifndef REARRANGEMENT
  5004. // FlushQueue(pHwDevExt);
  5005. #endif REARRANGEMENT
  5006. pHwDevExt->dvdstrm.Stop();
  5007. }
  5008. };
  5009. ////// if( PrevRate < 10000 && pHwDevExt->Rate != PrevRate ) // Scan
  5010. if( PrevRate < 10000 && pHwDevExt->NewCompleteRate != pHwDevExt->OldCompleteRate ) // 98.07.29 H.Yagi
  5011. {
  5012. #ifndef REARRANGEMENT
  5013. FlushQueue(pHwDevExt);
  5014. #else
  5015. while( (pTmp=pHwDevExt->scheduler.getSRB())!=NULL ){
  5016. // pTmp->Status = STATUS_CANCELLED;
  5017. pTmp->Status = STATUS_SUCCESS;
  5018. CallAtStreamCompleteNotify( pTmp, pTmp->Status );
  5019. }
  5020. #endif REARRANGEMENT
  5021. if( pHwDevExt->dvdstrm.GetState() != Stop )
  5022. pHwDevExt->dvdstrm.Stop();
  5023. };
  5024. pHwDevExt->ticktime.SetStreamTime( pHwDevExt->StartTime );
  5025. }else{ // Slow���[�h��
  5026. if( PrevRate == 10000 ) // Normal
  5027. {
  5028. if( pHwDevExt->dvdstrm.GetState() == Play )
  5029. {
  5030. dProp = pHwDevExt->Rate/10000;
  5031. if( dProp>1 && dProp<16 ){
  5032. if( !pHwDevExt->dvdstrm.Slow( dProp ) ){
  5033. DBG_PRINTF( ("DVDWDM: dvdstrm.Slow Error\n\r") );
  5034. DBG_BREAK();
  5035. }
  5036. }else{
  5037. DBG_PRINTF( ("DVDWDM: Slow Speed is invalid 0x%0x\n\r", dProp ) );
  5038. DBG_BREAK();
  5039. }
  5040. };
  5041. }
  5042. if( PrevRate < 10000 ) // Scan
  5043. {
  5044. // Flush Scheduler SRB queue.
  5045. #ifndef REARRANGEMENT
  5046. FlushQueue(pHwDevExt);
  5047. #else
  5048. while( (pTmp=pHwDevExt->scheduler.getSRB())!=NULL ){
  5049. // pTmp->Status = STATUS_CANCELLED;
  5050. pTmp->Status = STATUS_SUCCESS;
  5051. CallAtStreamCompleteNotify( pTmp, pTmp->Status );
  5052. }
  5053. #endif REARRANGEMENT
  5054. if( pHwDevExt->dvdstrm.GetState() != Stop )
  5055. pHwDevExt->dvdstrm.Stop();
  5056. pHwDevExt->ticktime.SetStreamTime( pHwDevExt->StartTime );
  5057. };
  5058. if( PrevRate > 10000 ) // Slow
  5059. {
  5060. if( pHwDevExt->dvdstrm.GetState() == Slow )
  5061. {
  5062. dProp = pHwDevExt->Rate/10000;
  5063. if( dProp>1 && dProp<16 ){
  5064. if( !pHwDevExt->dvdstrm.Slow( dProp ) ){
  5065. DBG_PRINTF( ("DVDWDM: dvdstrm.Slow Error\n\r") );
  5066. DBG_BREAK();
  5067. }
  5068. }else{
  5069. DBG_PRINTF( ("DVDWDM: Slow Speed is invalid 0x%0x\n\r", dProp ) );
  5070. DBG_BREAK();
  5071. }
  5072. };
  5073. }
  5074. }
  5075. pHwDevExt->ticktime.SetRate( pHwDevExt->Rate );
  5076. if( !pHwDevExt->dvdstrm.SetAudioProperty( AudioProperty_Number, &(pHwDevExt->m_AudioChannel) ) ){
  5077. DBG_PRINTF( ("DVDWDM: Set Audio channel Error\n\r") );
  5078. DBG_BREAK();
  5079. }
  5080. if( !pHwDevExt->dvdstrm.SetSubpicProperty( SubpicProperty_Number, &(pHwDevExt->m_SubpicChannel) ) ){
  5081. DBG_PRINTF( ("DVDWDM: Set Subpic channel Error\n\r") );
  5082. DBG_BREAK();
  5083. }
  5084. }
  5085. ULONGLONG ConvertPTStoStrm( ULONG pts )
  5086. {
  5087. // return value is 100ns units.
  5088. ULONGLONG strm;
  5089. strm = (ULONGLONG)pts;
  5090. strm &= 0x0ffffffff;
  5091. strm = (strm * 10000) / 90;
  5092. return( strm );
  5093. }
  5094. ULONG ConvertStrmtoPTS( ULONGLONG strm )
  5095. {
  5096. ULONGLONG temp;
  5097. ULONG pts;
  5098. //
  5099. // we may lose some bits here, but we're only using the 32bit PTS anyway
  5100. //
  5101. temp = (strm * 9 + 500 ) / 1000;
  5102. temp &= 0x0ffffffff;
  5103. pts = (ULONG)temp;
  5104. return( pts );
  5105. }
  5106. BOOL ToshibaNotePC( PHW_STREAM_REQUEST_BLOCK pSrb)
  5107. {
  5108. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  5109. BOOL ret;
  5110. ret = FALSE;
  5111. DWORD dwVideoOut, tmpTest;
  5112. LONG dwVideoNum, i;
  5113. tmpTest = 0x00000001;
  5114. dwVideoOut = 0;
  5115. dwVideoNum = 0;
  5116. if( !pHwDevExt->dvdstrm.GetCapability( DigitalVideoOut, &dwVideoOut ) ){
  5117. DBG_PRINTF( ("DVDWDM: GetCapability Error\n\r" ) );
  5118. DBG_BREAK();
  5119. }
  5120. pHwDevExt->m_DVideoOut = dwVideoOut;
  5121. DBG_PRINTF( ("DVDWDM: Support DigitalVideoOut = 0x%08x\n\r", dwVideoOut ) );
  5122. for( i=0; i<32; i++ ){
  5123. if( (dwVideoOut & tmpTest) != 0x0 ){
  5124. dwVideoNum++;
  5125. }
  5126. tmpTest = tmpTest<<1;
  5127. }
  5128. pHwDevExt->m_DVideoNum = dwVideoNum;
  5129. DBG_PRINTF( ("DVDWDM: Support DigitalVideoOut Num = %d\n\r", dwVideoNum ) );
  5130. if( pHwDevExt->m_DVideoNum == 1 ){ // if This is Notebook-PC, this value = 1.
  5131. ret = TRUE;
  5132. }else{
  5133. ret = FALSE;
  5134. }
  5135. return( ret );
  5136. }
  5137. void USCC_Discontinuity( PHW_DEVICE_EXTENSION pHwDevExt )
  5138. {
  5139. PHW_STREAM_REQUEST_BLOCK pSrb;
  5140. PKSSTREAM_HEADER pPacket;
  5141. DBG_PRINTF( ("DVDWDM:USCC_Discontinuity()\n\r") );
  5142. if( pHwDevExt->pstroCC ){
  5143. pSrb = pHwDevExt->ccque.get();
  5144. if( pSrb ){
  5145. //
  5146. // we have a request, send a discontinuity
  5147. //
  5148. pSrb->Status = STATUS_SUCCESS;
  5149. pPacket = pSrb->CommandData.DataBufferArray;
  5150. pPacket->OptionsFlags = KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY |
  5151. KSSTREAM_HEADER_OPTIONSF_TIMEVALID |
  5152. KSSTREAM_HEADER_OPTIONSF_DURATIONVALID;
  5153. pPacket->DataUsed = 0;
  5154. pSrb->NumberOfBuffers = 0;
  5155. pPacket->PresentationTime.Time = pHwDevExt->ticktime.GetStreamTime();
  5156. pPacket->Duration = 1000;
  5157. // StreamClassStreamNotification( StreamRequestComplete,
  5158. // pSrb->StreamObject,
  5159. // pSrb );
  5160. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  5161. }
  5162. }
  5163. }
  5164. void SetVideoRateDefault( PHW_DEVICE_EXTENSION pHwDevExt )
  5165. {
  5166. pHwDevExt->VideoStartTime = 0;
  5167. pHwDevExt->VideoInterceptTime = 0;
  5168. pHwDevExt->Rate = VIDEO_MAX_FULL_RATE;
  5169. pHwDevExt->StartTime = 0;
  5170. pHwDevExt->InterceptTime = 0;
  5171. }
  5172. void SetAudioRateDefault( PHW_DEVICE_EXTENSION pHwDevExt )
  5173. {
  5174. pHwDevExt->AudioStartTime = 0;
  5175. pHwDevExt->AudioInterceptTime = 0;
  5176. }
  5177. void SetSubpicRateDefault( PHW_DEVICE_EXTENSION pHwDevExt )
  5178. {
  5179. pHwDevExt->SubpicStartTime = 0;
  5180. pHwDevExt->SubpicInterceptTime = 0;
  5181. }
  5182. //--- 98.06.01 S.Watanabe
  5183. #ifdef DBG
  5184. char * DebugLLConvtoStr( ULONGLONG val, int base )
  5185. {
  5186. static char str[5][100];
  5187. static int cstr = -1;
  5188. int count = 0;
  5189. int digit;
  5190. char tmp[100];
  5191. int i;
  5192. if( ++cstr >= 5 )
  5193. cstr = 0;
  5194. if( base == 10 ) {
  5195. for( ; ; ) {
  5196. digit = (int)( val % 10 );
  5197. tmp[count++] = (char)( digit + '0' );
  5198. val /= 10;
  5199. if( val == 0 )
  5200. break;
  5201. }
  5202. }
  5203. else if( base == 16 ) {
  5204. for( ; ; ) {
  5205. digit = (int)( val & 0xF );
  5206. if( digit < 10 )
  5207. tmp[count++] = (char)( digit + '0' );
  5208. else
  5209. tmp[count++] = (char)( digit - 10 + 'a' );
  5210. val >>= 4;
  5211. if( val == 0 )
  5212. break;
  5213. }
  5214. }
  5215. else
  5216. DBG_BREAK();
  5217. for( i = 0; i < count; i++ ) {
  5218. str[cstr][i] = tmp[count-i-1];
  5219. }
  5220. str[cstr][i] = '\0';
  5221. return str[cstr];
  5222. }
  5223. #endif
  5224. //--- End.
  5225. //--- 98.06.02 S.Watanabe
  5226. void TimerCppReset( PHW_STREAM_REQUEST_BLOCK pSrb )
  5227. {
  5228. // StreamClassCallAtNewPriority( NULL, pSrb->HwDeviceExtension, Low, (PHW_PRIORITY_ROUTINE)LowTimerCppReset, pSrb );
  5229. StreamClassCallAtNewPriority( pSrb->StreamObject, pSrb->HwDeviceExtension, Low, (PHW_PRIORITY_ROUTINE)LowTimerCppReset, pSrb );
  5230. }
  5231. void LowTimerCppReset( PHW_STREAM_REQUEST_BLOCK pSrb )
  5232. {
  5233. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  5234. // BOOLEAN bStatus;
  5235. // BOOL bQueStatus = FALSE;
  5236. // Temporary
  5237. if( pHwDevExt->pSrbCpp == NULL ) {
  5238. DBG_PRINTF(( "DVDWDM: pSrbCpp is NULL!\r\n" ));
  5239. return;
  5240. }
  5241. DBG_PRINTF( ("DVDWDM:TimerCppReset\r\n") );
  5242. // cpp initialize
  5243. if( pHwDevExt->bCppReset ) {
  5244. if( pHwDevExt->dvdstrm.GetState() != Stop ){
  5245. #ifndef REARRANGEMENT
  5246. // FlushQueue(pHwDevExt);
  5247. #endif REARRANGEMENT
  5248. pHwDevExt->dvdstrm.Stop();
  5249. }
  5250. if( !pHwDevExt->dvdstrm.CppInit() ){
  5251. DBG_PRINTF( ("DVDWDM: dvdstrm.CppInit Error\n\r") );
  5252. DBG_BREAK();
  5253. }
  5254. }
  5255. else { // TitleKey
  5256. if( pHwDevExt->dvdstrm.GetState() != Stop )
  5257. {
  5258. #ifndef REARRANGEMENT
  5259. // FlushQueue(pHwDevExt);
  5260. #endif REARRANGEMENT
  5261. if( !pHwDevExt->dvdstrm.Stop() ){
  5262. DBG_PRINTF( ("DVDWDM: dvdstrm.Stop Error\n\r") );
  5263. DBG_BREAK();
  5264. };
  5265. };
  5266. }
  5267. pHwDevExt->pSrbCpp = NULL;
  5268. pHwDevExt->bCppReset = FALSE;
  5269. pSrb->Status = STATUS_SUCCESS;
  5270. // StreamClassStreamNotification( ReadyForNextStreamControlRequest,
  5271. // pSrb->StreamObject );
  5272. //
  5273. // StreamClassStreamNotification( StreamRequestComplete,
  5274. // pSrb->StreamObject,
  5275. // pSrb );
  5276. DBG_PRINTF( ("DVDWDM: Success return\r\n") );
  5277. CallAtStreamCompleteNotify( pSrb, pSrb->Status );
  5278. return;
  5279. }
  5280. BOOL SetCppFlag( PHW_DEVICE_EXTENSION pHwDevExt, BOOL NeedNotify )
  5281. {
  5282. DBG_PRINTF(( "DVDWDM:SetCppFlag()\r\n" ));
  5283. BOOL ret;
  5284. // ASSERT( pHwDevExt->pSrbCpp!=NULL );
  5285. if(pHwDevExt->pSrbCpp==NULL ){
  5286. return( FALSE );
  5287. }
  5288. // BUGBUG �b���Ή�
  5289. // �Đ����Ȃ� 500ms �f�B���C��������
  5290. // �{���́A�f�R�[�_�ł̍Đ����I�������܂ő҂��Ȃ����΂Ȃ��Ȃ�
  5291. // if( pHwDevExt->StreamState == WrapState_Decode ) {
  5292. if( pHwDevExt->dvdstrm.GetState() != Stop ) {
  5293. StreamClassScheduleTimer(
  5294. NULL,
  5295. pHwDevExt,
  5296. 500*1000,
  5297. (PHW_TIMER_ROUTINE)TimerCppReset,
  5298. pHwDevExt->pSrbCpp
  5299. );
  5300. DBG_PRINTF(( "DVDWDM: ScheduleTimer 500ms\r\n" ));
  5301. ret = TRUE;
  5302. }
  5303. else {
  5304. // cpp initialize
  5305. if( pHwDevExt->bCppReset ) {
  5306. if( !pHwDevExt->dvdstrm.CppInit() ){
  5307. DBG_PRINTF( ("DVDWDM: dvdstrm.CppInit Error\n\r") );
  5308. DBG_BREAK();
  5309. }
  5310. }
  5311. if( pHwDevExt->pSrbCpp!=NULL){
  5312. if( NeedNotify==TRUE ){
  5313. pHwDevExt->pSrbCpp->Status = STATUS_SUCCESS;
  5314. CallAtStreamCompleteNotify( pHwDevExt->pSrbCpp,STATUS_SUCCESS );
  5315. }
  5316. pHwDevExt->pSrbCpp = NULL;
  5317. pHwDevExt->bCppReset = FALSE;
  5318. }
  5319. DBG_PRINTF(( "DVDWDM: ScheduleTimer 000\r\n" ));
  5320. ret = FALSE;
  5321. }
  5322. return( ret );
  5323. }
  5324. //--- End.
  5325. void OpenTVControl( PHW_STREAM_REQUEST_BLOCK pSrb, OsdDataStruc dOsd )
  5326. {
  5327. //K.O MacroVision
  5328. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  5329. // Clear the m_APSChange
  5330. pHwDevExt->m_APSChange = FALSE;
  5331. pHwDevExt->m_APSType = ApsType_Off;
  5332. return;
  5333. //
  5334. /********* commented out all of this routine, because TVControl is handled
  5335. // by display driver. 99.04.01 by H.Yagi
  5336. DWORD swOSD, swHKey;
  5337. DisplayStatusStruc dispStat;
  5338. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  5339. BOOL statTV = FALSE;
  5340. swHKey = DISABLE_TV;
  5341. dispStat.AvailableDisplay = 0x0;
  5342. dispStat.CurrentDisplay = 0x0;
  5343. // Clear the m_APSChange
  5344. pHwDevExt->m_APSChange = FALSE;
  5345. pHwDevExt->m_APSType = ApsType_Off;
  5346. // turn off OSD
  5347. swOSD = Video_OSD_Off;
  5348. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OSDSwitch, &swOSD );
  5349. // Check TV-Control is available or not.
  5350. if( pHwDevExt->m_bTVct==FALSE ){
  5351. return;
  5352. }
  5353. // Get current display status.
  5354. statTV = pHwDevExt->tvctrl.GetDisplayStatus( &dispStat );
  5355. // Check current Display (TV_BIT)
  5356. if( (statTV==TRUE) &&
  5357. ((dispStat.CurrentDisplay & TVCONTROL_TV_BIT )!=0) ){
  5358. // display OSD data.
  5359. // pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OSDData, &dOsd );
  5360. // swOSD = Video_OSD_On;
  5361. // pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OSDSwitch, &swOSD );
  5362. ;
  5363. }
  5364. DBG_PRINTF( ("DVDWDM:m_VideoOutputSource=%08x\n\r", pHwDevExt->m_OutputSource ) );
  5365. *******/
  5366. }
  5367. void CloseTVControl( PHW_STREAM_REQUEST_BLOCK pSrb )
  5368. {
  5369. //K.O MacroVision
  5370. #ifndef TVALD
  5371. DWORD swHKey;
  5372. #endif TVALD
  5373. DWORD dProp;
  5374. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  5375. // Clear the m_APSChange
  5376. pHwDevExt->m_APSChange = FALSE;
  5377. pHwDevExt->m_APSType = ApsType_Off;
  5378. // restore OutputSource setting
  5379. dProp = pHwDevExt->m_OutputSource;
  5380. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5381. #ifndef TVALD
  5382. if( pHwDevExt->m_bTVct==TRUE ){
  5383. // Disable TV output mode
  5384. swHKey = ENABLE_TV;
  5385. pHwDevExt->tvctrl.SetTVOutput( swHKey );
  5386. }
  5387. #endif TVALD
  5388. return;
  5389. /********* commented out all of this routine, because TVControl is handled
  5390. // by display driver. 99.04.01 by H.Yagi
  5391. DWORD swOSD, swHKey, dProp;
  5392. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  5393. // Clear the m_APSChange
  5394. pHwDevExt->m_APSChange = FALSE;
  5395. pHwDevExt->m_APSType = ApsType_Off;
  5396. // restore OutputSource setting
  5397. dProp = pHwDevExt->m_OutputSource;
  5398. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5399. // turn off OSD
  5400. swOSD = Video_OSD_Off;
  5401. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OSDSwitch, &swOSD );
  5402. // Check TV Control is available or not.
  5403. if( pHwDevExt->m_bTVct==TRUE ){
  5404. // Disable TV output mode
  5405. swHKey = ENABLE_TV;
  5406. pHwDevExt->tvctrl.SetTVOutput( swHKey );
  5407. // restore OutputSource setting to default.
  5408. dProp = pHwDevExt->m_OutputSource;
  5409. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5410. }
  5411. *******/
  5412. }
  5413. BOOL VGADVDTVControl( PHW_STREAM_REQUEST_BLOCK pSrb, DWORD stat, OsdDataStruc dOsd )
  5414. {
  5415. // Stat : OutputSource_VGA / OutPutSource_DVD
  5416. //K.O MacroVision
  5417. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  5418. if(( pHwDevExt->m_PCID==PC_TECRA750 || pHwDevExt->m_PCID==PC_TECRA780 )
  5419. ||( pHwDevExt->m_PCID==PC_PORTEGE7000 || pHwDevExt->m_PCID==PC_TECRA8000 ))
  5420. {
  5421. if( pHwDevExt->m_APSType==ApsType_Off )
  5422. return(TRUE);
  5423. else
  5424. return (FALSE);
  5425. }
  5426. return( TRUE );
  5427. /********* commented out all of this routine, because TVControl is handled
  5428. // by display driver. 99.04.01 by H.Yagi
  5429. DWORD swOSD;
  5430. DisplayStatusStruc dispStat;
  5431. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  5432. DWORD dProp = OutputSource_DVD;
  5433. dispStat.AvailableDisplay = 0x0;
  5434. dispStat.CurrentDisplay = 0x0;
  5435. if( pHwDevExt->m_PCID==PC_TECRA8000 || // Sofia or SkyE
  5436. pHwDevExt->m_PCID==PC_PORTEGE7000 ) {
  5437. return( FALSE );
  5438. }
  5439. // Check TV-Control is available or not. // SC2 or SJ
  5440. if( pHwDevExt->m_bTVct==FALSE ){
  5441. // turn off OSD data.
  5442. swOSD = Video_OSD_Off;
  5443. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OSDSwitch, &swOSD );
  5444. if( stat==OutputSource_VGA ){
  5445. if( pHwDevExt->m_APSType!=ApsType_Off ){
  5446. // Chnage OutputSource_DVD
  5447. dProp = OutputSource_DVD;
  5448. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5449. }else{
  5450. // Chnage OutputSource_VGA
  5451. dProp = OutputSource_VGA;
  5452. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5453. }
  5454. }else{
  5455. // Chnage OutputSource_DVD
  5456. dProp = OutputSource_DVD;
  5457. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5458. }
  5459. return( FALSE );
  5460. }
  5461. // Other PC
  5462. // turn off OSD data.
  5463. swOSD = Video_OSD_Off;
  5464. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OSDSwitch, &swOSD );
  5465. if( stat==OutputSource_VGA ){
  5466. if( pHwDevExt->m_APSType!=ApsType_Off ){
  5467. // Chnage OutputSource_DVD
  5468. dProp = OutputSource_DVD;
  5469. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5470. }else{
  5471. // Chnage OutputSource_VGA
  5472. dProp = OutputSource_VGA;
  5473. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5474. }
  5475. }else{
  5476. // Chnage OutputSource_DVD
  5477. dProp = OutputSource_DVD;
  5478. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5479. }
  5480. return( FALSE );
  5481. *********/
  5482. }
  5483. BOOL MacroVisionTVControl( PHW_STREAM_REQUEST_BLOCK pSrb, DWORD stat, OsdDataStruc dOsd )
  5484. {
  5485. //K.O MacroVision
  5486. // Stat : ApsType_Off / ApsType_1 / ApsType_2 / ApsType_3
  5487. //********* commented out all of this routine, because TVControl is handled
  5488. // by display driver. 99.04.01 by H.Yagi
  5489. DBG_PRINTF( ("DVDWDM:MacroVision TV Control\n\r") );
  5490. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  5491. DWORD dProp = OutputSource_DVD;
  5492. #ifndef TVALD
  5493. DWORD swHKey;
  5494. // SkyE & Sofia
  5495. if( pHwDevExt->m_PCID==PC_PORTEGE7000 || pHwDevExt->m_PCID==PC_TECRA8000 )
  5496. {
  5497. if( stat!=ApsType_Off )
  5498. { // MacroVision On
  5499. // Disable TV output mode
  5500. swHKey = DISABLE_TV;
  5501. pHwDevExt->tvctrl.SetTVOutput( swHKey );
  5502. }
  5503. else
  5504. { // MacroVision Off
  5505. swHKey = ENABLE_TV;
  5506. pHwDevExt->tvctrl.SetTVOutput( swHKey );
  5507. }
  5508. return( TRUE );
  5509. }
  5510. #endif TVALD
  5511. // Check TV-Control is available or not.
  5512. // if( pHwDevExt->m_PCID==PC_TECRA750 || pHwDevExt->m_PCID==PC_TECRA780 )
  5513. if(( pHwDevExt->m_PCID==PC_TECRA750 || pHwDevExt->m_PCID==PC_TECRA780 )
  5514. ||( pHwDevExt->m_PCID==PC_PORTEGE7000 || pHwDevExt->m_PCID==PC_TECRA8000 ))
  5515. {
  5516. if( stat!=ApsType_Off)
  5517. {
  5518. // Chnage OutputSource_DVD
  5519. dProp = OutputSource_DVD;
  5520. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5521. }
  5522. else
  5523. {
  5524. if( pHwDevExt->m_OutputSource==OutputSource_VGA )
  5525. {
  5526. // Chnage OutputSource_VGA
  5527. dProp = OutputSource_VGA;
  5528. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5529. }
  5530. else
  5531. {
  5532. // Chnage OutputSource_DVD
  5533. dProp = OutputSource_DVD;
  5534. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5535. }
  5536. }
  5537. return( TRUE );
  5538. }
  5539. // Other PC
  5540. // turn off OSD data.
  5541. if( stat!=ApsType_Off)
  5542. {
  5543. // Chnage OutputSource_DVD
  5544. dProp = OutputSource_DVD;
  5545. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5546. }
  5547. else
  5548. {
  5549. if( pHwDevExt->m_OutputSource==OutputSource_VGA )
  5550. {
  5551. // Chnage OutputSource_VGA
  5552. dProp = OutputSource_VGA;
  5553. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5554. }
  5555. else
  5556. {
  5557. // Chnage OutputSource_DVD
  5558. dProp = OutputSource_DVD;
  5559. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5560. }
  5561. }
  5562. return( TRUE );
  5563. /********* commented out all of this routine, because TVControl is handled
  5564. // by display driver. 99.04.01 by H.Yagi
  5565. DBG_PRINTF( ("DVDWDM:MacroVision TV Control\n\r") );
  5566. BOOL statTV = FALSE;
  5567. DWORD swOSD, swHKey;
  5568. DisplayStatusStruc dispStat;
  5569. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  5570. DWORD dProp = OutputSource_DVD;
  5571. dispStat.AvailableDisplay = 0x0;
  5572. dispStat.CurrentDisplay = 0x0;
  5573. // Check TV-Control is available or not.
  5574. if( pHwDevExt->m_bTVct==FALSE ){ // SC2 or SJ
  5575. // turn off OSD data.
  5576. swOSD = Video_OSD_Off;
  5577. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OSDSwitch, &swOSD );
  5578. if( stat!=ApsType_Off){
  5579. if( pHwDevExt->m_OutputSource==OutputSource_VGA ){
  5580. // Chnage OutputSource_DVD
  5581. dProp = OutputSource_DVD;
  5582. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5583. }else{
  5584. // Chnage OutputSource_VGA
  5585. dProp = OutputSource_DVD;
  5586. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5587. }
  5588. }else{
  5589. if( pHwDevExt->m_OutputSource==OutputSource_VGA ){
  5590. // Chnage OutputSource_VGA
  5591. dProp = OutputSource_VGA;
  5592. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5593. }else{
  5594. // Chnage OutputSource_DVD
  5595. dProp = OutputSource_DVD;
  5596. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5597. }
  5598. }
  5599. return( TRUE );
  5600. }
  5601. // Get current display status.
  5602. statTV = pHwDevExt->tvctrl.GetDisplayStatus( &dispStat );
  5603. if( statTV==FALSE ){
  5604. DBG_PRINTF( ("DVDWDM:TV Control is not available\n\r") );
  5605. DBG_BREAK();
  5606. }else{
  5607. DBG_PRINTF( ("DVDWDM:GetDisplayStatus = %08x\n\r", dispStat.CurrentDisplay) );
  5608. pHwDevExt->m_CurrentDisplay = dispStat.CurrentDisplay;
  5609. }
  5610. // SkyE & Sofia
  5611. if( pHwDevExt->m_PCID==PC_PORTEGE7000 ||
  5612. pHwDevExt->m_PCID==PC_TECRA8000 ){
  5613. if( stat!=ApsType_Off ){ // MacroVision On
  5614. if( (dispStat.CurrentDisplay & TVCONTROL_TV_BIT)!=0 ){
  5615. // set LCD only mode
  5616. dispStat.SizeofStruc = sizeof( dispStat );
  5617. dispStat.CurrentDisplay = TVCONTROL_LCD_BIT;
  5618. statTV = pHwDevExt->tvctrl.SetDisplayStatus( &dispStat );
  5619. if( statTV==FALSE ){
  5620. DBG_PRINTF( ("DVDWDM:TVControl error\n\r") );
  5621. DBG_BREAK();
  5622. }
  5623. // Change OutputSource_DVD
  5624. dProp = OutputSource_DVD;
  5625. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5626. }else{
  5627. // Chnage OutputSource_DVD
  5628. dProp = OutputSource_DVD;
  5629. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5630. }
  5631. // Disable TV output mode
  5632. swHKey = DISABLE_TV;
  5633. pHwDevExt->tvctrl.SetTVOutput( swHKey );
  5634. }else{ // MacroVision Off
  5635. if( dispStat.AvailableDisplay == TVCONTROL_TV_BIT ){
  5636. // set LCD only mode
  5637. dispStat.SizeofStruc = sizeof( dispStat );
  5638. dispStat.CurrentDisplay = TVCONTROL_LCD_BIT;
  5639. statTV = pHwDevExt->tvctrl.SetDisplayStatus( &dispStat );
  5640. if( statTV==FALSE ){
  5641. DBG_PRINTF( ("DVDWDM:TVControl error\n\r") );
  5642. DBG_BREAK();
  5643. }
  5644. // Chnage OutputSource_DVD
  5645. dProp = OutputSource_DVD;
  5646. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5647. }else{
  5648. // Chnage OutputSource_DVD
  5649. dProp = OutputSource_DVD;
  5650. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5651. }
  5652. // Enable TV output mode
  5653. swHKey = ENABLE_TV;
  5654. pHwDevExt->tvctrl.SetTVOutput( swHKey );
  5655. }
  5656. return( TRUE );
  5657. }
  5658. // Other PC
  5659. // turn off OSD data.
  5660. swOSD = Video_OSD_Off;
  5661. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OSDSwitch, &swOSD );
  5662. if( stat!=ApsType_Off){
  5663. if( pHwDevExt->m_OutputSource==OutputSource_VGA ){
  5664. // Chnage OutputSource_DVD
  5665. dProp = OutputSource_DVD;
  5666. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5667. }else{
  5668. // Chnage OutputSource_VGA
  5669. dProp = OutputSource_DVD;
  5670. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5671. }
  5672. }else{
  5673. if( pHwDevExt->m_OutputSource==OutputSource_VGA ){
  5674. // Chnage OutputSource_VGA
  5675. dProp = OutputSource_VGA;
  5676. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5677. }else{
  5678. // Chnage OutputSource_DVD
  5679. dProp = OutputSource_DVD;
  5680. pHwDevExt->dvdstrm.SetVideoProperty( VideoProperty_OutputSource, &dProp );
  5681. }
  5682. }
  5683. return( TRUE );
  5684. *******/
  5685. }
  5686. void CallAtDeviceNextDeviceNotify( PHW_STREAM_REQUEST_BLOCK pSrb, NTSTATUS stat )
  5687. {
  5688. ASSERT( KeGetCurrentIrql() == PASSIVE_LEVEL );
  5689. pSrb->Status = stat;
  5690. StreamClassCallAtNewPriority( NULL,
  5691. pSrb->HwDeviceExtension,
  5692. LowToHigh,
  5693. (PHW_PRIORITY_ROUTINE)DeviceNextDeviceNotify,
  5694. pSrb
  5695. );
  5696. }
  5697. void DeviceNextDeviceNotify( PHW_STREAM_REQUEST_BLOCK pSrb )
  5698. {
  5699. ASSERT( KeGetCurrentIrql() != PASSIVE_LEVEL );
  5700. StreamClassDeviceNotification( ReadyForNextDeviceRequest,
  5701. pSrb->HwDeviceExtension );
  5702. }
  5703. void CallAtDeviceCompleteNotify( PHW_STREAM_REQUEST_BLOCK pSrb, NTSTATUS stat )
  5704. {
  5705. ASSERT( KeGetCurrentIrql() == PASSIVE_LEVEL );
  5706. pSrb->Status = stat;
  5707. StreamClassCallAtNewPriority( NULL,
  5708. pSrb->HwDeviceExtension,
  5709. LowToHigh,
  5710. (PHW_PRIORITY_ROUTINE)DeviceCompleteNotify,
  5711. pSrb
  5712. );
  5713. }
  5714. void DeviceCompleteNotify( PHW_STREAM_REQUEST_BLOCK pSrb )
  5715. {
  5716. ASSERT( KeGetCurrentIrql() != PASSIVE_LEVEL );
  5717. StreamClassDeviceNotification( DeviceRequestComplete,
  5718. pSrb->HwDeviceExtension, pSrb );
  5719. }
  5720. void CallAtStreamNextDataNotify( PHW_STREAM_REQUEST_BLOCK pSrb, NTSTATUS stat )
  5721. {
  5722. ASSERT( KeGetCurrentIrql() == PASSIVE_LEVEL );
  5723. pSrb->Status = stat;
  5724. // StreamClassCallAtNewPriority( NULL, pSrb->HwDeviceExtension, LowToHigh, (PHW_PRIORITY_ROUTINE)StreamNextDataNotify, pSrb );
  5725. StreamClassCallAtNewPriority( pSrb->StreamObject, pSrb->HwDeviceExtension, LowToHigh, (PHW_PRIORITY_ROUTINE)StreamNextDataNotify, pSrb );
  5726. }
  5727. void StreamNextDataNotify( PHW_STREAM_REQUEST_BLOCK pSrb )
  5728. {
  5729. // ASSERT( KeGetCurrentIrql() != PASSIVE_LEVEL );
  5730. StreamClassStreamNotification( ReadyForNextStreamDataRequest,
  5731. pSrb->StreamObject );
  5732. }
  5733. void CallAtStreamNextCtrlNotify( PHW_STREAM_REQUEST_BLOCK pSrb, NTSTATUS stat )
  5734. {
  5735. ASSERT( KeGetCurrentIrql() == PASSIVE_LEVEL );
  5736. pSrb->Status = stat;
  5737. // StreamClassCallAtNewPriority( NULL, pSrb->HwDeviceExtension, LowToHigh, (PHW_PRIORITY_ROUTINE)StreamNextCtrlNotify, pSrb );
  5738. StreamClassCallAtNewPriority( pSrb->StreamObject, pSrb->HwDeviceExtension, LowToHigh, (PHW_PRIORITY_ROUTINE)StreamNextCtrlNotify, pSrb );
  5739. }
  5740. void StreamNextCtrlNotify( PHW_STREAM_REQUEST_BLOCK pSrb )
  5741. {
  5742. // ASSERT( KeGetCurrentIrql() != PASSIVE_LEVEL );
  5743. StreamClassStreamNotification( ReadyForNextStreamControlRequest,
  5744. pSrb->StreamObject );
  5745. }
  5746. void CallAtStreamCompleteNotify( PHW_STREAM_REQUEST_BLOCK pSrb, NTSTATUS stat )
  5747. {
  5748. ASSERT( KeGetCurrentIrql() == PASSIVE_LEVEL );
  5749. pSrb->Status = stat;
  5750. // StreamClassCallAtNewPriority( NULL, pSrb->HwDeviceExtension, LowToHigh, (PHW_PRIORITY_ROUTINE)StreamCompleteNotify, pSrb );
  5751. StreamClassCallAtNewPriority( pSrb->StreamObject, pSrb->HwDeviceExtension, LowToHigh, (PHW_PRIORITY_ROUTINE)StreamCompleteNotify, pSrb );
  5752. }
  5753. void StreamCompleteNotify( PHW_STREAM_REQUEST_BLOCK pSrb )
  5754. {
  5755. ASSERT( KeGetCurrentIrql() != PASSIVE_LEVEL );
  5756. StreamClassStreamNotification( StreamRequestComplete,
  5757. pSrb->StreamObject, pSrb );
  5758. }
  5759. //void CallAtStreamSignalMultipleNotify( PHW_DEVICE_EXTENSION pHwDevExt )
  5760. void CallAtStreamSignalMultipleNotify( PHW_STREAM_REQUEST_BLOCK pSrb )
  5761. {
  5762. ASSERT( KeGetCurrentIrql() == PASSIVE_LEVEL );
  5763. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)(pSrb->HwDeviceExtension);
  5764. // StreamClassCallAtNewPriority( NULL, pHwDevExt, LowToHigh, (PHW_PRIORITY_ROUTINE)StreamSignalMultipleNotify, pHwDevExt );
  5765. StreamClassCallAtNewPriority( pSrb->StreamObject, pHwDevExt, LowToHigh, (PHW_PRIORITY_ROUTINE)StreamSignalMultipleNotify, pHwDevExt );
  5766. }
  5767. void StreamSignalMultipleNotify( PHW_DEVICE_EXTENSION pHwDevExt )
  5768. {
  5769. ASSERT( KeGetCurrentIrql() != PASSIVE_LEVEL );
  5770. StreamClassStreamNotification( SignalMultipleStreamEvents,
  5771. pHwDevExt->pstroYUV,
  5772. &MY_KSEVENTSETID_VPNOTIFY,
  5773. KSEVENT_VPNOTIFY_FORMATCHANGE );
  5774. }
  5775. void DumpPTSValue( PHW_STREAM_REQUEST_BLOCK pSrb )
  5776. {
  5777. PHW_DEVICE_EXTENSION pHwDevExt;
  5778. PKSSTREAM_HEADER pStruc;
  5779. PUCHAR pDat;
  5780. ULONG i, j, k;
  5781. // DWORD pts;
  5782. // DWORD csum = 0x0;
  5783. pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  5784. /**************
  5785. for( i=0; i<pSrb->NumberOfBuffers; i++ ){
  5786. pts = 0;
  5787. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  5788. if( pStruc->DataUsed){
  5789. pDat = (PUCHAR)pStruc->Data;
  5790. if( *(pDat+21) & 0x80 ){
  5791. pts +=((DWORD)(*(pDat+23) & 0x0E)) << 29;
  5792. pts +=((DWORD)(*(pDat+24) & 0xFF)) << 22;
  5793. pts +=((DWORD)(*(pDat+25) & 0xFE)) << 14;
  5794. pts +=((DWORD)(*(pDat+26) & 0xFF)) << 7;
  5795. pts +=((DWORD)(*(pDat+27) & 0xFE)) >> 1;
  5796. DBG_PRINTF( ("DVDWDM: **** PTS of Data = %08x\n\r", pts ) );
  5797. DBG_PRINTF( ("DVDWDM: **** curr - prev = %08x\n\r", (pts-pHwDevExt->m_PTS) ) );
  5798. pHwDevExt->m_PTS = pts;
  5799. }
  5800. }
  5801. }
  5802. **************/
  5803. /************************
  5804. for( i=0; i<pSrb->NumberOfBuffers; i++ ){
  5805. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  5806. if( pStruc->DataUsed){
  5807. pDat = (PUCHAR)pStruc->Data;
  5808. DBG_PRINTF( ("DVDWDM:********* Dump Data ********\n\r") );
  5809. for( j=0; j<128; j++ ){
  5810. DBG_PRINTF( (": ") );
  5811. for( k=0; k<16; k++ ){
  5812. // DBG_PRINTF( (" %02x", *(pDat+(16*j+k)) ));
  5813. csum += (DWORD)(*(pDat+(16*j+k)));
  5814. }
  5815. // DBG_PRINTF( ("\n\r") );
  5816. DBG_PRINTF( ("%04x, ", csum ) );
  5817. csum = 0x0;
  5818. }
  5819. DBG_PRINTF( ("\n\r") );
  5820. }
  5821. }
  5822. ************************/
  5823. k = 0;
  5824. for( i=0; i<pSrb->NumberOfBuffers; i++ ){
  5825. pStruc = &((PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray))[i];
  5826. if( pStruc->DataUsed){
  5827. pDat = (PUCHAR)pStruc->Data;
  5828. DBG_PRINTF( ("DVDWDM:***** Dump Data (16-47) *****\n\r") );
  5829. DBG_PRINTF( (":") );
  5830. for( j=16; j<48; j++ ){
  5831. DBG_PRINTF( (" %02x", *(pDat+j) ));
  5832. }
  5833. DBG_PRINTF( ("\n\r") );
  5834. }
  5835. }
  5836. }
  5837. #ifndef REARRANGEMENT
  5838. void FlushQueue( PHW_DEVICE_EXTENSION pHwDevExt)
  5839. {
  5840. PHW_STREAM_REQUEST_BLOCK pTmp;
  5841. int wSrbptr;
  5842. pTmp = NULL;
  5843. DBG_PRINTF( ("DVDWDM:FlushQueue\n\r") );
  5844. if(pHwDevExt->scheduler.checkTopSRB())
  5845. {
  5846. while((pTmp = pHwDevExt->scheduler.getSRB())!=NULL )
  5847. {
  5848. pTmp->Status = STATUS_SUCCESS;
  5849. CallAtStreamCompleteNotify( pTmp, pTmp->Status );
  5850. DBG_PRINTF( ("DVDWDM:FlushQueue-CompleteSrb = %x\n\r", pTmp) );
  5851. }
  5852. }
  5853. for( wSrbptr = 0; wSrbptr < SRB_POINTER_MAX; wSrbptr++)
  5854. {
  5855. if (pHwDevExt->scheduler.m_SrbPointerTable[wSrbptr] != NULL)
  5856. {
  5857. pTmp = (PHW_STREAM_REQUEST_BLOCK)pHwDevExt->scheduler.m_SrbPointerTable[wSrbptr]; //get SRB pointer
  5858. pTmp->Status = STATUS_SUCCESS;
  5859. CallAtStreamCompleteNotify( pTmp, pTmp->Status );
  5860. DBG_PRINTF( ("DVDWDM:FlushQueue-CompleteSrb = %x\n\r", pTmp) );
  5861. pHwDevExt->scheduler.m_SrbPointerTable[wSrbptr] = NULL;
  5862. }
  5863. }
  5864. memset(pHwDevExt->scheduler.m_SrbPointerTable, NULL, SRB_POINTER_MAX * 4);
  5865. pHwDevExt->scheduler.m_SendPacketNumber = 0;
  5866. // pHwDevExt->scheduler.InitRearrangement();
  5867. }
  5868. #endif REARRANGEMENT