DSScreenCastGraph.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /* Copyright (C) 2014 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. #ifndef PLUGIN_DSHOW_DSSCREENCAST_H
  19. #define PLUGIN_DSHOW_DSSCREENCAST_H
  20. #include "plugin_dshow_config.h"
  21. #include "internals/DSBaseCaptureGraph.h"
  22. #include <control.h>
  23. #include <vector>
  24. #include <qedit.h>
  25. class CPushSourceDesktop;
  26. class DSScreenCastGraph : public DSBaseCaptureGraph
  27. {
  28. public:
  29. DSScreenCastGraph(ISampleGrabberCB* callback, HRESULT *hr);
  30. virtual ~DSScreenCastGraph();
  31. std::vector<DSCaptureFormat> *getFormats() {
  32. return &this->supportedFormats;
  33. };
  34. virtual HRESULT setSource(const std::string &devicePath) {
  35. return S_OK;
  36. }
  37. HRESULT setParameters(DSCaptureFormat *format, int framerate);
  38. HRESULT connect();
  39. HRESULT disconnect();
  40. HRESULT start();
  41. HRESULT stop();
  42. HRESULT pause();
  43. bool isRunning();
  44. bool isPaused();
  45. HRESULT getConnectedMediaType(AM_MEDIA_TYPE *mediaType);
  46. virtual std::string getDeviceId() const {
  47. return std::string("screencast");
  48. }
  49. private:
  50. HRESULT createCaptureGraph();
  51. private:
  52. ISampleGrabberCB *grabberCallback;
  53. ICaptureGraphBuilder2 *captureGraphBuilder;
  54. IGraphBuilder *graphBuilder;
  55. CPushSourceDesktop *sourceFilter;
  56. IBaseFilter *nullRendererFilter;
  57. IBaseFilter *sampleGrabberFilter;
  58. ISampleGrabber *grabberController;
  59. IMediaControl *mediaController;
  60. IMediaEventEx *mediaEventController;
  61. std::vector<DSCaptureFormat> supportedFormats;
  62. DSCaptureFormat *captureFormat;
  63. bool running;
  64. bool paused;
  65. };
  66. #endif /* PLUGIN_DSHOW_DSSCREENCAST_H */
  67. /* Copyright (C) 2014 Mamadou DIOP.
  68. *
  69. * This file is part of Open Source Doubango Framework.
  70. *
  71. * DOUBANGO is free software: you can redistribute it and/or modify
  72. * it under the terms of the GNU General Public License as published by
  73. * the Free Software Foundation, either version 3 of the License, or
  74. * (at your option) any later version.
  75. *
  76. * DOUBANGO is distributed in the hope that it will be useful,
  77. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  78. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  79. * GNU General Public License for more details.
  80. *
  81. * You should have received a copy of the GNU General Public License
  82. * along with DOUBANGO.
  83. */
  84. #ifndef PLUGIN_DSHOW_DSSCREENCAST_H
  85. #define PLUGIN_DSHOW_DSSCREENCAST_H
  86. #include "plugin_dshow_config.h"
  87. #include "internals/DSBaseCaptureGraph.h"
  88. #include <control.h>
  89. #include <vector>
  90. #include <qedit.h>
  91. class CPushSourceDesktop;
  92. class DSScreenCastGraph : public DSBaseCaptureGraph
  93. {
  94. public:
  95. DSScreenCastGraph(ISampleGrabberCB* callback, HRESULT *hr);
  96. virtual ~DSScreenCastGraph();
  97. std::vector<DSCaptureFormat> *getFormats() {
  98. return &this->supportedFormats;
  99. };
  100. virtual HRESULT setSource(const std::string &devicePath) {
  101. return S_OK;
  102. }
  103. HRESULT setParameters(DSCaptureFormat *format, int framerate);
  104. HRESULT connect();
  105. HRESULT disconnect();
  106. HRESULT start();
  107. HRESULT stop();
  108. HRESULT pause();
  109. bool isRunning();
  110. bool isPaused();
  111. HRESULT getConnectedMediaType(AM_MEDIA_TYPE *mediaType);
  112. virtual std::string getDeviceId() const {
  113. return std::string("screencast");
  114. }
  115. private:
  116. HRESULT createCaptureGraph();
  117. private:
  118. ISampleGrabberCB *grabberCallback;
  119. ICaptureGraphBuilder2 *captureGraphBuilder;
  120. IGraphBuilder *graphBuilder;
  121. CPushSourceDesktop *sourceFilter;
  122. IBaseFilter *nullRendererFilter;
  123. IBaseFilter *sampleGrabberFilter;
  124. ISampleGrabber *grabberController;
  125. IMediaControl *mediaController;
  126. IMediaEventEx *mediaEventController;
  127. std::vector<DSCaptureFormat> supportedFormats;
  128. DSCaptureFormat *captureFormat;
  129. bool running;
  130. bool paused;
  131. };
  132. #endif /* PLUGIN_DSHOW_DSSCREENCAST_H */