1
0

vid_d3d.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include "VideoOutputChild.h"
  3. #include <d3d9.h>
  4. #include <d3dx9.h>
  5. typedef HRESULT (WINAPI *D3DXCREATEFONTW)(LPDIRECT3DDEVICE9, INT, UINT, UINT, UINT, BOOL, DWORD, DWORD, DWORD, DWORD, LPCWSTR, LPD3DXFONT *);
  6. extern D3DXCREATEFONTW pCreateFontW;
  7. class Direct3DVideoOutput
  8. {
  9. public:
  10. Direct3DVideoOutput(HWND hwnd, VideoAspectAdjuster *_adjuster);
  11. int OpenVideo(int w, int h, unsigned int type, int flipit, double aspectratio);
  12. void OnWindowSize();
  13. int onPaint(HWND hwnd);
  14. void displayFrame(const char *buf, int size, int time);
  15. void close(); // hides any output of the video
  16. void timerCallback();
  17. void setPalette(RGBQUAD *pal);
  18. void drawSubtitle(SubsItem *item);
  19. void resetSubtitle();
  20. void setVFlip(int on);
  21. void Refresh();
  22. private:
  23. HRESULT DoRender();
  24. bool FindSuitableConversion(UINT adapter, D3DFORMAT output_format);
  25. D3DDEVTYPE GetDeviceType(IDirect3D9 *d3d, UINT display_adapter);
  26. IDirect3D9 *d3d;
  27. IDirect3D9Ex *d3dEx;
  28. IDirect3DDevice9 *device;
  29. IDirect3DDevice9Ex *deviceEx;
  30. IDirect3DSurface9 *surface, *logo_surface;
  31. ID3DXFont *subtitle_font;
  32. D3DFORMAT surface_type;
  33. D3DSWAPEFFECT swap_effect;
  34. int input_type;
  35. int width, height;
  36. VideoAspectAdjuster *adjuster;
  37. HWND hwnd;
  38. RECT last_rect;
  39. int flip;
  40. UINT display_adapter;
  41. SubsItem *current_subtitle;
  42. bool opened, valid_surface;
  43. int need_change;
  44. D3DTEXTUREFILTERTYPE stretch_filter;
  45. RGBQUAD *m_palette;
  46. };