aboutsummaryrefslogtreecommitdiff
path: root/Src/Winamp/vid_d3d.h
blob: 9bde7919c495c1cd4c899cd0e6be0068e006ddba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include "VideoOutputChild.h"
#include <d3d9.h>
#include <d3dx9.h>

typedef HRESULT (WINAPI *D3DXCREATEFONTW)(LPDIRECT3DDEVICE9, INT, UINT, UINT, UINT, BOOL, DWORD, DWORD, DWORD, DWORD, LPCWSTR, LPD3DXFONT *);
extern D3DXCREATEFONTW pCreateFontW;

class Direct3DVideoOutput 
{
public:
	Direct3DVideoOutput(HWND hwnd, VideoAspectAdjuster *_adjuster);
	int OpenVideo(int w, int h, unsigned int type, int flipit, double aspectratio);
	void OnWindowSize();

	int onPaint(HWND hwnd);
	void displayFrame(const char *buf, int size, int time);
	void close(); // hides any output of the video
	void timerCallback();
	void setPalette(RGBQUAD *pal);
	void drawSubtitle(SubsItem *item);
	void resetSubtitle();
	void setVFlip(int on);
	void Refresh();

private:
	HRESULT DoRender();
	bool FindSuitableConversion(UINT adapter, D3DFORMAT output_format);
	D3DDEVTYPE GetDeviceType(IDirect3D9 *d3d, UINT display_adapter);
	IDirect3D9 *d3d;
	IDirect3D9Ex *d3dEx;
	IDirect3DDevice9 *device;
	IDirect3DDevice9Ex *deviceEx;
	IDirect3DSurface9 *surface, *logo_surface;
	ID3DXFont *subtitle_font;
	D3DFORMAT surface_type;
	D3DSWAPEFFECT swap_effect;
	int input_type;
	int width, height;
	VideoAspectAdjuster *adjuster;
	HWND hwnd;
	RECT last_rect;
	int flip;
	UINT display_adapter;
	SubsItem *current_subtitle;
	bool opened, valid_surface;
	int need_change;
	D3DTEXTUREFILTERTYPE stretch_filter;
	
	RGBQUAD *m_palette;
};