For DOS Protected Mode version of sensor core software
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.

603 lines
15 KiB

3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 07/12/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: DirectShowStreamVideo.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of DirectShowStreamVideo.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "..\Version.h"
  16. #include "DirectShowStreamVideo.h"
  17. #include "DirectShowSampleGrabberCB.h"
  18. #include "DirectShowVideo.h"
  19. CDirectShowStreamVideo::CDirectShowStreamVideo()
  20. {
  21. m_pVideoWindow = NULL;
  22. m_pAMVideoProcAmp = NULL;
  23. m_pAMAnalogVideoDecoder = NULL;
  24. m_pAMCrossbar = NULL;
  25. m_pInputPin = NULL;
  26. m_pCaptureFilter = NULL;
  27. m_nInputPinCount = 0;
  28. m_nOutputPin = -1;
  29. m_nDirectShowVideoSwitch = 0;
  30. m_nDirectShowVideoSource = -1;
  31. m_nDirectShowVideoFrame = 0;
  32. m_nDirectShowVideoStandard = AnalogVideo_None;
  33. m_nVideoFPS = 3;
  34. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CDirectShowStreamVideo::CDirectShowStreamVideo" );
  35. }
  36. CDirectShowStreamVideo::~CDirectShowStreamVideo()
  37. {
  38. Destroy();
  39. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CDirectShowStreamVideo::~CDirectShowStreamVideo" );
  40. }
  41. BOOL CDirectShowStreamVideo::Create( IBaseFilter *pSourceFilter, IBaseFilter *pCaptureFilter )
  42. {
  43. Destroy();
  44. if( !pCaptureFilter || FAILED( pCaptureFilter->QueryInterface( IID_IBaseFilter, (void**)&m_pCaptureFilter ) ) )
  45. m_pCaptureFilter = NULL;
  46. // make copy of crossbar if exist
  47. if( FAILED( pSourceFilter->QueryInterface( IID_IAMCrossbar, (void**)&m_pAMCrossbar ) ) )
  48. m_pAMCrossbar = NULL;
  49. IBaseFilter *pMemberFilter = NULL;
  50. if( FAILED(pSourceFilter->QueryInterface( IID_IBaseFilter, (void**)&pMemberFilter ) ) )
  51. return FALSE;
  52. // search for video window
  53. m_pVideoWindow = (IVideoWindow*)FindInterface( pMemberFilter, IID_IVideoWindow );
  54. if( m_pVideoWindow )
  55. {
  56. // hide video window
  57. m_pVideoWindow->put_Visible( OAFALSE );
  58. m_pVideoWindow->put_AutoShow( OAFALSE );
  59. }
  60. // search for analog video amplifier
  61. m_pAMVideoProcAmp = (IAMVideoProcAmp*)FindInterface( pMemberFilter, IID_IAMVideoProcAmp );
  62. if( m_pAMVideoProcAmp && 0 )
  63. {
  64. // make gray-scale video
  65. SetVideoSaturation( 0 );
  66. // set contrast
  67. SetVideoContrast( 50 );
  68. // set brightness
  69. SetVideoBrightness( 50 );
  70. }
  71. // search for analog video decoder
  72. m_pAMAnalogVideoDecoder = (IAMAnalogVideoDecoder*)FindInterface( pMemberFilter, IID_IAMAnalogVideoDecoder );
  73. // search for sample grabber
  74. ISampleGrabber *pSampleGrabber = (ISampleGrabber*)FindInterface( pMemberFilter, IID_ISampleGrabber );
  75. if( !pSampleGrabber )
  76. {
  77. pMemberFilter->Release();
  78. return FALSE;
  79. }
  80. if( !CDirectShowStream::Create( pSampleGrabber ) )
  81. {
  82. pSampleGrabber->Release();
  83. pMemberFilter->Release();
  84. return FALSE;
  85. }
  86. pSampleGrabber->Release();
  87. pMemberFilter->Release();
  88. // prepare swiching
  89. if( m_pAMCrossbar )
  90. {
  91. if( !InitSwitcher() )
  92. return FALSE;
  93. }
  94. else
  95. {
  96. m_nInputPinCount = 1;
  97. m_pInputPin = new LONG[m_nInputPinCount];
  98. if( !m_pInputPin )
  99. {
  100. m_nInputPinCount = 0;
  101. return FALSE;
  102. }
  103. m_pInputPin[0] = 0;
  104. m_nOutputPin = 0;
  105. }
  106. #ifdef __INCLUDE__VIDEO__MEDIA__SERVER__
  107. m_MediaServer.Create( m_pBitmapInfoHeader );
  108. #endif // __INCLUDE__VIDEO__MEDIA__SERVER__
  109. return TRUE;
  110. }
  111. void CDirectShowStreamVideo::Destroy()
  112. {
  113. CDirectShowStream::Destroy();
  114. #ifdef __INCLUDE__VIDEO__MEDIA__SERVER__
  115. m_MediaServer.Destroy();
  116. #endif // __INCLUDE__VIDEO__MEDIA__SERVER__
  117. if( m_pAMCrossbar )
  118. {
  119. m_pAMCrossbar->Release();
  120. m_pAMCrossbar = NULL;
  121. }
  122. if( m_pVideoWindow )
  123. {
  124. m_pVideoWindow->Release();
  125. m_pVideoWindow = NULL;
  126. }
  127. if( m_pAMVideoProcAmp )
  128. {
  129. m_pAMVideoProcAmp->Release();
  130. m_pAMVideoProcAmp = NULL;
  131. }
  132. if( m_pAMAnalogVideoDecoder )
  133. {
  134. m_pAMAnalogVideoDecoder->Release();
  135. m_pAMAnalogVideoDecoder = NULL;
  136. }
  137. if( m_pInputPin )
  138. {
  139. delete [] m_pInputPin;
  140. m_pInputPin = NULL;
  141. }
  142. if( m_pCaptureFilter )
  143. {
  144. m_pCaptureFilter->Release();
  145. m_pCaptureFilter = NULL;
  146. }
  147. m_nInputPinCount = 0;
  148. m_nOutputPin = -1;
  149. m_nDirectShowVideoSwitch = 0;
  150. m_nDirectShowVideoSource = -1;
  151. m_nDirectShowVideoFrame = 0;
  152. }
  153. BOOL CDirectShowStreamVideo::SetVideoStandart( long lVideoStandard )
  154. {
  155. if( !m_pAMAnalogVideoDecoder )
  156. return FALSE;
  157. if( FAILED( m_pAMAnalogVideoDecoder->put_TVFormat( lVideoStandard ) ) )
  158. return FALSE;
  159. m_nDirectShowVideoStandard = lVideoStandard;
  160. return TRUE;
  161. }
  162. BOOL CDirectShowStreamVideo::SetVideoFPS( INT nFPS )
  163. {
  164. m_nVideoFPS = nFPS;
  165. return TRUE;
  166. }
  167. BOOL CDirectShowStreamVideo::IsSwitchable()
  168. {
  169. return m_pAMCrossbar != NULL;
  170. }
  171. INT CDirectShowStreamVideo::GetVideoSourceCount()
  172. {
  173. return m_nInputPinCount;
  174. }
  175. BOOL CDirectShowStreamVideo::SetVideoSource( INT nSource )
  176. {
  177. if( !m_pAMCrossbar && !nSource )
  178. return TRUE;
  179. if( nSource < 0 || nSource >= m_nInputPinCount || !m_pAMCrossbar )
  180. return FALSE;
  181. if( m_nOutputPin == -1 )
  182. return FALSE;
  183. if( !m_pAMCrossbar )
  184. return FALSE;
  185. if( FAILED( m_pAMCrossbar->Route( m_nOutputPin, m_pInputPin[ nSource ] ) ) )
  186. return FALSE;
  187. m_nDirectShowVideoSource = nSource;
  188. return TRUE;
  189. }
  190. PVOID CDirectShowStreamVideo::FindInterface( IBaseFilter *pFilter, REFIID iid )
  191. {
  192. if( !pFilter )
  193. return NULL;
  194. IEnumPins *pEnumPins = NULL;
  195. HRESULT hr = pFilter->EnumPins( &pEnumPins );
  196. if( FAILED(hr) )
  197. return NULL;
  198. PVOID pInterface = NULL;
  199. while( !pInterface )
  200. {
  201. IPin *pPinOut = NULL;
  202. // get next pin
  203. if( pEnumPins->Next( 1, &pPinOut, NULL ) != S_OK )
  204. break;
  205. // get pin information
  206. PIN_INFO PinInfo;
  207. hr = pPinOut->QueryPinInfo( &PinInfo );
  208. if( FAILED( hr ) )
  209. {
  210. pPinOut->Release();
  211. continue;
  212. }
  213. if( PinInfo.pFilter )
  214. PinInfo.pFilter->Release();
  215. // check direction
  216. if( PinInfo.dir == PINDIR_INPUT )
  217. {
  218. pPinOut->Release();
  219. continue;
  220. }
  221. // get pin connected to this pin
  222. IPin *pPinIn = NULL;
  223. hr = pPinOut->ConnectedTo( &pPinIn );
  224. if( FAILED( hr ) )
  225. {
  226. pPinOut->Release();
  227. continue;
  228. }
  229. hr = pPinIn->QueryPinInfo( &PinInfo );
  230. if( FAILED( hr ) )
  231. {
  232. pPinOut->Release();
  233. pPinIn->Release();
  234. continue;
  235. }
  236. /*
  237. TCHAR pName[MAX_PATH];
  238. ::WideCharToMultiByte( CP_ACP, 0, PinInfo.achName, -1, pName, MAX_PATH, 0, 0 );
  239. FILTER_INFO fi;
  240. PinInfo.pFilter->QueryFilterInfo( &fi );
  241. ::WideCharToMultiByte( CP_ACP, 0, fi.achName, -1, pName, MAX_PATH, 0, 0 );
  242. if( fi.pGraph )
  243. fi.pGraph->Release();
  244. */
  245. if( (!PinInfo.pFilter) || FAILED( PinInfo.pFilter->QueryInterface( iid, &pInterface ) ) )
  246. pInterface = FindInterface( PinInfo.pFilter, iid );
  247. if( PinInfo.pFilter )
  248. PinInfo.pFilter->Release();
  249. pPinOut->Release();
  250. pPinIn->Release();
  251. }
  252. pEnumPins->Release();
  253. return pInterface;
  254. }
  255. BOOL CDirectShowStreamVideo::InitSwitcher()
  256. {
  257. if( !m_pAMCrossbar )
  258. return FALSE;
  259. long OutputPinCount;
  260. long InputPinCount;
  261. HRESULT hr = m_pAMCrossbar->get_PinCounts( &OutputPinCount, &InputPinCount );
  262. if( FAILED( hr ) )
  263. return FALSE;
  264. long i;
  265. for( i = 0; i < OutputPinCount && m_nOutputPin < 0; i++ )
  266. {
  267. long PinIndexRelated;
  268. long PhysicalType;
  269. HRESULT hr = m_pAMCrossbar->get_CrossbarPinInfo( FALSE, i, &PinIndexRelated, &PhysicalType );
  270. if( FAILED( hr ) )
  271. return FALSE;
  272. switch( PhysicalType )
  273. {
  274. case PhysConn_Video_Tuner:
  275. case PhysConn_Video_Composite:
  276. case PhysConn_Video_SVideo:
  277. case PhysConn_Video_RGB:
  278. case PhysConn_Video_YRYBY:
  279. case PhysConn_Video_SerialDigital:
  280. case PhysConn_Video_ParallelDigital:
  281. case PhysConn_Video_SCSI:
  282. case PhysConn_Video_AUX:
  283. case PhysConn_Video_1394:
  284. case PhysConn_Video_USB:
  285. case PhysConn_Video_VideoDecoder:
  286. case PhysConn_Video_VideoEncoder:
  287. case PhysConn_Video_SCART:
  288. m_nOutputPin = i;
  289. break;
  290. }
  291. }
  292. PLONG pInputPin = new LONG[ InputPinCount ];
  293. if( !pInputPin )
  294. return FALSE;
  295. long nInput = 0;
  296. for( i = 0; i < InputPinCount; i++ )
  297. {
  298. long PinIndexRelated = 0;
  299. long PhysicalType = -1;
  300. HRESULT hr = m_pAMCrossbar->get_CrossbarPinInfo( TRUE, i, &PinIndexRelated, &PhysicalType );
  301. if( FAILED( hr ) )
  302. {
  303. delete [] pInputPin;
  304. return FALSE;
  305. }
  306. switch( PhysicalType )
  307. {
  308. case PhysConn_Video_Tuner:
  309. case PhysConn_Video_Composite:
  310. case PhysConn_Video_SVideo:
  311. case PhysConn_Video_RGB:
  312. case PhysConn_Video_YRYBY:
  313. case PhysConn_Video_SerialDigital:
  314. case PhysConn_Video_ParallelDigital:
  315. case PhysConn_Video_SCSI:
  316. case PhysConn_Video_AUX:
  317. case PhysConn_Video_1394:
  318. case PhysConn_Video_USB:
  319. case PhysConn_Video_VideoDecoder:
  320. case PhysConn_Video_VideoEncoder:
  321. case PhysConn_Video_SCART:
  322. pInputPin[ nInput++ ] = i;
  323. break;
  324. }
  325. }
  326. m_nInputPinCount = nInput;
  327. m_pInputPin = new LONG[ m_nInputPinCount ];
  328. if( !m_pInputPin )
  329. {
  330. delete [] pInputPin;
  331. return FALSE;
  332. }
  333. ::CopyMemory( m_pInputPin, pInputPin, sizeof(LONG) * m_nInputPinCount );
  334. delete [] pInputPin;
  335. return TRUE;
  336. }
  337. void CDirectShowStreamVideo::OnVideoSample( double SampleTime, BYTE *pBuffer, long BufferLen )
  338. {
  339. if( !m_pBitmapInfoHeader || !pBuffer )
  340. return;
  341. #ifdef __INCLUDE__VIDEO__MEDIA__SERVER__
  342. QWORD qTime = 10000i64 * (QWORD)GetTickCount();
  343. if( !m_MediaServer.WriteSample( qTime, pBuffer, BufferLen ) )
  344. LGLOG( LOG_LEVEL_LOW, LOG_TYPE_INFO, this, _T("CDirectShowStreamVideo::OnVideoSample"), _T("m_MediaServer.WriteSample failed") );
  345. #endif
  346. // protect
  347. CLgLocker Lock( &CLgLinkP<CDirectShowStream,CDirectShowVideo>::GetLock() );
  348. // make reference
  349. CLgArray< CLgLink<CDirectShowVideo,CDirectShowStream>* >& arrVideo = *this;
  350. if( arrVideo.GetCount() )
  351. {
  352. // determine number of visible windows
  353. INT nVisibleCount = 0;
  354. for( INT i = 0; i < arrVideo.GetCount(); i++ )
  355. {
  356. CDirectShowVideo *pDirectShowVideo = *arrVideo[i];
  357. if( pDirectShowVideo->IsVideoShow() )
  358. nVisibleCount ++;
  359. }
  360. // no visible windows
  361. if( !nVisibleCount )
  362. return;
  363. // take every second frame
  364. if( ++m_nDirectShowVideoFrame >= m_nVideoFPS || nVisibleCount == 1 )
  365. {
  366. // update current input
  367. if( m_nDirectShowVideoSwitch < arrVideo.GetCount() )
  368. {
  369. // update image
  370. CDirectShowVideo *pDirectShowVideo = *arrVideo[ m_nDirectShowVideoSwitch ];
  371. pDirectShowVideo->UpdateVideo( m_pBitmapInfoHeader, pBuffer, SampleTime );
  372. }
  373. // get next input
  374. for( INT i = 0; i < arrVideo.GetCount(); i++ )
  375. {
  376. // take next window
  377. m_nDirectShowVideoSwitch = (m_nDirectShowVideoSwitch + 1) % arrVideo.GetCount();
  378. CDirectShowVideo *pDirectShowVideo = *arrVideo[ m_nDirectShowVideoSwitch ];
  379. // if new source differs from old source then switch
  380. if( m_nDirectShowVideoSource != pDirectShowVideo->GetVideoInput() && pDirectShowVideo->IsVideoShow() )
  381. {
  382. // check video standard
  383. if( m_nDirectShowVideoStandard != pDirectShowVideo->GetVideoStandard() &&
  384. pDirectShowVideo->GetVideoStandard() != AnalogVideo_None )
  385. {
  386. // switch video standard
  387. SetVideoStandart( pDirectShowVideo->GetVideoStandard() );
  388. LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, "CDirectShowStreamVideo::OnVideoSample", "video standard switched to %d", m_nDirectShowVideoStandard );
  389. }
  390. // switch video source
  391. SetVideoSource( pDirectShowVideo->GetVideoInput() );
  392. LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, "CDirectShowStreamVideo::OnVideoSample", "video input switched to %d", m_nDirectShowVideoSource );
  393. break;
  394. }
  395. }
  396. // reset frame counter
  397. m_nDirectShowVideoFrame = 0;
  398. }
  399. }
  400. }
  401. BOOL CDirectShowStreamVideo::SetVideoContrast(double dPercent)
  402. {
  403. if( !m_pAMVideoProcAmp )
  404. return FALSE;
  405. // get limits
  406. LONG nMin = 0;
  407. LONG nMax = 0;
  408. LONG nSteppingDelta = 0;
  409. LONG nDefault = 0;
  410. LONG nCapsFlags = 0;
  411. HRESULT hr = m_pAMVideoProcAmp->GetRange( VideoProcAmp_Contrast, &nMin, &nMax, &nSteppingDelta, &nDefault, &nCapsFlags );
  412. if( FAILED(hr) )
  413. return FALSE;
  414. // prepare new value
  415. LONG nContrast = (LONG)( nMin + ( nMax - nMin ) * dPercent / 100.0 );
  416. // check bounds
  417. if( nContrast > nMax ) nContrast = nMax;
  418. if( nContrast < nMin ) nContrast = nMin;
  419. // make contrast
  420. hr = m_pAMVideoProcAmp->Set( VideoProcAmp_Contrast, nContrast, VideoProcAmp_Flags_Manual );
  421. return SUCCEEDED(hr);
  422. }
  423. BOOL CDirectShowStreamVideo::SetVideoBrightness( double dPercent )
  424. {
  425. if( !m_pAMVideoProcAmp )
  426. return FALSE;
  427. // get limits
  428. LONG nMin = 0;
  429. LONG nMax = 0;
  430. LONG nSteppingDelta = 0;
  431. LONG nDefault = 0;
  432. LONG nCapsFlags = 0;
  433. HRESULT hr = m_pAMVideoProcAmp->GetRange( VideoProcAmp_Brightness, &nMin, &nMax, &nSteppingDelta, &nDefault, &nCapsFlags );
  434. if( FAILED(hr) )
  435. return FALSE;
  436. // prepare new value
  437. LONG nBrightness = (LONG)( nMin + ( nMax - nMin ) * dPercent / 100.0 );
  438. // check bounds
  439. if( nBrightness > nMax ) nBrightness = nMax;
  440. if( nBrightness < nMin ) nBrightness = nMin;
  441. // make bright
  442. hr = m_pAMVideoProcAmp->Set( VideoProcAmp_Brightness, nBrightness, VideoProcAmp_Flags_Manual );
  443. return SUCCEEDED(hr);
  444. }
  445. BOOL CDirectShowStreamVideo::SetVideoSaturation( double dPercent )
  446. {
  447. if( !m_pAMVideoProcAmp )
  448. return FALSE;
  449. // get limits
  450. LONG nMin = 0;
  451. LONG nMax = 0;
  452. LONG nSteppingDelta = 0;
  453. LONG nDefault = 0;
  454. LONG nCapsFlags = 0;
  455. HRESULT hr = m_pAMVideoProcAmp->GetRange( VideoProcAmp_Saturation, &nMin, &nMax, &nSteppingDelta, &nDefault, &nCapsFlags );
  456. if( FAILED(hr) )
  457. return FALSE;
  458. // prepare new value
  459. LONG nSaturation = (LONG)( nMin + ( nMax - nMin ) * dPercent / 100.0 );
  460. // check bounds
  461. if( nSaturation > nMax ) nSaturation = nMax;
  462. if( nSaturation < nMin ) nSaturation = nMin;
  463. // make bright
  464. hr = m_pAMVideoProcAmp->Set( VideoProcAmp_Saturation, nSaturation, VideoProcAmp_Flags_Manual );
  465. return SUCCEEDED(hr);
  466. }
  467. BOOL CDirectShowStreamVideo::ShowPropertyPage( HWND hParentWnd )
  468. {
  469. IBaseFilter *pFilter = m_pCaptureFilter;
  470. /* Obtain the filter's IBaseFilter interface. (Not shown) */
  471. ISpecifyPropertyPages *pProp;
  472. HRESULT hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pProp);
  473. if (SUCCEEDED(hr))
  474. {
  475. // Get the filter's name and IUnknown pointer.
  476. FILTER_INFO FilterInfo;
  477. pFilter->QueryFilterInfo(&FilterInfo);
  478. IUnknown *pFilterUnk;
  479. pFilter->QueryInterface(IID_IUnknown, (void **)&pFilterUnk);
  480. // Show the page.
  481. CAUUID caGUID;
  482. pProp->GetPages(&caGUID);
  483. pProp->Release();
  484. OleCreatePropertyFrame(
  485. hParentWnd, // Parent window
  486. 0, 0, // (Reserved)
  487. FilterInfo.achName, // Caption for the dialog box
  488. 1, // Number of objects (just the filter)
  489. &pFilterUnk, // Array of object pointers.
  490. caGUID.cElems, // Number of property pages
  491. caGUID.pElems, // Array of property page CLSIDs
  492. 0, // Locale identifier
  493. 0, NULL // Reserved
  494. );
  495. // Clean up.
  496. pFilterUnk->Release();
  497. FilterInfo.pGraph->Release();
  498. CoTaskMemFree(caGUID.pElems);
  499. }
  500. return TRUE;
  501. }