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.

138 lines
3.8 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////
  2. // MPEG2Componentimpl.h : implementation helper template for MPEG2component interface
  3. // Copyright (c) Microsoft Corporation 1999.
  4. #ifndef MPEG2COMPONENTIMPL_H
  5. #define MPEG2COMPONENTIMPL_H
  6. #include "componentimpl.h"
  7. #include "MPEG2componenttype.h"
  8. namespace BDATuningModel {
  9. template<class T,
  10. class MostDerived = IMPEG2Component,
  11. LPCGUID iid = &__uuidof(MostDerived),
  12. LPCGUID LibID = &LIBID_TunerLib,
  13. WORD wMajor = 1,
  14. WORD wMinor = 0,
  15. class tihclass = CComTypeInfoHolder
  16. > class ATL_NO_VTABLE IMPEG2ComponentImpl :
  17. public IComponentImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass>
  18. {
  19. // IMPEG2Component
  20. public:
  21. long m_PID;
  22. long m_PCRPID;
  23. long m_ProgramNumber;
  24. IMPEG2ComponentImpl() : m_PID(-1),
  25. m_PCRPID(-1),
  26. m_ProgramNumber(-1) {}
  27. virtual ~IMPEG2ComponentImpl() {}
  28. typedef IMPEG2ComponentImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass> thistype;
  29. typedef IComponentImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass> basetype;
  30. BEGIN_PROP_MAP(thistype)
  31. CHAIN_PROP_MAP(basetype)
  32. PROP_DATA_ENTRY("PID", m_PID, VT_I4)
  33. PROP_DATA_ENTRY("PCRPID", m_PCRPID, VT_I4)
  34. PROP_DATA_ENTRY("ProgramNumber", m_ProgramNumber, VT_I4)
  35. END_PROP_MAP()
  36. // IMPEG2Component
  37. public:
  38. STDMETHOD(put_Type)(/*[in]*/ IComponentType* pNewVal) {
  39. try {
  40. if (!pNewVal) {
  41. return E_POINTER;
  42. }
  43. PQMPEG2ComponentType pT(pNewVal);
  44. if (!pT) {
  45. return DISP_E_TYPEMISMATCH;
  46. }
  47. return basetype::put_Type(pNewVal);
  48. } catch (...) {
  49. return E_POINTER;
  50. }
  51. }
  52. STDMETHOD(get_PID)(/*[out, retval]*/ long *pPID) {
  53. try {
  54. if (!pPID) {
  55. return E_POINTER;
  56. }
  57. ATL_LOCKT();
  58. *pPID = m_PID;
  59. return NOERROR;
  60. } catch (...) {
  61. return E_POINTER;
  62. }
  63. }
  64. STDMETHOD(put_PID)(/*[in]*/ long NewPID) {
  65. ATL_LOCKT();
  66. m_PID = NewPID;
  67. MARK_DIRTY(T);
  68. return NOERROR;
  69. }
  70. STDMETHOD(get_PCRPID)(/*[out, retval]*/ long *pPCRPID) {
  71. try {
  72. if (!pPCRPID) {
  73. return E_POINTER;
  74. }
  75. ATL_LOCKT();
  76. *pPCRPID = m_PCRPID;
  77. return NOERROR;
  78. } catch (...) {
  79. return E_POINTER;
  80. }
  81. }
  82. STDMETHOD(put_PCRPID)(/*[in]*/ long NewPCRPID) {
  83. m_PCRPID = NewPCRPID;
  84. MARK_DIRTY(T);
  85. return NOERROR;
  86. }
  87. STDMETHOD(get_ProgramNumber)(/*[out, retval]*/ long *pProgramNumber) {
  88. try {
  89. if (!pProgramNumber) {
  90. return E_POINTER;
  91. }
  92. ATL_LOCKT();
  93. *pProgramNumber = m_ProgramNumber;
  94. return NOERROR;
  95. } catch (...) {
  96. return E_POINTER;
  97. }
  98. }
  99. STDMETHOD(put_ProgramNumber)(/*[in]*/ long NewProgramNumber) {
  100. ATL_LOCKT();
  101. m_ProgramNumber = NewProgramNumber;
  102. MARK_DIRTY(T);
  103. return NOERROR;
  104. }
  105. STDMETHOD(Clone) (IComponent **ppNew) {
  106. try {
  107. if (!ppNew) {
  108. return E_POINTER;
  109. }
  110. ATL_LOCKT();
  111. HRESULT hr = basetype::Clone(ppNew);
  112. if (FAILED(hr)) {
  113. return hr;
  114. }
  115. T* pt = static_cast<T*>(*ppNew);
  116. pt->m_PCRPID = m_PCRPID;
  117. pt->m_PID = m_PID;
  118. pt->m_ProgramNumber = m_ProgramNumber;
  119. return NOERROR;
  120. } catch (HRESULT h) {
  121. return h;
  122. } catch (...) {
  123. return E_POINTER;
  124. }
  125. }
  126. };
  127. }; // namespace
  128. #endif // MPEG2COMPONENTIMPL_H
  129. // end of file -- MPEG2componentimpl.h