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.

141 lines
4.2 KiB

  1. //==========================================================================;
  2. // MSVidBDATuner.h : Declaration of the CMSVidBDATuner
  3. // copyright (c) Microsoft Corp. 1998-1999.
  4. /////////////////////////////////////////////////////////////////////////////
  5. #pragma once
  6. #ifndef __MSVidBDATUNER_H_
  7. #define __MSVidBDATUNER_H_
  8. #include <algorithm>
  9. #include <tchar.h>
  10. #include <bdamedia.h>
  11. #include <objectwithsiteimplsec.h>
  12. #include "bcasteventimpl.h"
  13. #include "segimpl.h"
  14. #include "tunerimpl.h"
  15. #include "seg.h"
  16. typedef CComQIPtr<ITuner> PQTuner;
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CMSVidBDATuner
  19. class ATL_NO_VTABLE __declspec(uuid("A2E3074E-6C3D-11d3-B653-00C04F79498E")) CMSVidBDATuner :
  20. public CComObjectRootEx<CComSingleThreadModel>,
  21. public CComCoClass<CMSVidBDATuner, &__uuidof(CMSVidBDATuner)>,
  22. public ISupportErrorInfo,
  23. public IConnectionPointContainerImpl<CMSVidBDATuner>,
  24. public CProxy_Tuner<CMSVidBDATuner>,
  25. public IBroadcastEventImpl<CMSVidBDATuner>,
  26. public IObjectWithSiteImplSec<CMSVidBDATuner>,
  27. public IMSVidGraphSegmentImpl<CMSVidBDATuner, MSVidSEG_SOURCE, &KSCATEGORY_BDA_RECEIVER_COMPONENT>,
  28. public IMSVidTunerImpl<CMSVidBDATuner, &LIBID_MSVidCtlLib, &KSCATEGORY_BDA_RECEIVER_COMPONENT, IMSVidTuner>,
  29. public IProvideClassInfo2Impl<&CLSID_MSVidBDATunerDevice, &IID_IMSVidTunerEvent, &LIBID_MSVidCtlLib>
  30. {
  31. public:
  32. CMSVidBDATuner() : m_iNetworkProvider(-1), m_iTuner(-1), m_iTIF(-1) {
  33. }
  34. REGISTER_AUTOMATION_OBJECT(IDS_PROJNAME,
  35. IDS_REG_BDATUNER_PROGID,
  36. IDS_REG_BDATUNER_DESC,
  37. LIBID_MSVidCtlLib,
  38. __uuidof(CMSVidBDATuner));
  39. DECLARE_PROTECT_FINAL_CONSTRUCT()
  40. BEGIN_COM_MAP(CMSVidBDATuner)
  41. COM_INTERFACE_ENTRY(IMSVidGraphSegment)
  42. COM_INTERFACE_ENTRY(IMSVidTuner)
  43. COM_INTERFACE_ENTRY(IDispatch)
  44. COM_INTERFACE_ENTRY(IMSVidDevice)
  45. COM_INTERFACE_ENTRY(IMSVidInputDevice)
  46. COM_INTERFACE_ENTRY(IMSVidVideoInputDevice)
  47. COM_INTERFACE_ENTRY(IObjectWithSite)
  48. COM_INTERFACE_ENTRY(IBroadcastEvent)
  49. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  50. COM_INTERFACE_ENTRY(IConnectionPointContainer)
  51. COM_INTERFACE_ENTRY(IPersist)
  52. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  53. COM_INTERFACE_ENTRY(IProvideClassInfo)
  54. END_COM_MAP()
  55. BEGIN_CATEGORY_MAP(CMSVidBDATuner)
  56. IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
  57. IMPLEMENTED_CATEGORY(CATID_SafeForInitializing)
  58. IMPLEMENTED_CATEGORY(CATID_PersistsToPropertyBag)
  59. END_CATEGORY_MAP()
  60. BEGIN_CONNECTION_POINT_MAP(CMSVidBDATuner)
  61. CONNECTION_POINT_ENTRY(IID_IMSVidTunerEvent)
  62. END_CONNECTION_POINT_MAP()
  63. // ISupportsErrorInfo
  64. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  65. public:
  66. PQCreateDevEnum m_pSystemEnum;
  67. int m_iNetworkProvider;
  68. int m_iTuner;
  69. int m_iTIF;
  70. virtual HRESULT DoTune(TNTuneRequest &ctr);
  71. virtual HRESULT UpdateTR(TNTuneRequest& pTR);
  72. HRESULT Unload(void);
  73. HRESULT LoadTunerSection(DSFilter& np, const GUID& kscategory);
  74. // IMSVidGraphSegment
  75. STDMETHOD(put_Init)(IUnknown *pDeviceMoniker)
  76. {
  77. if (!pDeviceMoniker) {
  78. return E_POINTER;
  79. }
  80. HRESULT hr = IMSVidGraphSegmentImpl<CMSVidBDATuner, MSVidSEG_SOURCE, &KSCATEGORY_BDA_RECEIVER_COMPONENT>::put_Init(pDeviceMoniker);
  81. if (FAILED(hr)) {
  82. return hr;
  83. }
  84. if (!m_pDev) {
  85. m_fInit = false;
  86. return E_NOINTERFACE;
  87. }
  88. return NOERROR;
  89. }
  90. STDMETHOD(Build)() {
  91. // undone: should we tune here?
  92. return NOERROR;
  93. }
  94. STDMETHOD(PreRun)() {
  95. if (m_pCurrentTR) {
  96. return DoTune(m_pCurrentTR);
  97. }
  98. // undone: do any np initialization.
  99. return NOERROR;
  100. }
  101. STDMETHOD(put_Container)(IMSVidGraphSegmentContainer *pCtl);
  102. // IMSVidDevice
  103. STDMETHOD(get_Name)(BSTR * Name)
  104. {
  105. if (!m_fInit) {
  106. return Error(IDS_OBJ_NO_INIT, __uuidof(CMSVidBDATuner), CO_E_NOTINITIALIZED);
  107. }
  108. try {
  109. return GetName(((m_iNetworkProvider > -1) ? (m_Filters[m_iNetworkProvider]) : DSFilter()), m_pDev, CComBSTR(_T("BDA NetworkProvider"))).CopyTo(Name);
  110. return NOERROR;
  111. } catch(...) {
  112. return E_POINTER;
  113. }
  114. }
  115. // IBroadcastEvent
  116. STDMETHOD(Fire)(GUID gEventID);
  117. };
  118. #endif //__MSVidBDATUNER_H_