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.

110 lines
3.5 KiB

  1. //==========================================================================;
  2. //
  3. // fp2vr.h : Declaration of the custom composition class for gluing file
  4. // playback to the video renderer
  5. //
  6. // Copyright (c) Microsoft Corporation 1999.
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9. #ifndef FP2VRCOMP_H
  10. #define FP2VRCOMP_H
  11. #pragma once
  12. #include <winerror.h>
  13. #include <algorithm>
  14. #include <compimpl.h>
  15. #include <seg.h>
  16. #include <objectwithsiteimplsec.h>
  17. #include "resource.h" // main symbols
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CAnaCapComp
  20. class ATL_NO_VTABLE __declspec(uuid("B401C5EB-8457-427f-84EA-A4D2363364B0")) CFP2VRComp :
  21. public CComObjectRootEx<CComSingleThreadModel>,
  22. public CComCoClass<CFP2VRComp, &__uuidof(CFP2VRComp)>,
  23. public IObjectWithSiteImplSec<CFP2VRComp>,
  24. public IMSVidCompositionSegmentImpl<CFP2VRComp>
  25. {
  26. public:
  27. CFP2VRComp() {}
  28. virtual ~CFP2VRComp() {}
  29. REGISTER_NONAUTOMATION_OBJECT(IDS_PROJNAME,
  30. IDS_REG_FP2VRCOMP_DESC,
  31. LIBID_MSVidCtlLib,
  32. __uuidof(CFP2VRComp));
  33. DECLARE_PROTECT_FINAL_CONSTRUCT()
  34. BEGIN_COM_MAP(CFP2VRComp)
  35. COM_INTERFACE_ENTRY(IMSVidCompositionSegment)
  36. COM_INTERFACE_ENTRY(IMSVidGraphSegment)
  37. COM_INTERFACE_ENTRY(IPersist)
  38. COM_INTERFACE_ENTRY(IObjectWithSite)
  39. END_COM_MAP()
  40. // IMSVidComposition
  41. public:
  42. // IMSVidGraphSegment
  43. // IMSVidCompositionSegment
  44. STDMETHOD(Compose)(IMSVidGraphSegment * upstream, IMSVidGraphSegment * downstream)
  45. {
  46. TRACELM(TRACE_DEBUG, "CFP2VRComp::Compose()");
  47. if (m_fComposed) {
  48. return NOERROR;
  49. }
  50. ASSERT(m_pGraph);
  51. try {
  52. VWGraphSegment up(upstream);
  53. ASSERT(up.Graph() == m_pGraph);
  54. VWGraphSegment down(downstream);
  55. ASSERT(down.Graph() == m_pGraph);
  56. if (up.begin() == up.end()) {
  57. TRACELM(TRACE_ERROR, "CFP2VRComp::Compose() can't compose empty up segment");
  58. return E_INVALIDARG;
  59. }
  60. if (down.begin() == down.end()) {
  61. TRACELM(TRACE_ERROR, "CFP2VRComp::Compose() can't compose empty down segment");
  62. return E_INVALIDARG;
  63. }
  64. DSFilter pFP(*up.begin());
  65. VWGraphSegment::iterator iVR;
  66. VWGraphSegment::iterator prevVR;
  67. for (iVR = down.begin(); iVR != down.end(); ++iVR) {
  68. prevVR = iVR;
  69. }
  70. DSFilter pVR = DSFilter(*prevVR);
  71. ASSERT(!!pFP);
  72. ASSERT(pFP.GetGraph() == m_pGraph);
  73. ASSERT(!!pVR);
  74. ASSERT(pVR.GetGraph() == m_pGraph);
  75. HRESULT hr = m_pGraph.Connect(pFP, pVR, m_Filters,
  76. DSGraph::ATTEMPT_MERIT_UNLIKELY |
  77. DSGraph::ALLOW_WILDCARDS |
  78. DSGraph::IGNORE_MEDIATYPE_ERRORS |
  79. DSGraph::DONT_TERMINATE_ON_RENDERER |
  80. DSGraph::BIDIRECTIONAL_MEDIATYPE_MATCHING,
  81. DOWNSTREAM);
  82. if (FAILED(hr)) {
  83. TRACELSM(TRACE_ERROR, (dbgDump << "CFP2VRComp::Compose() FAILED connect hr = " << hexdump(hr)), "");
  84. return hr;
  85. }
  86. m_fComposed = true;
  87. return NOERROR;
  88. } catch (ComException &e) {
  89. return e;
  90. } catch (...) {
  91. return E_UNEXPECTED;
  92. }
  93. }
  94. };
  95. #endif // FP2VRCOMP_H
  96. // end of file - FP2VRComp.h