DSDisplayGraph.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Copyright (C) 2010-2011 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango.org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. #ifndef PLUGIN_DSHOW_DSDISPLAYGRAPH_H
  23. #define PLUGIN_DSHOW_DSDISPLAYGRAPH_H
  24. #include "plugin_dshow_config.h"
  25. #include <control.h>
  26. #include "internals/VideoFrame.h"
  27. #include "internals/DSOutputFilter.h"
  28. #include "internals/DSDisplayOverlay.h"
  29. #if defined(VMR9) || defined(VMR9_WINDOWLESS)
  30. #include <D3D9.h>
  31. #include <vmr9.h>
  32. #endif
  33. class DSDisplayGraph
  34. {
  35. public:
  36. DSDisplayGraph(HRESULT *hr);
  37. virtual ~DSDisplayGraph();
  38. int getDisplayFps() {
  39. return this->fps;
  40. };
  41. void setDisplayFps(int fps_);
  42. bool getImageFormat(UINT &width, UINT &height);
  43. bool setImageFormat(UINT width, UINT height);
  44. HRESULT connect();
  45. HRESULT disconnect();
  46. HRESULT start();
  47. HRESULT pause();
  48. HRESULT stop();
  49. bool isRunning();
  50. bool isPaused();
  51. IMediaEventEx *getMediaEvent() {
  52. return this->mediaEvent;
  53. };
  54. IVideoWindow *getVideoWindow() {
  55. return this->videoWindow;
  56. };
  57. DSOutputFilter *getSourceFilter() {
  58. return this->sourceFilter;
  59. };
  60. #if defined(VMR)
  61. IVMRMixerBitmap *getMixerBitmap() {
  62. return this->mixerBitmap;
  63. };
  64. #elif defined(VMR9)
  65. IVMRMixerBitmap9 *getMixerBitmap() {
  66. return this->mixerBitmap;
  67. };
  68. #elif defined(VMR9_WINDOWLESS)
  69. IVMRMixerBitmap9 *getMixerBitmap() {
  70. return this->mixerBitmap;
  71. };
  72. IVMRMixerControl9 *getMixerControl() {
  73. return this->mixerControl;
  74. };
  75. IVMRWindowlessControl9 *getWindowlessControl() {
  76. return this->windowlessControl;
  77. };
  78. #endif
  79. void handleFrame(const void* data, int w, int h);
  80. private:
  81. HRESULT createDisplayGraph();
  82. private:
  83. IGraphBuilder *graphBuilder;
  84. DSOutputFilter *sourceFilter;
  85. IBaseFilter *colorspaceConverterFilter;
  86. IBaseFilter *videoRendererFilter;
  87. IMediaControl *mediaController;
  88. IMediaEventEx *mediaEvent;
  89. IVideoWindow *videoWindow;
  90. #if defined(VMR)
  91. IVMRMixerBitmap *mixerBitmap;
  92. IVMRFilterConfig *filterConfig;
  93. #elif defined(VMR9)
  94. IVMRMixerBitmap9 *mixerBitmap;
  95. IVMRMixerControl9 *mixerControl;
  96. IVMRFilterConfig9 *filterConfig;
  97. #elif defined(VMR9_WINDOWLESS)
  98. IVMRMixerBitmap9 *mixerBitmap;
  99. IVMRMixerControl9 *mixerControl;
  100. IVMRFilterConfig9 *filterConfig;
  101. IVMRWindowlessControl9 *windowlessControl;
  102. #endif
  103. bool connected;
  104. bool running;
  105. bool paused;
  106. int fps;
  107. };
  108. #endif