Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.0 KiB

  1. #include <windows.h>
  2. #include "ibitmap.h"
  3. #ifndef _VIDPOOL_H
  4. #define _VIDPOOL_H
  5. // {36447655-7089-11d0-BC25-00AA00A13C86}
  6. DEFINE_GUID(BFID_PRIVATEDIB, 0x36447655, 0x7089, 0x11d0, 0xbc, 0x25, 0x0, 0xaa, 0x0, 0xa1, 0x3c, 0x86);
  7. class CVidPool;
  8. class CBitmap :
  9. public IBitmapSurface
  10. {
  11. private:
  12. LONG m_cRef;
  13. public:
  14. LPBYTE m_bits;
  15. LONG m_pitch;
  16. int m_lockcount;
  17. BOOL m_ext;
  18. CBitmap* m_next;
  19. CVidPool* m_factory;
  20. void *m_refdata;
  21. CBitmap() {m_cRef = 0; m_bits = NULL; m_pitch = 0; m_lockcount = 0; m_ext = FALSE;
  22. m_next = NULL; m_factory = NULL; m_refdata = NULL;}
  23. // IUnknown methods
  24. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  25. virtual STDMETHODIMP_(ULONG) AddRef(void);
  26. virtual STDMETHODIMP_(ULONG) Release(void);
  27. // IBitmapSurface methods
  28. virtual STDMETHODIMP Clone(IBitmapSurface** ppBitmapSurface);
  29. virtual STDMETHODIMP GetFormat(BFID* pBFID);
  30. virtual STDMETHODIMP GetFactory(IBitmapSurfaceFactory** ppBitmapSurfaceFactory);
  31. virtual STDMETHODIMP GetSize(long* pWidth, long* pHeight);
  32. virtual STDMETHODIMP LockBits(RECT* prcBounds, DWORD dwLockFlags, void** ppBits, long* pPitch);
  33. virtual STDMETHODIMP UnlockBits(RECT* prcBounds, void* pBits);
  34. };
  35. typedef void (NotifyAddingToFreeProc) (CBitmap *pBitmap, DWORD_PTR refdata);
  36. class CVidPool :
  37. public IBitmapSurfaceFactory
  38. {
  39. private:
  40. LONG m_cRef;
  41. BOOL m_growable;
  42. LONG m_nbufs;
  43. CBitmap* m_free;
  44. int m_pitch;
  45. BFID* m_format;
  46. CRITICAL_SECTION m_cs;
  47. LPBITMAPINFOHEADER m_pbmh;
  48. public:
  49. NotifyAddingToFreeProc *m_pAddingToFree;
  50. DWORD_PTR m_refdata;
  51. CVidPool(void);
  52. // IUnknown methods
  53. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj);
  54. virtual STDMETHODIMP_(ULONG) AddRef(void);
  55. virtual STDMETHODIMP_(ULONG) Release(void);
  56. // IBitmapSurfaceFactory methods
  57. virtual STDMETHODIMP CreateBitmapSurface(long width, long height, BFID* pBFID, DWORD dwHintFlags, IBitmapSurface** ppBitmapSurface);
  58. virtual STDMETHODIMP GetSupportedFormatsCount(long* pcFormats);
  59. virtual STDMETHODIMP GetSupportedFormats(long cFormats, BFID* pBFIDs);
  60. // private to implementation of CVidPool
  61. STDMETHODIMP InitPool(int nBuffers, LPBITMAPINFOHEADER lpcap);
  62. STDMETHODIMP AddExternalBuffer(void* pBits, void* refdata);
  63. STDMETHODIMP GetBuffer(CBitmap** ppBitmap, void** prefdata);
  64. STDMETHODIMP GetBuffer(IBitmapSurface** ppBitmap, void** prefdata);
  65. void AddToFreeList(CBitmap* pBitmap);
  66. BOOL Growable(void) { return m_growable; }
  67. BFID* GetFormat(void) {return m_format;}
  68. long GetWidth(void) { if (m_pbmh)
  69. return m_pbmh->biWidth;
  70. else
  71. return 0; }
  72. long GetHeight(void) { if (m_pbmh)
  73. return m_pbmh->biHeight;
  74. else
  75. return 0; }
  76. };
  77. #endif // #ifndef _VIDPOOL_H
  78.