DSOutputFilter.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* Copyright (C) 2011-2013 Doubango Telecom <http://www.doubango.org>
  2. *
  3. * This file is part of Open Source Doubango Framework.
  4. *
  5. * DOUBANGO 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 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * DOUBANGO 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 DOUBANGO.
  17. */
  18. #ifndef PLUGIN_DSHOW_DSOUTPUTFILTER_H
  19. #define PLUGIN_DSHOW_DSOUTPUTFILTER_H
  20. #include "plugin_dshow_config.h"
  21. #include "internals/DSBufferWriter.h"
  22. #include <streams.h>
  23. class DSOutputStream;
  24. // {17D9D5CB-850D-4339-B72A-F72D084D8D64}
  25. TDSHOW_DEFINE_GUID(CLSID_TdshowOutputFilter,
  26. 0x17d9d5cb, 0x850d, 0x4339, 0xb7, 0x2a, 0xf7, 0x2d, 0x8, 0x4d, 0x8d, 0x64);
  27. class DSOutputFilter : public CSource, public DSBufferWriter
  28. {
  29. public:
  30. DSOutputFilter(LPUNKNOWN pUnk, HRESULT *phr);
  31. virtual ~DSOutputFilter();
  32. //static CUnknown * WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *phr);
  33. DECLARE_IUNKNOWN;
  34. virtual void setBuffer(void *pointer, int size);
  35. virtual inline HRESULT setImageFormat(UINT width, UINT height);
  36. virtual bool getImageFormat(UINT &width, UINT &height);
  37. virtual void setFps(int fps_);
  38. virtual void showOverlay(int value);
  39. virtual void getMediaType(AM_MEDIA_TYPE* &pmt);
  40. virtual HRESULT setMediaType(const AM_MEDIA_TYPE* pmt);
  41. void reset();
  42. #ifdef _WIN32_WCE
  43. STDMETHODIMP_(ULONG) NonDelegatingRelease();
  44. #endif
  45. //protected:
  46. #ifdef _WIN32_WCE
  47. /*STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
  48. {
  49. CheckPointer(ppv, E_POINTER);
  50. if (riid == IID_IBaseFilter
  51. || riid == IID_IBaseFilter
  52. || riid == IID_IUnknown
  53. || riid == IID_IMediaFilter
  54. )
  55. {
  56. return GetInterface((IBaseFilter *) this, ppv);
  57. }
  58. else
  59. {
  60. *ppv = NULL;
  61. return E_NOINTERFACE;
  62. }
  63. };
  64. STDMETHODIMP_(ULONG) AddRef() {
  65. //return GetOwner()->AddRef();
  66. //return 1;
  67. return (ULONG)InterlockedIncrement(&m_cRef);
  68. };
  69. STDMETHODIMP_(ULONG) Release() {
  70. LONG lRefCount = InterlockedDecrement(&m_cRef);
  71. if(m_cRef < 1) delete this;
  72. return (ULONG)m_cRef;
  73. };
  74. STDMETHODIMP_(ULONG) NonDelegatingAddRef()
  75. {
  76. return InterlockedIncrement(&m_cRef);
  77. }*/
  78. #endif
  79. /*
  80. STDMETHODIMP_(ULONG) NonDelegatingRelease()
  81. {
  82. if(InterlockedDecrement(&m_cRef) == 0)
  83. {
  84. delete this;
  85. return 0;
  86. }
  87. return m_cRef;
  88. }*/
  89. private:
  90. DSOutputStream *outputStream;
  91. friend class DSOutputStream;
  92. };
  93. #endif