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.

84 lines
2.3 KiB

  1. //==========================================================================;
  2. //
  3. // compimpl.h : additional infrastructure to support implementing IMSVidCompositionSegment
  4. // nicely from c++
  5. // Copyright (c) Microsoft Corporation 1999.
  6. //
  7. /////////////////////////////////////////////////////////////////////////////
  8. #pragma once
  9. #ifndef COMPIMPL_H
  10. #define COMPIMPL_H
  11. #include <segimpl.h>
  12. namespace MSVideoControl {
  13. typedef CComQIPtr<IMSVidCompositionSegment, &__uuidof(IMSVidCompositionSegment)> PQCompositionSegment;
  14. template<class T, class DerivedMost = IMSVidCompositionSegment> class DECLSPEC_NOVTABLE IMSVidCompositionSegmentImpl :
  15. public IMSVidGraphSegmentImpl<T, MSVidSEG_XFORM, &GUID_NULL, DerivedMost> {
  16. public:
  17. bool m_fComposed;
  18. VWSegmentList m_Segments;
  19. VWSegmentList::iterator m_pUp;
  20. VWSegmentList::iterator m_pDown;
  21. IMSVidCompositionSegmentImpl() :
  22. m_fComposed(false),
  23. m_Segments(VWSegmentList()),
  24. m_pUp(m_Segments.end()),
  25. m_pDown(m_Segments.end())
  26. {}
  27. virtual ~IMSVidCompositionSegmentImpl() {
  28. m_fComposed = false;
  29. }
  30. STDMETHOD(GetClassID) (LPCLSID guid) {
  31. try {
  32. memcpy(guid, &__uuidof(T), sizeof(CLSID));
  33. return NOERROR;
  34. } catch(...) {
  35. return E_POINTER;
  36. }
  37. }
  38. STDMETHOD(get_Up)(IMSVidGraphSegment **upstream)
  39. {
  40. if (!m_fComposed) {
  41. return ImplReportError(__uuidof(T), IDS_OBJ_NO_INIT, __uuidof(IMSVidCompositionSegment), CO_E_NOTINITIALIZED);
  42. }
  43. ASSERT(m_pGraph);
  44. try {
  45. return (*m_pUp).CopyTo(upstream);
  46. } catch (ComException &e) {
  47. return e;
  48. } catch (...) {
  49. return E_UNEXPECTED;
  50. }
  51. return NOERROR;
  52. }
  53. STDMETHOD(get_Down)(IMSVidGraphSegment **downstream)
  54. {
  55. if (!m_fComposed) {
  56. return ImplReportError(__uuidof(T), IDS_OBJ_NO_INIT, __uuidof(IMSVidCompositionSegment), CO_E_NOTINITIALIZED);
  57. }
  58. ASSERT(m_pGraph);
  59. try {
  60. return (*m_pDown).CopyTo(downstream);
  61. } catch (ComException &e) {
  62. return e;
  63. } catch (...) {
  64. return E_UNEXPECTED;
  65. }
  66. return NOERROR;
  67. }
  68. };
  69. }; // namespace
  70. #endif
  71. // end of file compimpl.h