DSSampleGrabber.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* Copyright (C) 2014-2015 Mamadou DIOP
  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. #pragma once
  19. #if defined(_WIN32_WCE)
  20. #include "plugin_dshow_config.h"
  21. #include <streams.h>
  22. #include <math.h>
  23. #include <internals/DSUtils.h>
  24. #include <internals/wince/DSISampleGrabberCB.h>
  25. #include "DSSampleGrabberUtils.h"
  26. class DSSampleGrabber : public CTransInPlaceFilter
  27. {
  28. public:
  29. // instantiation
  30. DSSampleGrabber( TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr );
  31. ~DSSampleGrabber(void);
  32. public:
  33. HRESULT Transform(IMediaSample *pSample);
  34. HRESULT CheckInputType(const CMediaType* mtIn);
  35. HRESULT SetFps(int inputFps, int outputFps);
  36. // DECLARE_IUNKNOWN;
  37. STDMETHODIMP QueryInterface(REFIID riid, void **ppv) {
  38. return GetOwner()->QueryInterface(riid,ppv);
  39. };
  40. STDMETHODIMP_(ULONG) AddRef() {
  41. return InterlockedIncrement(&m_cRef);
  42. };
  43. STDMETHODIMP_(ULONG) Release() {
  44. return GetOwner()->Release();
  45. };
  46. STDMETHODIMP SetCallback(DSISampleGrabberCB* callback_);
  47. HRESULT SetSize(int width, int height);
  48. inline AM_MEDIA_TYPE GetMediaType() {
  49. return (AM_MEDIA_TYPE)this->mt;
  50. }
  51. private:
  52. int m_progress;
  53. int m_inputFps, m_outputFps;
  54. bool m_bProcessFrame;
  55. REFERENCE_TIME m_rtFrameLength; // UNITS/fps
  56. LONGLONG m_iFrameNumber;
  57. DSISampleGrabberCB* callback;
  58. CMediaType mt;
  59. BYTE *m_rgb24;
  60. };
  61. #endif /* _WIN32_WCE */