FakeFilterMapper2.h
上传用户:tangyu_668
上传日期:2014-02-27
资源大小:678k
文件大小:4k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /* 
  2.  * Copyright (C) 2003-2006 Gabest
  3.  * http://www.gabest.org
  4.  *
  5.  *  This Program is free software; you can redistribute it and/or modify
  6.  *  it under the terms of the GNU General Public License as published by
  7.  *  the Free Software Foundation; either version 2, or (at your option)
  8.  *  any later version.
  9.  *   
  10.  *  This Program is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13.  *  GNU General Public License for more details.
  14.  *   
  15.  *  You should have received a copy of the GNU General Public License
  16.  *  along with GNU Make; see the file COPYING.  If not, write to
  17.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  18.  *  http://www.gnu.org/copyleft/gpl.html
  19.  *
  20.  */
  21. #pragma once
  22. #include <atlbase.h>
  23. class FilterOverride
  24. {
  25. public:
  26. bool fDisabled, fTemporary;
  27. enum {REGISTERED, EXTERNAL} type;
  28. // REGISTERED
  29. CStringW dispname;
  30. // EXTERNAL
  31. CString path, name;
  32. CLSID clsid;
  33. // props
  34. CAtlList<GUID> guids, backup;
  35. enum {PREFERRED, BLOCK, MERIT};
  36. int iLoadType;
  37. DWORD dwMerit;
  38. FilterOverride() {fTemporary = false;}
  39. FilterOverride(FilterOverride* f)
  40. {
  41. fDisabled = f->fDisabled;
  42. fTemporary = f->fTemporary;
  43. type = f->type;
  44. dispname = f->dispname;
  45. path = f->path;
  46. name = f->name;
  47. clsid = f->clsid;
  48. guids.AddTailList(&f->guids);
  49. backup.AddTailList(&f->backup);
  50. iLoadType = f->iLoadType;
  51. dwMerit = f->dwMerit;
  52. }
  53. };
  54. /*
  55. class CFilterMapper2 : protected CUnknown, protected IFilterMapper2
  56. {
  57. static bool fInitialized;
  58. CComPtr<IFilterMapper2> m_pFM2;
  59. CString m_path;
  60. protected:
  61. DECLARE_IUNKNOWN;
  62. STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
  63. // IFilterMapper2
  64. STDMETHODIMP CreateCategory(REFCLSID clsidCategory, DWORD dwCategoryMerit, LPCWSTR Description);
  65. STDMETHODIMP UnregisterFilter(const CLSID* pclsidCategory, const OLECHAR* szInstance, REFCLSID Filter);
  66. STDMETHODIMP RegisterFilter(REFCLSID clsidFilter, LPCWSTR Name, IMoniker** ppMoniker, const CLSID* pclsidCategory, const OLECHAR* szInstance, const REGFILTER2* prf2);
  67. STDMETHODIMP EnumMatchingFilters(IEnumMoniker** ppEnum, DWORD dwFlags, BOOL bExactMatch, DWORD dwMerit, 
  68. BOOL bInputNeeded, DWORD cInputTypes, const GUID* pInputTypes, const REGPINMEDIUM* pMedIn, const CLSID* pPinCategoryIn, BOOL bRender, 
  69. BOOL bOutputNeeded, DWORD cOutputTypes, const GUID* pOutputTypes, const REGPINMEDIUM* pMedOut, const CLSID* pPinCategoryOut);
  70. public: 
  71. CFilterMapper2();
  72. virtual ~CFilterMapper2();
  73. static void Init();
  74. static IFilterMapper2* m_pFilterMapper2;
  75. CList<Filter*> m_filters;
  76. void Register(CString path);
  77. };
  78. */
  79. class CFilterMapper2 : protected CUnknown, public IFilterMapper2
  80. {
  81. static bool fInitialized;
  82. CComPtr<IUnknown> m_pFM2;
  83. CString m_path;
  84. bool m_fRefCounted, m_fAllowUnreg;
  85. protected:
  86. DECLARE_IUNKNOWN;
  87. STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
  88. // IFilterMapper2
  89. STDMETHODIMP CreateCategory(REFCLSID clsidCategory, DWORD dwCategoryMerit, LPCWSTR Description);
  90. STDMETHODIMP UnregisterFilter(const CLSID* pclsidCategory, const OLECHAR* szInstance, REFCLSID Filter);
  91. STDMETHODIMP RegisterFilter(REFCLSID clsidFilter, LPCWSTR Name, IMoniker** ppMoniker, const CLSID* pclsidCategory, const OLECHAR* szInstance, const REGFILTER2* prf2);
  92. STDMETHODIMP EnumMatchingFilters(IEnumMoniker** ppEnum, DWORD dwFlags, BOOL bExactMatch, DWORD dwMerit, 
  93. BOOL bInputNeeded, DWORD cInputTypes, const GUID* pInputTypes, const REGPINMEDIUM* pMedIn, const CLSID* pPinCategoryIn, BOOL bRender, 
  94. BOOL bOutputNeeded, DWORD cOutputTypes, const GUID* pOutputTypes, const REGPINMEDIUM* pMedOut, const CLSID* pPinCategoryOut);
  95. public: 
  96. CFilterMapper2(bool fRefCounted, bool fAllowUnreg = false, LPUNKNOWN pUnkOuter = NULL);
  97. virtual ~CFilterMapper2();
  98. void SetInner(IUnknown* pUnk) {m_pFM2 = pUnk;}
  99. static void Init();
  100. static IFilterMapper2* m_pFilterMapper2;
  101. CList<FilterOverride*> m_filters;
  102. void Register(CString path);
  103. };