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.

180 lines
4.2 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////
  2. // DVBTuneRequestimpl.h : implementation helper template for component type interface
  3. // Copyright (c) Microsoft Corporation 1999.
  4. #ifndef DVBTUNEREQUESTIMPL_H
  5. #define DVBTUNEREQUESTIMPL_H
  6. #include <tune.h>
  7. #include "tunerequestimpl.h"
  8. typedef CComQIPtr<IDVBTLocator> PQDVBTLocator;
  9. typedef CComQIPtr<IDVBSLocator> PQDVBSLocator;
  10. namespace BDATuningModel {
  11. template<class T,
  12. class MostDerived = IDVBTuneRequest,
  13. LPCGUID iid = &__uuidof(MostDerived),
  14. LPCGUID LibID = &LIBID_TunerLib,
  15. WORD wMajor = 1,
  16. WORD wMinor = 0,
  17. class tihclass = CComTypeInfoHolder
  18. > class ATL_NO_VTABLE IDVBTuneRequestImpl :
  19. public ITuneRequestImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass>
  20. {
  21. // IDVBTuneRequest
  22. public:
  23. typedef ITuneRequestImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass> basetype;
  24. IDVBTuneRequestImpl() : m_ONID(-1), m_TSID(-1), m_SID(-1){}
  25. virtual ~IDVBTuneRequestImpl() {}
  26. BEGIN_PROP_MAP(IDVBTuneRequestImpl)
  27. CHAIN_PROP_MAP(basetype)
  28. PROP_DATA_ENTRY("Original Network ID", m_ONID, VT_I4)
  29. PROP_DATA_ENTRY("Transport Stream ID", m_TSID, VT_I4)
  30. PROP_DATA_ENTRY("Service ID", m_SID, VT_I4)
  31. END_PROP_MAP()
  32. long m_ONID;
  33. long m_TSID;
  34. long m_SID;
  35. STDMETHOD(get_ONID)(long *pVal)
  36. {
  37. try {
  38. if (!pVal) {
  39. return E_POINTER;
  40. }
  41. ATL_LOCKT();
  42. *pVal = m_ONID;
  43. } catch (...) {
  44. return E_POINTER;
  45. }
  46. return NOERROR;
  47. }
  48. STDMETHOD(put_ONID)(long newVal)
  49. {
  50. ATL_LOCKT();
  51. m_ONID = newVal;
  52. MARK_DIRTY(T);
  53. return NOERROR;
  54. }
  55. STDMETHOD(get_TSID)(long *pVal)
  56. {
  57. try {
  58. if (!pVal) {
  59. return E_POINTER;
  60. }
  61. ATL_LOCKT();
  62. *pVal = m_TSID;
  63. } catch (...) {
  64. return E_POINTER;
  65. }
  66. return NOERROR;
  67. }
  68. STDMETHOD(put_TSID)(long newVal)
  69. {
  70. ATL_LOCKT();
  71. m_TSID = newVal;
  72. MARK_DIRTY(T);
  73. return NOERROR;
  74. }
  75. STDMETHOD(get_SID)(long *pVal)
  76. {
  77. try {
  78. if (!pVal) {
  79. return E_POINTER;
  80. }
  81. ATL_LOCKT();
  82. *pVal = m_SID;
  83. } catch (...) {
  84. return E_POINTER;
  85. }
  86. return NOERROR;
  87. }
  88. STDMETHOD(put_SID)(long newVal)
  89. {
  90. ATL_LOCKT();
  91. m_SID = newVal;
  92. MARK_DIRTY(T);
  93. return NOERROR;
  94. }
  95. STDMETHOD(Clone) (ITuneRequest **ppTR) {
  96. try {
  97. if (!ppTR) {
  98. return E_POINTER;
  99. }
  100. ATL_LOCKT();
  101. HRESULT hr = basetype::Clone(ppTR);
  102. if (FAILED(hr)) {
  103. return hr;
  104. }
  105. T* pt = static_cast<T*>(*ppTR);
  106. pt->m_ONID = m_ONID;
  107. pt->m_TSID = m_TSID;
  108. pt->m_SID = m_SID;
  109. return NOERROR;
  110. } catch (HRESULT h) {
  111. return h;
  112. } catch (...) {
  113. return E_POINTER;
  114. }
  115. }
  116. STDMETHOD(put_Locator)(ILocator *pLocator)
  117. {
  118. try {
  119. ATL_LOCKT();
  120. if (pLocator) {
  121. TNDVBTuningSpace ts(m_TS);
  122. if (!ts) {
  123. return E_UNEXPECTED;
  124. }
  125. DVBSystemType st = ts.SystemType();
  126. switch (st) {
  127. case DVB_Terrestrial: {
  128. PQDVBTLocator l(pLocator);
  129. if (!l) {
  130. return DISP_E_TYPEMISMATCH;
  131. }
  132. break;
  133. }
  134. case DVB_Satellite: {
  135. PQDVBSLocator l(pLocator);
  136. if (!l) {
  137. return DISP_E_TYPEMISMATCH;
  138. }
  139. break;
  140. }
  141. case DVB_Cable:
  142. //dvb c locator is same as base ILocator
  143. default: {
  144. }}
  145. }
  146. return basetype::put_Locator(pLocator);
  147. } catch (...) {
  148. return E_POINTER;
  149. }
  150. }
  151. };
  152. }; // namespace
  153. #endif // DVBTUNEREQUESTIMPL_H
  154. // end of file -- atschchanneltunerequestimpl.h