mf_codec_topology.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* Copyright (C) 2013 Mamadou DIOP
  2. * Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
  3. *
  4. * This file is part of Open Source Doubango Framework.
  5. *
  6. * DOUBANGO is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * DOUBANGO is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with DOUBANGO.
  18. */
  19. #ifndef PLUGIN_WIN_MF_CODEC_TOPOLOGY_H
  20. #define PLUGIN_WIN_MF_CODEC_TOPOLOGY_H
  21. #include "mf_codec.h"
  22. #include "mf_custom_src.h"
  23. #include "tsk_thread.h"
  24. class MFCodecTopologySampleGrabberCB;
  25. class MFCodecTopology : IUnknown
  26. {
  27. friend class MFCodecTopologySampleGrabberCB;
  28. public:
  29. MFCodecTopology(MFCodec* pCodec, HRESULT &hr);
  30. virtual ~MFCodecTopology();
  31. virtual HRESULT Initialize();
  32. virtual HRESULT DeInitialize();
  33. virtual HRESULT ProcessInput(IMFSample* pSample);
  34. virtual HRESULT ProcessOutput(IMFSample **ppSample);
  35. // IUnknown
  36. STDMETHODIMP QueryInterface(REFIID iid, void** ppv);
  37. STDMETHODIMP_(ULONG) AddRef();
  38. STDMETHODIMP_(ULONG) Release();
  39. inline BOOL isStarted() {
  40. return m_bStarted;
  41. }
  42. inline BOOL isInitialized() {
  43. return m_bInitialized;
  44. }
  45. private:
  46. static void* TSK_STDCALL RunSessionThread(void *pArg);
  47. protected:
  48. HRESULT Start();
  49. HRESULT Stop();
  50. private:
  51. long m_nRefCount;
  52. protected:
  53. BOOL m_bInitialized;
  54. BOOL m_bStarted;
  55. MFCodec* m_pCodec;
  56. CMFSource *m_pSource;
  57. IMFMediaSession *m_pSession;
  58. IMFTopology *m_pTopologyFull;
  59. IMFTopology *m_pTopologyPartial;
  60. IMFMediaType *m_pOutputType;
  61. IMFMediaType *m_pInputType;
  62. MFCodecTopologySampleGrabberCB *m_pGrabberCallback;
  63. IMFActivate *m_pGrabberActivate;
  64. tsk_thread_handle_t* m_pTread;
  65. SampleQueue m_SampleQueue;
  66. };
  67. class MFCodecVideoTopology : public MFCodecTopology
  68. {
  69. public:
  70. MFCodecVideoTopology(MFCodec* pCodec, HRESULT &hr);
  71. virtual ~MFCodecVideoTopology();
  72. private:
  73. UINT32 m_nWidth, m_nHeight;
  74. };
  75. #endif /* PLUGIN_WIN_MF_CODEC_TOPOLOGY_H */