DSGrabber.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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_DIRECTSHOW_GRABBER_H
  19. #define PLUGIN_DSHOW_DIRECTSHOW_GRABBER_H
  20. #include "plugin_dshow_config.h"
  21. #include "internals/DSBaseCaptureGraph.h"
  22. #include "internals/VideoFrame.h"
  23. #include "tinymedia/tmedia_producer.h"
  24. #include "tsk_mutex.h"
  25. class DSDisplay;
  26. #if defined(_WIN32_WCE)
  27. # include "internals/wince/DSISampleGrabberCB.h"
  28. #endif
  29. class DSGrabber : public
  30. #if defined(_WIN32_WCE)
  31. DSISampleGrabberCB
  32. #else
  33. ISampleGrabberCB
  34. #endif
  35. {
  36. public:
  37. DSGrabber(HRESULT *hr, BOOL screenCast);
  38. virtual ~DSGrabber();
  39. void setCallback(tmedia_producer_enc_cb_f callback, const void* callback_data);
  40. void setCaptureDevice(const std::string &devicePath);
  41. virtual void start();
  42. virtual void pause();
  43. virtual void stop();
  44. virtual bool setCaptureParameters(int format, int f);
  45. virtual bool setCaptureParameters(int w, int h, int f);
  46. virtual void setPluginFirefox(bool value);
  47. virtual int getFramerate();
  48. virtual HRESULT getConnectedMediaType(AM_MEDIA_TYPE *mediaType);
  49. virtual HRESULT STDMETHODCALLTYPE SampleCB(double SampleTime, IMediaSample *pSample);
  50. virtual HRESULT STDMETHODCALLTYPE BufferCB(double SampleTime, BYTE *pBuffer, long BufferLen);
  51. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject);
  52. virtual ULONG STDMETHODCALLTYPE AddRef();
  53. virtual ULONG STDMETHODCALLTYPE Release();
  54. DSDisplay *preview;
  55. private:
  56. int width;
  57. int height;
  58. int fps;
  59. DSBaseCaptureGraph *graph;
  60. //VideoFrame *currentFrame;
  61. BITMAPINFOHEADER bitmapInfo;
  62. BYTE *buffer;
  63. tsk_mutex_handle_t *mutex_buffer;
  64. BOOL first_buffer;
  65. BOOL screenCast;
  66. const void* plugin_cb_data;
  67. tmedia_producer_enc_cb_f plugin_cb;
  68. };
  69. #endif