DSCaptureGraph.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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_DSCAPTUREGRAPH_H
  19. #define PLUGIN_DSHOW_DSCAPTUREGRAPH_H
  20. #include "plugin_dshow_config.h"
  21. #include <vector>
  22. #include <control.h>
  23. #include "internals/DSBaseCaptureGraph.h"
  24. #include "internals/DSFrameRateFilter.h"
  25. #if defined(_WIN32_WCE)
  26. # include "internals/wince/DSSampleGrabber.h"
  27. # include "internals/wince/DSNullFilter.h"
  28. # include "internals/wince/DSISampleGrabberCB.h"
  29. #else
  30. # include <qedit.h>
  31. #endif
  32. class DSCaptureGraph : public DSBaseCaptureGraph
  33. {
  34. public:
  35. #ifdef _WIN32_WCE
  36. DSCaptureGraph(DSISampleGrabberCB* callback, HRESULT *hr);
  37. #else
  38. DSCaptureGraph(ISampleGrabberCB* callback, HRESULT *hr);
  39. #endif
  40. virtual ~DSCaptureGraph();
  41. std::vector<DSCaptureFormat> *getFormats() {
  42. return &this->supportedFormats;
  43. };
  44. HRESULT setSource(const std::string &devicePath);
  45. HRESULT setParameters(DSCaptureFormat *format, int framerate);
  46. HRESULT connect();
  47. HRESULT disconnect();
  48. HRESULT start();
  49. HRESULT stop();
  50. HRESULT pause();
  51. bool isRunning();
  52. bool isPaused();
  53. std::string getDeviceId() const {
  54. return this->deviceId;
  55. };
  56. HRESULT getConnectedMediaType(AM_MEDIA_TYPE *mediaType);
  57. private:
  58. HRESULT createCaptureGraph();
  59. private:
  60. #ifdef _WIN32_WCE
  61. DSISampleGrabberCB *grabberCallback;
  62. #else
  63. ISampleGrabberCB *grabberCallback;
  64. #endif
  65. ICaptureGraphBuilder2 *captureGraphBuilder;
  66. IGraphBuilder *graphBuilder;
  67. IBaseFilter *sourceFilter;
  68. IBaseFilter *nullRendererFilter;
  69. IBaseFilter *sampleGrabberFilter;
  70. #ifdef _WIN32_WCE
  71. IBaseFilter *colorConvertor565; //http://msdn.microsoft.com/en-us/library/aa926076.aspx
  72. #else
  73. DSFrameRateFilter *frameRateFilter;
  74. #endif
  75. #ifdef _WIN32_WCE
  76. DSSampleGrabber *grabberController;
  77. #else
  78. ISampleGrabber *grabberController;
  79. #endif
  80. IMediaControl *mediaController;
  81. IMediaEventEx *mediaEventController;
  82. IAMStreamConfig *streamConfiguration;
  83. std::vector<DSCaptureFormat> supportedFormats;
  84. DSCaptureFormat *captureFormat;
  85. bool running;
  86. bool paused;
  87. std::string deviceId;
  88. };
  89. #endif