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.

82 lines
2.3 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////
  2. // MPEG2ComponentTypeimpl.h : implementation helper template for component type interface
  3. // Copyright (c) Microsoft Corporation 1999.
  4. #ifndef MPEG2COMPONENTTYPEIMPL_H
  5. #define MPEG2COMPONENTTYPEIMPL_H
  6. #include "languagecomponenttypeimpl.h"
  7. namespace BDATuningModel {
  8. template<class T,
  9. class MostDerived = IMPEG2ComponentType,
  10. LPCGUID iid = &__uuidof(MostDerived),
  11. LPCGUID LibID = &LIBID_TunerLib,
  12. WORD wMajor = 1,
  13. WORD wMinor = 0,
  14. class tihclass = CComTypeInfoHolder
  15. > class ATL_NO_VTABLE IMPEG2ComponentTypeImpl :
  16. public ILanguageComponentTypeImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass>
  17. {
  18. // IMPEG2ComponentType
  19. public:
  20. MPEG2StreamType m_StreamType;
  21. IMPEG2ComponentTypeImpl() : m_StreamType(BDA_UNITIALIZED_MPEG2STREAMTYPE) {}
  22. virtual ~IMPEG2ComponentTypeImpl() {}
  23. // typedef IMPEG2ComponentTypeImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass> thistype;
  24. typedef ILanguageComponentTypeImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass> basetype;
  25. BEGIN_PROP_MAP(IMPEG2ComponentTypeImpl)
  26. CHAIN_PROP_MAP(basetype)
  27. PROP_DATA_ENTRY("Stream Type", m_StreamType, VT_I4)
  28. END_PROP_MAP()
  29. STDMETHOD(get_StreamType)(MPEG2StreamType *pVal)
  30. {
  31. try {
  32. if (!pVal) {
  33. return E_POINTER;
  34. }
  35. ATL_LOCKT();
  36. *pVal = m_StreamType;
  37. } catch (...) {
  38. return E_POINTER;
  39. }
  40. return NOERROR;
  41. }
  42. STDMETHOD(put_StreamType)(MPEG2StreamType newVal)
  43. {
  44. ATL_LOCKT();
  45. m_StreamType = newVal;
  46. MARK_DIRTY(T);
  47. return NOERROR;
  48. }
  49. STDMETHOD(Clone) (IComponentType **ppCT) {
  50. try {
  51. if (!ppCT) {
  52. return E_POINTER;
  53. }
  54. ATL_LOCKT();
  55. HRESULT hr = basetype::Clone(ppCT);
  56. if (FAILED(hr)) {
  57. return hr;
  58. }
  59. T* pt = static_cast<T*>(*ppCT);
  60. pt->m_StreamType = m_StreamType;
  61. return NOERROR;
  62. } catch (HRESULT h) {
  63. return h;
  64. } catch (...) {
  65. return E_POINTER;
  66. }
  67. }
  68. };
  69. }; // namespace
  70. #endif // MPEG2COMPONENTTYPEIMPL_H
  71. // end of file -- MPEG2componenttypeimpl.h