Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2561 lines
67 KiB

  1. /*
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. */
  4. //
  5. // tmVidrnd.cpp : Implementation of video render terminal.
  6. //
  7. #include "stdafx.h"
  8. #include "termmgr.h"
  9. #include "tmvidrnd.h"
  10. ///////////////////////////////////////////////////////////////////////////////
  11. CMSPThread g_VideoRenderThread;
  12. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  13. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  14. STDMETHODIMP CVideoRenderTerminal::InitializeDynamic(
  15. IN IID iidTerminalClass,
  16. IN DWORD dwMediaType,
  17. IN TERMINAL_DIRECTION Direction,
  18. IN MSP_HANDLE htAddress
  19. )
  20. {
  21. USES_CONVERSION;
  22. LOG((MSP_TRACE, "CVideoRenderTerminal::Initialize - enter"));
  23. if ( Direction != TD_RENDER )
  24. {
  25. LOG((MSP_ERROR, "CVideoRenderTerminal::Initialize - "
  26. "invalid direction - returning E_INVALIDARG"));
  27. return E_INVALIDARG;
  28. }
  29. HRESULT hr;
  30. //
  31. // Now do the base class method.
  32. //
  33. hr = CBaseTerminal::Initialize(iidTerminalClass,
  34. dwMediaType,
  35. Direction,
  36. htAddress);
  37. if ( FAILED(hr) )
  38. {
  39. LOG((MSP_ERROR, "CVideoRenderTerminal::Initialize - "
  40. "base class method failed - returning 0x%08x", hr));
  41. return hr;
  42. }
  43. //
  44. // attempt to "start" thread for doing asyncronous work
  45. //
  46. // the global thread object has a "start count". each initialized terminal
  47. // will start it on initialization (only the first terminal will actually
  48. // _start_ the thread).
  49. //
  50. // on cleanup, each initialized terminal will "stop" the thread object
  51. // (same run count logic applies -- only the last terminal will actually
  52. // _stop_ the thread).
  53. //
  54. hr = g_VideoRenderThread.Start();
  55. if (FAILED(hr))
  56. {
  57. LOG((MSP_ERROR, "CVideoRenderTerminal::Initialize - "
  58. "Creating thread failed. return: %x", hr));
  59. return hr;
  60. }
  61. //
  62. // it seems the tread started successfully. set this flag so that we know
  63. // if we need to stop in destructor
  64. //
  65. m_bThreadStarted = TRUE;
  66. //
  67. // Create the video renderer filter as a synchronous work item on our
  68. // worker thread, because the filter needs a window message pump.
  69. //
  70. CREATE_VIDEO_RENDER_FILTER_CONTEXT Context;
  71. Context.ppBaseFilter = & m_pIFilter; // will be filled in on completion
  72. Context.hr = E_UNEXPECTED; // will be used as return value
  73. hr = g_VideoRenderThread.QueueWorkItem(WorkItemProcCreateVideoRenderFilter,
  74. (void *) & Context,
  75. TRUE); // synchronous
  76. if ( FAILED(hr) )
  77. {
  78. LOG((MSP_ERROR, "CVideoRenderTerminal::Initialize - "
  79. "can't queue work item - returning 0x%08x", hr));
  80. //
  81. // undo our starting the thread
  82. //
  83. g_VideoRenderThread.Stop();
  84. m_bThreadStarted = FALSE;
  85. return hr;
  86. }
  87. //
  88. // We successfully queued and completed the work item. Now check the
  89. // return value.
  90. //
  91. if ( FAILED(Context.hr) )
  92. {
  93. LOG((MSP_ERROR, "CVideoRenderTerminal::Initialize - "
  94. "CoCreateInstance work item failed - returning 0x%08x",
  95. Context.hr));
  96. //
  97. // undo our starting the thread
  98. //
  99. g_VideoRenderThread.Stop();
  100. m_bThreadStarted = FALSE;
  101. return Context.hr;
  102. }
  103. //
  104. // Find our exposed pin.
  105. //
  106. hr = FindTerminalPin();
  107. if (FAILED(hr))
  108. {
  109. LOG((MSP_ERROR, "CVideoRenderTerminal::Initialize - "
  110. "FindTerminalPin failed; returning 0x%08x", hr));
  111. //
  112. // undo our starting the thread
  113. //
  114. g_VideoRenderThread.Stop();
  115. m_bThreadStarted = FALSE;
  116. return hr;
  117. }
  118. //
  119. // Get the basic video interface for the filter.
  120. //
  121. hr = m_pIFilter->QueryInterface(IID_IBasicVideo,
  122. (void **) &m_pIBasicVideo);
  123. if (FAILED(hr))
  124. {
  125. LOG((MSP_ERROR, "CVideoRenderTerminal::Initialize "
  126. "(IBasicVideo QI) - returning error: 0x%08x", hr));
  127. //
  128. // undo our starting the thread
  129. //
  130. g_VideoRenderThread.Stop();
  131. m_bThreadStarted = FALSE;
  132. return hr;
  133. }
  134. //
  135. // Get the video window interface for the filter.
  136. //
  137. hr = m_pIFilter->QueryInterface(IID_IVideoWindow,
  138. (void **) &m_pIVideoWindow);
  139. if (FAILED(hr))
  140. {
  141. LOG((MSP_ERROR, "CVideoRenderTerminal::Initialize "
  142. "(IVideoWindow QI) - returning error: 0x%08x", hr));
  143. //
  144. // undo our starting the thread
  145. //
  146. g_VideoRenderThread.Stop();
  147. m_bThreadStarted = FALSE;
  148. return hr;
  149. }
  150. //
  151. // Get the draw video image interface for the filter.
  152. //
  153. hr = m_pIFilter->QueryInterface(IID_IDrawVideoImage,
  154. (void **) &m_pIDrawVideoImage);
  155. if (FAILED(hr))
  156. {
  157. LOG((MSP_ERROR, "CVideoRenderTerminal::Initialize "
  158. "(IDrawVideoImage QI) - returning error: 0x%08x", hr));
  159. //
  160. // undo our starting the thread
  161. //
  162. g_VideoRenderThread.Stop();
  163. m_bThreadStarted = FALSE;
  164. return hr;
  165. }
  166. //
  167. // Since this filter does not support a name we get one from our resources.
  168. //
  169. TCHAR szTemp[MAX_PATH];
  170. if (::LoadString(_Module.GetResourceInstance(), IDS_VIDREND_DESC, szTemp, MAX_PATH))
  171. {
  172. lstrcpyn(m_szName, szTemp, MAX_PATH);
  173. }
  174. else
  175. {
  176. LOG((MSP_ERROR, "CVideoRenderTerminal::Initialize "
  177. "(LoadString) - returning E_UNEXPECTED"));
  178. //
  179. // undo our starting the thread
  180. //
  181. g_VideoRenderThread.Stop();
  182. m_bThreadStarted = FALSE;
  183. return E_UNEXPECTED;
  184. }
  185. LOG((MSP_TRACE, "CVideoRenderTerminal::Initialize - exit S_OK"));
  186. return S_OK;
  187. }
  188. CVideoRenderTerminal::~CVideoRenderTerminal()
  189. {
  190. LOG((MSP_TRACE, "CVideoRenderTerminal::~CVideoRenderTerminal - enter"));
  191. //
  192. // we nee to explicitly release these before stopping the thread, since
  193. // stopping the thread will cause couninitialize that will cause eventual
  194. // unload of the dll containing code for objects referred by these
  195. // pointers.
  196. //
  197. // these are smart pointers, so we just ground them,
  198. //
  199. m_pIBasicVideo = NULL;
  200. m_pIVideoWindow = NULL;
  201. m_pIDrawVideoImage = NULL;
  202. //
  203. // release base class' data members. a bit hacky, but we need to do this
  204. // before stopping the worker thread.
  205. //
  206. m_pIPin = NULL;
  207. m_pIFilter = NULL;
  208. m_pGraph = NULL;
  209. //
  210. // if the terminal successfully initialized and the thread started,
  211. // stop it (the thread object has start count).
  212. //
  213. if (m_bThreadStarted)
  214. {
  215. LOG((MSP_TRACE, "CVideoRenderTerminal::~CVideoRenderTerminal - stopping thread"));
  216. g_VideoRenderThread.Stop();
  217. m_bThreadStarted = FALSE;
  218. }
  219. LOG((MSP_TRACE, "CVideoRenderTerminal::~CVideoRenderTerminal - finish"));
  220. }
  221. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  222. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  223. DWORD WINAPI WorkItemProcCreateVideoRenderFilter(LPVOID pVoid)
  224. {
  225. LOG((MSP_TRACE, "WorkItemProcCreateVideoRenderFilter - enter"));
  226. CREATE_VIDEO_RENDER_FILTER_CONTEXT * pContext =
  227. (CREATE_VIDEO_RENDER_FILTER_CONTEXT *) pVoid;
  228. (pContext->hr) = CoCreateInstance(
  229. CLSID_VideoRenderer,
  230. NULL,
  231. CLSCTX_INPROC_SERVER,
  232. IID_IBaseFilter,
  233. (void **) (pContext->ppBaseFilter)
  234. );
  235. LOG((MSP_TRACE, "WorkItemProcCreateVideoRenderFilter - exit"));
  236. return 0;
  237. }
  238. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  239. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  240. HRESULT
  241. CVideoRenderTerminal::FindTerminalPin(
  242. )
  243. {
  244. LOG((MSP_TRACE, "CVideoRenderTerminal::FindTerminalPin - enter"));
  245. if (m_pIPin != NULL)
  246. {
  247. LOG((MSP_ERROR, "CVideoRenderTerminal::FindTerminalPin - "
  248. "already got a pin - returning E_UNEXPECTED"));
  249. return E_UNEXPECTED;
  250. }
  251. HRESULT hr;
  252. CComPtr<IEnumPins> pIEnumPins;
  253. ULONG cFetched;
  254. //
  255. // Find the render pin for the filter.
  256. //
  257. if (FAILED(hr = m_pIFilter->EnumPins(&pIEnumPins)))
  258. {
  259. LOG((MSP_ERROR,
  260. "CVideoRenderTerminal::FindTerminalPin - can't enum pins %8x",
  261. hr));
  262. return hr;
  263. }
  264. if (S_OK != (hr = pIEnumPins->Next(1, &m_pIPin, &cFetched)))
  265. {
  266. LOG((MSP_ERROR,
  267. "CVideoRenderTerminal::FindTerminalPin - can't get a pin %8x",
  268. hr));
  269. return (hr == S_FALSE) ? E_FAIL : hr;
  270. }
  271. LOG((MSP_TRACE, "CVideoRenderTerminal::FindTerminalPin - exit S_OK"));
  272. return S_OK;
  273. }
  274. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  275. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  276. HRESULT CVideoRenderTerminal::AddFiltersToGraph(
  277. )
  278. {
  279. LOG((MSP_TRACE, "CVideoRenderTerminal::AddFiltersToGraph() - enter"));
  280. USES_CONVERSION;
  281. if ( m_pGraph == NULL)
  282. {
  283. LOG((MSP_ERROR, "CVideoRenderTerminal::AddFiltersToGraph() - "
  284. "we have no graph - returning E_UNEXPECTED"));
  285. return E_UNEXPECTED;
  286. }
  287. if ( m_pIFilter == NULL)
  288. {
  289. LOG((MSP_ERROR, "CVideoRenderTerminal::AddFiltersToGraph() - "
  290. "we have no filter - returning E_UNEXPECTED"));
  291. return E_UNEXPECTED;
  292. }
  293. // AddFilter returns VFW_S_DUPLICATE_NAME if name is duplicate; still succeeds
  294. HRESULT hr;
  295. try
  296. {
  297. USES_CONVERSION;
  298. hr = m_pGraph->AddFilter(m_pIFilter, T2CW(m_szName));
  299. }
  300. catch (...)
  301. {
  302. LOG((MSP_ERROR, "CVideoRenderTerminal::AddFiltersToGraph - T2CW threw an exception - "
  303. "return E_OUTOFMEMORY"));
  304. return E_OUTOFMEMORY;
  305. }
  306. if ( FAILED(hr) )
  307. {
  308. LOG((MSP_ERROR, "CVideoRenderTerminal::AddFiltersToGraph() - "
  309. "Can't add filter. %08x", hr));
  310. return hr;
  311. }
  312. LOG((MSP_TRACE, "CVideoRenderTerminal::AddFiltersToGraph - exit S_OK"));
  313. return S_OK;
  314. }
  315. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  316. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  317. STDMETHODIMP CVideoRenderTerminal::CompleteConnectTerminal(void)
  318. {
  319. LOG((MSP_TRACE, "CVideoRenderTerminal::CompleteConnectTerminal - "
  320. "enter"));
  321. //
  322. // Don't clobber the base class.
  323. //
  324. HRESULT hr = CSingleFilterTerminal::CompleteConnectTerminal();
  325. if ( FAILED(hr) )
  326. {
  327. LOG((MSP_ERROR, "CVideoRenderTerminal::CompleteConnectTerminal - "
  328. "base class method failed - exit 0x%08x", hr));
  329. return hr;
  330. }
  331. //
  332. // Perform sanity checks.
  333. //
  334. if (m_pIVideoWindow == NULL)
  335. {
  336. LOG((MSP_ERROR, "CVideoRenderTerminal::CompleteConnectTerminal - "
  337. "null ivideowindow ptr - exit E_UNEXPECTED"));
  338. return E_UNEXPECTED;
  339. }
  340. if (m_pGraph == NULL)
  341. {
  342. LOG((MSP_ERROR, "CVideoRenderTerminal::CompleteConnectTerminal - "
  343. "null graph ptr - exit E_UNEXPECTED"));
  344. return E_UNEXPECTED;
  345. }
  346. //
  347. // Make the video window invisible by default, ignoring the return code as
  348. // we can't do anything if it fails. We use the cached AutoShow value
  349. // in case the app has told us that it wants the window to be AutoShown
  350. // as soon as streaming starts.
  351. //
  352. m_pIVideoWindow->put_Visible( 0 );
  353. m_pIVideoWindow->put_AutoShow( m_lAutoShowCache );
  354. LOG((MSP_TRACE, "CVideoRenderTerminal::CompleteConnectTerminal - "
  355. "exit S_OK"));
  356. return S_OK;
  357. }
  358. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  359. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  360. STDMETHODIMP CVideoRenderTerminal::get_AvgTimePerFrame(REFTIME * pVal)
  361. {
  362. LOG((MSP_TRACE, "CVideoRenderTerminal::get_AvgTimePerFrame - enter"));
  363. if ( TM_IsBadWritePtr( pVal, sizeof( REFTIME ) ) )
  364. {
  365. return E_POINTER;
  366. }
  367. m_CritSec.Lock();
  368. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  369. m_CritSec.Unlock();
  370. if (pIBasicVideo == NULL)
  371. {
  372. return E_FAIL; // minimal fix...
  373. }
  374. HRESULT hr = pIBasicVideo->get_AvgTimePerFrame(pVal);
  375. return hr;
  376. }
  377. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  378. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  379. STDMETHODIMP CVideoRenderTerminal::get_BitRate(long * pVal)
  380. {
  381. LOG((MSP_TRACE, "CVideoRenderTerminal::get_BitRate - enter"));
  382. if ( TM_IsBadWritePtr( pVal, sizeof (long) ) )
  383. {
  384. return E_POINTER;
  385. }
  386. m_CritSec.Lock();
  387. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  388. m_CritSec.Unlock();
  389. if (pIBasicVideo == NULL)
  390. {
  391. return E_FAIL; // minimal fix...
  392. }
  393. HRESULT hr;
  394. hr = pIBasicVideo->get_BitRate(pVal);
  395. return hr;
  396. }
  397. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  398. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  399. STDMETHODIMP CVideoRenderTerminal::get_BitErrorRate(long * pVal)
  400. {
  401. LOG((MSP_TRACE, "CVideoRenderTerminal::get_BitErrorRate - enter"));
  402. if ( TM_IsBadWritePtr( pVal, sizeof (long) ) )
  403. {
  404. return E_POINTER;
  405. }
  406. m_CritSec.Lock();
  407. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  408. m_CritSec.Unlock();
  409. if (pIBasicVideo == NULL)
  410. {
  411. return E_FAIL; // minimal fix...
  412. }
  413. HRESULT hr;
  414. hr = pIBasicVideo->get_BitErrorRate(pVal);
  415. return hr;
  416. }
  417. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  418. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  419. STDMETHODIMP CVideoRenderTerminal::get_VideoWidth(long * pVal)
  420. {
  421. LOG((MSP_TRACE, "CVideoRenderTerminal::get_VideoWidth - enter"));
  422. if ( TM_IsBadWritePtr( pVal, sizeof (long) ) )
  423. {
  424. return E_POINTER;
  425. }
  426. m_CritSec.Lock();
  427. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  428. m_CritSec.Unlock();
  429. if (pIBasicVideo == NULL)
  430. {
  431. return E_FAIL; // minimal fix...
  432. }
  433. HRESULT hr;
  434. hr = pIBasicVideo->get_VideoWidth(pVal);
  435. return hr;
  436. }
  437. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  438. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  439. STDMETHODIMP CVideoRenderTerminal::get_VideoHeight(long * pVal)
  440. {
  441. LOG((MSP_TRACE, "CVideoRenderTerminal::get_VideoHeight - enter"));
  442. if ( TM_IsBadWritePtr( pVal, sizeof (long) ) )
  443. {
  444. return E_POINTER;
  445. }
  446. m_CritSec.Lock();
  447. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  448. m_CritSec.Unlock();
  449. if (pIBasicVideo == NULL)
  450. {
  451. return E_FAIL; // minimal fix...
  452. }
  453. HRESULT hr;
  454. hr = pIBasicVideo->get_VideoHeight(pVal);
  455. return hr;
  456. }
  457. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  458. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  459. STDMETHODIMP CVideoRenderTerminal::get_SourceLeft(long * pVal)
  460. {
  461. LOG((MSP_TRACE, "CVideoRenderTerminal::get_SourceLeft - enter"));
  462. if ( TM_IsBadWritePtr( pVal, sizeof (long) ) )
  463. {
  464. return E_POINTER;
  465. }
  466. m_CritSec.Lock();
  467. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  468. m_CritSec.Unlock();
  469. if (pIBasicVideo == NULL)
  470. {
  471. return E_FAIL; // minimal fix...
  472. }
  473. HRESULT hr;
  474. hr = pIBasicVideo->get_SourceLeft(pVal);
  475. return hr;
  476. }
  477. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  478. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  479. STDMETHODIMP CVideoRenderTerminal::put_SourceLeft(long newVal)
  480. {
  481. LOG((MSP_TRACE, "CVideoRenderTerminal::put_SourceLeft - enter"));
  482. m_CritSec.Lock();
  483. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  484. m_CritSec.Unlock();
  485. if (pIBasicVideo == NULL)
  486. {
  487. return E_FAIL; // minimal fix...
  488. }
  489. HRESULT hr;
  490. hr = pIBasicVideo->put_SourceLeft(newVal);
  491. return hr;
  492. }
  493. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  494. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  495. STDMETHODIMP CVideoRenderTerminal::get_SourceWidth(long * pVal)
  496. {
  497. LOG((MSP_TRACE, "CVideoRenderTerminal::get_SourceWidth - enter"));
  498. if ( TM_IsBadWritePtr( pVal, sizeof (long) ) )
  499. {
  500. return E_POINTER;
  501. }
  502. m_CritSec.Lock();
  503. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  504. m_CritSec.Unlock();
  505. if (pIBasicVideo == NULL)
  506. {
  507. return E_FAIL; // minimal fix...
  508. }
  509. HRESULT hr;
  510. hr = pIBasicVideo->get_SourceWidth(pVal);
  511. return hr;
  512. }
  513. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  514. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  515. STDMETHODIMP CVideoRenderTerminal::put_SourceWidth(long newVal)
  516. {
  517. LOG((MSP_TRACE, "CVideoRenderTerminal::put_SourceWidth - enter"));
  518. m_CritSec.Lock();
  519. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  520. m_CritSec.Unlock();
  521. if (pIBasicVideo == NULL)
  522. {
  523. return E_FAIL; // minimal fix...
  524. }
  525. HRESULT hr;
  526. hr = pIBasicVideo->put_SourceWidth(newVal);
  527. return hr;
  528. }
  529. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  530. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  531. STDMETHODIMP CVideoRenderTerminal::get_SourceTop(long * pVal)
  532. {
  533. LOG((MSP_TRACE, "CVideoRenderTerminal::get_SourceTop - enter"));
  534. if ( TM_IsBadWritePtr( pVal, sizeof (long) ) )
  535. {
  536. return E_POINTER;
  537. }
  538. m_CritSec.Lock();
  539. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  540. m_CritSec.Unlock();
  541. if (pIBasicVideo == NULL)
  542. {
  543. return E_FAIL; // minimal fix...
  544. }
  545. HRESULT hr;
  546. hr = pIBasicVideo->get_SourceTop(pVal);
  547. return hr;
  548. }
  549. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  550. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  551. STDMETHODIMP CVideoRenderTerminal::put_SourceTop(long newVal)
  552. {
  553. LOG((MSP_TRACE, "CVideoRenderTerminal::put_SourceTop - enter"));
  554. m_CritSec.Lock();
  555. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  556. m_CritSec.Unlock();
  557. if (pIBasicVideo == NULL)
  558. {
  559. return E_FAIL; // minimal fix...
  560. }
  561. HRESULT hr;
  562. hr = pIBasicVideo->put_SourceTop(newVal);
  563. return hr;
  564. }
  565. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  566. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  567. STDMETHODIMP CVideoRenderTerminal::get_SourceHeight(long * pVal)
  568. {
  569. LOG((MSP_TRACE, "CVideoRenderTerminal::get_SourceHeight - enter"));
  570. if ( TM_IsBadWritePtr( pVal, sizeof (long) ) )
  571. {
  572. return E_POINTER;
  573. }
  574. m_CritSec.Lock();
  575. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  576. m_CritSec.Unlock();
  577. if (pIBasicVideo == NULL)
  578. {
  579. return E_FAIL; // minimal fix...
  580. }
  581. HRESULT hr;
  582. hr = pIBasicVideo->get_SourceHeight(pVal);
  583. return hr;
  584. }
  585. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  586. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  587. STDMETHODIMP CVideoRenderTerminal::put_SourceHeight(long newVal)
  588. {
  589. LOG((MSP_TRACE, "CVideoRenderTerminal::put_SourceHeight - enter"));
  590. m_CritSec.Lock();
  591. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  592. m_CritSec.Unlock();
  593. if (pIBasicVideo == NULL)
  594. {
  595. return E_FAIL; // minimal fix...
  596. }
  597. HRESULT hr;
  598. hr = pIBasicVideo->put_SourceHeight(newVal);
  599. return hr;
  600. }
  601. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  602. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  603. STDMETHODIMP CVideoRenderTerminal::get_DestinationLeft(long * pVal)
  604. {
  605. LOG((MSP_TRACE, "CVideoRenderTerminal::get_DestinationLeft - enter"));
  606. if ( TM_IsBadWritePtr( pVal, sizeof (long) ) )
  607. {
  608. return E_POINTER;
  609. }
  610. m_CritSec.Lock();
  611. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  612. m_CritSec.Unlock();
  613. if (pIBasicVideo == NULL)
  614. {
  615. return E_FAIL; // minimal fix...
  616. }
  617. HRESULT hr;
  618. hr = pIBasicVideo->get_DestinationLeft(pVal);
  619. return hr;
  620. }
  621. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  622. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  623. STDMETHODIMP CVideoRenderTerminal::put_DestinationLeft(long newVal)
  624. {
  625. LOG((MSP_TRACE, "CVideoRenderTerminal::put_Destinationleft - enter"));
  626. m_CritSec.Lock();
  627. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  628. m_CritSec.Unlock();
  629. if (pIBasicVideo == NULL)
  630. {
  631. return E_FAIL; // minimal fix...
  632. }
  633. HRESULT hr;
  634. hr = pIBasicVideo->put_DestinationLeft(newVal);
  635. return hr;
  636. }
  637. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  638. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  639. STDMETHODIMP CVideoRenderTerminal::get_DestinationWidth(long * pVal)
  640. {
  641. LOG((MSP_TRACE, "CVideoRenderTerminal::get_DestinationWidth - enter"));
  642. if ( TM_IsBadWritePtr( pVal, sizeof (long) ) )
  643. {
  644. return E_POINTER;
  645. }
  646. m_CritSec.Lock();
  647. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  648. m_CritSec.Unlock();
  649. if (pIBasicVideo == NULL)
  650. {
  651. return E_FAIL; // minimal fix...
  652. }
  653. HRESULT hr;
  654. hr = pIBasicVideo->get_DestinationWidth(pVal);
  655. return hr;
  656. }
  657. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  658. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  659. STDMETHODIMP CVideoRenderTerminal::put_DestinationWidth(long newVal)
  660. {
  661. LOG((MSP_TRACE, "CVideoRenderTerminal::put_DestinationWidth - enter"));
  662. m_CritSec.Lock();
  663. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  664. m_CritSec.Unlock();
  665. if (pIBasicVideo == NULL)
  666. {
  667. return E_FAIL; // minimal fix...
  668. }
  669. HRESULT hr;
  670. hr = pIBasicVideo->put_DestinationWidth(newVal);
  671. return hr;
  672. }
  673. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  674. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  675. STDMETHODIMP CVideoRenderTerminal::get_DestinationTop(long * pVal)
  676. {
  677. LOG((MSP_TRACE, "CVideoRenderTerminal::get_DestinationTop - enter"));
  678. if ( TM_IsBadWritePtr( pVal, sizeof (long) ) )
  679. {
  680. return E_POINTER;
  681. }
  682. m_CritSec.Lock();
  683. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  684. m_CritSec.Unlock();
  685. if (pIBasicVideo == NULL)
  686. {
  687. return E_FAIL; // minimal fix...
  688. }
  689. HRESULT hr;
  690. hr = pIBasicVideo->get_DestinationTop(pVal);
  691. return hr;
  692. }
  693. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  694. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  695. STDMETHODIMP CVideoRenderTerminal::put_DestinationTop(long newVal)
  696. {
  697. LOG((MSP_TRACE, "CVideoRenderTerminal::put_DestinationTop - enter"));
  698. m_CritSec.Lock();
  699. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  700. m_CritSec.Unlock();
  701. if (pIBasicVideo == NULL)
  702. {
  703. return E_FAIL; // minimal fix...
  704. }
  705. HRESULT hr;
  706. hr = pIBasicVideo->put_DestinationTop(newVal);
  707. return hr;
  708. }
  709. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  710. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  711. STDMETHODIMP CVideoRenderTerminal::get_DestinationHeight(long * pVal)
  712. {
  713. LOG((MSP_TRACE, "CVideoRenderTerminal::get_DestinationHeight - enter"));
  714. if ( TM_IsBadWritePtr( pVal, sizeof (long) ) )
  715. {
  716. return E_POINTER;
  717. }
  718. m_CritSec.Lock();
  719. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  720. m_CritSec.Unlock();
  721. if (pIBasicVideo == NULL)
  722. {
  723. return E_FAIL; // minimal fix...
  724. }
  725. HRESULT hr;
  726. hr = pIBasicVideo->get_DestinationHeight(pVal);
  727. return hr;
  728. }
  729. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  730. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  731. STDMETHODIMP CVideoRenderTerminal::put_DestinationHeight(long newVal)
  732. {
  733. LOG((MSP_TRACE, "CVideoRenderTerminal::put_DestinationHeight - enter"));
  734. m_CritSec.Lock();
  735. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  736. m_CritSec.Unlock();
  737. if (pIBasicVideo == NULL)
  738. {
  739. return E_FAIL; // minimal fix...
  740. }
  741. HRESULT hr;
  742. hr = pIBasicVideo->put_DestinationHeight(newVal);
  743. return hr;
  744. }
  745. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  746. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  747. STDMETHODIMP CVideoRenderTerminal::SetSourcePosition(long lLeft,
  748. long lTop,
  749. long lWidth,
  750. long lHeight)
  751. {
  752. LOG((MSP_TRACE, "CVideoRenderTerminal::SetSourcePosition - enter"));
  753. m_CritSec.Lock();
  754. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  755. m_CritSec.Unlock();
  756. if (pIBasicVideo == NULL)
  757. {
  758. return E_FAIL; // minimal fix...
  759. }
  760. HRESULT hr;
  761. hr = pIBasicVideo->SetSourcePosition(lLeft, lTop, lWidth, lHeight);
  762. return hr;
  763. }
  764. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  765. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  766. STDMETHODIMP CVideoRenderTerminal::GetSourcePosition(long * plLeft,
  767. long * plTop,
  768. long * plWidth,
  769. long * plHeight)
  770. {
  771. LOG((MSP_TRACE, "CVideoRenderTerminal::GetSourcePosition - enter"));
  772. if ( TM_IsBadWritePtr( plLeft, sizeof (long) ) ||
  773. TM_IsBadWritePtr( plTop, sizeof (long) ) ||
  774. TM_IsBadWritePtr( plWidth, sizeof (long) ) ||
  775. TM_IsBadWritePtr( plHeight, sizeof (long) ) )
  776. {
  777. return E_POINTER;
  778. }
  779. m_CritSec.Lock();
  780. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  781. m_CritSec.Unlock();
  782. if (pIBasicVideo == NULL)
  783. {
  784. return E_FAIL; // minimal fix...
  785. }
  786. HRESULT hr;
  787. hr = pIBasicVideo->GetSourcePosition(plLeft, plTop, plWidth, plHeight);
  788. return hr;
  789. }
  790. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  791. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  792. STDMETHODIMP CVideoRenderTerminal::SetDefaultSourcePosition()
  793. {
  794. LOG((MSP_TRACE, "CVideoRenderTerminal::SetDefaultSourcePosition - enter"));
  795. m_CritSec.Lock();
  796. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  797. m_CritSec.Unlock();
  798. if (pIBasicVideo == NULL)
  799. {
  800. return E_FAIL; // minimal fix...
  801. }
  802. HRESULT hr;
  803. hr = pIBasicVideo->SetDefaultSourcePosition();
  804. return hr;
  805. }
  806. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  807. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  808. STDMETHODIMP CVideoRenderTerminal::SetDestinationPosition(long lLeft,
  809. long lTop,
  810. long lWidth,
  811. long lHeight)
  812. {
  813. LOG((MSP_TRACE, "CVideoRenderTerminal::SetDestinationPosition - enter"));
  814. m_CritSec.Lock();
  815. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  816. m_CritSec.Unlock();
  817. if (pIBasicVideo == NULL)
  818. {
  819. return E_FAIL; // minimal fix...
  820. }
  821. HRESULT hr;
  822. hr = pIBasicVideo->SetDestinationPosition(lLeft, lTop, lWidth, lHeight);
  823. return hr;
  824. }
  825. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  826. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  827. STDMETHODIMP CVideoRenderTerminal::GetDestinationPosition(long *plLeft,
  828. long *plTop,
  829. long *plWidth,
  830. long *plHeight)
  831. {
  832. LOG((MSP_TRACE, "CVideoRenderTerminal::GetDestinationPosition - enter"));
  833. if ( TM_IsBadWritePtr( plLeft, sizeof (long) ) ||
  834. TM_IsBadWritePtr( plTop, sizeof (long) ) ||
  835. TM_IsBadWritePtr( plWidth, sizeof (long) ) ||
  836. TM_IsBadWritePtr( plHeight, sizeof (long) ) )
  837. {
  838. return E_POINTER;
  839. }
  840. m_CritSec.Lock();
  841. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  842. m_CritSec.Unlock();
  843. if (pIBasicVideo == NULL)
  844. {
  845. return E_FAIL; // minimal fix...
  846. }
  847. HRESULT hr;
  848. hr = pIBasicVideo->GetDestinationPosition(plLeft, plTop, plWidth, plHeight);
  849. return hr;
  850. }
  851. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  852. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  853. STDMETHODIMP CVideoRenderTerminal::SetDefaultDestinationPosition()
  854. {
  855. LOG((MSP_TRACE, "CVideoRenderTerminal::SetDefaultDestinationPosition - enter"));
  856. m_CritSec.Lock();
  857. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  858. m_CritSec.Unlock();
  859. if (pIBasicVideo == NULL)
  860. {
  861. return E_FAIL; // minimal fix...
  862. }
  863. HRESULT hr;
  864. hr = pIBasicVideo->SetDefaultDestinationPosition();
  865. return hr;
  866. }
  867. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  868. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  869. STDMETHODIMP CVideoRenderTerminal::GetVideoSize(long * plWidth,
  870. long * plHeight)
  871. {
  872. LOG((MSP_TRACE, "CVideoRenderTerminal::GetVideoSize - enter"));
  873. if ( TM_IsBadWritePtr( plWidth, sizeof (long) ) ||
  874. TM_IsBadWritePtr( plHeight, sizeof (long) ) )
  875. {
  876. return E_POINTER;
  877. }
  878. m_CritSec.Lock();
  879. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  880. m_CritSec.Unlock();
  881. if (pIBasicVideo == NULL)
  882. {
  883. return E_FAIL; // minimal fix...
  884. }
  885. HRESULT hr;
  886. hr = pIBasicVideo->GetVideoSize(plWidth, plHeight);
  887. return hr;
  888. }
  889. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  890. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  891. STDMETHODIMP CVideoRenderTerminal::GetVideoPaletteEntries(
  892. long lStartIndex,
  893. long lcEntries,
  894. long * plcRetrieved,
  895. long * plPalette
  896. )
  897. {
  898. LOG((MSP_TRACE, "CVideoRenderTerminal::GetVideoPaletteEntries - enter"));
  899. if ( TM_IsBadWritePtr( plcRetrieved, sizeof (long) ) ||
  900. TM_IsBadWritePtr( plPalette, sizeof (long) ) )
  901. {
  902. return E_POINTER;
  903. }
  904. m_CritSec.Lock();
  905. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  906. m_CritSec.Unlock();
  907. if (pIBasicVideo == NULL)
  908. {
  909. return E_FAIL; // minimal fix...
  910. }
  911. HRESULT hr;
  912. hr = pIBasicVideo->GetVideoPaletteEntries(lStartIndex,
  913. lcEntries,
  914. plcRetrieved,
  915. plPalette);
  916. return hr;
  917. }
  918. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  919. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  920. STDMETHODIMP CVideoRenderTerminal::GetCurrentImage(long * plBufferSize,
  921. long * pDIBImage)
  922. {
  923. LOG((MSP_TRACE, "CVideoRenderTerminal::GetCurrentImage - enter"));
  924. if ( TM_IsBadWritePtr( plBufferSize, sizeof (long) ) ||
  925. TM_IsBadWritePtr( pDIBImage, sizeof (long) ) )
  926. {
  927. return E_POINTER;
  928. }
  929. m_CritSec.Lock();
  930. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  931. m_CritSec.Unlock();
  932. if (pIBasicVideo == NULL)
  933. {
  934. return E_FAIL; // minimal fix...
  935. }
  936. HRESULT hr;
  937. hr = pIBasicVideo->GetCurrentImage(plBufferSize, pDIBImage);
  938. return hr;
  939. }
  940. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  941. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  942. STDMETHODIMP CVideoRenderTerminal::IsUsingDefaultSource()
  943. {
  944. LOG((MSP_TRACE, "CVideoRenderTerminal::IsUsingDefaultSource - enter"));
  945. m_CritSec.Lock();
  946. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  947. m_CritSec.Unlock();
  948. if (pIBasicVideo == NULL)
  949. {
  950. return E_FAIL; // minimal fix...
  951. }
  952. HRESULT hr;
  953. hr = pIBasicVideo->IsUsingDefaultSource();
  954. return hr;
  955. }
  956. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  957. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  958. STDMETHODIMP CVideoRenderTerminal::IsUsingDefaultDestination()
  959. {
  960. LOG((MSP_TRACE, "CVideoRenderTerminal::IsUsingDefaultDestination - "
  961. "enter"));
  962. m_CritSec.Lock();
  963. CComPtr <IBasicVideo> pIBasicVideo = m_pIBasicVideo;
  964. m_CritSec.Unlock();
  965. if (pIBasicVideo == NULL)
  966. {
  967. return E_FAIL; // minimal fix...
  968. }
  969. HRESULT hr;
  970. hr = pIBasicVideo->IsUsingDefaultDestination();
  971. return hr;
  972. }
  973. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  974. // IVideoWindow
  975. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  976. STDMETHODIMP CVideoRenderTerminal::put_Caption(BSTR strCaption)
  977. {
  978. LOG((MSP_TRACE, "CVideoRenderTerminal::put_Caption - enter"));
  979. m_CritSec.Lock();
  980. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  981. m_CritSec.Unlock();
  982. if (pIVideoWindow == NULL)
  983. {
  984. return E_FAIL; // minimal fix...
  985. }
  986. HRESULT hr;
  987. hr = pIVideoWindow->put_Caption(strCaption);
  988. return hr;
  989. }
  990. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  991. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  992. STDMETHODIMP CVideoRenderTerminal::get_Caption(BSTR FAR* strCaption)
  993. {
  994. LOG((MSP_TRACE, "CVideoRenderTerminal::get_Caption - enter"));
  995. if ( TM_IsBadWritePtr( strCaption, sizeof (BSTR) ) )
  996. {
  997. return E_POINTER;
  998. }
  999. m_CritSec.Lock();
  1000. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1001. m_CritSec.Unlock();
  1002. if (pIVideoWindow == NULL)
  1003. {
  1004. return E_FAIL; // minimal fix...
  1005. }
  1006. HRESULT hr;
  1007. hr = pIVideoWindow->get_Caption(strCaption);
  1008. return hr;
  1009. }
  1010. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1011. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1012. STDMETHODIMP CVideoRenderTerminal::put_WindowStyle(long WindowStyle)
  1013. {
  1014. LOG((MSP_TRACE, "CVideoRenderTerminal::put_WindowStyle - enter"));
  1015. m_CritSec.Lock();
  1016. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1017. m_CritSec.Unlock();
  1018. if (pIVideoWindow == NULL)
  1019. {
  1020. return E_FAIL; // minimal fix...
  1021. }
  1022. HRESULT hr;
  1023. hr = pIVideoWindow->put_WindowStyle(WindowStyle);
  1024. return hr;
  1025. }
  1026. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1027. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1028. STDMETHODIMP CVideoRenderTerminal::get_WindowStyle(long FAR* WindowStyle)
  1029. {
  1030. LOG((MSP_TRACE, "CVideoRenderTerminal::get_WindowStyle - enter"));
  1031. if ( TM_IsBadWritePtr( WindowStyle, sizeof (long) ) )
  1032. {
  1033. return E_POINTER;
  1034. }
  1035. m_CritSec.Lock();
  1036. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1037. m_CritSec.Unlock();
  1038. if (pIVideoWindow == NULL)
  1039. {
  1040. return E_FAIL; // minimal fix...
  1041. }
  1042. HRESULT hr;
  1043. hr = pIVideoWindow->get_WindowStyle(WindowStyle);
  1044. return hr;
  1045. }
  1046. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1047. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1048. STDMETHODIMP CVideoRenderTerminal::put_WindowStyleEx(long WindowStyleEx)
  1049. {
  1050. LOG((MSP_TRACE, "CVideoRenderTerminal::put_WindowStyleEx - enter"));
  1051. m_CritSec.Lock();
  1052. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1053. m_CritSec.Unlock();
  1054. if (pIVideoWindow == NULL)
  1055. {
  1056. return E_FAIL; // minimal fix...
  1057. }
  1058. HRESULT hr;
  1059. hr = pIVideoWindow->put_WindowStyleEx(WindowStyleEx);
  1060. return hr;
  1061. }
  1062. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1063. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1064. STDMETHODIMP CVideoRenderTerminal::get_WindowStyleEx(long FAR* WindowStyleEx)
  1065. {
  1066. LOG((MSP_TRACE, "CVideoRenderTerminal::get_WindowStyleEx - enter"));
  1067. if ( TM_IsBadWritePtr( WindowStyleEx, sizeof (long) ) )
  1068. {
  1069. return E_POINTER;
  1070. }
  1071. m_CritSec.Lock();
  1072. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1073. m_CritSec.Unlock();
  1074. if (pIVideoWindow == NULL)
  1075. {
  1076. return E_FAIL; // minimal fix...
  1077. }
  1078. HRESULT hr;
  1079. hr = pIVideoWindow->get_WindowStyleEx(WindowStyleEx);
  1080. return hr;
  1081. }
  1082. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1083. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1084. STDMETHODIMP CVideoRenderTerminal::put_AutoShow(long AutoShow)
  1085. {
  1086. LOG((MSP_TRACE, "CVideoRenderTerminal::put_AutoShow - enter"));
  1087. //
  1088. // Salvage broken C++ apps that don't know the difference between TRUE and
  1089. // VARIANT_TRUE -- treat any nonzero value as VARIANT_TRUE.
  1090. //
  1091. if ( AutoShow )
  1092. {
  1093. AutoShow = VARIANT_TRUE;
  1094. }
  1095. //
  1096. // Always cache our AutoShow state. If we happen to be connected at this
  1097. // time, then actually propagate the state to the filter.
  1098. // (All of this is because the filter can't change state when it's not
  1099. // connected, and we need to be able to do that to simplify apps.)
  1100. //
  1101. m_CritSec.Lock();
  1102. LOG((MSP_TRACE, "CVideoRenderTerminal::put_AutoShow - "
  1103. "cache was %d, setting to %d", m_lAutoShowCache, AutoShow));
  1104. m_lAutoShowCache = AutoShow;
  1105. TERMINAL_STATE ts = m_TerminalState;
  1106. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1107. //
  1108. // Need to unlock before we call on the filter, which
  1109. // calls into user32, causing possible deadlocks!
  1110. //
  1111. m_CritSec.Unlock();
  1112. if ( pIVideoWindow == NULL )
  1113. {
  1114. LOG((MSP_ERROR, "CVideoRenderTerminal::put_AutoShow - "
  1115. "no video window pointer - exit E_FAIL"));
  1116. return E_FAIL;
  1117. }
  1118. HRESULT hr;
  1119. if ( ts == TS_INUSE)
  1120. {
  1121. LOG((MSP_TRACE, "CVideoRenderTerminal::put_AutoShow - "
  1122. "terminal is in use - calling method on filter"));
  1123. hr = pIVideoWindow->put_AutoShow(AutoShow);
  1124. }
  1125. else
  1126. {
  1127. LOG((MSP_TRACE, "CVideoRenderTerminal::put_AutoShow - "
  1128. "terminal is not in use - only the cache was set"));
  1129. hr = S_OK;
  1130. }
  1131. if ( FAILED(hr) )
  1132. {
  1133. LOG((MSP_ERROR, "CVideoRenderTerminal::put_AutoShow - "
  1134. "exit 0x%08x", hr));
  1135. return hr;
  1136. }
  1137. LOG((MSP_TRACE, "CVideoRenderTerminal::put_AutoShow - exit S_OK"));
  1138. return S_OK;
  1139. }
  1140. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1141. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1142. STDMETHODIMP CVideoRenderTerminal::get_AutoShow(long FAR* pAutoShow)
  1143. {
  1144. LOG((MSP_TRACE, "CVideoRenderTerminal::get_AutoShow - enter"));
  1145. //
  1146. // Check arguments.
  1147. //
  1148. if ( TM_IsBadWritePtr( pAutoShow, sizeof (long) ) )
  1149. {
  1150. LOG((MSP_ERROR, "CVideoRenderTerminal::get_AutoShow - "
  1151. "bad return pointer - exit E_POINTER"));
  1152. return E_POINTER;
  1153. }
  1154. //
  1155. // We always cache our state (see the put_AutoShow method) so we can just
  1156. // return the cached state. There should be no other way the filter's
  1157. // visibility can be messed with.
  1158. //
  1159. m_CritSec.Lock();
  1160. LOG((MSP_TRACE, "CVideoRenderTerminal::put_AutoShow - "
  1161. "indicating cached value (%d)", m_lAutoShowCache));
  1162. *pAutoShow = m_lAutoShowCache;
  1163. m_CritSec.Unlock();
  1164. LOG((MSP_TRACE, "CVideoRenderTerminal::get_AutoShow - exit S_OK"));
  1165. return S_OK;
  1166. }
  1167. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1168. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1169. STDMETHODIMP CVideoRenderTerminal::put_WindowState(long WindowState)
  1170. {
  1171. LOG((MSP_TRACE, "CVideoRenderTerminal::put_WindowState - enter"));
  1172. m_CritSec.Lock();
  1173. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1174. m_CritSec.Unlock();
  1175. if (pIVideoWindow == NULL)
  1176. {
  1177. return E_FAIL; // minimal fix...
  1178. }
  1179. HRESULT hr;
  1180. hr = pIVideoWindow->put_WindowState(WindowState);
  1181. return hr;
  1182. }
  1183. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1184. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1185. STDMETHODIMP CVideoRenderTerminal::get_WindowState(long FAR* WindowState)
  1186. {
  1187. LOG((MSP_TRACE, "CVideoRenderTerminal::get_WindowState - enter"));
  1188. if ( TM_IsBadWritePtr( WindowState, sizeof (long) ) )
  1189. {
  1190. return E_POINTER;
  1191. }
  1192. m_CritSec.Lock();
  1193. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1194. m_CritSec.Unlock();
  1195. if (pIVideoWindow == NULL)
  1196. {
  1197. return E_FAIL; // minimal fix...
  1198. }
  1199. HRESULT hr;
  1200. hr = pIVideoWindow->get_WindowState(WindowState);
  1201. return hr;
  1202. }
  1203. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1204. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1205. STDMETHODIMP CVideoRenderTerminal::put_BackgroundPalette(
  1206. long BackgroundPalette
  1207. )
  1208. {
  1209. LOG((MSP_TRACE, "CVideoRenderTerminal::put_BackgroundPalette - enter"));
  1210. m_CritSec.Lock();
  1211. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1212. m_CritSec.Unlock();
  1213. if (pIVideoWindow == NULL)
  1214. {
  1215. return E_FAIL; // minimal fix...
  1216. }
  1217. HRESULT hr;
  1218. hr = pIVideoWindow->put_BackgroundPalette(BackgroundPalette);
  1219. return hr;
  1220. }
  1221. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1222. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1223. STDMETHODIMP CVideoRenderTerminal::get_BackgroundPalette(
  1224. long FAR* pBackgroundPalette
  1225. )
  1226. {
  1227. LOG((MSP_TRACE, "CVideoRenderTerminal::get_BackgroundPalette - enter"));
  1228. if ( TM_IsBadWritePtr( pBackgroundPalette, sizeof (long) ) )
  1229. {
  1230. return E_POINTER;
  1231. }
  1232. m_CritSec.Lock();
  1233. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1234. m_CritSec.Unlock();
  1235. if (pIVideoWindow == NULL)
  1236. {
  1237. return E_FAIL; // minimal fix...
  1238. }
  1239. HRESULT hr;
  1240. hr = pIVideoWindow->get_BackgroundPalette(pBackgroundPalette);
  1241. return hr;
  1242. }
  1243. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1244. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1245. STDMETHODIMP CVideoRenderTerminal::put_Visible(long Visible)
  1246. {
  1247. LOG((MSP_TRACE, "CVideoRenderTerminal::put_Visible - enter"));
  1248. //
  1249. // Salvage broken C++ apps that don't know the difference between TRUE and
  1250. // VARIANT_TRUE -- treat any nonzero value as VARIANT_TRUE.
  1251. //
  1252. if ( Visible )
  1253. {
  1254. Visible = VARIANT_TRUE;
  1255. }
  1256. m_CritSec.Lock();
  1257. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1258. //
  1259. // Need to unlock before we call on the filter, which
  1260. // calls into user32, causing possible deadlocks!
  1261. //
  1262. m_CritSec.Unlock();
  1263. if ( pIVideoWindow == NULL )
  1264. {
  1265. LOG((MSP_ERROR, "CVideoRenderTerminal::put_Visible - "
  1266. "no video window pointer - exit E_FAIL"));
  1267. return E_FAIL;
  1268. }
  1269. HRESULT hr = pIVideoWindow->put_Visible(Visible);
  1270. if ( FAILED(hr) )
  1271. {
  1272. LOG((MSP_ERROR, "CVideoRenderTerminal::put_Visible - "
  1273. "exit 0x%08x", hr));
  1274. return hr;
  1275. }
  1276. LOG((MSP_TRACE, "CVideoRenderTerminal::put_Visible - exit S_OK"));
  1277. return S_OK;
  1278. }
  1279. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1280. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1281. STDMETHODIMP CVideoRenderTerminal::get_Visible(long FAR* pVisible)
  1282. {
  1283. LOG((MSP_TRACE, "CVideoRenderTerminal::get_Visible - enter"));
  1284. //
  1285. // Check arguments.
  1286. //
  1287. if ( TM_IsBadWritePtr( pVisible, sizeof (long) ) )
  1288. {
  1289. LOG((MSP_ERROR, "CVideoRenderTerminal::get_Visible - "
  1290. "bad return pointer - exit E_POINTER"));
  1291. return E_POINTER;
  1292. }
  1293. m_CritSec.Lock();
  1294. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1295. //
  1296. // Need to unlock before we call on the filter, which
  1297. // calls into user32, causing possible deadlocks!
  1298. //
  1299. m_CritSec.Unlock();
  1300. if ( pIVideoWindow == NULL )
  1301. {
  1302. LOG((MSP_ERROR, "CVideoRenderTerminal::get_Visible - "
  1303. "no video window pointer - exit E_FAIL"));
  1304. return E_FAIL;
  1305. }
  1306. HRESULT hr = pIVideoWindow->get_Visible(pVisible);
  1307. if ( FAILED(hr) )
  1308. {
  1309. LOG((MSP_ERROR, "CVideoRenderTerminal::get_Visible - "
  1310. "exit 0x%08x", hr));
  1311. return hr;
  1312. }
  1313. LOG((MSP_TRACE, "CVideoRenderTerminal::get_Visible - exit S_OK"));
  1314. return S_OK;
  1315. }
  1316. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1317. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1318. STDMETHODIMP CVideoRenderTerminal::put_Left(long Left)
  1319. {
  1320. LOG((MSP_TRACE, "CVideoRenderTerminal::put_Left - enter"));
  1321. m_CritSec.Lock();
  1322. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1323. m_CritSec.Unlock();
  1324. if (pIVideoWindow == NULL)
  1325. {
  1326. return E_FAIL; // minimal fix...
  1327. }
  1328. HRESULT hr;
  1329. hr = pIVideoWindow->put_Left(Left);
  1330. return hr;
  1331. }
  1332. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1333. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1334. STDMETHODIMP CVideoRenderTerminal::get_Left(long FAR* pLeft)
  1335. {
  1336. LOG((MSP_TRACE, "CVideoRenderTerminal::get_Left - enter"));
  1337. if ( TM_IsBadWritePtr( pLeft, sizeof (long) ) )
  1338. {
  1339. return E_POINTER;
  1340. }
  1341. m_CritSec.Lock();
  1342. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1343. m_CritSec.Unlock();
  1344. if (pIVideoWindow == NULL)
  1345. {
  1346. return E_FAIL; // minimal fix...
  1347. }
  1348. HRESULT hr;
  1349. hr = pIVideoWindow->get_Left(pLeft);
  1350. return hr;
  1351. }
  1352. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1353. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1354. STDMETHODIMP CVideoRenderTerminal::put_Width(long Width)
  1355. {
  1356. LOG((MSP_TRACE, "CVideoRenderTerminal::put_Width - enter"));
  1357. m_CritSec.Lock();
  1358. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1359. m_CritSec.Unlock();
  1360. if (pIVideoWindow == NULL)
  1361. {
  1362. return E_FAIL; // minimal fix...
  1363. }
  1364. HRESULT hr;
  1365. hr = pIVideoWindow->put_Width(Width);
  1366. return hr;
  1367. }
  1368. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1369. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1370. STDMETHODIMP CVideoRenderTerminal::get_Width(long FAR* pWidth)
  1371. {
  1372. LOG((MSP_TRACE, "CVideoRenderTerminal::get_Width - enter"));
  1373. if ( TM_IsBadWritePtr( pWidth, sizeof (long) ) )
  1374. {
  1375. return E_POINTER;
  1376. }
  1377. m_CritSec.Lock();
  1378. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1379. m_CritSec.Unlock();
  1380. if (pIVideoWindow == NULL)
  1381. {
  1382. return E_FAIL; // minimal fix...
  1383. }
  1384. HRESULT hr;
  1385. hr = pIVideoWindow->get_Width(pWidth);
  1386. return hr;
  1387. }
  1388. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1389. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1390. STDMETHODIMP CVideoRenderTerminal::put_Top(long Top)
  1391. {
  1392. LOG((MSP_TRACE, "CVideoRenderTerminal::put_Top - enter"));
  1393. m_CritSec.Lock();
  1394. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1395. m_CritSec.Unlock();
  1396. if (pIVideoWindow == NULL)
  1397. {
  1398. return E_FAIL; // minimal fix...
  1399. }
  1400. HRESULT hr;
  1401. hr = pIVideoWindow->put_Top(Top);
  1402. return hr;
  1403. }
  1404. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1405. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1406. STDMETHODIMP CVideoRenderTerminal::get_Top(long FAR* pTop)
  1407. {
  1408. LOG((MSP_TRACE, "CVideoRenderTerminal::get_Top - enter"));
  1409. if ( TM_IsBadWritePtr( pTop, sizeof (long) ) )
  1410. {
  1411. return E_POINTER;
  1412. }
  1413. m_CritSec.Lock();
  1414. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1415. m_CritSec.Unlock();
  1416. if (pIVideoWindow == NULL)
  1417. {
  1418. return E_FAIL; // minimal fix...
  1419. }
  1420. HRESULT hr;
  1421. hr = pIVideoWindow->get_Top(pTop);
  1422. return hr;
  1423. }
  1424. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1425. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1426. STDMETHODIMP CVideoRenderTerminal::put_Height(long Height)
  1427. {
  1428. LOG((MSP_TRACE, "CVideoRenderTerminal::put_Height - enter"));
  1429. m_CritSec.Lock();
  1430. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1431. m_CritSec.Unlock();
  1432. if (pIVideoWindow == NULL)
  1433. {
  1434. return E_FAIL; // minimal fix...
  1435. }
  1436. HRESULT hr;
  1437. hr = pIVideoWindow->put_Height(Height);
  1438. return hr;
  1439. }
  1440. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1441. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1442. STDMETHODIMP CVideoRenderTerminal::get_Height(long FAR* pHeight)
  1443. {
  1444. LOG((MSP_TRACE, "CVideoRenderTerminal::get_Height - enter"));
  1445. if ( TM_IsBadWritePtr( pHeight, sizeof (long) ) )
  1446. {
  1447. return E_POINTER;
  1448. }
  1449. m_CritSec.Lock();
  1450. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1451. m_CritSec.Unlock();
  1452. if (pIVideoWindow == NULL)
  1453. {
  1454. return E_FAIL; // minimal fix...
  1455. }
  1456. HRESULT hr;
  1457. hr = pIVideoWindow->get_Height(pHeight);
  1458. return hr;
  1459. }
  1460. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1461. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1462. STDMETHODIMP CVideoRenderTerminal::put_Owner(OAHWND Owner)
  1463. {
  1464. LOG((MSP_TRACE, "CVideoRenderTerminal::put_Owner - enter"));
  1465. m_CritSec.Lock();
  1466. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1467. m_CritSec.Unlock();
  1468. if (pIVideoWindow == NULL)
  1469. {
  1470. return E_FAIL; // minimal fix...
  1471. }
  1472. HRESULT hr;
  1473. hr = pIVideoWindow->put_Owner(Owner);
  1474. return hr;
  1475. }
  1476. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1477. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1478. STDMETHODIMP CVideoRenderTerminal::get_Owner(OAHWND FAR* Owner)
  1479. {
  1480. LOG((MSP_TRACE, "CVideoRenderTerminal::get_Owner - enter"));
  1481. if ( TM_IsBadWritePtr( Owner, sizeof (OAHWND) ) )
  1482. {
  1483. return E_POINTER;
  1484. }
  1485. m_CritSec.Lock();
  1486. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1487. m_CritSec.Unlock();
  1488. if (pIVideoWindow == NULL)
  1489. {
  1490. return E_FAIL; // minimal fix...
  1491. }
  1492. HRESULT hr;
  1493. hr = pIVideoWindow->get_Owner(Owner);
  1494. return hr;
  1495. }
  1496. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1497. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1498. STDMETHODIMP CVideoRenderTerminal::put_MessageDrain(OAHWND Drain)
  1499. {
  1500. LOG((MSP_TRACE, "CVideoRenderTerminal::put_MessageDrain - enter"));
  1501. m_CritSec.Lock();
  1502. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1503. m_CritSec.Unlock();
  1504. if (pIVideoWindow == NULL)
  1505. {
  1506. return E_FAIL; // minimal fix...
  1507. }
  1508. HRESULT hr;
  1509. hr = pIVideoWindow->put_MessageDrain(Drain);
  1510. return hr;
  1511. }
  1512. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1513. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1514. STDMETHODIMP CVideoRenderTerminal::get_MessageDrain(OAHWND FAR* Drain)
  1515. {
  1516. LOG((MSP_TRACE, "CVideoRenderTerminal::get_MessageDrain - enter"));
  1517. if ( TM_IsBadWritePtr( Drain, sizeof (OAHWND) ) )
  1518. {
  1519. return E_POINTER;
  1520. }
  1521. m_CritSec.Lock();
  1522. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1523. m_CritSec.Unlock();
  1524. if (pIVideoWindow == NULL)
  1525. {
  1526. return E_FAIL; // minimal fix...
  1527. }
  1528. HRESULT hr;
  1529. hr = pIVideoWindow->get_MessageDrain(Drain);
  1530. return hr;
  1531. }
  1532. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1533. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1534. STDMETHODIMP CVideoRenderTerminal::get_BorderColor(long FAR* Color)
  1535. {
  1536. LOG((MSP_TRACE, "CVideoRenderTerminal::get_BorderColor - enter"));
  1537. if ( TM_IsBadWritePtr( Color, sizeof (long) ) )
  1538. {
  1539. return E_POINTER;
  1540. }
  1541. m_CritSec.Lock();
  1542. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1543. m_CritSec.Unlock();
  1544. if (pIVideoWindow == NULL)
  1545. {
  1546. return E_FAIL; // minimal fix...
  1547. }
  1548. HRESULT hr;
  1549. hr = pIVideoWindow->get_BorderColor(Color);
  1550. return hr;
  1551. }
  1552. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1553. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1554. STDMETHODIMP CVideoRenderTerminal::put_BorderColor(long Color)
  1555. {
  1556. LOG((MSP_TRACE, "CVideoRenderTerminal::put_BorderColor - enter"));
  1557. m_CritSec.Lock();
  1558. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1559. m_CritSec.Unlock();
  1560. if (pIVideoWindow == NULL)
  1561. {
  1562. return E_FAIL; // minimal fix...
  1563. }
  1564. HRESULT hr;
  1565. hr = pIVideoWindow->put_BorderColor(Color);
  1566. return hr;
  1567. }
  1568. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1569. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1570. STDMETHODIMP CVideoRenderTerminal::get_FullScreenMode(long FAR* FullScreenMode)
  1571. {
  1572. LOG((MSP_TRACE, "CVideoRenderTerminal::get_FullScreenMode - enter"));
  1573. if ( TM_IsBadWritePtr( FullScreenMode, sizeof (long) ) )
  1574. {
  1575. return E_POINTER;
  1576. }
  1577. m_CritSec.Lock();
  1578. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1579. m_CritSec.Unlock();
  1580. if (pIVideoWindow == NULL)
  1581. {
  1582. return E_FAIL; // minimal fix...
  1583. }
  1584. HRESULT hr;
  1585. hr = pIVideoWindow->get_FullScreenMode(FullScreenMode);
  1586. return hr;
  1587. }
  1588. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1589. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1590. STDMETHODIMP CVideoRenderTerminal::put_FullScreenMode(long FullScreenMode)
  1591. {
  1592. LOG((MSP_TRACE, "CVideoRenderTerminal::put_FullScreenMode - enter"));
  1593. m_CritSec.Lock();
  1594. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1595. m_CritSec.Unlock();
  1596. if (pIVideoWindow == NULL)
  1597. {
  1598. return E_FAIL; // minimal fix...
  1599. }
  1600. HRESULT hr;
  1601. hr = pIVideoWindow->put_FullScreenMode(FullScreenMode);
  1602. return hr;
  1603. }
  1604. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1605. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1606. STDMETHODIMP CVideoRenderTerminal::SetWindowForeground(long Focus)
  1607. {
  1608. LOG((MSP_TRACE, "CVideoRenderTerminal::SetWindowForeground - enter"));
  1609. m_CritSec.Lock();
  1610. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1611. m_CritSec.Unlock();
  1612. if (pIVideoWindow == NULL)
  1613. {
  1614. return E_FAIL; // minimal fix...
  1615. }
  1616. HRESULT hr;
  1617. hr = pIVideoWindow->SetWindowForeground(Focus);
  1618. return hr;
  1619. }
  1620. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1621. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1622. STDMETHODIMP CVideoRenderTerminal::NotifyOwnerMessage(OAHWND hwnd,
  1623. long uMsg,
  1624. LONG_PTR wParam,
  1625. LONG_PTR lParam)
  1626. {
  1627. LOG((MSP_TRACE, "CVideoRenderTerminal::NotifyOwnerMessage - enter"));
  1628. m_CritSec.Lock();
  1629. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1630. m_CritSec.Unlock();
  1631. if (pIVideoWindow == NULL)
  1632. {
  1633. return E_FAIL; // minimal fix...
  1634. }
  1635. HRESULT hr;
  1636. hr = pIVideoWindow->NotifyOwnerMessage(hwnd, uMsg, wParam, lParam);
  1637. return hr;
  1638. }
  1639. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1640. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1641. STDMETHODIMP CVideoRenderTerminal::SetWindowPosition(long Left,
  1642. long Top,
  1643. long Width,
  1644. long Height)
  1645. {
  1646. LOG((MSP_TRACE, "CVideoRenderTerminal::SetWindowPosition - enter"));
  1647. m_CritSec.Lock();
  1648. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1649. m_CritSec.Unlock();
  1650. if (pIVideoWindow == NULL)
  1651. {
  1652. return E_FAIL; // minimal fix...
  1653. }
  1654. HRESULT hr;
  1655. hr = pIVideoWindow->SetWindowPosition(Left, Top, Width, Height);
  1656. return hr;
  1657. }
  1658. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1659. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1660. STDMETHODIMP CVideoRenderTerminal::GetWindowPosition(
  1661. long FAR* pLeft, long FAR* pTop, long FAR* pWidth, long FAR* pHeight
  1662. )
  1663. {
  1664. LOG((MSP_TRACE, "CVideoRenderTerminal::GetWindowPosition - enter"));
  1665. if ( TM_IsBadWritePtr( pLeft, sizeof (long) ) ||
  1666. TM_IsBadWritePtr( pTop, sizeof (long) ) ||
  1667. TM_IsBadWritePtr( pWidth, sizeof (long) ) ||
  1668. TM_IsBadWritePtr( pHeight, sizeof (long) ) )
  1669. {
  1670. return E_POINTER;
  1671. }
  1672. m_CritSec.Lock();
  1673. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1674. m_CritSec.Unlock();
  1675. if (pIVideoWindow == NULL)
  1676. {
  1677. return E_FAIL; // minimal fix...
  1678. }
  1679. HRESULT hr;
  1680. hr = pIVideoWindow->GetWindowPosition(pLeft, pTop, pWidth, pHeight);
  1681. return hr;
  1682. }
  1683. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1684. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1685. STDMETHODIMP CVideoRenderTerminal::GetMinIdealImageSize(long FAR* pWidth,
  1686. long FAR* pHeight)
  1687. {
  1688. LOG((MSP_TRACE, "CVideoRenderTerminal::GerMinIdealImageSize - enter"));
  1689. if ( TM_IsBadWritePtr( pWidth, sizeof (long) ) ||
  1690. TM_IsBadWritePtr( pHeight, sizeof (long) ) )
  1691. {
  1692. return E_POINTER;
  1693. }
  1694. m_CritSec.Lock();
  1695. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1696. m_CritSec.Unlock();
  1697. if (pIVideoWindow == NULL)
  1698. {
  1699. return E_FAIL; // minimal fix...
  1700. }
  1701. HRESULT hr;
  1702. hr = pIVideoWindow->GetMinIdealImageSize(pWidth, pHeight);
  1703. return hr;
  1704. }
  1705. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1706. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1707. STDMETHODIMP CVideoRenderTerminal::GetMaxIdealImageSize(long FAR* pWidth,
  1708. long FAR* pHeight)
  1709. {
  1710. LOG((MSP_TRACE, "CVideoRenderTerminal::GetMaxIdealImageSize - enter"));
  1711. if ( TM_IsBadWritePtr( pWidth, sizeof (long) ) ||
  1712. TM_IsBadWritePtr( pHeight, sizeof (long) ) )
  1713. {
  1714. return E_POINTER;
  1715. }
  1716. m_CritSec.Lock();
  1717. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1718. m_CritSec.Unlock();
  1719. if (pIVideoWindow == NULL)
  1720. {
  1721. return E_FAIL; // minimal fix...
  1722. }
  1723. HRESULT hr;
  1724. hr = pIVideoWindow->GetMaxIdealImageSize(pWidth, pHeight);
  1725. return hr;
  1726. }
  1727. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1728. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1729. STDMETHODIMP CVideoRenderTerminal::GetRestorePosition(long FAR* pLeft,
  1730. long FAR* pTop,
  1731. long FAR* pWidth,
  1732. long FAR* pHeight)
  1733. {
  1734. LOG((MSP_TRACE, "CVideoRenderTerminal::GetRestorePosition - enter"));
  1735. m_CritSec.Lock();
  1736. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1737. m_CritSec.Unlock();
  1738. if (pIVideoWindow == NULL)
  1739. {
  1740. return E_FAIL; // minimal fix...
  1741. }
  1742. HRESULT hr;
  1743. hr = pIVideoWindow->GetRestorePosition(pLeft, pTop, pWidth, pHeight);
  1744. return hr;
  1745. }
  1746. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1747. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1748. STDMETHODIMP CVideoRenderTerminal::HideCursor(long HideCursor)
  1749. {
  1750. LOG((MSP_TRACE, "CVideoRenderTerminal::HideCursor - enter"));
  1751. m_CritSec.Lock();
  1752. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1753. m_CritSec.Unlock();
  1754. if (pIVideoWindow == NULL)
  1755. {
  1756. return E_FAIL; // minimal fix...
  1757. }
  1758. HRESULT hr;
  1759. hr = pIVideoWindow->HideCursor(HideCursor);
  1760. return hr;
  1761. }
  1762. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1763. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1764. STDMETHODIMP CVideoRenderTerminal::IsCursorHidden(long FAR* CursorHidden)
  1765. {
  1766. LOG((MSP_TRACE, "CVideoRenderTerminal::IsCursorHidden - enter"));
  1767. if ( TM_IsBadWritePtr( CursorHidden, sizeof (long) ))
  1768. {
  1769. return E_POINTER;
  1770. }
  1771. m_CritSec.Lock();
  1772. CComPtr <IVideoWindow> pIVideoWindow = m_pIVideoWindow;
  1773. m_CritSec.Unlock();
  1774. if (pIVideoWindow == NULL)
  1775. {
  1776. return E_FAIL; // minimal fix...
  1777. }
  1778. HRESULT hr;
  1779. hr = pIVideoWindow->IsCursorHidden(CursorHidden);
  1780. return hr;
  1781. }
  1782. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1783. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1784. // IDrawVideoImage
  1785. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1786. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1787. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1788. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1789. STDMETHODIMP CVideoRenderTerminal::DrawVideoImageBegin(void)
  1790. {
  1791. LOG((MSP_TRACE, "CVideoRenderTerminal::DrawVideoImageBegin - enter"));
  1792. m_CritSec.Lock();
  1793. CComPtr <IDrawVideoImage> pIDrawVideoImage = m_pIDrawVideoImage;
  1794. m_CritSec.Unlock();
  1795. if ( pIDrawVideoImage == NULL )
  1796. {
  1797. LOG((MSP_ERROR, "CVideoRenderTerminal::DrawVideoImageBegin - "
  1798. "exit E_FAIL"));
  1799. return E_FAIL;
  1800. }
  1801. HRESULT hr;
  1802. hr = pIDrawVideoImage->DrawVideoImageBegin();
  1803. if ( FAILED(hr) )
  1804. {
  1805. LOG((MSP_ERROR, "CVideoRenderTerminal::DrawVideoImageBegin - "
  1806. "exit 0x%08x", hr));
  1807. return hr;
  1808. }
  1809. LOG((MSP_TRACE, "CVideoRenderTerminal::DrawVideoImageBegin - exit S_OK"));
  1810. return S_OK;
  1811. }
  1812. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1813. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1814. STDMETHODIMP CVideoRenderTerminal::DrawVideoImageEnd (void)
  1815. {
  1816. LOG((MSP_TRACE, "CVideoRenderTerminal::DrawVideoImageEnd - enter"));
  1817. m_CritSec.Lock();
  1818. CComPtr <IDrawVideoImage> pIDrawVideoImage = m_pIDrawVideoImage;
  1819. m_CritSec.Unlock();
  1820. if ( pIDrawVideoImage == NULL )
  1821. {
  1822. LOG((MSP_ERROR, "CVideoRenderTerminal::DrawVideoImageEnd - "
  1823. "exit E_FAIL"));
  1824. return E_FAIL;
  1825. }
  1826. HRESULT hr;
  1827. hr = pIDrawVideoImage->DrawVideoImageEnd();
  1828. if ( FAILED(hr) )
  1829. {
  1830. LOG((MSP_ERROR, "CVideoRenderTerminal::DrawVideoImageEnd - "
  1831. "exit 0x%08x", hr));
  1832. return hr;
  1833. }
  1834. LOG((MSP_TRACE, "CVideoRenderTerminal::DrawVideoImageEnd - exit S_OK"));
  1835. return S_OK;
  1836. }
  1837. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1838. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1839. STDMETHODIMP CVideoRenderTerminal::DrawVideoImageDraw (IN HDC hdc,
  1840. IN LPRECT lprcSrc,
  1841. IN LPRECT lprcDst)
  1842. {
  1843. LOG((MSP_TRACE, "CVideoRenderTerminal::DrawVideoImageBegin - enter"));
  1844. m_CritSec.Lock();
  1845. CComPtr <IDrawVideoImage> pIDrawVideoImage = m_pIDrawVideoImage;
  1846. m_CritSec.Unlock();
  1847. if ( pIDrawVideoImage == NULL )
  1848. {
  1849. LOG((MSP_ERROR, "CVideoRenderTerminal::DrawVideoImageDraw - "
  1850. "exit E_FAIL"));
  1851. return E_FAIL;
  1852. }
  1853. HRESULT hr;
  1854. hr = pIDrawVideoImage->DrawVideoImageDraw(hdc, lprcSrc, lprcDst);
  1855. if ( FAILED(hr) )
  1856. {
  1857. LOG((MSP_ERROR, "CVideoRenderTerminal::DrawVideoImageDraw - "
  1858. "exit 0x%08x", hr));
  1859. return hr;
  1860. }
  1861. LOG((MSP_TRACE, "CVideoRenderTerminal::DrawVideoImageDraw - exit S_OK"));
  1862. return S_OK;
  1863. }
  1864. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1865. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++